quickstart support for osmfr and bbike areas (#861)

* quickstart support for osmfr and bbike areas

- Use the `--empty` flag to start with an empty database
- Geofabrik as the default server
- osmfr is used for hierarchical area names such as `europe/austria`
- bbbike is used for Capitalized area names such as `Adelaide`
pull/870/head
zstadler 2020-05-15 08:14:14 +03:00 zatwierdzone przez GitHub
rodzic e10aa33268
commit aea7d73ece
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 47 dodań i 12 usunięć

Wyświetl plik

@ -7,20 +7,44 @@ set -o nounset
########################################### ###########################################
# OpenMapTiles quickstart.sh for x86_64 linux # OpenMapTiles quickstart.sh for x86_64 linux
# #
# Usage:
# ./quickstart.sh [--empty] [area [geofabrik|osmfr|bbbike]]
#
# Use a preloaded docker image to speed up, unless the --empty flag is used.
#
# Servers:
# geofabik: http://download.geofabrik.de (default)
# osmfr: http://download.openstreetmap.fr (default for hierarchical area names)
# bbbike: https://www.bbbike.org (default for capitalized area names)
#
# Example calls ... # Example calls ...
# ./quickstart.sh # ./quickstart.sh
# ./quickstart.sh africa # ./quickstart.sh africa
# ./quickstart.sh africa geofabrik
# ./quickstart.sh africa osmfr
# ./quickstart.sh alabama # ./quickstart.sh alabama
# ./quickstart.sh alaska # ./quickstart.sh alaska
# ./quickstart.sh albania # ./quickstart.sh albania
# ./quickstart.sh alberta # ./quickstart.sh alberta
# ./quickstart.sh alps # ./quickstart.sh alps
# ./quickstart.sh europe/austria
# ./quickstart.sh europe/austria/salzburg osmfr
# ./quickstart.sh Adelaide
# ./quickstart.sh Adelaide bbbike
# .... # ....
# #
# to list areas : make download-geofabrik-list # to list geofabrik areas: make download-geofabrik-list
# see more QUICKSTART.md # see more QUICKSTART.md
# #
# If --empty is not given, use preloaded docker image to speed up
if [ $# -gt 0 ] && [[ $1 == --empty ]]; then
export USE_PRELOADED_IMAGE=""
shift
else
export USE_PRELOADED_IMAGE=true
fi
if [ $# -eq 0 ]; then if [ $# -eq 0 ]; then
osm_area=albania # default test country osm_area=albania # default test country
echo "No parameter - set area=$osm_area " echo "No parameter - set area=$osm_area "
@ -28,7 +52,22 @@ else
osm_area=$1 osm_area=$1
fi fi
pbf_file="./data/${osm_area}-latest.osm.pbf" if [ $# -eq 2 ]; then
osm_server=$2
else
if [ ${osm_area} != $(basename ${osm_area}) ]; then
# Only openstreetmap.fr has area hierarchy
osm_server=osmfr
elif [[ ${osm_area} == [[:upper:]]* ]]; then
# Only bbbike area names are capitalized
osm_server=bbbike
else
# default OSM server
osm_server=geofabrik
fi
fi
pbf_file="./data/${osm_area##*/}-latest.osm.pbf"
## Min versions ... ## Min versions ...
MIN_COMPOSE_VER=1.7.1 MIN_COMPOSE_VER=1.7.1
@ -67,11 +106,6 @@ if [ "$(version "$DOCKER_VER")" -lt "$(version "$MIN_DOCKER_VER")" ]; then
exit 1 exit 1
fi fi
# If there are no arguments, or just the area is set, use preloaded docker image to speed up
# to force all steps, use two arguments, e.g. "./quickstart monaco empty"
(( $# == 0 || $# == 1 )) && USE_PRELOADED_IMAGE=true || USE_PRELOADED_IMAGE=""
export USE_PRELOADED_IMAGE
echo " " echo " "
echo "-------------------------------------------------------------------------------------" echo "-------------------------------------------------------------------------------------"
echo "====> : Pulling or refreshing OpenMapTiles docker images " echo "====> : Pulling or refreshing OpenMapTiles docker images "
@ -88,6 +122,7 @@ echo "--------------------------------------------------------------------------
echo "====> : OpenMapTiles quickstart! [ https://github.com/openmaptiles/openmaptiles ] " echo "====> : OpenMapTiles quickstart! [ https://github.com/openmaptiles/openmaptiles ] "
echo " : This will be logged to the $log_file file (for debugging) and to the screen" echo " : This will be logged to the $log_file file (for debugging) and to the screen"
echo " : Area : $osm_area " echo " : Area : $osm_area "
echo " : Download Server : $osm_server "
echo " : Preloaded Image : $USE_PRELOADED_IMAGE " echo " : Preloaded Image : $USE_PRELOADED_IMAGE "
echo " : Git version : $githash " echo " : Git version : $githash "
echo " : Started : $STARTDATE " echo " : Started : $STARTDATE "
@ -143,9 +178,9 @@ rm -f ./data/*.mbtiles
if [[ ! -f "${pbf_file}" || ! -f "./data/docker-compose-config.yml" ]]; then if [[ ! -f "${pbf_file}" || ! -f "./data/docker-compose-config.yml" ]]; then
echo " " echo " "
echo "-------------------------------------------------------------------------------------" echo "-------------------------------------------------------------------------------------"
echo "====> : Downloading ${osm_area} from Geofabrik..." echo "====> : Downloading ${osm_area} from ${osm_server}..."
rm -rf ./data/* rm -rf ./data/*
make download-geofabrik "area=${osm_area}" make download-${osm_server} "area=${osm_area}"
else else
echo " " echo " "
echo "-------------------------------------------------------------------------------------" echo "-------------------------------------------------------------------------------------"
@ -184,9 +219,9 @@ if [[ "$USE_PRELOADED_IMAGE" == true ]]; then
echo " : Source code: https://github.com/openmaptiles/openmaptiles-tools/tree/master/docker/import-data" echo " : Source code: https://github.com/openmaptiles/openmaptiles-tools/tree/master/docker/import-data"
echo " : includes all data from the import-data image" echo " : includes all data from the import-data image"
echo " :" echo " :"
echo " : Use two-parameter quickstart to start with an empty database:" echo " : Use the --empty flag to start with an empty database:"
echo " : ./quickstart.sh albania empty" echo " : ./quickstart.sh --empty albania "
echo " : If desired, you can manually import data by one using these commands:" echo " : If desired, you can manually import data by using these commands:"
echo " : make destroy-db" echo " : make destroy-db"
echo " : make start-db" echo " : make start-db"
echo " : make import-data" echo " : make import-data"