summaryrefslogtreecommitdiff
path: root/ishtar_common/models_common.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2022-07-17 12:34:47 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2022-12-12 12:23:17 +0100
commitbb2e5296e89ba924cc1e5e361e7dd53067676bbf (patch)
treecdcf9ae5ebc01a0fb92a9262ee498e78ea05adc5 /ishtar_common/models_common.py
parent018e9911bba93d37515ee9c1e740a004cb3589bc (diff)
downloadIshtar-bb2e5296e89ba924cc1e5e361e7dd53067676bbf.tar.bz2
Ishtar-bb2e5296e89ba924cc1e5e361e7dd53067676bbf.zip
Geo - sheet: fix coordinates display
Diffstat (limited to 'ishtar_common/models_common.py')
-rw-r--r--ishtar_common/models_common.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/ishtar_common/models_common.py b/ishtar_common/models_common.py
index 66025948a..cea327e13 100644
--- a/ishtar_common/models_common.py
+++ b/ishtar_common/models_common.py
@@ -2234,19 +2234,22 @@ class GeoVectorData(Imported, OwnPerms):
def source_label(self):
return str(self.source)
- def display_coordinates(self, rounded=5, dim=2, srid=4326, cache=True):
+ def display_coordinates(self, rounded=5, dim=2, srid=None, cache=True):
if not srid:
- profile = get_current_profile()
- if profile.display_srs and profile.display_srs.srid:
- srid = profile.display_srs.srid
+ if self.spatial_reference_system and self.spatial_reference_system.srid:
+ srid = self.spatial_reference_system.srid
else:
- srid = 4326
+ profile = get_current_profile()
+ if profile.display_srs and profile.display_srs.srid:
+ srid = profile.display_srs.srid
+ if not srid:
+ srid = 4326
return self.get_coordinates(rounded=rounded, srid=srid, dim=dim, cache=cache)
def get_coordinates(self, rounded=5, srid: int = None, dim=2, cache=False):
if dim not in (2, 3):
raise ValueError(_("Only 2 or 3 dimensions"))
- if cache:
+ if cache and srid == 4326:
coordinates = [self.cached_x, self.cached_y]
if dim == 3:
coordinates.append(self.cached_z)