limit the number of features in feature layer

270
2
08-11-2022 07:18 AM
GuyShaharabani
New Contributor III

I use the feature Layer definitionExpression property, and it is working.

But I want to limit the number of features the feature layer will load or display.

Is there a way to that in JS or it has to done it arcgis pro(before publishing the layer)?

0 Kudos
2 Replies
UndralBatsukh
Esri Regular Contributor

Hi there, 

The maxRecordCount property needs to be set at the time of feature service publishing: https://developers.arcgis.com/rest/services-reference/enterprise/feature-service.htm

If you are using Query class to query features from your FeatureLayer then use the Query.num property to specify the number of features to retrieve: https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-Query.html#num

 

0 Kudos
GuyShaharabani
New Contributor III

but the property maxRecordCount determines the number of features returned from a query, I just want to limit to number of features displayed from the layer at all times.

am I worng?

0 Kudos