This works as expected. I'm able to zoom, pan, etc., and the GEO layer redraws as needed. Now, I would like to refresh the layer every 15 minutes. My thoughts are that I should simply remove the overlaymap using map.overlayMapTypes.removeAt() then nullify radarLayer and lastly simply repeat the code block that was used to create the layer in the first place. Unfortunately, this doesn't work... the result is that I can see the GEO layer briefly disappear/reappear, but the very same radar image is shown as before. I can wait a full 30 minutes before triggering this refresh, and the very same radar image is continually shown. Also worth mentioning is that my API account statistics, when monitored before and after my attempted refresh, show that no call is made to WeatherBog.
All that said, I'm well aware that I can fully reload my webpage to 'solve' this situation, but my application requires a more elegant solution of refreshing the GEO layer by itself.
How do I go about refreshing a GEO Google overlay?
Below is the code I use to initially create the layer:
map.overlayMapTypes.push(null); radarLayerIndex = map.overlayMapTypes.getLength(); radarLayer = new google.maps.ImageMapType({ getTileUrl: function (myLatLng, zoomlevel) { var theurl = "http://i.wxbug.net/GEO/Google/Radar/GetTile_v2.aspx?as=0&c=0&fq=1&tx=" + getX(myLatLng.toString()) + "&ty=" + getY(myLatLng.toString()) + "&zm=" + zoomlevel + "&mw=0&ds=0&stl=0&api_key=" + weatherbugAPIKey; return theurl; }, tileSize: new google.maps.Size(256, 256), opacity: radarOpacity, isPng: true }); map.overlayMapTypes.setAt(radarLayerIndex, radarLayer);
This works as expected. I'm able to zoom, pan, etc., and the GEO layer redraws as needed. Now, I would like to refresh the layer every 15 minutes. My thoughts are that I should simply remove the overlaymap using map.overlayMapTypes.removeAt() then nullify radarLayer and lastly simply repeat the code block that was used to create the layer in the first place. Unfortunately, this doesn't work... the result is that I can see the GEO layer briefly disappear/reappear, but the very same radar image is shown as before. I can wait a full 30 minutes before triggering this refresh, and the very same radar image is continually shown. Also worth mentioning is that my API account statistics, when monitored before and after my attempted refresh, show that no call is made to WeatherBog.
All that said, I'm well aware that I can fully reload my webpage to 'solve' this situation, but my application requires a more elegant solution of refreshing the GEO layer by itself.
Any ideas?
Message edited by mcore 10 months ago