[generator] Fix small bugs and use osmctools from repository

This commit is contained in:
Ilya Zverev 2015-08-20 20:45:58 +03:00 committed by Alex Zolotarev
parent bfd18f1e03
commit a8ba11fd41
3 changed files with 13 additions and 12 deletions

View file

@ -42,7 +42,11 @@ find_osmconvert() {
OSMCONVERT="${OSMCONVERT:-$HOME/osmctools/osmconvert}"
if [ ! -x "$OSMCONVERT" ]; then
OSMCONVERT="$INTDIR/osmconvert"
wget -q -O - http://m.m.i24.cc/osmconvert.c | cc -x c - -lz -O3 -o $OSMCONVERT
if [ -e "$OMIM_PATH/tools/osmctools/osmconvert.c" ]; then
cc -x c -lz -O3 "$OMIM_PATH/tools/osmctools/osmconvert.c" -o "$OSMCONVERT"
else
curl -s http://m.m.i24.cc/osmconvert.c | cc -x c - -lz -O3 -o $OSMCONVERT
fi
fi
}
@ -59,7 +63,7 @@ DATA_PATH="${DATA_PATH:-$OMIM_PATH/data}"
[ ! -r "$DATA_PATH/types.txt" ] && fail "Cannot find classificators in $DATA_PATH, please set correct OMIM_PATH"
GENERATOR_TOOL="${GENERATOR_TOOL-$SCRIPT_PATH/bin/generator_tool}"
[ -x "$SCRIPT_PATH/find_generator.tool.sh" ] && source "$SCRIPT_PATH/find_generator_tool.sh"
[ -x "$SCRIPT_PATH/find_generator_tool.sh" ] && source "$SCRIPT_PATH/find_generator_tool.sh"
[ ! -x "${GENERATOR_TOOL-}" ] && fail "Cannot find generator tool"
if [ "$(uname)" == "Darwin" ]; then

View file

@ -211,15 +211,14 @@ fi
if [ "$MODE" == "coast" ]; then
putmode
# The patch increases number of nodes for osmconvert to avoid overflow crash
[ ! -x "$OSMCTOOLS/osmconvert" ] && wget -q -O - http://m.m.i24.cc/osmconvert.c | sed 's/60004/600004/' | cc -x c - -lz -O3 -o "$OSMCTOOLS/osmconvert"
[ ! -x "$OSMCTOOLS/osmupdate" ] && wget -q -O - http://m.m.i24.cc/osmupdate.c | cc -x c - -o "$OSMCTOOLS/osmupdate"
[ ! -x "$OSMCTOOLS/osmfilter" ] && wget -q -O - http://m.m.i24.cc/osmfilter.c | cc -x c - -O3 -o "$OSMCTOOLS/osmfilter"
[ ! -x "$OSMCTOOLS/osmconvert" ] && cc -x c -lz -O3 "$OMIM_PATH/tools/osmctools/osmconvert.c" -o "$OSMCTOOLS/osmconvert"
[ ! -x "$OSMCTOOLS/osmupdate" ] && cc -x c "$OMIM_PATH/tools/osmctools/osmupdate.c" -o "$OSMCTOOLS/osmupdate"
[ ! -x "$OSMCTOOLS/osmfilter" ] && cc -x c -O3 "$OMIM_PATH/tools/osmctools/osmfilter.c" -o "$OSMCTOOLS/osmfilter"
if [ -n "$OPT_DOWNLOAD" ]; then
# Planet download is requested
log "STATUS" "Step 0: Downloading and converting the planet"
PLANET_PBF="$(dirname "$PLANET")/planet-latest.osm.pbf"
wget -O "$PLANET_PBF" http://planet.openstreetmap.org/pbf/planet-latest.osm.pbf
curl -s -o "$PLANET_PBF" http://planet.openstreetmap.org/pbf/planet-latest.osm.pbf
"$OSMCTOOLS/osmconvert" "$PLANET_PBF" --drop-author --drop-version --out-o5m "-o=$PLANET"
rm "$PLANET_PBF"
fi
@ -250,7 +249,7 @@ if [ "$MODE" == "coast" ]; then
-preprocess 2>> "$LOG_PATH/WorldCoasts.log"
# Generate temporary coastlines file in the coasts intermediate dir
if ! "$GENERATOR_TOOL" --intermediate_data_path="$INTCOASTSDIR/" --node_storage=map --osm_file_type=o5m --osm_file_name="$COASTS" \
--user_resource_path="$DATA_PATH/" -make_coasts -fail_on_coasts 2>&1 | tee -a "$LOG_PATH/WorldCoasts.log" | { grep -i 'not merged' || true; }
--user_resource_path="$DATA_PATH/" -make_coasts -fail_on_coasts 2>&1 | tee -a "$LOG_PATH/WorldCoasts.log" | { grep -i 'not merged\|coastline polygons' || true; }
then
log "STATUS" "Coastline merge failed"
if [ -n "$OPT_UPDATE" ]; then

View file

@ -38,8 +38,7 @@ if [ "$1" == "pbf" ]; then
PLANET="${PLANET:-$HOME/planet/planet-latest.o5m}"
OSMCTOOLS="${OSMCTOOLS:-$HOME/osmctools}"
[ ! -d "$OSMCTOOLS" ] && OSMCTOOLS="$INTDIR"
# The patch increases number of nodes for osmconvert to avoid overflow crash.
[ ! -x "$OSMCTOOLS/osmconvert" ] && wget -q -O - http://m.m.i24.cc/osmconvert.c | sed 's/60004/600004/' | cc -x c - -lz -O3 -o "$OSMCTOOLS/osmconvert"
[ ! -x "$OSMCTOOLS/osmconvert" ] && cc -x c -lz -O3 "$OMIM_PATH/tools/osmctools/osmconvert.c" -o "$OSMCTOOLS/osmconvert"
TMPBORDERS="$INTDIR/tmpborders"
mkdir "$TMPBORDERS"
@ -127,8 +126,7 @@ elif [ "$1" == "online" ]; then
PLANET="${PLANET:-$HOME/planet/planet-latest.o5m}"
OSMCTOOLS="${OSMCTOOLS:-$HOME/osmctools}"
[ ! -d "$OSMCTOOLS" ] && OSMCTOOLS="$INTDIR"
# The patch increases number of nodes for osmconvert to avoid overflow crash.
[ ! -x "$OSMCTOOLS/osmconvert" ] && wget -q -O - http://m.m.i24.cc/osmconvert.c | sed 's/60004/600004/' | cc -x c - -lz -O3 -o "$OSMCTOOLS/osmconvert"
[ ! -x "$OSMCTOOLS/osmconvert" ] && cc -x c -lz -O3 "$OMIM_PATH/tools/osmctools/osmconvert.c" -o "$OSMCTOOLS/osmconvert"
PBF="$INTDIR/planet.pbf"
"$OSMCTOOLS/osmconvert" "$PLANET" --hash-memory=2000 --out-pbf -o="$PBF"