diff options
| -rw-r--r-- | chimere/models.py | 7 | ||||
| -rw-r--r-- | chimere/views.py | 2 | 
2 files changed, 6 insertions, 3 deletions
diff --git a/chimere/models.py b/chimere/models.py index e3fa122..0fb42fb 100644 --- a/chimere/models.py +++ b/chimere/models.py @@ -1092,7 +1092,7 @@ class AggregatedPolygon(models.Model):          managed = False          db_table = 'chimere_aggregated_polygons' -    def getGeoJSON(self, color="", inner_color=''): +    def getGeoJSON(self, simplify=False, color="", inner_color=''):          '''Return a GeoJSON string          '''          # get colors @@ -1112,8 +1112,11 @@ class AggregatedPolygon(models.Model):                  if not inner_color:                      inner_color = c.inner_color +        geom = self.polygon +        if simplify: +            geom = self.polygon.simplify(0.0003).json          attributes = { -            'color': color, 'geometry': json.loads(self.polygon.geojson), +            'color': color, 'geometry': json.loads(geom),              'type': "Feature", "properties": {                  'color': color,                  'inner_color': inner_color, diff --git a/chimere/views.py b/chimere/views.py index 8eaa83a..52ac3b4 100644 --- a/chimere/views.py +++ b/chimere/views.py @@ -815,7 +815,7 @@ def _getGeoObjects(area_name, category_ids, status='A', getjson=True,              # no bounding box filter              if getjson:                  for poly in query.all(): -                    items.append(json.loads(poly.getGeoJSON())) +                    items.append(json.loads(poly.getGeoJSON(simplify=True)))              else:                  items += list(query)          else:  | 
