summaryrefslogtreecommitdiff
path: root/ishtar_common
diff options
context:
space:
mode:
authorQuentinAndre <quentin.andre@imt-atlantique.net>2021-07-09 17:49:35 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2021-11-16 17:04:41 +0100
commitedf18b7c4bcd4026b84e2dda67c36a041dd6402b (patch)
tree7f9ef9adc46cb9d6865694a2079651f3cbe517b4 /ishtar_common
parent69bc18ff8424a5e2417919b0b381dd15973a89db (diff)
downloadIshtar-edf18b7c4bcd4026b84e2dda67c36a041dd6402b.tar.bz2
Ishtar-edf18b7c4bcd4026b84e2dda67c36a041dd6402b.zip
correction with kwargs for get_polygons
Diffstat (limited to 'ishtar_common')
-rw-r--r--ishtar_common/models_common.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/ishtar_common/models_common.py b/ishtar_common/models_common.py
index 2a6dd4be8..755ea23dd 100644
--- a/ishtar_common/models_common.py
+++ b/ishtar_common/models_common.py
@@ -2847,14 +2847,14 @@ class GeoItem(models.Model):
if self.multi_polygon_source == "P" and self.multi_polygon:
return self.multi_polygon, self.multi_polygon_source_item
- def get_geo_items(self, get_polygons=False, rounded=True):
+ def get_geo_items(self, get_polygons, rounded=True):
dict = {
"type": "Feature",
"geometry": {},
}
- if self.multi_polygon:
- if get_polygons:
- list_coords = []
+ if get_polygons:
+ list_coords = []
+ if self.multi_polygon:
for polygon in self.multi_polygon:
list_coords.append([])
for linear_ring in range(len(polygon)):
@@ -2866,17 +2866,17 @@ class GeoItem(models.Model):
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"]["type"] = "MultiPolygon"
+ dict["geometry"]["coordinates"] = list_coords
+ else:
+ dict["geometry"]["type"] = "Point"
+ if self.multi_polygon:
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]
+ else:
+ x, y = self.display_coordinates
+ dict["geometry"]["coordinates"] = [x, y]
return dict
def convert_coordinates(self, point_2d, rounded):