From 3d7a5d7ebde172d10afa414d6725f51aef6c3552 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sat, 6 Jul 2019 13:09:03 -0400 Subject: [PATCH] better Map Pack descriptions, building on PR #1823 --- .../osm-vector-maps/templates/iiab-update-map | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/roles/osm-vector-maps/templates/iiab-update-map b/roles/osm-vector-maps/templates/iiab-update-map index b0607c823..31b106234 100755 --- a/roles/osm-vector-maps/templates/iiab-update-map +++ b/roles/osm-vector-maps/templates/iiab-update-map @@ -27,8 +27,7 @@ else: doc_root = get_iiab_env('WWWROOT') menuDefs = doc_root + "/js-menu/menu-files/menu-defs/" vector_map_idx_dir = doc_root + "/common/assets" -#map_doc_root = '{{ vector_map_path }}' -map_doc_root = '/library/www/osm-vector-maps' +map_doc_root = '{{ vector_map_path }}' # /library/www/osm-vector-maps # map_catalog will be global, assumed always available map_catalog = {} map_menu_def_list = [] @@ -75,10 +74,10 @@ def main(): fetch_menu_json_value('autoupdate_menu'),region,)) menus.update_menu_json(menu_ref) # redirect from box/maps to an installed map rather than test page - with open('{{ vector_map_path }}/index.html','w') as fp: + with open(map_doc_root + '/index.html','w') as fp: outstr = """ \n\n"""%fname fp.write(outstr) - + def get_map_catalog(): global map_catalog @@ -165,15 +164,24 @@ def create_menu_def(region,default_name,intended_use='map'): menuDef["logo_url"] = default_logo menuitem = lang + '-' + item['perma_ref'] menuDef["menu_item_name"] = default_name + if item.get('title','ERROR') == "World": - menuDef["title"] = "OpenStreetMap: " + item.get('title','ERROR') + fancyTitle = "Planet Earth" + elif item.get('title','ERROR') == "Central America": + fancyTitle = "Central America-Caribbean" else: - menuDef["title"] = "OpenStreetMap: " + item.get('title','ERROR') + " & Earth" + fancyTitle = item.get('title','ERROR') + + if fancyTitle == "Planet Earth": + menuDef["title"] = "OpenStreetMap: " + fancyTitle + else: + menuDef["title"] = "OpenStreetMap: " + fancyTitle + " & Earth" + menuDef["map_name"] = item['perma_ref'] # the following is in the idx json #menuDef["file_name"] = lang + '-osm-omt_' + region + '_' + os.path.basename(item['url'])[:-4] - menuDef["description"] = '18 levels of zoom (5 m resolution) for ' + item.get('title','ERROR') + ', illustrating human geography.

10 levels of zoom (5 km resolution) of satellite photos covering the whole world.' - menuDef["extra_description"] = 'Search for cities/towns that have more than 1000 people. There are currently 127,654 such settlements.' + menuDef["description"] = '18 levels of zoom (5 m resolution) for ' + fancyTitle + ', illustrating human geography.

10 levels of zoom (5 km resolution) for satellite photos, covering the whole world.' + menuDef["extra_description"] = 'Search for cities/towns with more than 1000 people. There are about 127,654 worldwide.' menuDef["extra_html"] = "" #menuDef["automatically_generated"] = "true" menuDef["change_ref"] = "generated" @@ -181,7 +189,7 @@ def create_menu_def(region,default_name,intended_use='map'): if not os.path.isfile(menuDefs + default_name): # logic to here can still overwrite existing menu def print("creating %s"%menuDefs + default_name) with open(menuDefs + default_name,'w') as menufile: - menufile.write(json.dumps(menuDef,indent=2)) + menufile.write(json.dumps(menuDef,indent=4)) return default_name[:-5] def human_readable(num):