1

I'm looking to refresh a featureLayer in Esri Leaflet with the refresh() method (API reference: https://esri.github.io/esri-leaflet/api-reference/layers/feature-layer.html).

I set up a button to refresh the featureLayer:

const testLayer = L.esri.featureLayer({url:''}).addTo(map);

document.getElementById("test").onclick = function(){
testLayer.refresh();
});

However, I would like to set it up with a setInterval method. So when people are making changes and editing data it will update the webmap dashboard.

setInterval(function() {
    testLayer.refresh();
}, 3000);

I need the feature layer to refresh so when there's changes to the data that webmap will reflect that without reloading the page. The ArcGIS API for Javascript has a similar and working method documented here support.esri.com/en/technical-article/000013384 -- however I'm using the esri Leaflet plugin. It seems to pretty simple to me but I'll set it up and make a change to the data and the map will not update the featureLayer unless I press refresh on the page.

  • Can you explain a bit more about "not working"? – TomazicM Feb 1 at 20:01
  • Sure thing, I need the feature layer to refresh so when there's changes to the data that webmap will reflect that without reloading the page. The ArcGIS API for Javascript has a similar and working method documented here support.esri.com/en/technical-article/000013384 -- however I'm using the esri Leaflet plugin. It seems to pretty simple to me but I'll set it up and make a change to the data and the map will not update the featureLayer unless I press refresh on the page. – Derek Duskin Feb 1 at 20:52
  • Please Edit the question to provide clarifications requested in comments. – Vince Feb 1 at 22:33
  • What is your layer source? Are you sure it's changing? Do you see change if you refresh page in browser? What request goes to server upon refresh (debug network)? – TomazicM Feb 3 at 7:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.