Fixed GIS test failures when GDAL is not installed
Thanks Iacopo Spalletti for the report and testing.
This commit is contained in:
parent
ac750dbbc0
commit
24c1605aa0
|
@ -493,6 +493,9 @@ class GEOSGeometry(GEOSBase, ListMixin):
|
||||||
else:
|
else:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if not gdal.HAS_GDAL:
|
||||||
|
raise GEOSException("GDAL library is not available to transform() geometry.")
|
||||||
|
|
||||||
if isinstance(ct, gdal.CoordTransform):
|
if isinstance(ct, gdal.CoordTransform):
|
||||||
# We don't care about SRID because CoordTransform presupposes
|
# We don't care about SRID because CoordTransform presupposes
|
||||||
# source SRS.
|
# source SRS.
|
||||||
|
@ -500,9 +503,6 @@ class GEOSGeometry(GEOSBase, ListMixin):
|
||||||
elif srid is None or srid < 0:
|
elif srid is None or srid < 0:
|
||||||
raise GEOSException("Calling transform() with no SRID set is not supported")
|
raise GEOSException("Calling transform() with no SRID set is not supported")
|
||||||
|
|
||||||
if not gdal.HAS_GDAL:
|
|
||||||
raise GEOSException("GDAL library is not available to transform() geometry.")
|
|
||||||
|
|
||||||
# Creating an OGR Geometry, which is then transformed.
|
# Creating an OGR Geometry, which is then transformed.
|
||||||
g = gdal.OGRGeometry(self.wkb, srid)
|
g = gdal.OGRGeometry(self.wkb, srid)
|
||||||
g.transform(ct)
|
g.transform(ct)
|
||||||
|
|
|
@ -989,6 +989,7 @@ class GEOSTest(unittest.TestCase, TestDataMixin):
|
||||||
self.assertEqual(g1.srid, 4326)
|
self.assertEqual(g1.srid, 4326)
|
||||||
self.assertIsNot(g1, g, "Clone didn't happen")
|
self.assertIsNot(g1, g, "Clone didn't happen")
|
||||||
|
|
||||||
|
@skipUnless(HAS_GDAL, "GDAL is required.")
|
||||||
def test_transform_nosrid(self):
|
def test_transform_nosrid(self):
|
||||||
""" Testing `transform` method (no SRID or negative SRID) """
|
""" Testing `transform` method (no SRID or negative SRID) """
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue