mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-23 15:57:23 -04:00
broadcast-areas: plot script works with groups
Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk>
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
import geojson
|
||||||
import cartopy.crs as ccrs
|
import cartopy.crs as ccrs
|
||||||
import cartopy.feature as cfeature
|
import cartopy.feature as cfeature
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
@@ -32,21 +33,21 @@ def main():
|
|||||||
all_areas = BroadcastAreasRepository().get_all_areas_for_library(lid)
|
all_areas = BroadcastAreasRepository().get_all_areas_for_library(lid)
|
||||||
some_areas = sample(all_areas, min(len(all_areas), 25))
|
some_areas = sample(all_areas, min(len(all_areas), 25))
|
||||||
for area in some_areas:
|
for area in some_areas:
|
||||||
print(" ", area[1]) # noqa: T001
|
print(" ", area[0], area[1]) # noqa: T001
|
||||||
|
|
||||||
inp = input("> ")
|
inp = input("> ")
|
||||||
if inp == "":
|
if inp == "":
|
||||||
break
|
break
|
||||||
|
|
||||||
aid = make_string_safe_for_id(inp)
|
aid = inp.strip()
|
||||||
area = BroadcastAreasRepository().get_areas([aid])[0]
|
area = BroadcastAreasRepository().get_areas([aid])[0]
|
||||||
|
|
||||||
feature = area[-2]
|
feature = area[-2]
|
||||||
feature_shape = sgeom.shape(feature["geometry"])
|
feature_shape = sgeom.shape(geojson.loads(feature)["geometry"])
|
||||||
features.append(feature_shape)
|
features.append(feature_shape)
|
||||||
|
|
||||||
simple_feature = area[-1]
|
simple_feature = area[-1]
|
||||||
simple_feature_shape = sgeom.shape(simple_feature["geometry"])
|
simple_feature_shape = sgeom.shape(geojson.loads(simple_feature)["geometry"])
|
||||||
simple_features.append(simple_feature_shape)
|
simple_features.append(simple_feature_shape)
|
||||||
|
|
||||||
print() # noqa: T001
|
print() # noqa: T001
|
||||||
|
|||||||
Reference in New Issue
Block a user