summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Bronn <jbronn@gmail.com>2010-03-29 21:56:01 +0000
committerJustin Bronn <jbronn@gmail.com>2010-03-29 21:56:01 +0000
commit381b10c2c665749789011d4aa7c16e6a42600a3b (patch)
tree08d947e73207cfec349c874bc2635ac8c380a7d4
parent85fa7d889491257590bd05d701bea908966eb6f5 (diff)
Added another GDAL bug workaround for retrieving the correct coordinate dimension on geometry collections. Refs #12312.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12883 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 94aad148fe..d08d0d53a4 100644
--- a/django/contrib/gis/gdal/geometries.py
+++ b/django/contrib/gis/gdal/geometries.py
@@ -198,6 +198,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):