mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-11 18:37:33 -04:00
Add estimated areas for non-visual users
Since the key relies on visual association between the shapes on the maps and the styling of the key, it won’t work for non-visual users. An alternative way of giving them the same information is by providing the size of the area numerically.
This commit is contained in:
@@ -14,6 +14,9 @@ class Polygons():
|
||||
|
||||
approx_metres_to_degree = 111_320
|
||||
approx_square_metres_to_square_degree = approx_metres_to_degree ** 2
|
||||
square_degrees_to_square_miles = (
|
||||
approx_square_metres_to_square_degree / (1000 * 1000) * 0.386102
|
||||
)
|
||||
|
||||
# Estimated amount of bleed into neigbouring areas based on typical
|
||||
# range/separation of cell towers.
|
||||
@@ -161,6 +164,12 @@ class Polygons():
|
||||
def point_count(self):
|
||||
return len(list(itertools.chain(*self.as_coordinate_pairs_long_lat)))
|
||||
|
||||
@property
|
||||
def estimated_area(self):
|
||||
return sum(
|
||||
polygon.area for polygon in self
|
||||
) * self.square_degrees_to_square_miles
|
||||
|
||||
|
||||
def flatten_polygons(polygons):
|
||||
if isinstance(polygons, GeometryCollection):
|
||||
|
||||
Reference in New Issue
Block a user