diff options
author | QuentinAndre <quentin.andre@imt-atlantique.net> | 2021-07-09 16:43:39 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-11-16 17:04:41 +0100 |
commit | 6b427a5a0d25ca81cbaf82e7d67e289f7ce561ee (patch) | |
tree | cd006be26e8fee16e401d1dd8a81791cd78bbc27 /ishtar_common | |
parent | ce33be2ba45d85c7c0f6a06fe4d35bd27ef05ae4 (diff) | |
download | Ishtar-6b427a5a0d25ca81cbaf82e7d67e289f7ce561ee.tar.bz2 Ishtar-6b427a5a0d25ca81cbaf82e7d67e289f7ce561ee.zip |
modified urls and black reformatting
Diffstat (limited to 'ishtar_common')
-rw-r--r-- | ishtar_common/models_common.py | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/ishtar_common/models_common.py b/ishtar_common/models_common.py index 106556725..2a6dd4be8 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: |