0

I'm trying to add an ArcGIS Server tiled/cached layer to OpenLayers. This is working using code modified from these samples.

The only problem is that when panning the map, the layer does not update to show data which was previously off the screen. In this example I've panned the map to the west, and the overlay data hasn't updated:

enter image description here

However, if I zoom (rather than pan) the layer does update. Do I need to explicitly call an update method on the layer when panning? Note that the first example script correctly updates after panning (but this is a basemap, not an overlay - does that make a difference?)

My sample code is available here. I need to hard-code the layerInfo parameters, rather than retrieving them at run-time (I obtained the values using ..../MapServer?f=json&pretty=true)

Thanks for any advice.

[EDIT: the layer does update when panning in Chrome or IE9, but not in FireFox or Opera.]

[EDIT2: if I switch the layer off then on in the moveend function, the layer correctly updates after panning in FireFox and Opera:

map.events.register("moveend", map, function() { 
   var lyrs = map.getLayersByName("geology");
   if(lyrs.length > 0) {
      lyr = lyrs[0];
      lyr.setVisibility(false);
      lyr.setVisibility(true);                
   }                                         
}); 
2
  • did u try it without google map as baselayer?. try to add another basemap from esri as to seeing problem if google maps.
    – urcm
    Commented Jul 13, 2012 at 6:14
  • @Aragon note the edits showing that it works in Chrome or IE9. Does that rule out Google's baselayer as interfering? Commented Jul 13, 2012 at 6:56

1 Answer 1

1

can u try it not defining lots of layer definations as following:

        var url = "http://107.21.18.93/ArcGIS/rest/services/GeoScience
                                            /GeologyUnitBoundaries/MapServer"

        var overlayLayer = new OpenLayers.Layer.ArcGISCache('GeoScience', url, {
                tileOrigin: tileOrigin,
                resolutions: mapResolutions,
                sphericalMercator: true,
                maxExtent: mapExtent,
                useArcGISServer: false,
                isBaseLayer: false,
                projection: proj
            });
            map.addLayers([overlayLayer]);

write all level resolutions in array as mapResolutions.

i hope it helps you...

2
  • Where would the tileOrigin (etc) variables come from in this case? Also, I noticed that if I toggle the visibility off then immediately on in the moveend function, it works. Commented Jul 13, 2012 at 6:30
  • read your conf.xml file, it states there as <XOrigin>-5120900</XOrigin><YOrigin>-9998100</YOrigin> sth in this example here.
    – urcm
    Commented Jul 13, 2012 at 6:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.