koopjs / FeatureServer

An open source Geoservices Implementation (deprecated)
https://geoservices.github.io
Other
101 stars 32 forks source link

Query parameter 'returnExtentOnly' does not return extent #161

Closed rrabb closed 4 years ago

rrabb commented 4 years ago

Description

The MapService/FeatureService query parameter 'returnExtentOnly' is ignored. When combined with returnCountOnly, it should return an object with 'count' and 'extent' properties. When this is the only query parameter passed to a Map/FeatureService query, then it should return the total extent of all the features queried.

Please add this property to the query so make it more compliant with the Esri REST API specs, see below.

Example 1

Using a regular ArcGIS Server MapService or FeatureService and issuing a query like below: https://....../MapServer/1/query?where=1%3D1&returnCountOnly=true&returnExtentOnly=true&f=json

returns: {"count":1393,"extent":{"xmin":-95.774711903768633,"ymin":35.995689640994861,"xmax":-89.09897374772504,"ymax":40.61364740498594,"spatialReference":{"wkid":4326,"latestWkid":4326}}}

Example 2

However, with koop featureserver when that query is issued, it only returns the count. https://..../wfs-provider/koop/wfs/massgis/aqua/FeatureServer/0/query?where=1%3D1&returnCountOnly=true&returnExtentOnly=true&f=json

returns: {"count":45}

Example 3

Using a regular ArcGIS Server Map/FeatureService, https://...../MapServer/1/query?where=1%3D1&returnExtentOnly=true&f=json

returns: {"extent":{"xmin":-95.774711903768633,"ymin":35.995689640994861,"xmax":-89.09897374772504,"ymax":40.61364740498594,"spatialReference":{"wkid":4326,"latestWkid":4326}}}

Example 4

However, when that same query is issued to koop FeatureServer, it returns all features instead of just the full extent. https://..../wfs-provider/koop/wfs/massgis/aqua/FeatureServer/0/query?where=1%3D1&returnExtentOnly=true&f=json

From the API docs:

returnExtentOnly : This option was added at 10.4. If true, the response only includes the extent of the features that would be returned by the query. If returnCountOnly=true, the response will return both the count and the extent. The default is false. This parameter applies only if the supportsReturningQueryExtent property of the layer is true. Values: true | false

Source: https://developers.arcgis.com/rest/services-reference/query-map-service-layer-.htm

rgwozdz commented 4 years ago

@rrabb - can you confirm that you are using version 2.20.0 of FeatureServer? That release included support for returnExtentOnly. In my local Koop deployment, which includes that version of FeatureServer, I get the expected behavior of returnExtentOnly.

rgwozdz commented 4 years ago

@rrabb - can you confirm you have this issue after upgrading to FeatureServer 2.20.0?

rrabb commented 4 years ago

@rgwozdz - sorry for the late response, I was using fs 2.16, so I updated my package.json to the latest koop framework, but I'm still seeing this behavior. It appears that upgrading koop to ^3.10.0 did upgrade the featureserver package in node-modules to 2.20.0.

"dependencies": { "body-parser": "^1.19.0", "cors": "^2.8.5", "express": "~4.16.0", "koop": "^3.10.0", "moment": "^2.24.0", "node-rest-client": "^3.1.0", "proj4": "^2.4.4" }

rrabb commented 4 years ago

@rgwozdz - I had to restart the koop service on linux. Now it is working as expected. Thanks! Upgrading fs to 2.20.0 fixed this.