1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 11:42:08 +00:00

more move problems

This commit is contained in:
George Hunt 2019-04-09 06:24:56 +01:00
parent 0e803bd83d
commit 07597d6915

View file

@ -44,7 +44,8 @@ def main():
print(installed_maps)
write_osm_vector_idx(installed_maps)
for region in installed_maps:
for fname in installed_maps:
region = extract_region_from_filename(fname)
print('checking for %s region'%region)
if region != 'maplist':
item = map_catalog['regions'][region]
@ -104,10 +105,11 @@ def get_installed_regions():
def write_osm_vector_idx(installed_maps):
map_dict ={}
map_dict['regions'] = {}
for map in installed_maps:
for fname in installed_maps:
region = extract_region_from_filename(fname)
if map == 'maplist': continue # not a real region
data_dict = map_catalog['regions'].get(map,'')
map_dict['regions'][map] = data_dict
data_dict = map_catalog['regions'].get(region,'')
map_dict['regions'][region] = data_dict
with open(osm_vector_idx_dir + '/osm-vector-idx.json','w') as idx:
idx.write(json.dumps(map_dict,indent=2))
@ -156,6 +158,15 @@ def fetch_menu_json_value(key):
data = json.loads(menudef.read())
return data.get(key,'')
def extract_region_from_filename(fname):
substitutions = { "north": "north_america",\
"central": "central_america",\
"southeast": "southeast_asia",
"south": "south_america" }
# wish I had used - as separator between key and date
nibble = fname.split('_')[0]
nibble = substitutions.get(nibble,nibble)
return(nibble)
if __name__ == '__main__':
if console_installed: