Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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);                
   }                                         
}); 
share|improve this question
    
did u try it without google map as baselayer?. try to add another basemap from esri as to seeing problem if google maps. –  Aragon Jul 13 '12 at 6:14
    
@Aragon note the edits showing that it works in Chrome or IE9. Does that rule out Google's baselayer as interfering? –  Stephen Lead Jul 13 '12 at 6:56

1 Answer 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...

share|improve this answer
    
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. –  Stephen Lead Jul 13 '12 at 6:30
    
read your conf.xml file, it states there as <XOrigin>-5120900</XOrigin><YOrigin>-9998100</YOrigin> sth in this example here. –  Aragon Jul 13 '12 at 6:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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