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

Merge pull request #1650 from tim-moody/map-dirs

name change
This commit is contained in:
Tim Moody 2019-05-11 10:22:05 -04:00 committed by GitHub
commit 944e84d031
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -36,7 +36,7 @@ def main():
global map_menu_def_list
get_map_catalog()
#print(json.dumps(map_catalog,indent=2))
map_menu_def_list = get_menu_def_names()
print(json.dumps(map_menu_def_list,indent=2))
@ -76,7 +76,7 @@ def get_map_catalog():
#print(json.dumps(map_catalog,indent=2))
def get_menu_def_names(intended_use='map'):
menu_def_list =[]
menu_def_list =[]
os.chdir(menuDefs)
for filename in os.listdir('.'):
if fnmatch.fnmatch(filename, '*.json'):
@ -107,7 +107,7 @@ def get_installed_regions():
return installed
def write_vector_map_idx(installed_maps):
map_dict ={}
map_dict ={}
idx_dict = {}
for fname in installed_maps:
region = extract_region_from_filename(fname)
@ -117,7 +117,7 @@ def write_vector_map_idx(installed_maps):
# Create the idx file in format required bo js-menu system
item = map_dict['perma_ref']
idx_dict[item] = {}
idx_dict[item] = {}
idx_dict[item]['file_name'] = os.path.basename(map_dict['url'][:-4])
idx_dict[item]['menu_item'] = map_dict['perma_ref']
idx_dict[item]['size'] = map_dict['size']
@ -125,8 +125,8 @@ def write_vector_map_idx(installed_maps):
idx_dict[item]['region'] = region
idx_dict[item]['language'] = map_dict['perma_ref'][:2]
with open(vector_map_idx_dir + '/osm_version_idx.json','w') as idx:
idx.write(json.dumps(idx_dict,indent=2))
with open(vector_map_idx_dir + 'vector-map-idx.json','w') as idx:
idx.write(json.dumps(idx_dict,indent=2))
def create_menu_def(region,default_name,intended_use='map'):
item = map_catalog['regions'][region]
@ -183,7 +183,7 @@ def extract_region_from_filename(fname):
nibble = fname.split('_')[0]
nibble = substitutions.get(nibble,nibble)
return(nibble)
if __name__ == '__main__':
if console_installed:
main()