diff options
| author | Claude Paroz <claude@2xlibre.net> | 2016-06-18 17:10:16 +0200 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2016-06-18 21:48:32 +0200 |
| commit | 8ba44ecda024050c219e7cbc1f16c2d56fa258ac (patch) | |
| tree | 62dbb5464fe2ac9404ba24484ad01e94f689530b /django | |
| parent | b45852c2631d4f291fb22ef3348065f2a3c2e5e3 (diff) | |
Fixed #26775 -- Supported dim=3 geography fields
Thanks François-Xavier Thomas for the report.
Diffstat (limited to 'django')
| -rw-r--r-- | django/contrib/gis/db/backends/postgis/operations.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/django/contrib/gis/db/backends/postgis/operations.py b/django/contrib/gis/db/backends/postgis/operations.py index 14ed2d98f3..763f376544 100644 --- a/django/contrib/gis/db/backends/postgis/operations.py +++ b/django/contrib/gis/db/backends/postgis/operations.py @@ -268,18 +268,19 @@ class PostGISOperations(BaseSpatialOperations, DatabaseOperations): """ if f.geom_type == 'RASTER': return 'raster' - elif f.geography: + + # Type-based geometries. + # TODO: Support 'M' extension. + if f.dim == 3: + geom_type = f.geom_type + 'Z' + else: + geom_type = f.geom_type + if f.geography: if f.srid != 4326: raise NotImplementedError('PostGIS only supports geography columns with an SRID of 4326.') - return 'geography(%s,%d)' % (f.geom_type, f.srid) + return 'geography(%s,%d)' % (geom_type, f.srid) else: - # Type-based geometries. - # TODO: Support 'M' extension. - if f.dim == 3: - geom_type = f.geom_type + 'Z' - else: - geom_type = f.geom_type return 'geometry(%s,%d)' % (geom_type, f.srid) def get_distance(self, f, dist_val, lookup_type, handle_spheroid=True): |
