diff options
author | Melody Horn <melody@boringcactus.com> | 2020-06-06 11:39:50 -0600 |
---|---|---|
committer | Melody Horn <melody@boringcactus.com> | 2020-06-06 11:39:50 -0600 |
commit | 4127ae91822f9abeffeb614e95b6f9d832ecf7c6 (patch) | |
tree | c54b1831b450cb901fd787583e115951eb12e0d3 /dev | |
parent | 253a9230ad727baa2a55258de3d045872b84bd3f (diff) | |
download | pig.observer-4127ae91822f9abeffeb614e95b6f9d832ecf7c6.tar.gz pig.observer-4127ae91822f9abeffeb614e95b6f9d832ecf7c6.zip |
replace bad checkboxes with good map-based UI
Diffstat (limited to 'dev')
-rw-r--r-- | dev/georgia/convert.py | 2 | ||||
-rw-r--r-- | dev/nyc/convert.py | 2 | ||||
-rw-r--r-- | dev/utah/convert.py | 12 |
3 files changed, 8 insertions, 8 deletions
diff --git a/dev/georgia/convert.py b/dev/georgia/convert.py index f734030..37a9e56 100644 --- a/dev/georgia/convert.py +++ b/dev/georgia/convert.py @@ -8,7 +8,7 @@ cameras = raw_data['features'] sources = [] for camera in cameras: - coord = [float(x) for x in camera['geometry']['coordinates']] + coord = [float(x) for x in reversed(camera['geometry']['coordinates'])] cam = dict() cam['id'] = camera['properties']['cctv_id'] if 'HLS' in camera['properties']: diff --git a/dev/nyc/convert.py b/dev/nyc/convert.py index 2f21861..f6a10f5 100644 --- a/dev/nyc/convert.py +++ b/dev/nyc/convert.py @@ -22,4 +22,4 @@ for camera in data: cam['url'] = url sources.append({'coord': coord, 'cams': [cam]}) with open('sources.json', 'w') as f: - json.dump({'NYC': sources}, f) + json.dump(sources, f) 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) |