esri-leaflet Feature Layer not respecting minScale and maxScale

303
1
11-14-2023 10:56 AM
bdk0172
New Contributor

We recently added functionality to our application to be able to display feature data from ArcGIS Online using esri-leaflet and esri-leaflet-renderers.  Apparently the 2 plug-ins do not take into account the minScale and maxScale returned from ArcGIS Online, so we have implemented the use of minZoom and maxZoom which are options of feature.  I found a 7 year long discussion where it was talked about, but apparently never implemented (https://github.com/Esri/esri-leaflet/issues/426).  We have multiple customers that want to switch from ArcGIS Enterprise to Online.  The issue is if we don't configure the minZoom and maxZoom correctly, you run the risk of having too much data showing up when you're zoomed out far and since feature data renders on the client, it can bog the user's machine down.  Our code simply adds the featureLayer to the Leaflet map and then esri-leaflet and esri-leaflet-renderers pretty much handles everything behind the scenes.  Other than making a call directly to get the JSON, is there some way to hijack the data after esri-leaflet has obtained it, get the minScale and maxScale and convert that to minZoom and maxZoom?

0 Kudos
1 Reply
GavinRehkemper
Esri Contributor

Hi, I think the issue you reference has the solution you're looking for:

combine the code example from https://github.com/Esri/esri-leaflet/issues/426#issue-52828917 with the LOD calculation from here:  https://github.com/Esri/esri-leaflet/issues/426#issuecomment-459169743

example: https://codepen.io/gavinr/pen/qBgLJzw?editors=0010

I hope this helps!

 

0 Kudos