Beispiel #1
0
 def test_reproject_multipoint(self):
     "Check round-trip through reprojection"
     geom = MultiPoint([(135, -43), (165, -25)])
     new_geom = reproject(geom, 'epsg:4326', 'epsg:3112')
     new_new_geom = reproject(new_geom, 'epsg:3112')
     for g, ng in zip(geom, new_new_geom):
         self.assertTrue(np.allclose(g.xy, ng.xy))
Beispiel #2
0
 def test_reproject_polygon(self):
     "Check round-trip through polygon"
     geom = Polygon([(0, 0), (1, 1), (1, 0)])
     new_geom = reproject(geom, 'epsg:4326', 'epsg:3112')
     new_new_geom = reproject(new_geom, 'epsg:3112')
     self.assertTrue(np.allclose(geom.exterior.xy,
                                 new_new_geom.exterior.xy))
Beispiel #3
0
 def test_reproject_polygon_holes(self):
     "Check round-trip through polygon"
     geom = Polygon(shell=[(-1, -1), (-1, 2), (2, 2), (2, -1)],
                    holes=[[(0, 0), (1, 1), (1, 0)]])
     new_geom = reproject(geom, 'epsg:4326', 'epsg:3112')
     new_new_geom = reproject(new_geom, 'epsg:3112')
     self.assertTrue(np.allclose(geom.exterior.xy,
                                 new_new_geom.exterior.xy))
Beispiel #4
0
 def test_reproject_multilinestring(self):
     "Check round-trip through reprojection"
     geom = MultiLineString([[(135, -43), (165, -25)],
                             [(134, -32), (132, -32)]])
     new_geom = reproject(geom, 'epsg:4326', 'epsg:3112')
     new_new_geom = reproject(new_geom, 'epsg:3112')
     for g, ng in zip(geom, new_new_geom):
         self.assertTrue(np.allclose(g.xy, ng.xy))
Beispiel #5
0
 def test_reproject_multipolygon(self):
     "Check roundtrip through reprojection"
     geom = MultiPolygon([
         Polygon([(0, 0), (1, 1), (1, 0)]),
         Polygon(shell=[(-1, -1), (-1, 2), (2, 2), (2, -1)],
                 holes=[[(0, 0), (1, 1), (1, 0)]])
     ])
     new_geom = reproject(geom, 'epsg:4326', 'epsg:3112')
     new_new_geom = reproject(new_geom, 'epsg:3112')
     for g, ng in zip(geom, new_new_geom):
         self.assertTrue(np.allclose(g.exterior.xy, ng.exterior.xy))
Beispiel #6
0
 def test_reproject_linestring(self):
     "Check round-trip through reprojection"
     geom = LineString([(135, -43), (165, -25)])
     new_geom = reproject(geom, 'epsg:4326', 'epsg:3112')
     new_new_geom = reproject(new_geom, 'epsg:3112')
     self.assertTrue(np.allclose(geom.xy, new_new_geom.xy))
Beispiel #7
0
 def test_reproject_point(self):
     "Check round-trip through reprojection"
     geom = Point(135, -43)
     new_geom = reproject(geom, 'epsg:4326', 'epsg:3112')
     new_new_geom = reproject(new_geom, 'epsg:3112')
     self.assertTrue(np.allclose(geom.xy, new_new_geom.xy))
Beispiel #8
0
 def test_fail_on_unknown_geom(self):
     "Unknown geometries should raise a ValueError"
     geom = GeometryCollection([])
     with self.assertRaises(ValueError):
         reproject(geom, 'epsg:4326', 'epsg:3112')
Beispiel #9
0
 def test_fail_on_unknown(self):
     "An unknown object should raise a valueerror"
     with self.assertRaises(ValueError):
         reproject({}, 'epsg:4326', 'epsg:3112')