Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Added another GDAL bug workaround for retrieving the correct coordina…

…te dimension on geometry collections. Refs #12312.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@12883 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 381b10c2c665749789011d4aa7c16e6a42600a3b 1 parent 85fa7d8
Justin Bronn authored March 29, 2010

Showing 1 changed file with 8 additions and 0 deletions. Show diff stats Hide diff stats

  1. 8  django/contrib/gis/gdal/geometries.py
8  django/contrib/gis/gdal/geometries.py
@@ -198,6 +198,14 @@ def dimension(self):
198 198
 
199 199
     def _get_coord_dim(self):
200 200
         "Returns the coordinate dimension of the Geometry."
  201
+        if isinstance(self, GeometryCollection) and GDAL_VERSION < (1, 5, 2):
  202
+            # On GDAL versions prior to 1.5.2, there exists a bug in which
  203
+            # the coordinate dimension of geometry collections is always 2:
  204
+            #   http://trac.osgeo.org/gdal/ticket/2334
  205
+            # Here we workaround by returning the coordinate dimension of the
  206
+            # first geometry in the collection instead.
  207
+            if len(self):
  208
+                return capi.get_coord_dim(capi.get_geom_ref(self.ptr, 0))
201 209
         return capi.get_coord_dim(self.ptr)
202 210
 
203 211
     def _set_coord_dim(self, dim):

0 notes on commit 381b10c

Please sign in to comment.
Something went wrong with that request. Please try again.