diff options
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 |
commit | 9a33671a0c5f788f85d23c34f880d0994789e675 (patch) | |
tree | cdcf9ae5ebc01a0fb92a9262ee498e78ea05adc5 /ishtar_common/models_common.py | |
parent | 058a8dd843b08043defeb389513d00ffa5a8734b (diff) | |
download | Ishtar-9a33671a0c5f788f85d23c34f880d0994789e675.tar.bz2 Ishtar-9a33671a0c5f788f85d23c34f880d0994789e675.zip |
Geo - sheet: fix coordinates display
Diffstat (limited to 'ishtar_common/models_common.py')
-rw-r--r-- | ishtar_common/models_common.py | 15 |
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) |