def test_ensure_wgs84(self): self.assertRaises(SpatialError, ensure_wgs84, GEOSGeometry('POLYGON((-95 38, -96 40, -97 42, -95 38))')) orig_pnt = Point(-95.23592948913574, 38.97127105172941) std_pnt = ensure_wgs84(orig_pnt) self.assertEqual(orig_pnt.srid, None) self.assertEqual(std_pnt.srid, 4326) self.assertEqual(std_pnt.x, -95.23592948913574) self.assertEqual(std_pnt.y, 38.97127105172941) orig_pnt = Point(-95.23592948913574, 38.97127105172941) orig_pnt.set_srid(2805) std_pnt = ensure_wgs84(orig_pnt) self.assertEqual(orig_pnt.srid, 2805) self.assertEqual(std_pnt.srid, 4326) # These should be different, since it got transformed. self.assertNotEqual(std_pnt.x, -95.23592948913574) self.assertNotEqual(std_pnt.y, 38.97127105172941)
def test_ensure_wgs84(self): from django.contrib.gis.geos import GEOSGeometry, Point self.assertRaises( SpatialError, ensure_wgs84, GEOSGeometry("POLYGON((-95 38, -96 40, -97 42, -95 38))"), ) orig_pnt = Point(-95.23592948913574, 38.97127105172941) std_pnt = ensure_wgs84(orig_pnt) self.assertEqual(orig_pnt.srid, None) self.assertEqual(std_pnt.srid, 4326) self.assertEqual(std_pnt.x, -95.23592948913574) self.assertEqual(std_pnt.y, 38.97127105172941) orig_pnt = Point(-95.23592948913574, 38.97127105172941) orig_pnt.srid = 2805 std_pnt = ensure_wgs84(orig_pnt) self.assertEqual(orig_pnt.srid, 2805) self.assertEqual(std_pnt.srid, 4326) # These should be different, since it got transformed. self.assertNotEqual(std_pnt.x, -95.23592948913574) self.assertNotEqual(std_pnt.y, 38.97127105172941)