Skip to content

Commit

Permalink
Set tar_build to Force when force_rebuild is True (#138)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrstnbwnkl committed Feb 29, 2024
1 parent 3b5e451 commit ac39d31
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -56,7 +56,7 @@ This image respects the following custom environment variables to be passed duri

- `tile_urls`: Add as many (space-separated) URLs as you like, e.g. https://download.geofabrik.de/europe/andorra-latest.osm.pbf
- `use_tiles_ignore_pbf`: `True` uses a local tile.tar file and skips building. Default `True`.
- `force_rebuild`: `True` forces a rebuild of the routing tiles. Default `False`.
- `force_rebuild`: `True` forces a rebuild of the routing tiles and sets `build_tar` to `Force`. Default `False`.
- `build_elevation`: `True` downloads elevation tiles which are covering the routing graph. `Force` will do the same, but first delete any existing elevation tiles. Default `False`.
- `build_admins`: `True` builds the admin db needed for things like border-crossing penalties and detailed routing responses. `Force` will do the same, but first delete the existing db. Default `False`.
- `build_time_zones`: `True` builds the timezone db which is needed for time-dependent routing. `Force` will do the same, but first delete the existing db. Default `False`.
Expand Down
15 changes: 11 additions & 4 deletions scripts/run.sh
Expand Up @@ -17,11 +17,15 @@ run_cmd() {
}

do_build_tar() {
if ([[ ${build_tar} == "True" && ! -f $TILE_TAR ]]) || [[ ${build_tar} == "Force" ]]; then
local build_tar_local=$1
if ([[ ${build_tar_local} == "True" && ! -f $TILE_TAR ]]) || [[ ${build_tar_local} == "Force" ]]; then
options="-c ${CONFIG_FILE} -v"
if ! [[ -z ${traffic_name} ]]; then
options="${options} -t"
fi
if [[${build_tar_local} == "Force" ]]; then
options="${options} --overwrite"
fi
run_cmd "valhalla_build_extract ${options}"
fi
}
Expand Down Expand Up @@ -49,14 +53,17 @@ fi
if [[ -z $serve_tiles ]]; then
serve_tiles="True"
fi
if [[ "$force_rebuild" == "True" ]]; then
build_tar="Force"
fi

# evaluate CMD
if [[ $1 == "build_tiles" ]]; then

run_cmd "/valhalla/scripts/configure_valhalla.sh ${CONFIG_FILE} ${CUSTOM_FILES} ${TILE_DIR} ${TILE_TAR}"
# tar tiles unless not wanted
if [[ "$build_tar" == "True" ]] || [[ ${build_tar} == "Force" ]]; then
do_build_tar
if [[ "$build_tar" == "True" ]] || [[ "$build_tar" == "Force" ]]; then
do_build_tar "$build_tar"
else
echo "WARNING: Skipping tar building. Expect degraded performance while using Valhalla."
fi
Expand Down Expand Up @@ -86,7 +93,7 @@ if [[ $1 == "build_tiles" ]]; then
echo "INFO: Not serving tiles. Exiting."
fi
elif [[ $1 == "tar_tiles" ]]; then
do_build_tar
do_build_tar "$build_tar"
else
echo "ERROR: Unrecognized CMD: '$1'"
exit 1
Expand Down

0 comments on commit ac39d31

Please sign in to comment.