summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2022-06-15 10:22:01 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2022-12-12 12:21:01 +0100
commit59f97318687a19a8623261aff0bc875ca99c5c7c (patch)
tree4a17c15d334249d2ae4f5d53395e608299336d7e
parentfb3e9bd47dd56385eb2be38b8ea51f6a5535d884 (diff)
downloadIshtar-59f97318687a19a8623261aff0bc875ca99c5c7c.tar.bz2
Ishtar-59f97318687a19a8623261aff0bc875ca99c5c7c.zip
Fix migrations
-rw-r--r--UPGRADE-V4.md (renamed from UPGRADE_V4.md)0
-rw-r--r--ishtar_common/management/commands/migrate_to_geo_v4.py1
-rw-r--r--ishtar_common/models_common.py22
3 files changed, 5 insertions, 18 deletions
diff --git a/UPGRADE_V4.md b/UPGRADE-V4.md
index f69dbb9ec..f69dbb9ec 100644
--- a/UPGRADE_V4.md
+++ b/UPGRADE-V4.md
diff --git a/ishtar_common/management/commands/migrate_to_geo_v4.py b/ishtar_common/management/commands/migrate_to_geo_v4.py
index d904b279a..188365c45 100644
--- a/ishtar_common/management/commands/migrate_to_geo_v4.py
+++ b/ishtar_common/management/commands/migrate_to_geo_v4.py
@@ -195,6 +195,7 @@ def _process_main(obj):
"x": obj.x,
"y": obj.y,
"z": obj.z,
+ "spatial_reference_system": obj.spatial_reference_system
}
data = models_common.GeoVectorData.objects.create(**attrs)
obj.main_geodata = data
diff --git a/ishtar_common/models_common.py b/ishtar_common/models_common.py
index b13517f25..2fb0d40f6 100644
--- a/ishtar_common/models_common.py
+++ b/ishtar_common/models_common.py
@@ -2266,6 +2266,8 @@ class GeoVectorData(Imported, OwnPerms):
args["z"] = self.z
point = Point(**args).transform(srid, clone=True)
coordinates = [point.x, point.y]
+ if srid == 4326:
+ coordinates = list(reversed(coordinates))
if dim == 3:
coordinates.append(point.z)
else:
@@ -3470,25 +3472,9 @@ class GeoItem(GeographicItem):
@property
def display_coordinates(self, rounded=True):
- if not self.point_2d:
+ if not self.main_geodata:
return ""
- profile = get_current_profile()
- if (
- not profile.display_srs
- or not profile.display_srs.srid
- or (
- profile.display_srs == self.spatial_reference_system
- and self.x
- and self.y
- )
- ):
- x, y = self.x, self.y
- else:
- point = self.point_2d.transform(profile.display_srs.srid, clone=True)
- x, y = point.x, point.y
- if rounded:
- return round(x, 5), round(y, 5)
- return x, y
+ return self.main_geodata.display_coordinates(rounded=rounded)
@property
def display_spatial_reference_system(self):