Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorIlya Zverev <zverik@textual.ru>2017-05-17 20:18:07 +0300
committerIlya Zverev <zverik@textual.ru>2017-06-02 18:01:30 +0300
commitb79686c731b308401e9297c9655481b60f23159e (patch)
tree538f05141a8618731bc83c61fa55a54fea2c0a02 /tools
parentc21332589d4e26313d5a8e1b328252f5a07c9a3e (diff)
[generator] Update generate_mwm also
Diffstat (limited to 'tools')
-rwxr-xr-xtools/unix/generate_mwm.sh62
1 files changed, 12 insertions, 50 deletions
diff --git a/tools/unix/generate_mwm.sh b/tools/unix/generate_mwm.sh
index 13c47bff28..289c00b0c0 100755
--- a/tools/unix/generate_mwm.sh
+++ b/tools/unix/generate_mwm.sh
@@ -9,19 +9,15 @@
# - Data path with classificators etc. should be present in $OMIM_PATH/data
# Inside it should be at least: categories.txt, classificator.txt, types.txt, drules_proto.bin
# - Compiled generator_tool somewhere in omim/../build/out/whatever, or supply BUILD_PATH
-# - For routing, compiled OSRM binaries in omim/../osrm-backend-release, or supply OSRM_BUILD_PATH
# - Target path for mwm is the same as o5m path, or supply TARGET
# - Set TMPDIR variable if you have no space in the default temporary location.
-# Cross-borders routing index is not created, since we don't assume
-# the source file to be one of the pre-defined countries.
-
set -u
set -e
if [ $# -lt 1 ]; then
echo
- echo "Usage: $0 \<file.o5m/osm/bz2/pbf\> [\<routing_profile.lua\>]"
+ echo "Usage: $0 \<file.o5m/osm/bz2/pbf\>"
echo
echo "Useful environment variables:"
echo
@@ -29,6 +25,7 @@ if [ $# -lt 1 ]; then
echo -e "BORDER\tPath and name of a polygon file for the input"
echo -e "COASTS\tPath and name of WorldCoasts.geom"
echo -e "TARGET\tWhere to put resulting files"
+ echo -e "OSM2FT\tSet to 1 to keep the osm2ft file"
echo
exit 1
fi
@@ -103,60 +100,25 @@ if [ "$SOURCE_TYPE" == "pbf" -o "$SOURCE_TYPE" == "bz2" -o "$SOURCE_TYPE" == "os
SOURCE_TYPE=o5m
fi
if [ "$SOURCE_TYPE" == "o5m" ]; then
+ if [ -n "${BORDERS_PATH-}" -a -f "${BORDERS_PATH-}/$BASE_NAME.poly" ]; then
+ [ ! -d "$TBORDERS" ] && CLEAN_BORDERS=1 && mkdir "$TBORDERS"
+ cp "$BORDERS_PATH"/*.poly "$TBORDERS"
+ CROSS_MWM="--make_cross_mwm"
+ fi
+
$GENERATOR_TOOL $INTDIR_FLAG --osm_file_type=o5m --osm_file_name="$SOURCE_FILE" --preprocess=true || fail "Preprocessing failed"
$GENERATOR_TOOL $INTDIR_FLAG --osm_file_type=o5m --osm_file_name="$SOURCE_FILE" --data_path="$TARGET" --user_resource_path="$DATA_PATH" $GENERATE_EVERYTHING --output="$BASE_NAME"
+ $GENERATOR_TOOL $INTDIR_FLAG --data_path="$TARGET" --user_resource_path="$DATA_PATH" ${CROSS_MWM-} --make_routing_index --generate_traffic_keys --output="$BASE_NAME"
else
- fail "Unsupported source type: $SOURCE_TYPE"
+ echo "Unsupported source type: $SOURCE_TYPE" >&2
fi
[ -n "${CLEAN_POLY-}" ] && rm "$TBORDERS/$BASE_NAME.poly"
[ -n "${CLEAN_BORDERS-}" ] && rm -r "$TBORDERS"
-if [ $# -gt 1 ]; then
- # Create .mwm with routing index and a .mwm.norouting file
- OSRM_PATH="${OSRM_PATH:-$OMIM_PATH/3party/osrm/osrm-backend}"
- OSRM_BUILD_PATH="${OSRM_BUILD_PATH:-$OMIM_PATH/../osrm-backend-release}"
- [ ! -x "$OSRM_BUILD_PATH/osrm-extract" -a -x "$SCRIPT_PATH/bin/osrm-extract" ] && OSRM_BUILD_PATH="$SCRIPT_PATH/bin"
- [ ! -x "$OSRM_BUILD_PATH/osrm-extract" ] && fail "Please compile OSRM binaries to $OSRM_BUILD_PATH"
- [ ! -r "$TARGET/$BASE_NAME.mwm" ] && fail "Please build mwm file beforehand"
-
- OSRM_THREADS=${OSRM_THREADS:-15}
- OSRM_MEMORY=${OSRM_MEMORY:-50}
- EXTRACT_CFG="$INTDIR/extractor.ini"
- PREPARE_CFG="$INTDIR/contractor.ini"
- echo "threads = $OSRM_THREADS" > "$EXTRACT_CFG"
- echo "memory = $OSRM_MEMORY" > "$PREPARE_CFG"
- echo "threads = $OSRM_THREADS" >> "$PREPARE_CFG"
- if [ -r "$2" ]; then
- PROFILE="$2"
- else
- echo "$2 is not a profile, using standard car.lua" >&2
- PROFILE="$OSRM_PATH/profiles/car.lua"
- fi
- [ ! -r "$PROFILE" ] && fail "Lua profile $PROFILE is not found"
-
- PBF="$INTDIR/tmp.pbf"
- OSRM="$INTDIR/tmp.osrm"
- export STXXLCFG="$HOME/.stxxl"
- find_osmconvert
- "$OSMCONVERT" "$SOURCE_FILE" -o=$PBF || fail "Converting to PBF failed"
- "$OSRM_BUILD_PATH/osrm-extract" --config "$EXTRACT_CFG" --profile "$PROFILE" "$PBF" || fail
- rm "$PBF"
- "$OSRM_BUILD_PATH/osrm-prepare" --config "$PREPARE_CFG" --profile "$PROFILE" "$OSRM" -r "$OSRM.restrictions" || fail
- "$OSRM_BUILD_PATH/osrm-mapsme" -i "$OSRM" || fail
- if [ -n "${BORDERS_PATH-}" -a ! -d "$TARGET/borders" ]; then
- [ ! -e "$BORDERS_PATH/$BASE_NAME.poly" ] && fail "You should have a polygon for processed file: $BORDERS_PATH/$BASE_NAME.poly"
- CROSS_MWM="--make_cross_section"
- mkdir "$TBORDERS"
- cp "$BORDERS_PATH"/*.poly "$TBORDERS"
- fi
- $GENERATOR_TOOL --make_routing=true ${CROSS_MWM-} --osrm_file_name="$OSRM" --data_path="$TARGET" --user_resource_path="$DATA_PATH" --output="$BASE_NAME"
- [ -n "${CROSS_MWM-}" ] && rm -r "$TBORDERS"
-fi
-
# This file is needed only for routing generation
-rm -f "$TARGET/$BASE_NAME.mwm.osm2ft"
+[ -z "${OSM2FT-}" ] && rm -f "$TARGET/$BASE_NAME.mwm.osm2ft"
# Remove temporary offsets table
[ -d "$TARGET/$BASE_NAME" ] && rm -r "$TARGET/$BASE_NAME"
-exit 0 #added so that the exit code of the script is 0, and not whatever the [ -d ] returns
+exit 0 # Added so that the exit code of the script is 0, and not whatever the [ -d ] returns.