mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-25 00:33:58 -04:00
Make the max polygon point count a constant
And document it in context.
This commit is contained in:
@@ -27,6 +27,12 @@ point_counts = []
|
|||||||
invalid_polygons = []
|
invalid_polygons = []
|
||||||
rtree_index = RTree()
|
rtree_index = RTree()
|
||||||
|
|
||||||
|
# The hard limit in the CBCs is 6,000 points per polygon. But we also
|
||||||
|
# care about optimising how quickjly we can process and display polygons
|
||||||
|
# so we aim for something lower, i.e. enough to give us a good amount of
|
||||||
|
# precision relative to the accuracy of a cell broadcast
|
||||||
|
MAX_NUMBER_OF_POINTS_PER_POLYGON = 250
|
||||||
|
|
||||||
|
|
||||||
def simplify_geometry(feature):
|
def simplify_geometry(feature):
|
||||||
if feature["type"] == "Polygon":
|
if feature["type"] == "Polygon":
|
||||||
@@ -125,7 +131,7 @@ def polygons_and_simplified_polygons(feature):
|
|||||||
|
|
||||||
point_counts.append(simplified.point_count)
|
point_counts.append(simplified.point_count)
|
||||||
|
|
||||||
if simplified.point_count >= 250:
|
if simplified.point_count >= MAX_NUMBER_OF_POINTS_PER_POLYGON:
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
'Too many points '
|
'Too many points '
|
||||||
'(adjust Polygons.perimeter_to_simplification_ratio or '
|
'(adjust Polygons.perimeter_to_simplification_ratio or '
|
||||||
|
|||||||
Reference in New Issue
Block a user