returnCountOnly causes wrong subsequence query?

851
2
07-02-2021 07:12 AM
EmreCan
New Contributor II

Hello,

I am using ArcGIS REST Api version 10.6.1.

I have the following problem: Geometries are not displayed in 3D mode because the requests may be incorrect. In 2D mode (MapView) everything works fine.

My analysis:

If I do not support queries with returnCountOnly & returnIdsOnly in the query interface, then everything works. So if I return an empty object in the following query:

Request:

http://localhost:8080/rest/arcgis/features/4242/4242/query?f=json&returnIdsOnly=true&returnCountOnly...

Response: 

 

{}

 

As soon as I return an object with the Count value as usual it doesn't work.

 

{"count": 1}

 

Because the subsequent requests then look like this:

Request:

 

 

http://localhost:8080/rest/arcgis/features/4242/4242/query?f=json&outFields=objectId%2Cdescription&outSR=102100&spatialRel=esriSpatialRelIntersects&where=1%3D1

 

But I don't want to support query calls without a geometry.

My expected subsequent request would be:

 

 

http://localhost:8080/rest/arcgis/features/4242/4242/query?f=json&geometry=<geometry>&maxAllowableOffset=3261.313206833336&outFields=objectId%2Cdescription&outSR=102100&spatialRel=esriSpatialRelIntersects&where=1%3D1&geometryType=esriGeometryEnvelope&inSR=102100

 

 


I also get the following error message on #fetchTile():fetchTile_Error.PNG

What is the best way to solve the problem? I don't want to remove the returnCountOnly function from the interface.

Why does it work at all if I return something wrong (empty object) so to speak?

 

Thanks for any help!

 

*** EDIT ***

I found out that when the feature count is over 50,000 that the request is split into multiple requests.

So where does the limit "50,000" come from and how can I override it?

I didn't find anything about this in the docs.

0 Kudos
2 Replies
EmreCan
New Contributor II

I found out that when the feature count is over 50,000 that the request is split into multiple requests.

So where does the limit "50,000" come from and how can I override it?

I didn't find anything about this in the docs.

0 Kudos
CourtneyMenikheim
Occasional Contributor

The API limits calls to 1000 results at a time. There is not a way to get more than this.
In my experience, the best way to handle this is:
- get a list of the objectids that match your query
- divide the list of objectids into groups of 1000
- make a separate call for each group of 1000 to get the features (with geometries, if appropriate) from the service

Note: Browsers, and some services, often have limits for how many queries they can process at one time. Trying to run more than that will crash the browser, or cause all the queries to fail. If you need to run a lot of them, you may need to set up some custom code to make sure that a smaller group of queries finishes before running the next batch.

Courtney Menikheim | Application Developer | @thecmenikheim