summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Bronn <jbronn@gmail.com>2010-03-29 21:58:48 +0000
committerJustin Bronn <jbronn@gmail.com>2010-03-29 21:58:48 +0000
commit8ef5daeb4f0e202b0a653379d8d5dedc5f11a9a9 (patch)
tree11bd6696ba94af5a880a07df378bf3b2a8b5808d
parent08d00942d057bdf9a7a7da650657c88bc23a08e1 (diff)
[1.1.X] Added another GDAL bug workaround for retrieving the correct coordinate dimension on geometry collections. Refs #12312.
Backport of r12883 from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@12884 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--django/contrib/gis/gdal/geometries.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/django/contrib/gis/gdal/geometries.py b/django/contrib/gis/gdal/geometries.py
index 58b72493b9..1988577b48 100644
--- a/django/contrib/gis/gdal/geometries.py
+++ b/django/contrib/gis/gdal/geometries.py
@@ -181,6 +181,14 @@ class OGRGeometry(GDALBase):
def _get_coord_dim(self):
"Returns the coordinate dimension of the Geometry."
+ if isinstance(self, GeometryCollection) and GDAL_VERSION < (1, 5, 2):
+ # On GDAL versions prior to 1.5.2, there exists a bug in which
+ # the coordinate dimension of geometry collections is always 2:
+ # http://trac.osgeo.org/gdal/ticket/2334
+ # Here we workaround by returning the coordinate dimension of the
+ # first geometry in the collection instead.
+ if len(self):
+ return capi.get_coord_dim(capi.get_geom_ref(self.ptr, 0))
return capi.get_coord_dim(self.ptr)
def _set_coord_dim(self, dim):