diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2022-07-11 19:24:55 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2022-12-12 12:21:26 +0100 |
commit | de7f242b37c38ea262b3d7d5db984f901181c728 (patch) | |
tree | f0a821c0d8c56f3814e509949ef117d4bbf2b276 /ishtar_common/models_common.py | |
parent | 903240c3b6c69587466ff5908b115dc919a64d25 (diff) | |
download | Ishtar-de7f242b37c38ea262b3d7d5db984f901181c728.tar.bz2 Ishtar-de7f242b37c38ea262b3d7d5db984f901181c728.zip |
Geo: fix default srid when no srid is set
Diffstat (limited to 'ishtar_common/models_common.py')
-rw-r--r-- | ishtar_common/models_common.py | 7 |
1 files changed, 6 insertions, 1 deletions
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, |