From d8f5816974df579d8092677418fac1dcffdaea99 Mon Sep 17 00:00:00 2001 From: QuentinAndre Date: Fri, 9 Jul 2021 16:43:39 +0200 Subject: modified urls and black reformatting --- ishtar_common/models_common.py | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'ishtar_common/models_common.py') 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: -- cgit v1.2.3