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.
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.
Sign up to join this communityFirst 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.
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')
map.addLayer(lyr)
newLyr = new esri.layers.FeatureLayer('http://someOtherURL')
map.removeLayer(lyr)
map.addLayer(newLyr)
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!