Querying FeatureService behaves differently depending on MapView Zoom Level

328
1
01-10-2023 05:16 AM
DavidHanimann
New Contributor

There is a strange behaviour when querying a FeatureService. I have a Point FeatureLayer that is hosted on ArcGIS Portal in a MapView. When the zoom level in the MapView is initially set to a high number (e. g.10), then  the points from the FeatureLayer are queried by the extent of the MapView, which is what I expect. However, when the initial zoom level of the map is at around 3 or lower or unset, then all points are loaded at once using queries with the parameters resultOffset and resultRecordCount. This happens regardless of the current zoom level of the MapView .The layer has a scel-dependent visibility and is only visible when zooming in. The layer has 100'000s of points, i don't ever want to load all the points.

Here an example of the behaviour: CodePen 

Is there a way to cinfuger the loading behaviour? I couldn't find any doumentation on this behaviour, this would be very helpful.

0 Kudos
1 Reply
JoelBennett
MVP Regular Contributor

Although there is no documentation I know of regarding this, you can "opt out" of this behavior.  The short of it is that you would add this in a script tag prior to loading the API:

var dojoConfig = {
	has: {
		"featurelayer-snapshot-enabled": 0 // disable snapshot
	}
};

 

This is derived from this thread, at the end of the solution post.  For reference, these settings are found in the esri/core/has.js file.