Select to view content in your preferred language

How to specify a geographic extent to filter out a query in a FeatureService?

869
3
Jump to solution
01-10-2023 08:37 AM
VincentLaunstorfer
Frequent Contributor

Hi,

In a FeatureService query, to limit JSON export, I'd like to specify a geographic extent to filter out the result? With Top, Bottom, Left and Right extent coordinates (in decimal degrees). I guess it is possible but I wonder how...

Thanks 

FeatureService queryFeatureService query

0 Kudos
1 Solution

Accepted Solutions
jcarlson
MVP Esteemed Contributor

With Geometry Type set to Envelope, set the Input Geometry to something like this:

{xmin: -104, ymin: 35.6, xmax: -94.32, ymax: 41}

Just be sure to specify the Input Spatial Reference accordingly.

- Josh Carlson
Kendall County GIS

View solution in original post

3 Replies
jcarlson
MVP Esteemed Contributor

With Geometry Type set to Envelope, set the Input Geometry to something like this:

{xmin: -104, ymin: 35.6, xmax: -94.32, ymax: 41}

Just be sure to specify the Input Spatial Reference accordingly.

- Josh Carlson
Kendall County GIS
VincentLaunstorfer
Frequent Contributor

Thanks, it helped.

I had found the Query (Feature Service) which explains the geometry parameters. However, if you use WGS84 (WKID 4326) decimal degrees and you specify it in the Input Spatial Reference as 4326, the output is not as expected. It looks like the export is confused if the FeatureService spatial reference is different!

Instead, I used the Envelope with coordinates in the same Spatial Reference as the FeatureService and it did work. Although, it still exports 28,000+ features, thus exceeding the usual 2,000 features limit.

I am stuck again.

0 Kudos
berniejconnors
Frequent Contributor

Vincent,

You can "page" through the records using resultOffset=2000 and resultRecordCount=2000.  Your first query will need to use resultOffset=0 and subsequent queries you will have to increase the offset by 2000.  Some server admins might consider this scraping.  Hopefully, each query for 2000 records only ties up the server for a few seconds.

Bernie.