[OpenLayers-Users] Why does my overview map not work?
Tim Schaub
tschaub at openplans.org
Fri Nov 30 14:33:15 EST 2007
Hey-
Gregor Mosheh wrote:
> Boy, am I full of questions today. At least I'm breaking them up, into
> logical threads. :)
>
> Map: http://69.59.158.15/spraywatch2/map.php
>
> The overview map "doesn't work" I seem to recall that it used to work,
> fetching basemap tiles. Now the basemap is served via TileCache, and
> perhaps that's an issue. What configuration should be involved in the
> overview map?
>
I can already guess the problem, but I'll detail my debug procedure just
for kicks:
1) open http://69.59.158.15/spraywatch2/map.php
2) expand overview map
3) right-click on a broken image, and "copy image location"
4) view in a new tab to see the response from TileCache:
An error occurred: can't find resolution index for 0.250000. Available
resolutions are:
[0.05859375, 0.029296875, 0.0146484375, 0.00732421875, 0.003662109375,
0.0018310546875, 0.00091552734375, 0.000457763671875,
0.0002288818359375, 0.00011444091796875, 5.7220458984375e-05,
2.86102294921875e-05, 1.430511474609375e-05]
Wow, now that's helpful isn't it?
So, the overview map control is trying to guess at the resolutions it
should use for its map. And it's not guessing right in this case. So
the solution is to be explicit. Choose some resolutions that you know
TileCache will like:
var options = {
mapOptions: {
resolutions: [0.05859375, 0.029296875, 0.0146484375,
0.00732421875, 0.003662109375, 0.0018310546875, 0.00091552734375,
0.000457763671875, 0.0002288818359375, 0.00011444091796875,
5.7220458984375e-05, 2.86102294921875e-05, 1.430511474609375e-05]
}
};
var control = new OpenLayers.Control.OverviewMap(options);
or some restricted set of resolutions if you prefer.
This sort of configuration is documented here:
http://trac.openlayers.org/wiki/Control/OverviewMap
(which is reachable via
http://www.google.com/search?q=openlayers+overviewmap)
Tim
More information about the Users
mailing list