diff options
| author | Sergey Fedoseev <fedoseev.sergey@gmail.com> | 2015-10-24 19:12:38 +0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-10-24 11:39:24 -0400 |
| commit | a7bb5af50be7b0efbb784011a41fd25fdfe4d42c (patch) | |
| tree | 52f88dbe3e7a756aeab035c30284b7c200080eb9 /tests | |
| parent | 02ef96c5e58d8d3492b6e38246c8268f1a0de47e (diff) | |
Fixed #25583 -- Allowed calling `transform` with `CoordTransform` even if SRID is invalid.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/gis_tests/geos_tests/test_geos.py | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/tests/gis_tests/geos_tests/test_geos.py b/tests/gis_tests/geos_tests/test_geos.py index 07139f05f9..b408937f6d 100644 --- a/tests/gis_tests/geos_tests/test_geos.py +++ b/tests/gis_tests/geos_tests/test_geos.py @@ -656,23 +656,24 @@ class GEOSTest(unittest.TestCase, TestDataMixin): @skipUnless(HAS_GDAL, "GDAL is required.") def test_custom_srid(self): - """ Test with a srid unknown from GDAL """ - pnt = Point(111200, 220900, srid=999999) - self.assertTrue(pnt.ewkt.startswith("SRID=999999;POINT (111200.0")) - self.assertIsInstance(pnt.ogr, gdal.OGRGeometry) - self.assertIsNone(pnt.srs) + """Test with a null srid and a srid unknown to GDAL.""" + for srid in [None, 999999]: + pnt = Point(111200, 220900, srid=srid) + self.assertTrue(pnt.ewkt.startswith(("SRID=%s;" % srid if srid else '') + "POINT (111200.0")) + self.assertIsInstance(pnt.ogr, gdal.OGRGeometry) + self.assertIsNone(pnt.srs) - # Test conversion from custom to a known srid - c2w = gdal.CoordTransform( - gdal.SpatialReference( - '+proj=mill +lat_0=0 +lon_0=0 +x_0=0 +y_0=0 +R_A +ellps=WGS84 ' - '+datum=WGS84 +units=m +no_defs' - ), - gdal.SpatialReference(4326)) - new_pnt = pnt.transform(c2w, clone=True) - self.assertEqual(new_pnt.srid, 4326) - self.assertAlmostEqual(new_pnt.x, 1, 3) - self.assertAlmostEqual(new_pnt.y, 2, 3) + # Test conversion from custom to a known srid + c2w = gdal.CoordTransform( + gdal.SpatialReference( + '+proj=mill +lat_0=0 +lon_0=0 +x_0=0 +y_0=0 +R_A +ellps=WGS84 ' + '+datum=WGS84 +units=m +no_defs' + ), + gdal.SpatialReference(4326)) + new_pnt = pnt.transform(c2w, clone=True) + self.assertEqual(new_pnt.srid, 4326) + self.assertAlmostEqual(new_pnt.x, 1, 3) + self.assertAlmostEqual(new_pnt.y, 2, 3) def test_mutable_geometries(self): "Testing the mutability of Polygons and Geometry Collections." |
