aboutsummaryrefslogtreecommitdiff
path: root/dev/utah
diff options
context:
space:
mode:
authorMelody Horn <melody@boringcactus.com>2020-06-06 11:39:50 -0600
committerMelody Horn <melody@boringcactus.com>2020-06-06 11:39:50 -0600
commit4127ae91822f9abeffeb614e95b6f9d832ecf7c6 (patch)
treec54b1831b450cb901fd787583e115951eb12e0d3 /dev/utah
parent253a9230ad727baa2a55258de3d045872b84bd3f (diff)
downloadpig.observer-4127ae91822f9abeffeb614e95b6f9d832ecf7c6.tar.gz
pig.observer-4127ae91822f9abeffeb614e95b6f9d832ecf7c6.zip
replace bad checkboxes with good map-based UI
Diffstat (limited to 'dev/utah')
-rw-r--r--dev/utah/convert.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/dev/utah/convert.py b/dev/utah/convert.py
index b02fc5c..763bc39 100644
--- a/dev/utah/convert.py
+++ b/dev/utah/convert.py
@@ -5,20 +5,20 @@ from pprint import pprint
info = dict()
for place in ET.parse('UtahKML.xml').findall('.//{*}Placemark'):
- cam_id = int(place.attrib['id'])
+ cam_id = place.attrib['id']
cam_name = place.find(".//{*}SimpleData[@name='DisplayName']").text
- coords = [float(x) for x in place.find(".//{*}coordinates").text.split(',')]
- info[cam_id] = {'name': cam_name, 'coords': coords}
+ coord = [float(x) for x in reversed(place.find(".//{*}coordinates").text.split(','))]
+ info[cam_id] = {'name': cam_name, 'coord': coord}
sources = []
with open('cameras.json', 'r') as f:
places = json.load(f)
for place in places:
- cam_id = place['entityId']
+ cam_id = str(place['entityId'])
url = place['url']
this_info = info[cam_id]
name = this_info['name']
- coords = this_info['coords']
- sources.append({'coords': coords, 'cams': [{'id': cam_id, 'url': url, 'name': name}]})
+ coord = this_info['coord']
+ sources.append({'coord': coord, 'cams': [{'id': cam_id, 'url': url, 'name': name}]})
with open('sources.json', 'w') as f:
json.dump(sources, f)