From 21764c66eb9b39d86f964267920761dad3706065 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mika=C3=ABl=20Capelle?= Date: Sun, 11 Mar 2018 16:19:48 +0100 Subject: [PATCH] Fix issue in generate.sh and add variable to specify threads/memory mode. --- generate.sh | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/generate.sh b/generate.sh index 19c6deb..030ef7d 100755 --- a/generate.sh +++ b/generate.sh @@ -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}"