INNER CODE UNIT · Python
download_imagery
Zverik/every_door · tools/add_imagery.py:10
def download_imagery():
import requests
resp = requests.get('https://osmlab.github.io/editor-layer-index/imagery.geojson')
if resp.status_code != 200:
raise IOError('Failed to download imagery.geojson')
return resp.json()
if __name__ == '__main__':
if len(sys.argv) < 2:
print('Adds imagery index to the Every Door database')
print('Usage: {} <presets.db> [<imagery.geojson>]'.format(sys.argv[0]))
sys.exit(1)
json_path = None if len(sys.argv) <= 2 else sys.argv[2]
if json_path:
if os.path.isdir(json_path):
if 'editor-layer-index' not in json_path: