diff options
author | Melody Horn <melody@boringcactus.com> | 2020-06-06 12:44:37 -0600 |
---|---|---|
committer | Melody Horn <melody@boringcactus.com> | 2020-06-06 12:44:37 -0600 |
commit | 48ebef95cfc26aae3fcef1174f4eaeb71ca491fe (patch) | |
tree | 4a8817fcfda72182b607d184ef192ca8ceef5a36 /dev/utah/convert.py | |
parent | 4127ae91822f9abeffeb614e95b6f9d832ecf7c6 (diff) | |
download | pig.observer-48ebef95cfc26aae3fcef1174f4eaeb71ca491fe.tar.gz pig.observer-48ebef95cfc26aae3fcef1174f4eaeb71ca491fe.zip |
make a whole pile of things more good
Diffstat (limited to 'dev/utah/convert.py')
-rw-r--r-- | dev/utah/convert.py | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/dev/utah/convert.py b/dev/utah/convert.py deleted file mode 100644 index 763bc39..0000000 --- a/dev/utah/convert.py +++ /dev/null @@ -1,24 +0,0 @@ -import json -from collections import defaultdict -import xml.etree.ElementTree as ET -from pprint import pprint - -info = dict() -for place in ET.parse('UtahKML.xml').findall('.//{*}Placemark'): - cam_id = place.attrib['id'] - cam_name = place.find(".//{*}SimpleData[@name='DisplayName']").text - 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 = str(place['entityId']) - url = place['url'] - this_info = info[cam_id] - name = this_info['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) |