django-gisserver icon indicating copy to clipboard operation
django-gisserver copied to clipboard

Allow GeneratedField as geometry field

Open tomdtp opened this issue 7 months ago • 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?

tomdtp avatar Jul 11 '24 06:07 tomdtp