FeatureLayer always returns 1000 features

645
5
08-06-2021 06:38 AM
AndyWhitaker1
New Contributor III

I have created a FeatureLayer from a sublayer of a Dynamic Layer.  Queries to the FeatureLayer will only return 1,000 features at once.  I've used the num and start properties of the Query object to page results in the past, however, both the Dynamic Layer and the sublayer have the Max Record Count property set to 5,000 on the server.  So, I'd like to be able to take advantage of that.

2021-08-06_9-34-05.png2021-08-06_9-48-05.png

 

 

 

 

 

 

 

 

 

 

 

 

 

2021-08-06_8-52-53.pngWhen I observe my instance of the FeatureLayer in Developer Tools at runtime, it says the maxRecordCount is 1,000.

 

 

 

 

 

Any ideas why the FeatureLayer continues to default to 1,000?  I've referenced other posts here that all suggest setting the MaxRecordCount is the fix.  However, to my knowledge, the GIS folks have set this property as suggested.

0 Kudos
5 Replies
jcarlson
MVP Notable Contributor

I have seen this behavior as well. Are you explicitly stating the "resultRecordCount" parameter as 2000 and it still behaves this way?

- Josh Carlson
Kendall County GIS
0 Kudos
AndyWhitaker1
New Contributor III

Thanks, @jcarlson.  When working with the Query class in the JavaScript API, I believe we set the num property and the start property.  These should be analagous to resultRecordCount and resultOffset parameters in the REST API, which I can see in the Query action for the FeatureLayer in the ArcGIS REST Services Directory.

Funny thing, is that it works as expected when doing the query in the ArcGIS REST Services Directory, just not when coming from the client in JavaScript working with Query and making a call to the FeatureLayer's queryFeatures function.

0 Kudos
JeffreyWilkerson
Occasional Contributor II

I thought that this depended on what the REST service is setup to allow, and it defaults to 1000.  So if it's your service and you have access to ArcGIS Manager you can allow more, but if not you are only able to ever get up to the 1000 limit.  I have written code in the past to consume some one else's service that was limited to 1000 features, but I had to pull it in in groups, or hope that you can write a where clause for the query that comes in under 1000.  

CourtneyMenikheim
Occasional Contributor

The REST service limits it to 1000 features, regardless of what the Max Record Count is. I typically get around this by querying for the ObjectIDs for the parameters that I want. This will give you an array of ObjectIDs for all the features you want, even if it's over 1000. Then, I divide the results into chunks of 1000 and make a query to fetch features based on their ObjectID. 

Courtney Menikheim | Application Developer | @thecmenikheim
CourtneyMenikheim
Occasional Contributor

Be careful though - if your browser submits too many queries at once, you'll run into some issues. If there are several chunks of 1000, you may need to write some code to wait for a batch to finish before running the next one.

Courtney Menikheim | Application Developer | @thecmenikheim