Update generate.
This commit is contained in:
parent
50521fb7a5
commit
d1df95e280
35
generate.sh
35
generate.sh
@ -7,19 +7,20 @@ DEFAULT_WRITER=insa2018
|
|||||||
bounding_box=
|
bounding_box=
|
||||||
bounding_poly=
|
bounding_poly=
|
||||||
map_id=
|
map_id=
|
||||||
|
map_name=
|
||||||
debug=false
|
debug=false
|
||||||
|
|
||||||
graph_only=false
|
graph_only=false
|
||||||
mapsforge_only=false
|
mapsforge_only=false
|
||||||
|
|
||||||
input_file=
|
input_file=
|
||||||
output_name=
|
output_file=
|
||||||
|
|
||||||
# FUNCTION help_short()
|
# FUNCTION help_short()
|
||||||
#
|
#
|
||||||
# Print short usage information.
|
# Print short usage information.
|
||||||
function help_short() {
|
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()
|
# FUNCTION help_long()
|
||||||
@ -29,6 +30,7 @@ function help_long() {
|
|||||||
help_short
|
help_short
|
||||||
printf "\t-d,--debug\tEnable debug mode.\n"
|
printf "\t-d,--debug\tEnable debug mode.\n"
|
||||||
printf "\t-i,--id\tMap ID.\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-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-p,--bounding-polygon\tSpecify a bounding-polygon, only used for OSM2Graph.\n"
|
||||||
printf "\t-h,--help\tPrint this help.\n"
|
printf "\t-h,--help\tPrint this help.\n"
|
||||||
@ -136,11 +138,15 @@ do
|
|||||||
map_id="$2"
|
map_id="$2"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
-n|--name)
|
||||||
|
map_name="$2"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
-d|--debug)
|
-d|--debug)
|
||||||
debug=true
|
debug=true
|
||||||
;;
|
;;
|
||||||
-o|--output)
|
-o|--output)
|
||||||
output_name="$2"
|
output_file="$2"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-h|--help)
|
-h|--help)
|
||||||
@ -161,6 +167,10 @@ if [ -z "${map_id}" ]; then
|
|||||||
error_and_usage "No map ID specified."
|
error_and_usage "No map ID specified."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -z "${map_name}" ]; then
|
||||||
|
error_and_usage "No map name specified."
|
||||||
|
fi
|
||||||
|
|
||||||
if [ ! -z "${bounding_box}" ] && [ -e "${bounding_box}" ]; then
|
if [ ! -z "${bounding_box}" ] && [ -e "${bounding_box}" ]; then
|
||||||
bounding_box=$(cat ${bounding_box})
|
bounding_box=$(cat ${bounding_box})
|
||||||
fi
|
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."
|
error_and_usage "Using a merged file (_merge) without bounding box is not possible."
|
||||||
fi
|
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
|
if ${graph_only}; then
|
||||||
info "Skipping mapsforge generation... "
|
info "Skipping mapsforge generation... "
|
||||||
else
|
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
|
if [ ! -z "${bounding_box}" ]; then
|
||||||
CMD_MF="${CMD_MF} bbox=${bounding_box}"
|
CMD_MF="${CMD_MF} bbox=${bounding_box}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
nohup ${CMD_MF} > nohup_mf_$(basename ${output_file}).out &
|
echo ${CMD_MF}
|
||||||
|
${CMD_MF}
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -218,9 +234,10 @@ else
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
CMD_GR="${CMD_GR} --tf reject-relations"
|
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"
|
CMD_GR="${CMD_GR} --tf accept-ways highway=$(cat inputs/highway-filter.cmd) natural=coastline junction=roundabout --lp"
|
||||||
CMD_GR="${CMD_GR} --used-node --osm2graph writer=${DEFAULT_WRITER} file=${output_file}.mapgr map-id=${map_id}"
|
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
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user