mirror of
https://github.com/iiab/iiab.git
synced 2025-02-13 11:42:08 +00:00
* change osm_branch to maps_branch. That is what it is * wiki says stage1 does not include changes to maps/main.js * get the map catalog from ukids * skip bypass download if files are present * add an init.json * add in extend_sat * first cut * first errors * put fonts in iiab font dir * get the php tilesserve in place * add tileserver.php * add in search files * fonts are available already * Revert "fonts are available already" This reverts commit c93a38a4ed99080ae5590abaffa8cf69196ed9dd. * Create README.md * put fonts back in * getting ready to transfer to rpi * move regions.json to test * create the symlinks for viewer * use wget * deal with detail from regions.json * reformat to IIAB for map tiles * deleting z0-z9 takes 30min * remove sleep * transfer current state to hadron * bump transition between white labels to black on sat style from 7 to 9 * added init.json to aggregate * put regions.json in iiab map role * get files from archive.org * detail_url was wrong from update_regions.py * get regions.json from iiab repo * put regios.json where admin console needs it * update details_url * create yamls for osm * fix typos in new yamls * missing with_items clause * put detail.mbtiles in ./tiles folder * do the move from working to viewer * choose the version which uses lib_adm * first cut * first errors * put fonts in iiab font dir * get the php tilesserve in place * add tileserver.php * add in search files * fonts are available already * Revert "fonts are available already" This reverts commit c93a38a4ed99080ae5590abaffa8cf69196ed9dd. * put fonts back in * getting ready to transfer to rpi * move regions.json to test * create the symlinks for viewer * use wget * deal with detail from regions.json * reformat to IIAB for map tiles * deleting z0-z9 takes 30min * remove sleep * transfer current state to hadron * bump transition between white labels to black on sat style from 7 to 9 * added init.json to aggregate * put regions.json in iiab map role * get files from archive.org * detail_url was wrong from update_regions.py * get regions.json from iiab repo * put regios.json where admin console needs it * update details_url * create yamls for osm * fix typos in new yamls * missing with_items clause * put detail.mbtiles in ./tiles folder * install dir.php * change docroot in tileserver.php * Update README.md * regions.json updated with 2019 data * add mbtileinfo.php and put it in place * changes to osm-fixup * osm-fixup receive url * typo in fixup and wronge mbtileinfo base * sloppy mistakes arount found_region * can use adm-lib.py * change regions.json to map-catalog.json * change regios.json to map-catalog.json, bump 2map-reorg to 3map-reorg as branch name * another region->map * call the console script to add menu items * fetch test-page from test branch * typo in osm-fixup.py comment * remove the map_functions from test page * new bboxes, title to san_jose * remove the regions.json and map_functions.js * let the map repo have all files related to test-page * first cut * first errors * put fonts in iiab font dir * get the php tilesserve in place * add tileserver.php * add in search files * start debugging * fonts are available already * Revert "fonts are available already" This reverts commit c93a38a4ed99080ae5590abaffa8cf69196ed9dd. * Create README.md * put fonts back in * getting ready to transfer to rpi * move regions.json to test * create the symlinks for viewer * use wget * deal with detail from regions.json * reformat to IIAB for map tiles * deleting z0-z9 takes 30min * remove sleep * transfer current state to hadron * bump transition between white labels to black on sat style from 7 to 9 * added init.json to aggregate * put regions.json in iiab map role * get files from archive.org * detail_url was wrong from update_regions.py * get regions.json from iiab repo * put regios.json where admin console needs it * update details_url * create yamls for osm * fix typos in new yamls * missing with_items clause * put detail.mbtiles in ./tiles folder * do the move from working to viewer * these moves work * first cut * first errors * put fonts in iiab font dir * get the php tilesserve in place * add tileserver.php * add in search files * start debugging * fonts are available already * Revert "fonts are available already" This reverts commit c93a38a4ed99080ae5590abaffa8cf69196ed9dd. * put fonts back in * getting ready to transfer to rpi * move regions.json to test * create the symlinks for viewer * use wget * deal with detail from regions.json * reformat to IIAB for map tiles * deleting z0-z9 takes 30min * remove sleep * transfer current state to hadron * bump transition between white labels to black on sat style from 7 to 9 * added init.json to aggregate * put regions.json in iiab map role * get files from archive.org * detail_url was wrong from update_regions.py * get regions.json from iiab repo * put regios.json where admin console needs it * update details_url * create yamls for osm * fix typos in new yamls * missing with_items clause * put detail.mbtiles in ./tiles folder * install dir.php * change docroot in tileserver.php * Update README.md * regions.json updated with 2019 data * add mbtileinfo.php and put it in place * changes to osm-fixup * osm-fixup receive url * typo in fixup and wronge mbtileinfo base * sloppy mistakes arount found_region * can use adm-lib.py * change regions.json to map-catalog.json * change regios.json to map-catalog.json, bump 2map-reorg to 3map-reorg as branch name * another region->map * call the console script to add menu items * fetch test-page from test branch * typo in osm-fixup.py comment * remove the map_functions from test page * new bboxes, title to san_jose * remove the regions.json and map_functions.js * let the map repo have all files related to test-page * add css * get nginx /maps working * helps admin console work with osm-maps * point to the stage1 branch in maps * add bypass * pull from map repo from a branch that is controlled by a variable * somehow this install was missing php-sqlite * add init.json * change osm_branch to maps_branch. That is what it is * wiki says stage1 does not include changes to maps/main.js * get the map catalog from ukids * skip bypass download if files are present * let osm_enalbled control world to zoom 10 * expand bypass to install-map-region * lots of errors in download script * both are modified * need python to write init.json - but bash workds * add in make_init.py * init.json updated via python * get the installer mbtiles * change to map branch staage1 * add tileserve.php to installer * put style-osm.json in installer * create a link for planet in installer * turn off enable in local_vars for osm-vector-maps * copy scripts to /usr/bin * softcode satellite fname * typos * sat_dir needed work * standatdize output satellite mbtile name * sat_bboxes not defined * period to comma in sat_bboxes * too many errors--did this ever work * period to comma * move new file into place, save old to /tmp * cannot move to /tmp from root -- different filesystem. So use copy * add iiab-summarize.sh to /usr/bin * write init.json correctly * only the web-pack from stage1 branch * let installer use php * point to maps rc-master * partially working but with many missing pieces * got on the wrong machine * got through it once with pages in rc-master * add installer_functions to install.yml * spell installer_functions with a .js * need tileserver.php for installer * colorize the map list for installed tiles * add s to iiab-maps-finish.py * get the name correct for iiab-maps-finish.py * map->maps, add python3-pil * iiab-extend-sat much better, maybe good enouth * start work on README * Update README.md * move README.md up oe level * change default map page to installer * working on test-page redirect * create assets in test-page * get the installer redirect working * can now record satellite download info in database -- needs improvement in bounds * hyphen/underebar problem installer-functions.js * change rc-master to master * eliminate aggregate.py, dir.php, create_empty_mbtiles.sh * move assets from iiab to maps * removed dead wood and did get_url for map stuff * extra space in with_items clause after hyphen caused errors * keep stuff in main.yml I do not understand * last vestiges of maps in iiab repo * after runroles, nginx needs restarting * remove dead wood, pull redirect for maplist from maps repo * observe iiab standards * remove redundant code * get nginx box/maps to work * fonts moved, so the pointers must change * enabled => true in all
80 lines
2.6 KiB
Python
Executable file
80 lines
2.6 KiB
Python
Executable file
#!/usr/bin/python3
|
|
# -*- coding: UTF-8 -*-
|
|
|
|
import iiab.iiab_lib as iiab
|
|
|
|
try:
|
|
import iiab.adm_lib as adm
|
|
import iiab.adm_const as CONST
|
|
adm_cons_installed = True
|
|
except:
|
|
adm_cons_installed = False
|
|
pass
|
|
|
|
import argparse
|
|
import sys, os
|
|
import json
|
|
import glob
|
|
import shutil
|
|
import json
|
|
|
|
# GLOBALS
|
|
viewer_path = '/library/www/osm-vector-maps/viewer'
|
|
catalog_path = '/etc/iiab'
|
|
|
|
if len(sys.argv) != 3:
|
|
print("Argument 1=map_url, 2=<location of cmdsrv.conf>")
|
|
sys.exit(1)
|
|
|
|
def parse_args():
|
|
parser = argparse.ArgumentParser(description="Assemble Resources for Maps.")
|
|
parser.add_argument("map_url", help="The 'detail_url' field in mapcatalog.json.")
|
|
parser.add_argument("configdir", help="Place to look for cmdsrv.conf")
|
|
return parser.parse_args()
|
|
|
|
def main():
|
|
global map_catalog
|
|
args = parse_args()
|
|
map_catalog = adm.get_map_catalog()
|
|
catalog = map_catalog['maps']
|
|
found_map = catalog.get(args.map_url,'')
|
|
if found_map == '':
|
|
print('Download URL not found in map-catalog.json: %s'%args.map_url)
|
|
sys.exit(1)
|
|
|
|
osm_tile = CONST.maps_working_dir + str(os.path.basename(CONST.maps_osm_url))
|
|
sat_tile = CONST.maps_working_dir + str(os.path.basename(CONST.maps_sat_url))
|
|
for present in glob.glob(CONST.maps_working_dir + '/*'):
|
|
if present == osm_tile:
|
|
if os.path.isfile(CONST.maps_downloads_dir + os.path.basename(osm_tile)):
|
|
os.remove(CONST.maps_downloads_dir + os.path.basename(osm_tile))
|
|
shutil.move(osm_tile,CONST.maps_downloads_dir)
|
|
elif present == sat_tile:
|
|
if os.path.isfile(CONST.maps_downloads_dir + os.path.basename(sat_tile)):
|
|
os.remove(CONST.maps_downloads_dir + os.path.basename(sat_tile))
|
|
shutil.move(sat_tile,CONST.maps_downloads_dir)
|
|
else:
|
|
if os.path.isfile(CONST.maps_viewer_dir + 'tiles/' + os.path.basename(present)):
|
|
os.remove(CONST.maps_viewer_dir + 'tiles/' + os.path.basename(present))
|
|
shutil.move(present,CONST.maps_viewer_dir + 'tiles')
|
|
|
|
|
|
# create init.json which sets initial coords and zoom
|
|
init = {}
|
|
map = catalog[args.map_url]
|
|
init['region'] = map['region']
|
|
init['zoom'] = map['zoom']
|
|
init['center_lon'] = map['center_lon']
|
|
init['center_lat'] = map['center_lat']
|
|
init_fn = viewer_path + '/init.json'
|
|
with open(init_fn,'w') as init_fp:
|
|
init_fp.write(json.dumps(init,indent=2))
|
|
|
|
try:
|
|
adm.subproc_run("iiab-update-map", shell=True)
|
|
except:
|
|
print('iiab-updatee-map ERROR')
|
|
|
|
if __name__ == '__main__':
|
|
if adm_cons_installed:
|
|
main()
|