First time, map loads and the locations are plotted properly.

Second time, when the new set of locations are pulled from the app, map reloads and gets the new set of data. But it is not refreshed. The old plotted points are not getting removed.

  • 2
    We'll require details to be of any help. Details like: What API are you using? ArcObjects, or The web API's or the WebADF. What is your programming language/environment etc. Feb 9, 2012 at 13:23
  • serverapi.arcgisonline.com/jsapi
    – Veena
    Feb 10, 2012 at 15:09
  • If i use map.refresh(), points are never plotted. Please suggest.
    – Veena
    Feb 10, 2012 at 15:11
  • 1
    how are you adding the new set of locations? And what are you doing to remove the old locations? Please post your code, so that we can see suggest changes. Feb 11, 2012 at 9:29
  • 1
    My app is in MVC3. In Model , a property is created to return the map data. My view has a hidden variable which stores this model's property value (map data). Am using this hidden variable in javascript to plot the locations on ESRI map. First time, locations are plotted properly on the map. Then onwards map data is not getting refreshed; even though hidden variable gets new set of location info from Model. Please suggest
    – Veena
    Feb 13, 2012 at 14:36

2 Answers 2


For the JS API you will need to remove the old layer before (or after if you want...) you add the new one in.

For example:

map = new esri.Map('map')
lyr = new esri.layers.FeatureLayer('http://someurl')
newLyr = new esri.layers.FeatureLayer('http://someOtherURL')

The map should update on its own. I will often do map.removeAllLayers() and re-add my layers from scratch in the correct order because it simplifies generalization (and re-draw is almost not noticeable).


I was dealing with a possibly simialr situation this morning..in the silverlight api (I wish it was jsapi) and my problem was that I was doing some processing on the server with python and the return data was in a different projection that the map in the client.

The data was coming in but I couldn't see it (though I did inspect the geometry in the code in debug mode). I zoomed to the full extent and there were my lovely green points.. in Africa!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.