summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorSergey Fedoseev <fedoseev.sergey@gmail.com>2015-10-24 19:12:38 +0500
committerTim Graham <timograham@gmail.com>2015-10-24 11:39:24 -0400
commita7bb5af50be7b0efbb784011a41fd25fdfe4d42c (patch)
tree52f88dbe3e7a756aeab035c30284b7c200080eb9 /django
parent02ef96c5e58d8d3492b6e38246c8268f1a0de47e (diff)
Fixed #25583 -- Allowed calling `transform` with `CoordTransform` even if SRID is invalid.
Diffstat (limited to 'django')
-rw-r--r--django/contrib/gis/geos/geometry.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/django/contrib/gis/geos/geometry.py b/django/contrib/gis/geos/geometry.py
index 4782156698..d4823a372d 100644
--- a/django/contrib/gis/geos/geometry.py
+++ b/django/contrib/gis/geos/geometry.py
@@ -494,14 +494,18 @@ class GEOSGeometry(GEOSBase, ListMixin):
else:
return
- if (srid is None) or (srid < 0):
+ if isinstance(ct, gdal.CoordTransform):
+ # We don't care about SRID because CoordTransform presupposes
+ # source SRS.
+ srid = None
+ elif srid is None or srid < 0:
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.
- g = self.ogr
+ g = gdal.OGRGeometry(self.wkb, srid)
g.transform(ct)
# Getting a new GEOS pointer
ptr = wkb_r().read(g.wkb)