evtguy

Dynamic or auto-refreshing MapImageLayers- how?

Discussion created by evtguy on Feb 21, 2013
In my current app I'm developing, I am adding weather radar images from the NWS as mapImageLayers and they display just fine. The source images have a static URL and refresh themselves every two minutes. My desire is to have my application utilize the most current version.

I already have a five minute timer associated with my page because there is another data layer which requires updating every five minutes. I'm trying to add some additional code in my updating subroutine to update my mapImageLayers but visibly, nothing is changing. Here's a snippit of my attempted updating code:

 // Define the NWS Storm Total Precip Layer
 stormPrecipMi = new esri.layers.MapImage({
   'extent': { 'xmin': -125.725647, 'ymin': 45.22319, 'xmax': -119.251570, 'ymax': 51.156890, 'spatialReference': { 'wkid': 4326 }},
   'href': "http://radar.weather.gov/ridge/RadarImg/NTP/ATX_NTP_0.gif"
 });
 stormPrecipMi.height = 550;
 stormPrecipMi.width = 600;
 stormPrecipMi.scale = 1;

 if (nwsStormPrecipLayer != undefined) {
  nwsStormPrecipLayer.removeAllImages;
  nwsStormPrecipLayer.addImage(stormPrecipMi);
 }
 
 map.setExtent(map.extent);


In my code my layer variables are declared globally and no errors are generated in the console window. FWIW, here's my live app: http://gismaps.snoco.org/fws/

Right now, the only way to get updated images is to physically reload the page. Is there another way?

Thanks-
Steve

Outcomes