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>2021-09-01 12:36:46 +0200
commita9d3f70df86814e1845d0357a8daca0cf997a689 (patch)
treef8deac745cb7e2d196181fde0f9285108358a4fd /ishtar_common/models_common.py
parent1c3dadd00a7f9ba55e376d98d583b88c6d8f9244 (diff)
downloadIshtar-a9d3f70df86814e1845d0357a8daca0cf997a689.tar.bz2
Ishtar-a9d3f70df86814e1845d0357a8daca0cf997a689.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 3d8b4f8f6..982e02bf7 100644
--- a/ishtar_common/models_common.py
+++ b/ishtar_common/models_common.py
@@ -2860,28 +2860,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: