1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

Fixed #34686 -- Added support for GEOS 3.12.

This commit is contained in:
Olivier Tabone
2023-07-10 17:43:19 +02:00
committed by Mariusz Felisiak
parent 4555a823fd
commit f46a6b2816
6 changed files with 38 additions and 9 deletions

View File

@@ -73,6 +73,13 @@ class Feature(NamedModel):
geom = models.GeometryField()
class ThreeDimensionalFeature(NamedModel):
geom = models.GeometryField(dim=3)
class Meta:
required_db_features = {"supports_3d_storage"}
class MinusOneSRID(models.Model):
geom = models.PointField(srid=-1) # Minus one SRID.

View File

@@ -31,6 +31,7 @@ from .models import (
NonConcreteModel,
PennsylvaniaCity,
State,
ThreeDimensionalFeature,
Track,
)
@@ -252,7 +253,13 @@ class GeoModelTest(TestCase):
]
for klass in geometry_classes:
g = klass(srid=4326)
feature = Feature.objects.create(name="Empty %s" % klass.__name__, geom=g)
model_class = Feature
if g.hasz:
if not connection.features.supports_3d_storage:
continue
else:
model_class = ThreeDimensionalFeature
feature = model_class.objects.create(name=f"Empty {klass.__name__}", geom=g)
feature.refresh_from_db()
if klass is LinearRing:
# LinearRing isn't representable in WKB, so GEOSGeomtry.wkb