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

@@ -117,13 +117,13 @@ def test_has_polygons():
def test_polygons_are_enclosed_unless_asked_not_to_be():
england = broadcast_area_libraries.get('ctry19').get('ctry19-E92000001')
assert len(england.polygons) == len(england.unenclosed_polygons)
assert len(england.polygons) == len(england.polygons.as_unenclosed_coordinate_pairs)
first_polygon = england.polygons[0]
first_polygon = england.polygons[0].as_coordinate_pairs
assert first_polygon[0] != first_polygon[1] != first_polygon[2]
assert first_polygon[0] == first_polygon[-1]
first_polygon_unenclosed = england.unenclosed_polygons[0]
first_polygon_unenclosed = england.polygons[0].as_unenclosed_coordinate_pairs
assert first_polygon_unenclosed[0] == first_polygon[0]
assert first_polygon_unenclosed[-1] != first_polygon[-1]
assert first_polygon_unenclosed[-1] == first_polygon[-2]