Select to view content in your preferred language

Query in published services more than 2000 counts not working

2033
3
Jump to solution
01-30-2022 10:02 PM
pragati224
New Contributor III

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

3 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
New Contributor III

Thank You  KristianEkenes  it really helped me.

0 Kudos