1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-15 04:32:11 +00:00

Merge pull request #267 from iiab/master

sync from iiab/iiab
This commit is contained in:
A Holt 2019-07-06 21:34:21 -04:00 committed by GitHub
commit 40ee7834f8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 8 deletions

View file

@ -39,7 +39,7 @@
name: python-geojson
state: present
- name: Install /usr/bin/iiab-update-map for updating of Map Pack catalog
- name: Install /usr/bin/iiab-update-map for updating of Map Pack catalog & descriptions
template:
src: iiab-update-map
dest: /usr/bin/iiab-update-map

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,11 +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
menuDef["title"] = "OpenStreetMap: 18 Levels of Zoom for <b> " + item.get('title','ERROR') + '</b>'
if item.get('title','ERROR') == "World":
fancyTitle = "Planet Earth"
elif item.get('title','ERROR') == "Central America":
fancyTitle = "Central America-Caribbean"
else:
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"] = '<p>Resolution of the Whole World to 5 KM. OpenStreetMap data for <b>' + item.get('title','') + '</b> with details down to 5 Meters</p>'
menuDef["description"] = '18 levels of zoom (~1 m details) for ' + fancyTitle + ', illustrating human geography.<p>10 levels of zoom (~1 km details) 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"
@ -177,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):