forked from fossgis-routing-server/cbf-routing-profiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
compile_profiles.sh
executable file
·53 lines (44 loc) · 1.2 KB
/
compile_profiles.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash -e
#
# Create all profiles
#
#
if [ "x$1" = "x-c" ]; then
shift
COPYDATA=yes
else
COPYDATA=no
fi
if [ "x$1" = "x" ] || [ ! -f "$1" ]; then
echo "Usage: compile_profiles.sh [-c] <configfile>"
exit -1
fi
. $1
if [ "x$OSMDATA" = "x" ] || [ ! -f "$OSMDATA" ]; then
echo "Cannot access OSM data file $OSMDATA."
exit -1
fi
if [ "x$BUILDDIR" = "x" ] || [ ! -d "$BUILDDIR" ]; then
echo "Need build dir"
exit -1
fi
osmdatafile=`basename $OSMDATA`
osmdatadir=`dirname $OSMDATA`
osmdatadir=`cd $osmdatadir; pwd`
scriptdir=`dirname $0`
scriptdir=`cd $scriptdir; pwd`
cd $OSRMPATH
rm -f $BUILDDIR/*
for OSRMTYPE in $PROFILES; do
osminbuild=$BUILDDIR/$OSRMTYPE.${osmdatafile#*.}
ln -s $osmdatadir/$osmdatafile $osminbuild
time LUA_PATH="$scriptdir/lib/?.lua" ./osrm-extract -p $scriptdir/$OSRMTYPE.lua $osminbuild
echo "time for $OSRMTYPE extract"
time LUA_PATH="$scriptdir/lib/?.lua" ./osrm-partition $BUILDDIR/$OSRMTYPE.osrm
echo "time for $OSRMTYPE partition"
time LUA_PATH="$scriptdir/lib/?.lua" ./osrm-customize $BUILDDIR/$OSRMTYPE.osrm
echo "time for $OSRMTYPE customize"
done
if [ $COPYDATA = "yes" ]; then
cp $BUILDDIR/*.osrm* $DATADIR
fi