diff options
| author | Claude Paroz <claude@2xlibre.net> | 2016-06-18 18:08:53 +0200 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2016-06-21 15:22:21 +0200 |
| commit | 140c23502651dde4a562f3d732c862b5ccca2294 (patch) | |
| tree | 186dec1be211485bfabc39a394a3147f2ed02200 | |
| parent | fff5dbe59ca629c295480693f045f03537858eee (diff) | |
Fixed #26750 -- Fixed introspection for geography point field with dim=3
Thanks Yegor Kazantsev for the report and the initial patch.
| -rw-r--r-- | django/contrib/gis/gdal/geomtype.py | 3 | ||||
| -rw-r--r-- | tests/gis_tests/inspectapp/models.py | 1 | ||||
| -rw-r--r-- | tests/gis_tests/inspectapp/tests.py | 5 |
3 files changed, 9 insertions, 0 deletions
diff --git a/django/contrib/gis/gdal/geomtype.py b/django/contrib/gis/gdal/geomtype.py index 4ba2b153de..0ed7e66343 100644 --- a/django/contrib/gis/gdal/geomtype.py +++ b/django/contrib/gis/gdal/geomtype.py @@ -18,6 +18,7 @@ class OGRGeomType(object): 7: 'GeometryCollection', 100: 'None', 101: 'LinearRing', + 102: 'PointZ', 1 + wkb25bit: 'Point25D', 2 + wkb25bit: 'LineString25D', 3 + wkb25bit: 'Polygon25D', @@ -84,6 +85,8 @@ class OGRGeomType(object): return None elif s == 'Unknown': s = 'Geometry' + elif s == 'PointZ': + s = 'Point' return s + 'Field' def to_multi(self): diff --git a/tests/gis_tests/inspectapp/models.py b/tests/gis_tests/inspectapp/models.py index 4936a0e704..dacb4d48f6 100644 --- a/tests/gis_tests/inspectapp/models.py +++ b/tests/gis_tests/inspectapp/models.py @@ -19,6 +19,7 @@ class AllOGRFields(models.Model): class Fields3D(models.Model): point = models.PointField(dim=3) + pointg = models.PointField(dim=3, geography=True) line = models.LineStringField(dim=3) poly = models.PolygonField(dim=3) diff --git a/tests/gis_tests/inspectapp/tests.py b/tests/gis_tests/inspectapp/tests.py index 532037e803..feef59c586 100644 --- a/tests/gis_tests/inspectapp/tests.py +++ b/tests/gis_tests/inspectapp/tests.py @@ -11,6 +11,7 @@ from django.test.utils import modify_settings from django.utils.six import StringIO from ..test_data import TEST_DATA +from ..utils import postgis if HAS_GDAL: from django.contrib.gis.gdal import Driver, GDALException, GDAL_VERSION @@ -50,10 +51,14 @@ class InspectDbTests(TestCase): output = out.getvalue() if connection.features.supports_geometry_field_introspection: self.assertIn('point = models.PointField(dim=3)', output) + if postgis: + # Geography type is specific to PostGIS + self.assertIn('pointg = models.PointField(geography=True, dim=3)', output) self.assertIn('line = models.LineStringField(dim=3)', output) self.assertIn('poly = models.PolygonField(dim=3)', output) else: self.assertIn('point = models.GeometryField(', output) + self.assertIn('pointg = models.GeometryField(', output) self.assertIn('line = models.GeometryField(', output) self.assertIn('poly = models.GeometryField(', output) |
