Wrong Dateline wrapping on extents that cross the dateline #4896

Merged
merged 1 commit into from Mar 27, 2014

Conversation

Projects
None yet
2 participants
@tbonfort
Member

tbonfort commented Mar 27, 2014

Setup:

  • issue a getmap request for a projected SRS, with an extent that crosses the dateline, e.g. -21000000,-21000000,21000000,21000000
  • use a mapfile with a layer who's data is stored in lonlat

Expected:

  • MapServer uses a searchrect for querying the layer data, that ressembles -181,-90,181,90 or -180,-90,180,90

Issue:

  • The searchrect created looks like the red polygon from https://gist.github.com/tbonfort/9779573 which is obviously creating incorrect results. The resulting polygon after this patch is colored in blue.
Fix dateline wrapping logic for bounding boxes (#4896)
- Fixes a typo in the shapefile wrapping code to compare a vertex
  against its predecessor rather than the initial vertex to detect
  potential dateline hops.
- Forces +over proj parameter when reprojecting bboxes in order to
  conserve the initial property of wether the bbox intersects the
  dateline.

@tbonfort tbonfort added this to the 7.0 Release milestone Mar 27, 2014

@tbonfort tbonfort self-assigned this Mar 27, 2014

tbonfort added a commit to mapserver/msautotest_DEPRECATED that referenced this pull request Mar 27, 2014

Update expected for mapserver/mapserver#4896
- the wmsclient change was an error in the previous test
- the bounds floating point changes seem cosmetic, but have not been
  investigated further

@tbonfort tbonfort merged commit 46a4fea into mapserver:master Mar 27, 2014

1 check passed

default The Travis CI build passed
Details
@rouault

This comment has been minimized.

Show comment
Hide comment
@rouault

rouault Oct 2, 2014

Contributor

@tbonfort Are you sure about your change in msProjectShapeLine ? The original code was consistant with the use of msTestNeedWrap() done in msProjectLine(), i.e. that we compare the current point with the first point of the line. In which situation does it makes things better to compare to previous point rather than to first point ? Perhaps if we have a polygon with a nearly world extent but that does not cross the antimeridian, and whose point density is sufficiently high so that 2 consecutive points don't have an abs difference of longitude > 180 ?

Contributor

rouault commented Oct 2, 2014

@tbonfort Are you sure about your change in msProjectShapeLine ? The original code was consistant with the use of msTestNeedWrap() done in msProjectLine(), i.e. that we compare the current point with the first point of the line. In which situation does it makes things better to compare to previous point rather than to first point ? Perhaps if we have a polygon with a nearly world extent but that does not cross the antimeridian, and whose point density is sufficiently high so that 2 consecutive points don't have an abs difference of longitude > 180 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment