I am using ESRI Leaflet to load an ESRI rest service layer. I am counting the number of features that it loads in my pointToLayer function and displaying that number to the screen when the layer fires the load event. The number is different every time. Also, the number gets smaller if I set the initial view extent to a higher number. So it appears that ESRI Leaflet is only loading the features within the current extent, plus some padding.
However, it does not always load ALL of the features within the initial view. Sometimes some features are missing and when I refresh, they appear again. I have more than 1,000 features in my Rest service, but there would never be that many in the initial view that I set.
I am thus wondering:
Thanks
Jim
hi jim, sorry it took me so long to see this post.
its definitely expected behavior that Esri Leaflet queries the current map extent for a subset of the features stored in your actual service, but i'm surprised to hear that you're seeing an inconsistent count for a single view.
can you share a url to your service so that i can take a look?
I've observed similar behavior when adding the warnings layer (12) from this server: igems_haz (MapServer)
The layer does not consist of more than 1,000 features, but there are days when it seems that the features contain over 1,000 vertices. Like what you described, it doesn't always load all features and does not even load the same number when I hit reload. My assumption has been that the shear size of the layer overwhelms the memory on my computer, which leads to the inconsistent behavior. If you're adding over 1,000 features, you also be pushing the limits of your memory.
John Gravois provided some very helpful pointers on dealing with the issue here: