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 | 0ea862b94d0abb329c85b94e1fb64c848c2850da (patch) | |
| tree | f0a821c0d8c56f3814e509949ef117d4bbf2b276 /ishtar_common/models_common.py | |
| parent | b59dd1be1b3fa3fd549dd7da5aaf249205cd93bd (diff) | |
| download | Ishtar-0ea862b94d0abb329c85b94e1fb64c848c2850da.tar.bz2 Ishtar-0ea862b94d0abb329c85b94e1fb64c848c2850da.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, | 
