Store simplifed polygons in the SQLite database

This commit does two things:
- uses our new polygon-simplifying library to process the polygons
  before storing them, rather than processing them in real time
- stores only the polygons in the database, rather than the whole
  GeoJSON feature, because we don’t need any of the other information
  about the feature
This commit is contained in:
Chris Hill-Scott
2020-08-24 14:43:28 +01:00
parent 3470c5bb31
commit c49a6338af
8 changed files with 164 additions and 164 deletions

View File

@@ -79,6 +79,17 @@ class BroadcastMessage(JSONModel):
)
)
@cached_property
def simple_polygons(self):
polygons = Polygons(
broadcast_area_libraries.get_simple_polygons_for_areas_lat_long(
*self._dict['areas']
)
)
# If weve added multiple areas then we need to re-simplify the
# combined shapes to keep the point count down
return polygons.smooth.simplify if len(self.areas) > 1 else polygons
@property
def template(self):
response = service_api_client.get_service_template(