OpenLayers OpenLayers

Ticket #487 (closed feature: fixed)

Opened 1 year ago

Last modified 11 months ago

wrap the dateline

Reported by: jrf Assigned to:
Priority: major Milestone: 2.5 Release
Component: general Version:
Keywords: Cc:
State:

Description (Last modified by jrf)

Make all longitudes into "positive and negative clock numbers modulo Pi" using modular arithmetic, so that everything wraps around the dateline correctly. This will mean special changes for most layers, because different layers handle the dateline differently. Most will need to need a hard stop that gets only visually matched with the other side.

This may mean special stuff in the vector branch, e.g. what happens when some draws a line across the dateline? or drags a polygon across the dateline? or clicks in a feature that is on both sides of the dateline?

While it would be nice to also work out the code for pole crossing, it is more complex than just making latitudes into positive and negative clock numbers modulo Pi/2, because the singularity at the pole creates an orientation ambiguity that can only be remedied in one of two ways:

I think this means that pole crossing should wait for later.

Attachments

wrap.patch (21.7 kB) - added by sderle on 06/07/07 09:56:29.
crschmidt's patch with a typo corrected (r3277)
dateline.patch (29.5 kB) - added by euzuro on 06/11/07 18:05:57.
this is my reworked patch for the dateline wrapping. it is taken pretty much directly from crschmidt's "wraptheworld" sandbox. All tests pass in ff & ie6.

Change History

01/29/07 08:11:11 changed by jrf

  • description changed.

01/29/07 08:26:16 changed by jrf

  • description changed.

03/08/07 13:01:43 changed by sderle

  • milestone changed from 2.4 Release to 2.5 Release.

05/13/07 09:29:49 changed by jrf

  • priority changed from major to blocker.

05/24/07 00:47:26 changed by crschmidt

  • owner changed from euzuro to metacarta.
  • priority changed from blocker to major.

Thought from tschaub: Move to OL 3.0. Make everything use XY instead of LonLat, and LonLat is special because it wraps.

05/25/07 14:10:30 changed by tschaub

A fun exercise while considering dateline wrapping is to draw lines with Google's "My Maps". If you zoom way out, things start out well as you are given 360 degrees to play with. When you stray beyond the initial 360, your point wraps to the other side of the map though your cursor stays fixed. As you add points and pan, it looks like this 360 degree window shifts, always giving you a good bit of room to add points. Things quickly fall apart however if you start adding points at zoom 0 or so, then zoom to 2 or 3 and keep adding points. Points are orphaned, lines fall apart, and things get crazy. Similar craziness ensues when modifying polygons that wrap.

06/07/07 06:58:11 changed by crschmidt

  • keywords set to review.

What it does:

  • New option 'wrapDateLine' on the base layer
  • Wraps zoomToExtent
  • Wraps getLonLatFromPixel
  • Function 'adjustBounds' on layer does wrapping
  • Moved adjustBoundsForGutter inside adjustBounds
  • added calls to adjustBounds in all the getURL functions which can support it. (Grid layers, mostly.)

Limitations/expectations of this patch:

  • It is expected behavior that the layer's getPixelFromLonLat will not wrap. This means that if you are looking at Australia and Hawai'i, and you place a marker at 175, it will end up visible or not visible depending on which side of the date line you're on.
  • Vector drawing across the date line is not supported. (Your mouse will 'snap' to the other part of the world.)
  • Requests which cross the date line are *not* wrapped, so they will request content outside the world if it does not divide evenly.

06/07/07 09:56:29 changed by sderle

  • attachment wrap.patch added.

crschmidt's patch with a typo corrected (r3277)

06/08/07 14:33:00 changed by crschmidt

  • keywords deleted.

There's a newer version in SVN. We should make a new patch before committing.

06/08/07 14:59:26 changed by euzuro

  • owner changed from metacarta to euzuro.
  • status changed from new to assigned.

i'm currently reviewing this ticket from cr5's sandbox making a few small changes.

06/11/07 18:05:57 changed by euzuro

  • attachment dateline.patch added.

this is my reworked patch for the dateline wrapping. it is taken pretty much directly from crschmidt's "wraptheworld" sandbox. All tests pass in ff & ie6.

06/11/07 18:06:53 changed by euzuro

  • owner deleted.
  • status changed from assigned to new.

i just new patch. please RUN TESTS (just in case) and review.

06/12/07 13:49:28 changed by crschmidt

  • keywords set to commit.

Tests pass. Code works. And the sunshine smiled upon you, and it was said 'let it be done'.

06/12/07 14:04:28 changed by euzuro

  • status changed from new to closed.
  • resolution set to fixed.

fixed with r3323

07/05/07 16:56:05 changed by euzuro

  • keywords deleted.