From 0ea862b94d0abb329c85b94e1fb64c848c2850da Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 11 Jul 2022 19:24:55 +0200 Subject: Geo: fix default srid when no srid is set --- ishtar_common/models_common.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'ishtar_common/models_common.py') diff --git a/ishtar_common/models_common.py b/ishtar_common/models_common.py index 69cdeba94..8707120f9 100644 --- a/ishtar_common/models_common.py +++ b/ishtar_common/models_common.py @@ -2252,10 +2252,15 @@ class GeoVectorData(Imported, OwnPerms): coordinates.append(self.cached_z) else: if self.x or self.y or self.z: # user input - if not srid or srid == self.spatial_reference_system.srid: + if not srid or not self.spatial_reference_system or \ + srid == self.spatial_reference_system.srid: coordinates = [self.x, self.y] if dim == 3: coordinates.append(self.z) + if not self.spatial_reference_system: + q = SpatialReferenceSystem.objects.filter(srid=4326) + if q.count(): + self.spatial_reference_system = q.all()[0] else: args = { "x": self.x, -- cgit v1.2.3