Select to view content in your preferred language

Pan/Zoom Event

4916
11
04-09-2010 10:17 AM
JustinWilliams
Emerging Contributor
Just curious, if anyone has run into this before...

I have a National Weather Service radar layer which is being auto-refreshed at a specific interval. There seems to be an issue with the layer's refresh not overriding a cached image from the current zoom/extent. I have tried everything possible to remedy this, including rewriting my refresh method to construct an entire new layer and add it to the map.

So... I am curious. What event is firing when I zoom/pan, as this is the only action which will draw the latest data.

Any help would be appreciated!

Thanks,

Justin
GIS Analyst
Indiana Department of Homeland Security
Tags (2)
0 Kudos
11 Replies
RobertScheitlin__GISP
MVP Emeritus
Justin,

   Have you set the disableClientCaching to false on the layer (That is if it is a ArcGISDynamicMapServiceLayer)?
0 Kudos
JustinWilliams
Emerging Contributor
Yeah I've tried that and the cachePolicy = "off"

Another odd behavior is when the browser loads, it will always load old data and remains that way until you zoom/pan. It makes me think there is something going on with flash/flex in rebuilding a cached tile/image of the current screen extent.
0 Kudos
JustinWilliams
Emerging Contributor
Ok changes are being reflected by forcing a non-noticeable pan on the map(not sure if this pan is even taking place honestly, however my data is clearly being updated). However a new unintended behavior has occurred and my thinking leads me to believe this is another caching issue.

Here is an example of the event handler I am using to refresh one category of data. I have three other categories which can fire. When the other events fire, and refresh other layers, they revert all other layers to their previous outdated versions if the layer being refreshed has no new data. Any ideas on how to avoid/deal with this?

      //customized - the refresh handlers for the refresh categories
      private function critical_refresh_Handler(event:TimerEvent):void {
       var i:int = 0;
       var refresh_layer:ArcGISDynamicMapServiceLayer;
       //critical refreshes
       while( i < critical_live_layers.length) {
     refresh_layer = map.getLayer(critical_live_layers) as ArcGISDynamicMapServiceLayer;
     refresh_layer.refresh();
     i++
       }
       //pans the map to get the new data to draw, workaround to caching issue with flex/flash currently unknown.
    map.panDuration = 1;
    map.panDown();
    map.panUp();

      }
0 Kudos
JustinWilliams
Emerging Contributor
this seemed to fix the issue

      private function critical_refresh_Handler(event:TimerEvent):void {
       var i:int = 0;
       var refresh_layer:ArcGISDynamicMapServiceLayer;
       map.panEnabled = true;
    map.panDuration = 15;

    map.panDown();
       //critical refreshes
       while( i < critical_live_layers.length) {
     refresh_layer = map.getLayer(critical_live_layers) as ArcGISDynamicMapServiceLayer;
     refresh_layer.refresh();
     i++
       }
    map.panUp();
      }
0 Kudos
DasaPaddock
Esri Regular Contributor
Have you tried setting disableClientCaching to true? This should prevent the browser from using it's own cache instead of going back to the server.
See:
http://resources.esri.com/help/9.3/arcgisserver/apis/flex/apiref/com/esri/ags/layers/ArcGISDynamicMa...
0 Kudos
HessCorporation
Emerging Contributor
I'm also having this problem but with a custom WMS layer for national weather radar, so there is no disabledClientCaching option.

I'll try your fix as i think that will work...very strange problem though as all the settings to disable caching are set.

Just out of interest where are you sourcing your weather radar from? i'm using the nexrad feed from Iowa State but i'd like an AGS version if possible.

http://mesonet.agron.iastate.edu/ogc/
0 Kudos
DasaPaddock
Esri Regular Contributor
You could try a similar fix by implementing the same thing in your custom layer. When disableClientCaching is true, it just adds a _ts url parameter with the current time. This way every url requested is different.

Code:
reqVars._ts = new Date().time
0 Kudos
JustinWilliams
Emerging Contributor
Use add data and GIS Servers/WMS Service for this, has some neat layers for use

http://www.mapcontext.com/cgi-bin/wms.cgi?REQUEST=GetCapabilities&SERVICE=WMS&
0 Kudos
HessCorporation
Emerging Contributor
You could try a similar fix by implementing the same thing in your custom layer. When disableClientCaching is true, it just adds a _ts url parameter with the current time. This way every url requested is different.

Code:
reqVars._ts = new Date().time


The problem doesn't seem to be with client caching, i added that to the URL params but it just doesn't reload the layer when .refresh is fired, the same _ts value is returned every time. If i move the map then it does use a new _ts value and updates the map.

So i'm pretty sure the problem is with the refresh method, i'm using the custom WMS layer from the sample flex viewer. It seems to set the params the first time the layer is loaded, but the refresh command doesn't force a new URLRequest load.

Not sure if this is the same problem for the OP's feed, but from looking at the history of this issue on both forums it always seems to involve radar feeds and WMS. I'm wondering if WMS feeds just work differently and can't utilise refresh().
0 Kudos