Fold GeoJSON conversion into the county download steps and remove the unused Force redownload checkbox
This commit is contained in:
+12
-12
@@ -481,7 +481,7 @@ def get_script_map():
|
||||
|
||||
dl_roads = {}; dl_addrs = {}; dl_paths = {}
|
||||
osm_roads = {}; osm_addrs = {}; osm_paths = {}
|
||||
conv_roads = {}; conv_addrs = {}; conv_paths = {}
|
||||
conv_paths = {}
|
||||
diff_roads = {}; diff_addrs = {}; diff_paths = {}
|
||||
city_report = {}
|
||||
|
||||
@@ -491,26 +491,29 @@ def get_script_map():
|
||||
state = c['state']
|
||||
base = f'/data/{cid}'
|
||||
|
||||
# Each county download also converts the shapefile to GeoJSON, so the
|
||||
# diff can run straight after it. Uploaded paths are converted by a
|
||||
# separate convert-paths job that the dashboard starts after the upload.
|
||||
conv_roads = f'python shp-to-geojson.py {base}/roads.shp.zip {base}/county-roads.geojson'
|
||||
conv_addrs = f'python convert-addresses.py {base}/addresses.shp.zip {base}/county-addresses.geojson'
|
||||
conv_paths_cmd = f'python shp-to-geojson.py {base}/paths.shp.zip {base}/county-paths.geojson'
|
||||
|
||||
if c.get('roads_url'):
|
||||
dl_roads[cid] = f'mkdir -p {base} && wget {c["roads_url"]} -O {base}/roads.shp.zip'
|
||||
dl_roads[cid] = f'mkdir -p {base} && wget {c["roads_url"]} -O {base}/roads.shp.zip && {conv_roads}'
|
||||
if c.get('addresses_url'):
|
||||
dl_addrs[cid] = f'mkdir -p {base} && wget {c["addresses_url"]} -O {base}/addresses.shp.zip'
|
||||
dl_addrs[cid] = f'mkdir -p {base} && wget {c["addresses_url"]} -O {base}/addresses.shp.zip && {conv_addrs}'
|
||||
pu = c.get('paths_url', '')
|
||||
if pu == 'upload':
|
||||
dl_paths[cid] = {'type': 'upload', 'dest': f'{base}/paths.shp.zip'}
|
||||
conv_paths[cid] = conv_paths_cmd
|
||||
elif pu:
|
||||
dl_paths[cid] = f'mkdir -p {base} && wget {pu} -O {base}/paths.shp.zip'
|
||||
dl_paths[cid] = f'mkdir -p {base} && wget {pu} -O {base}/paths.shp.zip && {conv_paths_cmd}'
|
||||
|
||||
osm_roads[cid] = ['python', 'download-overpass.py', '--type', 'highways', name, state, f'{base}/osm-roads.geojson']
|
||||
osm_addrs[cid] = ['python', 'download-overpass.py', '--type', 'addresses', name, state, f'{base}/osm-addresses.geojson']
|
||||
if pu:
|
||||
osm_paths[cid] = ['python', 'download-overpass.py', '--type', 'paths', name, state, f'{base}/osm-paths.geojson']
|
||||
|
||||
conv_roads[cid] = ['python', 'shp-to-geojson.py', f'{base}/roads.shp.zip', f'{base}/county-roads.geojson']
|
||||
conv_addrs[cid] = ['python', 'convert-addresses.py', f'{base}/addresses.shp.zip', f'{base}/county-addresses.geojson']
|
||||
if pu:
|
||||
conv_paths[cid] = ['python', 'shp-to-geojson.py', f'{base}/paths.shp.zip', f'{base}/county-paths.geojson']
|
||||
|
||||
diff_roads[cid] = ['python', 'diff-highways.py', f'{base}/osm-roads.geojson', f'{base}/county-roads.geojson', '--output', f'{base}/diff-roads.geojson']
|
||||
diff_addrs[cid] = ['python', 'compare-addresses.py', '--local-file', f'{base}/county-addresses.geojson', '--osm-file', f'{base}/osm-addresses.geojson', '--output-dir', base]
|
||||
city_report[cid] = ['python', 'generate-city-report.py', '--existing-file', f'{base}/addresses-existing.geojson', '--output-dir', base]
|
||||
@@ -523,8 +526,6 @@ def get_script_map():
|
||||
sm['download-osm-roads'] = osm_roads
|
||||
sm['download-osm-addresses'] = osm_addrs
|
||||
if osm_paths: sm['download-osm-paths'] = osm_paths
|
||||
sm['convert-roads'] = conv_roads
|
||||
sm['convert-addresses'] = conv_addrs
|
||||
if conv_paths: sm['convert-paths'] = conv_paths
|
||||
sm['diff-roads'] = diff_roads
|
||||
sm['diff-addresses'] = diff_addrs
|
||||
@@ -552,7 +553,6 @@ def run_script():
|
||||
data = request.json
|
||||
script_name = data.get('script')
|
||||
county = data.get('county', '')
|
||||
force_download = data.get('forceDownload', False)
|
||||
|
||||
if not script_name:
|
||||
return jsonify({'error': 'No script specified'}), 400
|
||||
|
||||
Reference in New Issue
Block a user