mirror of https://github.com/django/django.git
[1.10.x] Fixed #26750 -- Fixed introspection for geography point field with dim=3
Thanks Yegor Kazantsev for the report and the initial patch.
Backport of 140c23502
from master.
This commit is contained in:
parent
69b46fcc39
commit
b1592dd73b
|
@ -18,6 +18,7 @@ class OGRGeomType(object):
|
||||||
7: 'GeometryCollection',
|
7: 'GeometryCollection',
|
||||||
100: 'None',
|
100: 'None',
|
||||||
101: 'LinearRing',
|
101: 'LinearRing',
|
||||||
|
102: 'PointZ',
|
||||||
1 + wkb25bit: 'Point25D',
|
1 + wkb25bit: 'Point25D',
|
||||||
2 + wkb25bit: 'LineString25D',
|
2 + wkb25bit: 'LineString25D',
|
||||||
3 + wkb25bit: 'Polygon25D',
|
3 + wkb25bit: 'Polygon25D',
|
||||||
|
@ -84,6 +85,8 @@ class OGRGeomType(object):
|
||||||
return None
|
return None
|
||||||
elif s == 'Unknown':
|
elif s == 'Unknown':
|
||||||
s = 'Geometry'
|
s = 'Geometry'
|
||||||
|
elif s == 'PointZ':
|
||||||
|
s = 'Point'
|
||||||
return s + 'Field'
|
return s + 'Field'
|
||||||
|
|
||||||
def to_multi(self):
|
def to_multi(self):
|
||||||
|
|
|
@ -19,6 +19,7 @@ class AllOGRFields(models.Model):
|
||||||
|
|
||||||
class Fields3D(models.Model):
|
class Fields3D(models.Model):
|
||||||
point = models.PointField(dim=3)
|
point = models.PointField(dim=3)
|
||||||
|
pointg = models.PointField(dim=3, geography=True)
|
||||||
line = models.LineStringField(dim=3)
|
line = models.LineStringField(dim=3)
|
||||||
poly = models.PolygonField(dim=3)
|
poly = models.PolygonField(dim=3)
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ from django.test.utils import modify_settings
|
||||||
from django.utils.six import StringIO
|
from django.utils.six import StringIO
|
||||||
|
|
||||||
from ..test_data import TEST_DATA
|
from ..test_data import TEST_DATA
|
||||||
|
from ..utils import postgis
|
||||||
|
|
||||||
if HAS_GDAL:
|
if HAS_GDAL:
|
||||||
from django.contrib.gis.gdal import Driver, GDALException, GDAL_VERSION
|
from django.contrib.gis.gdal import Driver, GDALException, GDAL_VERSION
|
||||||
|
@ -52,10 +53,14 @@ class InspectDbTests(TestCase):
|
||||||
output = out.getvalue()
|
output = out.getvalue()
|
||||||
if connection.features.supports_geometry_field_introspection:
|
if connection.features.supports_geometry_field_introspection:
|
||||||
self.assertIn('point = models.PointField(dim=3)', output)
|
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('line = models.LineStringField(dim=3)', output)
|
||||||
self.assertIn('poly = models.PolygonField(dim=3)', output)
|
self.assertIn('poly = models.PolygonField(dim=3)', output)
|
||||||
else:
|
else:
|
||||||
self.assertIn('point = models.GeometryField(', output)
|
self.assertIn('point = models.GeometryField(', output)
|
||||||
|
self.assertIn('pointg = models.GeometryField(', output)
|
||||||
self.assertIn('line = models.GeometryField(', output)
|
self.assertIn('line = models.GeometryField(', output)
|
||||||
self.assertIn('poly = models.GeometryField(', output)
|
self.assertIn('poly = models.GeometryField(', output)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue