[OpenLayers-Users] Correct dateline wrapping or correct map bounds, but not both?

Jani Patokallio jpatokal at iki.fi
Mon Jun 29 05:41:09 EDT 2009


Greetings,

I have an OpenLayers app (http://openflights.org) with maps that are
scaled according to the user's screen resolution and, when zoomed out,
span the entire globe (maxExtent -180,-90.0,180.0,90.0).  Based on my
experimentation, it appears that...

If I specify "maxResolution: auto":
+ the map is scaled correctly according to the user's screen size, with
the whole world displayed by default
- random gaps appear at the dateline, depending on the user's screen size

If I specify "maxResolution: 0.3515625" (*)
+ there is never any dateline gap
+ the map is scaled correctly on a 1024x768 display
- only a portion of the world is visible at 800x600

So am I really forced to make a choice between one and the other?  For
reference:

var mapOptions = {
 maxResolution: 0.3515625,
 restrictedExtent: new OpenLayers.Bounds(-9999, -90, 9999, 90),
 maxExtent: new OpenLayers.Bounds(-180,-90.0,180.0,90.0),
 numZoomLevels: 8,
};

(*) derived experimentally from the sequence in
http://trac.openlayers.org/wiki/SettingZoomLevels.

Cheers,
-jani







More information about the Users mailing list