Allow GeneratedField as geometry field
Opened this issue · 1 comments
We have some larger polygons in our database and in order to simplify calculations etc we have a GeneratedField, which builds a simplified version of the polygon.
geometry = models.MultiPolygonField(default=None, null=True)
geometry_simplified = models.GeneratedField(
expression=Multi(SimplifyPreserveTopology("geometry", 0.0001)),
output_field=models.MultiPolygonField(),
db_persist=True,
)
I would really like to use this as geometry column for our WFS, but it is throwing an error:
django.core.exceptions.ImproperlyConfigured: FeatureType 'model' does not expose a geometry field.
I looked at the code and could not quickly come up with a PR, maybe someone of the team can look into this?
Hi! Thanks for reporting this issue. I didn't see this option before.
It will take some time to have this issue scheduled. Totally understand it was tricky to find the source of the Django field translation into the internal XSD definitions. For anyone who likes to take a look, it happens here:
django-gisserver/gisserver/features.py
Line 93 in c8aec75