mirror of
https://github.com/iiab/iiab.git
synced 2025-03-09 15:40:17 +00:00
commit
944e84d031
1 changed files with 7 additions and 7 deletions
|
@ -36,7 +36,7 @@ def main():
|
||||||
global map_menu_def_list
|
global map_menu_def_list
|
||||||
get_map_catalog()
|
get_map_catalog()
|
||||||
#print(json.dumps(map_catalog,indent=2))
|
#print(json.dumps(map_catalog,indent=2))
|
||||||
|
|
||||||
map_menu_def_list = get_menu_def_names()
|
map_menu_def_list = get_menu_def_names()
|
||||||
print(json.dumps(map_menu_def_list,indent=2))
|
print(json.dumps(map_menu_def_list,indent=2))
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ def get_map_catalog():
|
||||||
#print(json.dumps(map_catalog,indent=2))
|
#print(json.dumps(map_catalog,indent=2))
|
||||||
|
|
||||||
def get_menu_def_names(intended_use='map'):
|
def get_menu_def_names(intended_use='map'):
|
||||||
menu_def_list =[]
|
menu_def_list =[]
|
||||||
os.chdir(menuDefs)
|
os.chdir(menuDefs)
|
||||||
for filename in os.listdir('.'):
|
for filename in os.listdir('.'):
|
||||||
if fnmatch.fnmatch(filename, '*.json'):
|
if fnmatch.fnmatch(filename, '*.json'):
|
||||||
|
@ -107,7 +107,7 @@ def get_installed_regions():
|
||||||
return installed
|
return installed
|
||||||
|
|
||||||
def write_vector_map_idx(installed_maps):
|
def write_vector_map_idx(installed_maps):
|
||||||
map_dict ={}
|
map_dict ={}
|
||||||
idx_dict = {}
|
idx_dict = {}
|
||||||
for fname in installed_maps:
|
for fname in installed_maps:
|
||||||
region = extract_region_from_filename(fname)
|
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
|
# Create the idx file in format required bo js-menu system
|
||||||
item = map_dict['perma_ref']
|
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]['file_name'] = os.path.basename(map_dict['url'][:-4])
|
||||||
idx_dict[item]['menu_item'] = map_dict['perma_ref']
|
idx_dict[item]['menu_item'] = map_dict['perma_ref']
|
||||||
idx_dict[item]['size'] = map_dict['size']
|
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]['region'] = region
|
||||||
idx_dict[item]['language'] = map_dict['perma_ref'][:2]
|
idx_dict[item]['language'] = map_dict['perma_ref'][:2]
|
||||||
|
|
||||||
with open(vector_map_idx_dir + '/osm_version_idx.json','w') as idx:
|
with open(vector_map_idx_dir + 'vector-map-idx.json','w') as idx:
|
||||||
idx.write(json.dumps(idx_dict,indent=2))
|
idx.write(json.dumps(idx_dict,indent=2))
|
||||||
|
|
||||||
def create_menu_def(region,default_name,intended_use='map'):
|
def create_menu_def(region,default_name,intended_use='map'):
|
||||||
item = map_catalog['regions'][region]
|
item = map_catalog['regions'][region]
|
||||||
|
@ -183,7 +183,7 @@ def extract_region_from_filename(fname):
|
||||||
nibble = fname.split('_')[0]
|
nibble = fname.split('_')[0]
|
||||||
nibble = substitutions.get(nibble,nibble)
|
nibble = substitutions.get(nibble,nibble)
|
||||||
return(nibble)
|
return(nibble)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
if console_installed:
|
if console_installed:
|
||||||
main()
|
main()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue