Ticket #487 (closed feature: fixed)

Opened 6 years ago

Last modified 6 years ago

wrap the dateline

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

Description (last modified by jrf) (diff)

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 Download (21.7 KB) - added by sderle 6 years ago.
crschmidt's patch with a typo corrected (r3277)
dateline.patch Download (29.5 KB) - added by euzuro 6 years ago.
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

Changed 6 years ago by jrf

  • description modified (diff)

Changed 6 years ago by jrf

  • description modified (diff)

Changed 6 years ago by sderle

  • milestone changed from 2.4 Release to 2.5 Release

Changed 6 years ago by jrf

  • priority changed from major to blocker

Changed 6 years ago 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.

Changed 6 years ago 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.

Changed 6 years ago by crschmidt

  • keywords review added

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.

Changed 6 years ago by sderle

crschmidt's patch with a typo corrected (r3277)

Changed 6 years ago by crschmidt

  • keywords review removed

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

Changed 6 years ago 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.

Changed 6 years ago by euzuro

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.

Changed 6 years ago by euzuro

  • owner euzuro deleted
  • status changed from assigned to new

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

Changed 6 years ago by crschmidt

  • keywords commit added

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

Changed 6 years ago by euzuro

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

fixed with r3323

Changed 6 years ago by euzuro

  • keywords commit removed
Note: See TracTickets for help on using tickets.