mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-24 00:07:02 -04:00
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:
@@ -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 we’ve 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(
|
||||
|
||||
Reference in New Issue
Block a user