Skip to content

Commit

Permalink
msautotest: add test for MapServer#6478
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault committed Feb 14, 2022
1 parent 5055d40 commit 713fbd1
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions msautotest/mspython/test_bug_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,3 +159,24 @@ def test_reprojection_rect_from_polar_stereographic_to_webmercator():
assert rect.project(polar_proj, webmercator) == 0
assert abs(rect.minx - -20e6) < 1e-1 * 20e6
assert abs(rect.maxx - 20e6) < 1e-1 * 20e6

###############################################################################
# Test reprojection of rectangle involving a datum shift (#6478)

def test_reprojection_rect_and_datum_shift():

webmercator = mapscript.projectionObj("init=epsg:3857")
epsg_28992 = mapscript.projectionObj("init=epsg:28992") # "Amersfoort / RD New"

point = mapscript.pointObj(545287, 6867556)
point.project(webmercator, epsg_28992)
if point.x == pytest.approx(121685, abs=2):
# Builds of PROJ >= 6 and < 8 with -DACCEPT_USE_OF_DEPRECATED_PROJ_API_H
# use pj_transform() but it doesn't work well with datum shift
# This is a non-nominal configuration used in some CI confs when use a
# PROJ 7 build to test PROJ.4 API and PROJ 6 API.
pytest.skip('This test cannot run with PROJ [6,8[ in builds with ACCEPT_USE_OF_DEPRECATED_PROJ_API_H')

rect = mapscript.rectObj(545287, 6867556, 545689, 6868025)
assert rect.project(webmercator, epsg_28992) == 0
assert rect.minx == pytest.approx(121711, abs=2)

0 comments on commit 713fbd1

Please sign in to comment.