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
This commit is contained in:
Justin Bronn 2010-03-29 21:56:01 +00:00
parent 85fa7d8894
commit 381b10c2c6
1 changed files with 8 additions and 0 deletions

View File

@ -198,6 +198,14 @@ class OGRGeometry(GDALBase):
def _get_coord_dim(self): def _get_coord_dim(self):
"Returns the coordinate dimension of the Geometry." "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) return capi.get_coord_dim(self.ptr)
def _set_coord_dim(self, dim): def _set_coord_dim(self, dim):