hi everyone, i am quite newbie on Javascript API, what i am trying to do is: i added new layers to the map and need to refresh or reload the map so i can see the new layer i tried many way mentioned here but nothing works http://forums.esri.com/Thread.asp?c=158&f=2396&t=259812
map.removeLayer(tiledMapServiceLayer); map.removeLayer(dynamicMapServiceLayer); var tiledMapServiceLayer = new esri.layers.ArcGISTiledMapServiceLayer("url"); map.addLayer(tiledMapServiceLayer); var dynamicMapServiceLayer = new esri.layers.ArcGISDynamicMapServiceLayer("url"); map.addLayer(dynamicMapServiceLayer); map.setExtent(map.extent);
hi everyone, i am quite newbie on Javascript API, what i am trying to do is: i added new layers to the map and need to refresh or reload the map so i can see the new layer i tried many way mentioned here but nothing works http://forums.esri.com/Thread.asp?c=158&f=2396&t=259812
map.removeLayer(tiledMapServiceLayer); map.removeLayer(dynamicMapServiceLayer); var tiledMapServiceLayer = new esri.layers.ArcGISTiledMapServiceLayer("url"); map.addLayer(tiledMapServiceLayer); var dynamicMapServiceLayer = new esri.layers.ArcGISDynamicMapServiceLayer("url"); map.addLayer(dynamicMapServiceLayer); map.setExtent(map.extent);
both addLayer and setExtent should refresh your map, but you are not creating valid layers.
var tiledMapServiceLayer = new esri.layers.ArcGISTiledMapServiceLayer("url");
you are passing in the String "url", you need to send the actual url.
destroy() Destroys the map instance. After the map is destroyed it is no longer valid however you can re-use the div element of the map to create a new map instance. (As of v2.0) Return value: none Code snippets: map.destroy();