Fetch extent of the map using REST API

6231
12
12-09-2014 01:24 PM
BhavinSanghani
Occasional Contributor II

How to find extent of the features after querying to the layer?

 

e.g. I query Parcel layer using "where"= "GISID IN (100000)" on <mapservice>/<layerid>/query url and I want to find extent of the result.

 

Is this possible using REST API?

 

In ArcGIS Javascript API, I can use graphicsUtils.graphicsExtent() to find extent of the results. Looking similar while using REST API at java layer.

 

I am exporting map document using print utility service based on the "where" criteria and "mapservice" url I have. I do not instantiate map document. I use ExportWebMapTask to export the map document. I want to make sure that when I export the map document, extent of the result is zoomed-in appropriately.

0 Kudos
12 Replies
MichaelGayheart1
New Contributor III

I asked essentially the same question in this post: Will future version of Javascript API support non-hosted feature services for QueryTask.executeForEx...

I mention in the thread that an Esri developer mentioned the functionality should be in the REST API and in JSAPI at 10.3.1.

At the 10.3 release though, there seems to be a hint that maybe this functionality is ready (at least for feature services)? ArcGIS REST API Look at the returnExtentOnly parameter that says it is new at 10.3. I'm not sure how you get the supportsReturningQueryExtent parameter to be true though.

Hopefully that helps!

BhavinSanghani
Occasional Contributor II

I am not sure on this but supportsReturningQueryExtent may be true based on the published services. It's kind of how supportsDynamicLayers property can become true.

0 Kudos
MichaelGayheart1
New Contributor III

At 10.3.1 I'm able to add the parameter returnExtentOnly to a REST service call and it only returns the extent. Here is an example: http://api.imb.org/arcgis/rest/services/LIVE/Urban/MapServer/0/query?where=GENC1%3D%27US-CA%27&retur...

I'm not sure if this works for every kind of underlying database, but this service is based on a file geodatabase.

Hopefully that helps!