From d1df95e280fe48a64c8497f5350625c8b5da0ddb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mika=C3=ABl=20Capelle?= Date: Mon, 5 Mar 2018 10:05:13 +0100 Subject: [PATCH] Update generate. --- generate.sh | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/generate.sh b/generate.sh index aa671d2..d56c100 100755 --- a/generate.sh +++ b/generate.sh @@ -7,19 +7,20 @@ DEFAULT_WRITER=insa2018 bounding_box= bounding_poly= map_id= +map_name= debug=false graph_only=false mapsforge_only=false input_file= -output_name= +output_file= # FUNCTION help_short() # # Print short usage information. function help_short() { - echo "Usage: $0 [-h|--help] [-d|--debug] [-i|--id MAP_ID] [-b|--bounding-box FILE|BBOX] [-g|--graph-only] [-f|--mapsforge-only] [-p|--bounding-polygon FILE] [-o|--output OUTPUT_NAME] INPUT_FILE" + echo "Usage: $0 [-h|--help] [-d|--debug] [-i|--id MAP_ID] [-n|--name MAP_NAME] [-b|--bounding-box FILE|BBOX] [-g|--graph-only] [-f|--mapsforge-only] [-p|--bounding-polygon FILE] [-o|--output OUTPUT_NAME] INPUT_FILE" } # FUNCTION help_long() @@ -29,6 +30,7 @@ function help_long() { help_short printf "\t-d,--debug\tEnable debug mode.\n" printf "\t-i,--id\tMap ID.\n" + printf "\t-n,--name\tMap name.\n" printf "\t-b,--bounding-box\tSpecify a bounding-box, either via a string or a file.\n" printf "\t-p,--bounding-polygon\tSpecify a bounding-polygon, only used for OSM2Graph.\n" printf "\t-h,--help\tPrint this help.\n" @@ -136,11 +138,15 @@ do map_id="$2" shift ;; + -n|--name) + map_name="$2" + shift + ;; -d|--debug) debug=true ;; -o|--output) - output_name="$2" + output_file="$2" shift ;; -h|--help) @@ -161,6 +167,10 @@ if [ -z "${map_id}" ]; then error_and_usage "No map ID specified." fi +if [ -z "${map_name}" ]; then + error_and_usage "No map name specified." +fi + if [ ! -z "${bounding_box}" ] && [ -e "${bounding_box}" ]; then bounding_box=$(cat ${bounding_box}) fi @@ -169,16 +179,22 @@ if [ -z "${bounding_box}" ] && echo ${input_file} | grep "merge"; then error_and_usage "Using a merged file (_merge) without bounding box is not possible." fi +# Uncomment this or set the variable before starting the script if +# you want to generate file for huge map (change 26g to whatever is +# relevant for your system) +# export JAVACMD_OPTIONS="-Xms26g -Xmx26g" + if ${graph_only}; then info "Skipping mapsforge generation... " else - CMD_MF="bin/osmosis --rb ${input_file} --lp --mapfile-writer file=${output_file}.mapfg threads=4" + CMD_MF="bin/osmosis --rb ${input_file} --lp --mapfile-writer file=${output_file}.mapfg type=hd threads=6" if [ ! -z "${bounding_box}" ]; then CMD_MF="${CMD_MF} bbox=${bounding_box}" fi - nohup ${CMD_MF} > nohup_mf_$(basename ${output_file}).out & + echo ${CMD_MF} + ${CMD_MF} fi @@ -218,9 +234,10 @@ else fi fi - CMD_GR="${CMD_GR} --tf reject-relations" - CMD_GR="${CMD_GR} --tf accept-ways highway=$(cat inputs/highway-filter.cmd) natural=coastline junction=roundabout" - CMD_GR="${CMD_GR} --used-node --osm2graph writer=${DEFAULT_WRITER} file=${output_file}.mapgr map-id=${map_id}" + CMD_GR="${CMD_GR} --tf reject-relations --lp" + CMD_GR="${CMD_GR} --tf accept-ways highway=$(cat inputs/highway-filter.cmd) natural=coastline junction=roundabout --lp" + CMD_GR="${CMD_GR} --used-node --lp --osm2graph writer=${DEFAULT_WRITER} file=${output_file}.mapgr" - nohup ${CMD_GR} > nohup_gr_$(basename ${output_file}).out & + echo ${CMD_GR} id="${map_id}" name="${map_name}" + ${CMD_GR} id="${map_id}" name="${map_name}" fi