[OpenLayers-Users] Correct dateline wrapping or correct map
bounds, but not both?
David Zwarg
dzwarg+ol_users at avencia.com
Mon Jun 29 09:35:33 EDT 2009
Hello Jani,
I was coming across a very similar problem to yours. I needed to represent
networks that spanned the IDL, with points and lines. (
http://www.sourcemap.org/beta/stage/index.php/objects/object-105) The way
that I got around the wrapping was to add points and lines as multi-point
and multi-line geometry collections. 1 geometry would lie within the bounds
of the coordinate system (-180 to 180, in your case below), and the other
geometries would be -x and +x * 360. For example, mapping 0, 51.47722
(Greenwich, UK), would place points at -360, 0, and 360. One could extend
this as many times as necessary, based on the aspect and maxExtent of the
map.
This approach adds a bunch of features to the map, but gets rid of the
flipping when the map is scrolled over the IDL.
David
On Mon, Jun 29, 2009 at 5:41 AM, Jani Patokallio <jpatokal at iki.fi> wrote:
> 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
>
>
>
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20090629/28f88a39/attachment.html
More information about the Users
mailing list