Example #1
0
 def test_geometry_types_copy(self):
     for k, v in jsondata.iteritems():
         geometry = Geometry.build_geometry(v, copy=True)
         self.assertDictEqual(
             json.loads(geometry.geojson),
             pydata[k]
         )
Example #2
0
    def test_transform_multi(self):
        crs1 = SpatialReference(4326)
        crs2 = SpatialReference(3857)

        forward = CoordinateTransform(crs1, crs2)
        backward = CoordinateTransform(crs2, crs1)

        for k, v in jsondata.iteritems():
            geom1 = Geometry.build_geometry(v, copy=True)
            if k == "geometrycollection":
                self.assertRaises(CoordinateTransformationError, forward, geom1)
            else:
                geom2 = forward(geom1)
                geom3 = backward(geom2)
                self.assertTrue(geom1.almost_equals(geom3))
Example #3
0
 def test_geometry_types_with_crs(self):
     for k, v in jsondata.iteritems():
         geometry = Geometry.build_geometry(v, copy=True, srid=3857)
         self.assertTrue('crs' in geometry.geojson)