AnsweredAssumed Answered

Refreshing WMS layers

Question asked by coreyalix01 on Aug 29, 2012
Latest reply on Nov 11, 2014 by alassom
I'm really struggling with figuring out how to refresh a WMS layer.  There seems to be a few missing operations:


  • First, it would be nice if we could simply invoke refresh() to update the imagery.

  • Second, it would be nice if we could clone() a layer and add it to a map.  This would allow us to add a new layer like the one we want to refresh before removing the old layer.

  • Third, without the two options above it would be nice if we could manually override supressing the GetMap request when two layers resolve to the same url.


In the third case I'm adding two layers and only imagery for the first is attempted:

        function createWmsLayer()         {             var layer = new esri.layers.WMSLayer("http://sampleserver1.arcgisonline.com/ArcGIS/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer/WMSServer");             layer.setVisibleLayers([2]);             layer.setImageFormat("png");             return layer;         }          map.addLayer(createWmsLayer());         map.addLayer(createWmsLayer());


http activity:

http://localhost:55240/Proxy.ashx?http://sampleserver1.arcgisonline.com/ArcGIS/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer/WMSServer?SERVICE=WMS&REQUEST=GetCapabilities  http://localhost:55240/Proxy.ashx?http://sampleserver1.arcgisonline.com/ArcGIS/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer/WMSServer?SERVICE=WMS&REQUEST=GetCapabilities  http://sampleserver1a.arcgisonline.com/ArcGIS/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer/WMSServer?SERVICE=WMS&REQUEST=GetMap&FORMAT=image/png&TRANSPARENT=TRUE&STYLES=&VERSION=1.3.0&LAYERS=2&WIDTH=996&HEIGHT=630&CRS=EPSG:4326&BBOX=18.1801624186747,-125.192865,55.5544955813253,-66.105824


It seems the only way to force the imagery to reload is by adding another WMS layer exactly like the first but with a random query string value.  Is there a better way?

Related Post
http://gis.stackexchange.com/questions/32272/arcgis-javascript-api-refresh

Outcomes