Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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.

Please help. Veenz

share|improve this question
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. –  Devdatta Tengshe Feb 9 '12 at 13:23
    
serverapi.arcgisonline.com/jsapi –  Veena Feb 10 '12 at 15:09
    
If i use map.refresh(), points are never plotted. Please suggest. –  Veena Feb 10 '12 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. –  Devdatta Tengshe Feb 11 '12 at 9:29
    
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 '12 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')
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).

share|improve this answer

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!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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