diff options
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: |