Fix issue in generate.sh and add variable to specify threads/memory mode.

This commit is contained in:
Mikaël Capelle 2018-03-11 16:19:48 +01:00
parent 3eec2d9b06
commit 21764c66eb

View File

@ -4,6 +4,14 @@ DEFAULT_OUTPUT_FOLDER=outputs
DEFAULT_WRITER=insa2018
if [ -z "${DEFAULT_THREADS}" ]; then
DEFAULT_THREADS=2
fi
if [ -z "${DEFAULT_MEMORY_MODE}" ]; then
DEFAULT_MEMORY_MODE=hd
fi
bounding_box=
bounding_poly=
map_id=
@ -163,11 +171,11 @@ done
check_input_file
check_output_file
if [ -z "${map_id}" ]; then
if [ ! $mapsforge_only ] && [ -z "${map_id}" ]; then
error_and_usage "No map ID specified."
fi
if [ -z "${map_name}" ]; then
if [ ! $mapsforge_only ] && [ -z "${map_name}" ]; then
error_and_usage "No map name specified."
fi
@ -187,7 +195,7 @@ fi
if ${graph_only}; then
info "Skipping mapsforge generation... "
else
CMD_MF="bin/osmosis --rb ${input_file} --lp --mapfile-writer file=${output_file}.mapfg type=hd threads=6"
CMD_MF="bin/osmosis --rb ${input_file} --lp --mapfile-writer file=${output_file}.mapfg type=${DEFAULT_MEMORY_MODE} threads=${DEFAULT_THREADS}"
if [ ! -z "${bounding_box}" ]; then
CMD_MF="${CMD_MF} bbox=${bounding_box}"
@ -223,8 +231,8 @@ else
CMD_GR="bin/osmosis --rb ${input_file} --lp"
if [ ! -z "${bounding_polygon}" ]; then
CMD_GR="${CMD_GR} --bounding-polygon file=${bounding_polygon} completeWays=yes --lp"
if [ ! -z "${bounding_poly}" ]; then
CMD_GR="${CMD_GR} --bounding-polygon file=${bounding_poly} completeWays=yes --lp"
else
if [ ! -z "${bounding_box}" ]; then
osmbbox=$(echo ${bounding_box} | \
@ -236,7 +244,7 @@ else
CMD_GR="${CMD_GR} --tf reject-relations --lp"
CMD_GR="${CMD_GR} --tf accept-ways highway=$(cat plugins/OSM2Graph/resources/highway-filter.cmd) natural=coastline junction=roundabout --lp"
CMD_GR="${CMD_GR} --used-node --lp --osm2graph writer=${DEFAULT_WRITER} file=${output_file}.mapgr"
CMD_GR="${CMD_GR} --used-node --lp --osm2graph writer=${DEFAULT_WRITER} file=${output_file}.mapgr threads=${DEFAULT_THREADS}"
echo ${CMD_GR} id="${map_id}" name="${map_name}"
${CMD_GR} id="${map_id}" name="${map_name}"