AngularJS$http post到geoserver获取功能

AngularJS$http post到geoserver获取功能,angularjs,http-post,geoserver,web-feature-service,Angularjs,Http Post,Geoserver,Web Feature Service,我正在Angular for geoserver中构建WFS客户端服务。到目前为止,我使用$HTTPGET来检索特性,但cql_过滤器有时太大,HTTPGET无法工作,因为URL太大。你能帮我把下面的http GET翻译成http POST吗?如果可能的话,我更愿意使用CQL过滤而不是OGC,因为我已经实现了它。 下面是我的getFeature方法: this.getWfsFeature = function(typeName, filter){ var deffered = $q.d

我正在Angular for geoserver中构建WFS客户端服务。到目前为止,我使用$HTTPGET来检索特性,但cql_过滤器有时太大,HTTPGET无法工作,因为URL太大。你能帮我把下面的http GET翻译成http POST吗?如果可能的话,我更愿意使用CQL过滤而不是OGC,因为我已经实现了它。 下面是我的getFeature方法:

this.getWfsFeature = function(typeName, filter){

    var deffered = $q.defer();

    $http({
        method: 'GET',
        url: ConfigService.getGeoserverURL() + "/frqaim/ows",
        params: {
            service: 'WFS',
            version: '1.0.0',
            cql_filter: filter,
            request: 'GetFeature',
            typeName: typeName,
            maxFeatures: 60,
            outputFormat:'application/json'
        },
    }).success(function(data){
        deffered.resolve(data.features);
    }).error(function(data, status, headers, config) {
        var msg = 'could not get wfs features. status: ' + status;
        console.log(msg);
        deffered.reject(msg);
    });

    return deffered.promise;
}
这是我的审判:

this.getWfsFeature2 = function(typeName, filter){

    var deffered = $q.defer();

    $http({
        method: 'POST',
        url: ConfigService.getGeoserverURL() + "/frqaim/ows",
        data: {
            service: 'WFS',
            version: '1.0.0',
            cql_filter: filter,
            request: 'GetFeature',
            typeName: typeName,
            maxFeatures: 60,
            outputFormat:'application/json'
        }
    }).success(function(data){
        deffered.resolve(data.features);
    }).error(function(data, status, headers, config) {
        var msg = 'could not get wfs features. status: ' + status;
        console.log(msg);
        deffered.reject(msg);
    });

    return deffered.promise;
}
响应异常:

<ows:ExceptionReport xmlns:ows="http://www.opengis.net/ows" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/ows http://localhost:8081/geoserver/schemas/ows/1.0.0/owsExceptionReport.xsd">
 <ows:Exception exceptionCode="NoApplicableCode">
  <ows:ExceptionText>org.xmlpull.v1.XmlPullParserException: only whitespace content allowed before start tag and not { (position: START_DOCUMENT seen {... @1:1) 
 only whitespace content allowed before start tag and not { (position: START_DOCUMENT seen {... @1:1) </ows:ExceptionText>
    </ows:Exception>
   </ows:ExceptionReport>

org.xmlpull.v1.XmlPullParserException:仅允许在开始标记之前使用空格内容,而不允许使用{(位置:start_文档已看到{…@1:1)
仅在开始标记之前允许空白内容,而不允许{(位置:start_文档已看到{…@1:1)
我想创建“数据”xml,它给出与GET请求相同的结果

修正:

这是帖子的样子:

  <wfs:GetFeature service="WFS" version="1.0.0" request="getFeature"    outputFormat="application/json"
 xmlns:wfs="http://www.opengis.net/wfs"
 xmlns:ogc="http://www.opengis.net/ogc"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:gml="http://www.opengis.net/gml"
 xsi:schemaLocation="http://www.opengis.net/wfs
 http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd">
<wfs:Query typeName="typeName">
<ogc:Filter>
<ogc:And>
<ogc:Within>
<ogc:PropertyName>the_geom</ogc:PropertyName>
<gml:Polygon>
<gml:outerBoundaryIs>
<gml:LinearRing>
<gml:coordinates>-62,48.30519115013797 -62,56.525823385131694 -30,56.525823385131694 -30,48.30519115013797 -62,48.30519115013797        </gml:coordinates>
</gml:LinearRing>
</gml:outerBoundaryIs>
</gml:Polygon>
</ogc:Within>

<ogc:Or>
<ogc:PropertyIsEqualTo>
   <ogc:PropertyName>propName</ogc:PropertyName>
   <ogc:Literal>value</ogc:Literal>
</ogc:PropertyIsEqualTo>
<ogc:PropertyIsEqualTo>
  <ogc:PropertyName>propName</ogc:PropertyName>
  <ogc:Literal>value</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Or>
<ogc:PropertyIsGreaterThanOrEqualTo>
<ogc:PropertyName>valid_to</ogc:PropertyName>
<ogc:Function name="dateParse">
    <ogc:Literal>yyyy-MM-dd'T'hh:mm:ss.SSSZ</ogc:Literal>
    <ogc:Literal>2015-03-06T09:47:46.260Z</ogc:Literal>
</ogc:Function>
</ogc:PropertyIsGreaterThanOrEqualTo>
<ogc:PropertyIsLessThan>
<ogc:PropertyName>valid_from</ogc:PropertyName>
<ogc:Function name="dateParse">
    <ogc:Literal>yyyy-MM-dd'T'hh:mm:ss.SSSZ</ogc:Literal>
    <ogc:Literal>2015-03-06T10:47:46.260Z</ogc:Literal>
</ogc:Function>
</ogc:PropertyIsLessThan>
</ogc:And>
</ogc:Filter>
</wfs:Query>
</wfs:GetFeature>

_geom
-62,48.30519115013797 -62,56.525823385131694 -30,56.525823385131694 -30,48.30519115013797 -62,48.30519115013797        
专有名称
价值
专有名称
价值
有效的
yyyy-MM-dd'hh:MM:ss.SSSZ
2015-03-06T09:47:46.260Z
有效的
yyyy-MM-dd'hh:MM:ss.SSSZ
2015-03-06T10:47:46.260Z

你实际发送的帖子看起来像什么我已经用帖子更新了这个问题。我仍然试图解决的唯一问题是ISO格式的日期解析。有什么想法吗?错误:java.lang.IllegalArgumentException:无效日期,无法解析无效日期,无法解析不可解析日期:“2015-03-06T09:47:46.260Z”只是字面上的日期就行了。嗨,你解决问题了吗?我看到的完全是同一个问题。我是说withe space消息。