#231 Report geometry

* should fix report geometry cast problem in cases where MultiPolygon(srid=4326) is taken as default
This commit is contained in:
mpeltriaux 2022-11-16 12:20:16 +01:00
parent 933332c1ef
commit eb2d01eeea

View File

@ -17,6 +17,7 @@ from compensation.models import Compensation, Payment, EcoAccountDeduction, EcoA
from intervention.models import Intervention from intervention.models import Intervention
from konova.models import Geometry from konova.models import Geometry
from konova.sub_settings.django_settings import BASE_DIR, DEFAULT_DATE_FORMAT from konova.sub_settings.django_settings import BASE_DIR, DEFAULT_DATE_FORMAT
from konova.sub_settings.lanis_settings import DEFAULT_SRID_RLP
class TimespanReport: class TimespanReport:
@ -333,7 +334,7 @@ class TimespanReport:
return Geometry.objects.filter( return Geometry.objects.filter(
id__in=ids id__in=ids
).annotate( ).annotate(
geom_cast=Cast("geom", MultiPolygonField()) geom_cast=Cast("geom", MultiPolygonField(srid=DEFAULT_SRID_RLP))
).annotate( ).annotate(
num=NumGeometries("geom_cast") num=NumGeometries("geom_cast")
).aggregate( ).aggregate(