I try get number of features through WFS request:
$.ajax('http://x.x.x.x/geoserver/wfs',{
type: 'GET',
data: {
service: 'WFS',
version: '1.1.0',
request: 'GetFeature',
typeName: 'workspace:layer',
outputFormat: 'text/javascript',
srsname: 'EPSG:4326',
resultType: 'hits',
bbox: extent.join(',') + ',EPSG:4326'
},
dataType: 'jsonp',
jsonpCallback:'parseResponse',
jsonp:'format_options'
}).then(function(response) {
var result = parserJSON.readFeatures(response);
});
But I get Uncaught SyntaxError. Response is not JSONP.
response:
xmlns:sf="http://www.openplans.org/spearfish"
xmlns:wfs="http://www.opengis.net/wfs"
xmlns:gml="http://www.opengis.net/gml"
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:ows="http://www.opengis.net/ows"
xmlns:tiger="http://www.census.gov" xmlns:topp="http://www.openplans.org/topp"
xmlns:baikalgeol="http://www.geol.irk.ru/baikalgeol"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" numberOfFeatures="35"
timeStamp="2016-10-07T02:38:43.015Z"
xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd"/>
As see server return numberOfFeatures="35".
I changed outputFormat on 'GML3' and parseGML3 (openlayers format). But it did not help.
How wrap response in json or read this xml without rest?
No comments:
Post a Comment