From 4127ae91822f9abeffeb614e95b6f9d832ecf7c6 Mon Sep 17 00:00:00 2001 From: Melody Horn Date: Sat, 6 Jun 2020 11:39:50 -0600 Subject: replace bad checkboxes with good map-based UI --- dev/utah/convert.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'dev/utah') 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) -- cgit v1.2.3