diff --git a/constants.py b/constants.py index 784aaf7..63a7ed6 100644 --- a/constants.py +++ b/constants.py @@ -24,17 +24,18 @@ boundaries_md_path = "./data/boundaries_md.json" workflows_path = '.github/workflows' -# folderpaths: +# data folderpaths: improper_geoms_folderpath = 'data/improper_geoms' disjointed_folderpath = 'data/disjointed' versioning_folderpath = 'data/versioning' other_footways_folderpath = 'data/other_footways' +tiles_folderpath = 'data/tiles' other_footways_subcatecories = { 'stairways' : {'highway':['steps']}, - 'main' : {'highway':['footway','living_street'],'foot':['designated'],'footway': ['alley','path','yes']}, - 'potential' : {'highway':['path','track']}, - 'informal' : {'foot':['yes','permissive']}, + 'main_footways' : {'highway':['footway','living_street'],'foot':['designated'],'footway': ['alley','path','yes']}, + 'potential_footways' : {'highway':['path','track']}, + 'informal_footways' : {'foot':['yes','permissive']}, 'pedestrian_areas' : {} #defined only by geometry type (Polygon,Multipolygon) } @@ -80,7 +81,7 @@ valid_values_path = 'quality_check/valid_tag_values.json' # node homepage: -user_basepage_url = f'https://{USERNAME}.github.io/'.astype('string') +user_basepage_url = f'https://{USERNAME}.github.io/' node_homepage_url = f'https://{USERNAME}.github.io/{REPO_NAME}/' data_updating_url = f'https://{USERNAME}.github.io/{REPO_NAME}/data/data_updating.html' @@ -117,8 +118,8 @@ # paths for other_footways subcategories: for subcategory in other_footways_subcatecories: subcategory_path = os.path.join(other_footways_folderpath, subcategory+data_format) - paths_dict['other_footways_subcategories'][subcategory] = subcategory - paths_dict['map_layers'][subcategory] = subcategory + paths_dict['other_footways_subcategories'][subcategory] = subcategory_path + paths_dict['map_layers'][subcategory] = subcategory_path # max radius to cut off unconnected crossings and kerbs diff --git a/data_quality/check_wiki_keys.py b/data_quality/check_wiki_keys.py index 02cbcfe..3acb3a5 100644 --- a/data_quality/check_wiki_keys.py +++ b/data_quality/check_wiki_keys.py @@ -1,8 +1,6 @@ import sys sys.path.append('oswm_codebase') from functions import * -# from constants import * - tags_dict = read_json('quality_check/feature_keys.json') diff --git a/generation/vec_tiles_gen.py b/generation/vec_tiles_gen.py new file mode 100644 index 0000000..3b77846 --- /dev/null +++ b/generation/vec_tiles_gen.py @@ -0,0 +1,22 @@ +import sys +sys.path.append('oswm_codebase') +from functions import * +import subprocess + +docker_img = 'ghcr.io/osgeo/gdal:alpine-normal-latest' + +create_folder_if_not_exists(tiles_folderpath) + + +print(paths_dict) + +layers_dict = paths_dict['map_layers'] + +for layername in layers_dict: + + outpath = os.path.join(tiles_folderpath,layername+'.pmtiles') + + runstring = f'docker run --rm -v ./data:/data {docker_img} ogr2ogr -f PMTiles {outpath} {layers_dict[layername]} -dsco MINZOOM={TILES_MIN_ZOOM} -dsco MAXZOOM={TILES_MAX_ZOOM} -progress' + + print(runstring) + diff --git a/other/templates/config.py b/other/templates/config.py index 2b95112..3104e70 100644 --- a/other/templates/config.py +++ b/other/templates/config.py @@ -29,9 +29,15 @@ -49.1843181999999999 # EASTERNMOST LONGITUDE ) -# Set a midpoint for the map: +# Set a midpoint for the map AND A Z LEVEL FOR THE INITIAL ZOOM: MID_LAT = -25.46075 MID_LGT = -49.26135 +INITIAL_Z_LEVEL = 19 + +# MIN AND MAX ZOOM LEVELS FOR TILE GENERATION: +# (since there's the 100MB file size limit, for big datasets might be better to stay at 19 or even 18) +TILES_MIN_ZOOM = 12 +TILES_MAX_ZOOM = 20 ### MORE DELICATE ONES: (leave them unchanged by default) @@ -45,4 +51,4 @@ OTHER_FOOTWAY_RULES = {'highway':['footway','steps','living_street','pedestrian','track','path'],'foot':['yes','designated','permissive'],'footway': ['alley','path','yes']} # since we download all features containing the tags of the previous rule-set, if there's another tag hierarchically above, we should exclude those features: -OTHER_FOOTWAY_EXCLUSION_RULES = {'highway': ['trunk','motorway','primary','secondary','trunk_link','motorway_link','primary_link'],'access':['no','private']} \ No newline at end of file +OTHER_FOOTWAY_EXCLUSION_RULES = {'highway': ['trunk','motorway','primary','secondary','trunk_link','motorway_link','primary_link'],'access':['no','private']} diff --git a/other/templates/copy_config.sh b/other/templates/copy_config.sh new file mode 100644 index 0000000..6857c3b --- /dev/null +++ b/other/templates/copy_config.sh @@ -0,0 +1 @@ +cp oswm_codebase/other/templates/config.py config.py \ No newline at end of file diff --git a/special_updates.py b/special_updates.py index cc67048..f7cee7a 100644 --- a/special_updates.py +++ b/special_updates.py @@ -1,6 +1,6 @@ # from constants import * from functions import * -from shutil import rmtree, copytree +from shutil import rmtree, copytree, copy """ script reserved for eventual modifications that shall happen on all nodes @@ -10,6 +10,9 @@ rmtree(workflows_path,ignore_errors=True) copytree('./oswm_codebase/workflows',workflows_path) +# copying requirements.txt: +copy('./oswm_codebase/requirements.txt','./requirements.txt') + # resetting the boundaries: remove_if_exists(boundaries_path) remove_if_exists(boundaries_md_path) diff --git a/workflows/data_daily_updating.yml b/workflows/data_daily_updating.yml index 5fcddf8..b6f40ec 100644 --- a/workflows/data_daily_updating.yml +++ b/workflows/data_daily_updating.yml @@ -54,6 +54,8 @@ jobs: - run: python oswm_codebase/filtering_adapting_data.py + - run: python oswm_codebase/generation/vec_tiles_gen.py + - run: python oswm_codebase/create_webmap.py - run: python oswm_codebase/data_quality/tag_values_checking.py