[OpenLayers-Dev] Should ArcGISCache getURL "this.getResolution()" be
joanne.mcgraw at sympatico.ca
joanne.mcgraw at sympatico.ca
Fri Mar 2 16:11:44 EST 2012
My forum post doesn't seem be getting accepted to the mailing list (even though I'm a member as far as I know - http://osgeo-org.1560.n6.nabble.com/Should-ArcGISCache-getURL-quot-this-getResolution-quot-be-quot-this-map-getResolution-quot-instead-td4540209.html), so I'll just send it around directly instead...
I'm hoping someone more knowledgeable in OpenLayers code can
review this post and tell me if I am correct in my proposed fix and
whether what I have observed is actually a bug or just the result of a
misunderstanding on my part.
I have an OpenLayers.Map with 3 resolutions available (e.g.,
resolutions = [1000,100, 10]). I have an ArcGISCache layer in the map
that I only want available for display at the 100 and 10 resolutions
(that is, it will show greyed out in the LayerSwitcher at 1000 and not
be displayed in the map). When the user zooms in to the 100 resolution
on the map (resolution 100 is in index 1 of the baselayer's resolution
array), the current OpenLayers.Layer.ArcGISCache class' getURL method's
first line of code ends up with the value of 10 (rather than 100) in the
"res" variable because that is the item at index 1 in its own list of
resolutions. Consequently, the method's algorithm generates invalid
paths to the tiles in the cache.
Originally, I started looked into the OpenLayers.Layer class'
getResolution method. It seems to assume the map (or more specifically,
the map's baselayer) and the layer in question at any given time will
always have the same number of resolutions. That didn't seem like a safe
assumption to me but I looked back through the history of the code and
see that that method has been that way for years. So, I went looking
around throughout OpenLayers and find that the OpenLayers.Layer's
getResolution method is only used a handful of times (Grid and KaMap's
getTileBounds and Image's resetBackBuffer and startTransition). This
leads me to believe that the OpenLayers.Layer's getResolution method is
more specific in its usage than I expect.
Given that thought, I'm now thinking instead that the problem is
just with the OpenLayers.Layer.ArcGISCache getURL method. Changing the
use of the Layer's getResolution method might have farther reaching
impacts than I could guess at. And, most other places in OpenLayers
where a getResolution call is made, they are made to the map...as I am
So, I have fixed my problem by changing the first line in the
OpenLayers.Layer.ArcGISCache class method getURL to (the commented
section at the end is the existing line of code):
var res = this.map.getResolution(); // var res = this.getResolution();
Could someone give me an idea if this is an acceptable approach? And, if so, would you consider it a bug that I should log?
Oh, I am using ArcGIS Server 10.0 and OpenLayers 2.11.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Dev