summaryrefslogtreecommitdiff
path: root/ishtar_common/models_common.py
diff options
context:
space:
mode:
authorQuentinAndre <quentin.andre@imt-atlantique.net>2021-07-09 16:43:39 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2022-07-08 09:58:48 +0200
commitd8f5816974df579d8092677418fac1dcffdaea99 (patch)
treedbee6b76b8eda1985d1e103fe5140bb7a56c3fbd /ishtar_common/models_common.py
parent5eb14c6e24c67c5ac53c06b1ba53893db47a3f91 (diff)
downloadIshtar-d8f5816974df579d8092677418fac1dcffdaea99.tar.bz2
Ishtar-d8f5816974df579d8092677418fac1dcffdaea99.zip
modified urls and black reformatting
Diffstat (limited to 'ishtar_common/models_common.py')
-rw-r--r--ishtar_common/models_common.py25
1 files changed, 16 insertions, 9 deletions
diff --git a/ishtar_common/models_common.py b/ishtar_common/models_common.py
index 349f0a50c..da68aae54 100644
--- a/ishtar_common/models_common.py
+++ b/ishtar_common/models_common.py
@@ -2869,28 +2869,35 @@ class GeoItem(models.Model):
for linear_ring in range(len(polygon)):
list_coords[-1].append([])
for coords in polygon[linear_ring]:
- point_2d = Point(coords[0], coords[1], srid=self.multi_polygon.srid)
- list_coords[-1][linear_ring].append(self.convert_coordinates(point_2d, rounded))
+ point_2d = Point(
+ coords[0], coords[1], srid=self.multi_polygon.srid
+ )
+ list_coords[-1][linear_ring].append(
+ self.convert_coordinates(point_2d, rounded)
+ )
dict["geometry"]["type"] = "MultiPolygon"
dict["geometry"]["coordinates"] = list_coords
else:
dict["geometry"]["type"] = "Point"
- dict["geometry"]["coordinates"] = self.convert_coordinates(self.multi_polygon.centroid, rounded)
+ dict["geometry"]["coordinates"] = self.convert_coordinates(
+ self.multi_polygon.centroid, rounded
+ )
else:
dict["geometry"]["type"] = "Point"
- x,y = self.display_coordinates
- dict["geometry"]["coordinates"] = [x,y]
+ x, y = self.display_coordinates
+ dict["geometry"]["coordinates"] = [x, y]
return dict
def convert_coordinates(self, point_2d, rounded):
profile = get_current_profile()
if (
- not profile.display_srs
- or not profile.display_srs.srid
- or (
+ not profile.display_srs
+ or not profile.display_srs.srid
+ or (
profile.display_srs == self.spatial_reference_system
and point_2d.x
- and point_2d.y)
+ and point_2d.y
+ )
):
x, y = point_2d.x, point_2d.y
else: