|
7 | 7 |
|
8 | 8 | # Tests that exercise map projections. |
9 | 9 |
|
10 | | -def test_normalizing_definition(): |
| 10 | +def test_projection_description(): |
11 | 11 | p = mapnik.Projection('epsg:4326') |
12 | | - expanded = p.expanded() |
13 | | - assert '+proj=longlat' in expanded |
| 12 | + assert 'WGS 84' == p.description() |
14 | 13 |
|
15 | 14 | # Trac Ticket #128 |
16 | 15 | 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) |
19 | 19 | c = mapnik.Coord(3.01331418311, 43.3333092669) |
20 | 20 | e = mapnik.Box2d(-122.54345245, 45.12312553, 68.2335581353, 48.231231233) |
21 | 21 |
|
22 | 22 | # It appears that the y component changes very slightly, is this OK? |
23 | 23 | # so we test for 'almost equal float values' |
24 | 24 |
|
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) |
42 | 27 |
|
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) |
45 | 30 |
|
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) |
48 | 33 |
|
| 34 | + assert tr.forward(e).center().y == pytest.approx(e.center().y) |
| 35 | + assert tr.forward(e).center().x == pytest.approx(e.center().x) |
49 | 36 |
|
50 | 37 | def wgs2merc(lon, lat): |
51 | 38 | x = lon * 20037508.34 / 180 |
|
0 commit comments