Skip to content

Commit 9954669

Browse files
committed
projection_test - update to use proj_transform
1 parent 72b6667 commit 9954669

File tree

1 file changed

+13
-26
lines changed

1 file changed

+13
-26
lines changed

test/python_tests/projection_test.py

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,45 +7,32 @@
77

88
# Tests that exercise map projections.
99

10-
def test_normalizing_definition():
10+
def test_projection_description():
1111
p = mapnik.Projection('epsg:4326')
12-
expanded = p.expanded()
13-
assert '+proj=longlat' in expanded
12+
assert 'WGS 84' == p.description()
1413

1514
# Trac Ticket #128
1615
def test_wgs84_inverse_forward():
17-
p = mapnik.Projection('epsg:4326')
18-
16+
p1 = mapnik.Projection('epsg:4326')
17+
p2 = mapnik.Projection('epsg:4326')
18+
tr = mapnik.ProjTransform(p1, p2)
1919
c = mapnik.Coord(3.01331418311, 43.3333092669)
2020
e = mapnik.Box2d(-122.54345245, 45.12312553, 68.2335581353, 48.231231233)
2121

2222
# It appears that the y component changes very slightly, is this OK?
2323
# so we test for 'almost equal float values'
2424

25-
assert p.inverse(c).y == pytest.approx(c.y)
26-
assert p.inverse(c).x == pytest.approx(c.x)
27-
28-
assert p.forward(c).y == pytest.approx(c.y)
29-
assert p.forward(c).x == pytest.approx(c.x)
30-
31-
assert p.inverse(e).center().y == pytest.approx(e.center().y)
32-
assert p.inverse(e).center().x == pytest.approx(e.center().x)
33-
34-
assert p.forward(e).center().y == pytest.approx(e.center().y)
35-
assert p.forward(e).center().x == pytest.approx(e.center().x)
36-
37-
assert c.inverse(p).y == pytest.approx(c.y)
38-
assert c.inverse(p).x == pytest.approx(c.x)
39-
40-
assert c.forward(p).y == pytest.approx(c.y)
41-
assert c.forward(p).x == pytest.approx(c.x)
25+
assert tr.backward(c).y == pytest.approx(c.y)
26+
assert tr.backward(c).x == pytest.approx(c.x)
4227

43-
assert e.inverse(p).center().y == pytest.approx(e.center().y)
44-
assert e.inverse(p).center().x == pytest.approx(e.center().x)
28+
assert tr.forward(c).y == pytest.approx(c.y)
29+
assert tr.forward(c).x == pytest.approx(c.x)
4530

46-
assert e.forward(p).center().y == pytest.approx(e.center().y)
47-
assert e.forward(p).center().x == pytest.approx(e.center().x)
31+
assert tr.backward(e).center().y == pytest.approx(e.center().y)
32+
assert tr.backward(e).center().x == pytest.approx(e.center().x)
4833

34+
assert tr.forward(e).center().y == pytest.approx(e.center().y)
35+
assert tr.forward(e).center().x == pytest.approx(e.center().x)
4936

5037
def wgs2merc(lon, lat):
5138
x = lon * 20037508.34 / 180

0 commit comments

Comments
 (0)