1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-03-09 15:40:17 +00:00

Merge pull request #1824 from holta/osm-descriptions

Better Map Pack descriptions, building on PR #1823
This commit is contained in:
A Holt 2019-07-06 13:24:15 -04:00 committed by GitHub
commit 83cca64c7c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 = """<head> \n<meta http-equiv="refresh" content="0; URL=/osm-vector-maps/en-osm-omt_%s " />\n</head>"""%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.<p>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.<p>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):