Select to view content in your preferred language

Query in published services more than 2000 counts not working

3285
4
Jump to solution
01-30-2022 10:02 PM
pragati224
Occasional Contributor

Hi Everyone,

 

I am working on an application created on Arcgis Api for javascript 3.39. I have published some map services from ArcGIS Server 10.8.1.

 

I want to extract all the features of the map service layer for working with it's geometry. While running the query it doesnt give returns "Error performing query operation" and fails. Once I checked, in ArcGIS Server Manager and updated the max features returned and match it to more than total number of fatures in it.

 

I republished the services from arcpro as my total count is 7719, I Provided maximum number of counts is 8000 and republished it. but again it is not giving any query result for OBJECT>0. However, when changing to 1001 in total feature returned in ArcGIS server it returns that much value in application while running the same query.

 

Can anybody bring some light on this to how to handle.

 

The query formed is:

 

http://localhost:6080/arcgis/rest/services/******/Population/MapServer/0/query?where=OBJECTID+%3E+1&...

 

0 Kudos
1 Solution

Accepted Solutions
KristianEkenes
Esri Regular Contributor

There's a couple of things you can do. First, I would try what has already been suggested...to paginate the queries. To do this, check for the exceededTransferLimit property of the result. If the value is true, then you make another query offsetting by the objectIds or extent or some other method. The start and num params in the query object are designed to help with pagination like this.

 

You can also set the maxRecordCountFactor to a value between 1 and 5. This will request the number of features in the maxRecordCount by the value set here. So in your case you can request up to 10,000 features in a single request. That may be OK, but paginating the queries is likely the better option for performance. We document this param in the 4x doc, but I imagine it should work in 3x query as well...

Here's the doc: https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html#maxRecor...

And a 4.x example: https://developers.arcgis.com/javascript/latest/sample-code/featurelayer-query-pagination/

Again, the same pattern applies to 3.39, you would just be using a slightly different syntax.

View solution in original post

4 Replies
jcarlson
MVP Esteemed Contributor

I've seen this sort of behavior. Even when the maximum returned features is turned up, it can still sometimes stop at 2,000. I have not discovered the source of the issue, but by first returning the count of features and then utilizing the resultOffset and making multiple requests, you can still get all your features, albeit in batches.

- Josh Carlson
Kendall County GIS
0 Kudos
KristianEkenes
Esri Regular Contributor

There's a couple of things you can do. First, I would try what has already been suggested...to paginate the queries. To do this, check for the exceededTransferLimit property of the result. If the value is true, then you make another query offsetting by the objectIds or extent or some other method. The start and num params in the query object are designed to help with pagination like this.

 

You can also set the maxRecordCountFactor to a value between 1 and 5. This will request the number of features in the maxRecordCount by the value set here. So in your case you can request up to 10,000 features in a single request. That may be OK, but paginating the queries is likely the better option for performance. We document this param in the 4x doc, but I imagine it should work in 3x query as well...

Here's the doc: https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html#maxRecor...

And a 4.x example: https://developers.arcgis.com/javascript/latest/sample-code/featurelayer-query-pagination/

Again, the same pattern applies to 3.39, you would just be using a slightly different syntax.

pragati224
Occasional Contributor

Thank You  KristianEkenes  it really helped me.

0 Kudos
Kevin_MacLeod
Frequent Contributor

ran into this. Trying to make simple count stats indicators in Infographic widget in webapp builder. I don't have Developer or access to do custom JS so I need it to work in AGOL. Bumping the service past 12,000 max record results, it bombs it out and just spins forever. I saw in Server logs it said to increase SOC heap size. I made that half a gig no effect. I have 10.91.   But, if anyone is looking to get tens of thousands of features or more to count or display on widgets like Infographic in WebApp Builder, just add the service as a map image sublayer on the webmap and voila, it works.  Sometimes you can add as external data source and for example that is the only way the Pie chart infographic widget works for whatever reason; but map image sublayer in the webmap is the only way to get counts for large numbers (tens of thousands) of features in WebApp Builder. Leaving this here after figuring out via trial and error in hopes it helps others.

0 Kudos