[OpenLayers-Dev] limitation of fix #487 to wrap the dateline

pdecker paulad at rmi.net
Tue Dec 11 16:57:43 EST 2007


Hello,

Here is some correspondance which may help others when trying to work with
tiles which cross the international date line.  I have used the wrapDateLine
parameter in the OpenLayers client and modified our WMS server, and it
works.  Your server may receive tiles outside latitude: +-90.0 and longitude
+-180.0 from OpenLayers. What I have done for our server is to tell
OpenLayers to send an additional parameter which specifies if the tile has
come from an image which spans the international date line.  If so, I
process the bounding boxes differently and do not strictly apply the WMS
lat/lon boundary conditions.

Thank you for your help.  The correspondance is shown below.


***********************************************************

On Dec 3, 2007, at 5:49 AM, Paula Decker wrote:
> Using OpenLayers 2.5 and the wrapDateLine parameter, will tiles  
> requested by the OpenLayers client still be in the range: Latitude:  
> -90 to 90, and -180 to 180 ?

While it appears that the longitude is clamped to that range when the  
wrapDateLine parameter is on, OpenLayers will continue to request  
tiles that have a BBOX outside of [-90,90].

Here are example BBOX parameters that OpenLayer sends when requesting  
a global set of tiles:
BBOX=-180,-90,0,90&WIDTH=512&HEIGHT=512
BBOX=0,-90,180,90&WIDTH=512&HEIGHT=512
BBOX=-180,-270,0,-90&WIDTH=512&HEIGHT=512
BBOX=0,-270,180,-90&WIDTH=512&HEIGHT=512
BBOX=0,90,180,270&WIDTH=512&HEIGHT=512
BBOX=-180,90,0,270&WIDTH=512&HEIGHT=512
BBOX=0,-450,180,-270&WIDTH=512&HEIGHT=512
BBOX=-180,-450,0,-270&WIDTH=512&HEIGHT=512

Aside from server logs, I often use the Live HTTP headers plug-in for  
FireFox or the one for Internet Explorer to see the requests  
OpenLayers is making to the remote server.

Cheers,
Ryan

***********************************************************

On Dec 3, 2007, at 10:31 AM, Paula Decker wrote:

> This is unexpected results...what is the advantage of the  
> wrapDateLine parameter?  It doesn't seem to adjust the lat, lon to  
> the acceptable EPSG:4326 range, namely: -90 <= lat <= 90, and
-180  
> <= lon <= 180.  Normally, the WMS server will throw an exception
if  
> it gets a lat,lon out of the valid EPSG:4326 range.


It has been a few weeks since I looked at this in detail, so my  
explanation may be slightly off in places...

Normally the internal view coordinate system in OpenLayers goes off to  
infinity in both the -x/+x and -y/+y directions. When it goes to make  
a request, it converts the internal view coordinate system to lat/lon  
(via getLonLatFromLayerPx) and makes the request. Without  
wrapDateLine, this conversion assumes the world is flat and goes off  
infinitely in all four directions.

However, with the wrapDateLine parameter turned on, its behaves a  
little differently. Depending on where your view is (e.g., what side  
of the dateline you are on), the internal coordinate system will  
change and getLonLatFromLayerPx will constrain the longitude component  
of the requests to [-180,180] and correctly place the results on the  
map.

But the latitude isn't similarly constrained, so OpenLayers will  
sometimes request areas of the globe that simply won't have data as it  
seeks to pull adjacent tiles in advance. So there is obviously some  
inefficiencies here, but it works well enough as is.

Although not strictly related to the above, I have found it useful to  
constrain the view window using the restrictedExtent option that you  
pass to the map constructor -- I set it to the result of "new  
OpenLayers.Bounds(-9999, -90, 9999, 90)" when using wrapDateLine. I  
also limit the zoom levels, since the wrapDateLine option doesn't work  
very well when you can see the same portion of the globe twice at the  
same time.

If you want to chat further, let's bring it back to the users mailing  
list, for the benefit of the archive.

Cheers,
Ryan


***********************************************************

Does this example help you ?

http://openlayers.org/dev/examples/wrapDateLine.html

Regards,
Pierre

On Nov 30, 2007 9:51 PM, pdecker <paulad at rmi.net> wrote:
>
> Hello,
>
> I want OpenLayers to provide tiles for a bounding box which spans the
> 180th
> meridian, for examle:  upper left latitude=1.0,  upper left
> longitude=170.0,
> lower right latitude=-1.0, lower right longitude=-170.0.
>
> Given this bbox, OpenLayers will then request the following tiles:
> minLon=0.0 maxLon=180.0 minLat= -90.0 maxLat=90.0
> minLon=-180.0 maxLon=0.0 minLat= -90.0 maxLat=90.0
> minLon=-180.0 maxLon=180.0 minLat= -90.0 maxLat=270.0
> minLon=-180.0 maxLon=332.0 minLat= -90.0 maxLat=422.0
>
> The maxLat=270, maxLon=332, maxLat=422 are out of range for valid
> latitude/longitude values.
>
> Is there a way to read images with bounding boxes that span the 180th
> meridian?
>
> Thanks in advance.
>
> PDecker
>
>

 


-- 
View this message in context: http://www.nabble.com/limitation-of-fix--487-to-wrap-the-dateline-tp14093713p14284345.html
Sent from the OpenLayers Dev mailing list archive at Nabble.com.




More information about the Dev mailing list