Use tools v4 with on-the-fly boundary generation (#750)
* Switch OMT to use the new tools v4.0.0 * borders are dynamically generated from the PBF file instead of downloading a prepared CSV file * all tools are executed as current user instead of root, thus files are easier to modify/delete if needed * all data is stored in the local file system instead of docker volumes (Docker currently has a limitation of non-root operation for internal volumes). This also makes it easier to examine and test it. * New `init-dirs` make target creates all the needed dirs - `build, data, cache` * `make clean` deletes the whole `build` dir instead of individual files. * `clean-docker` for backward compatibility deletes `cache` dirs (it used to be a volume) * all `psql` calls are now done with `ON_ERROR_STOP=1` * got rid of `pgclimb-*` targets -- same results can be done with `psql` (`pgclimb-list-views` & `pgclimb-list-tables` renamed to `list-views` and `list-tables`)
This commit is contained in:
@@ -39,7 +39,7 @@ githash=$( git rev-parse HEAD )
|
||||
# Options to run with docker and docker-compose - ensure the container is destroyed on exit,
|
||||
# as well as pass any other common parameters.
|
||||
# In the future this should use -u $(id -u "$USER"):$(id -g "$USER") instead of running docker as root.
|
||||
DC_OPTS="--rm"
|
||||
DC_OPTS="--rm -u $(id -u "$USER"):$(id -g "$USER")"
|
||||
|
||||
log_file=./quickstart.log
|
||||
rm -f $log_file
|
||||
@@ -130,10 +130,8 @@ docker images | grep openmaptiles
|
||||
|
||||
echo " "
|
||||
echo "-------------------------------------------------------------------------------------"
|
||||
echo "====> : Making directories - if they don't exist ( ./build ./data ./pgdata ) "
|
||||
mkdir -p pgdata
|
||||
mkdir -p build
|
||||
mkdir -p data
|
||||
echo "====> : Create directories if they don't exist"
|
||||
make init-dirs
|
||||
|
||||
echo " "
|
||||
echo "-------------------------------------------------------------------------------------"
|
||||
@@ -185,7 +183,7 @@ echo "--------------------------------------------------------------------------
|
||||
echo "====> : Start PostgreSQL service ; create PostgreSQL data volume "
|
||||
echo " : Source code: https://github.com/openmaptiles/postgis "
|
||||
echo " : Thank you: https://www.postgresql.org ! Thank you http://postgis.org !"
|
||||
docker-compose up -d postgres
|
||||
make db-start
|
||||
|
||||
echo " "
|
||||
echo "-------------------------------------------------------------------------------------"
|
||||
@@ -200,15 +198,7 @@ echo "====> : Start importing water data from http://osmdata.openstreetmap.de/ i
|
||||
echo " : Source code: https://github.com/openmaptiles/openmaptiles-tools/tree/master/docker/import-water "
|
||||
echo " : Data license: https://osmdata.openstreetmap.de/info/license.html "
|
||||
echo " : Thank you: https://osmdata.openstreetmap.de/info/ "
|
||||
docker-compose run $DC_OPTS import-water
|
||||
|
||||
echo " "
|
||||
echo "-------------------------------------------------------------------------------------"
|
||||
echo "====> : Start importing border data from http://openstreetmap.org into PostgreSQL "
|
||||
echo " : Source code: https://github.com/openmaptiles/openmaptiles-tools/tree/master/docker/import-osmborder"
|
||||
echo " : Data license: http://www.openstreetmap.org/copyright"
|
||||
echo " : Thank you: https://github.com/pnorman/osmborder "
|
||||
docker-compose run $DC_OPTS import-osmborder
|
||||
make import-water
|
||||
|
||||
echo " "
|
||||
echo "-------------------------------------------------------------------------------------"
|
||||
@@ -216,7 +206,7 @@ echo "====> : Start importing http://www.naturalearthdata.com into PostgreSQL
|
||||
echo " : Source code: https://github.com/openmaptiles/openmaptiles-tools/tree/master/docker/import-natural-earth "
|
||||
echo " : Terms-of-use: http://www.naturalearthdata.com/about/terms-of-use "
|
||||
echo " : Thank you: Natural Earth Contributors! "
|
||||
docker-compose run $DC_OPTS import-natural-earth
|
||||
make import-natural-earth
|
||||
|
||||
echo " "
|
||||
echo "-------------------------------------------------------------------------------------"
|
||||
@@ -224,7 +214,7 @@ echo "====> : Start importing OpenStreetMap Lakelines data "
|
||||
echo " : Source code: https://github.com/openmaptiles/openmaptiles-tools/tree/master/docker/import-lakelines "
|
||||
echo " : https://github.com/lukasmartinelli/osm-lakelines "
|
||||
echo " : Data license: .. "
|
||||
docker-compose run $DC_OPTS import-lakelines
|
||||
make import-lakelines
|
||||
|
||||
echo " "
|
||||
echo "-------------------------------------------------------------------------------------"
|
||||
@@ -234,7 +224,15 @@ echo " : Thank you Omniscale! "
|
||||
echo " : Source code: https://github.com/openmaptiles/openmaptiles-tools/tree/master/docker/import-osm "
|
||||
echo " : The OpenstreetMap data license: https://www.openstreetmap.org/copyright (ODBL) "
|
||||
echo " : Thank you OpenStreetMap Contributors ! "
|
||||
docker-compose run $DC_OPTS import-osm
|
||||
make import-osm
|
||||
|
||||
echo " "
|
||||
echo "-------------------------------------------------------------------------------------"
|
||||
echo "====> : Start importing border data from ./data/${testdata} into PostgreSQL using osmborder"
|
||||
echo " : Source code: https://github.com/pnorman/osmborder"
|
||||
echo " : Data license: http://www.openstreetmap.org/copyright"
|
||||
echo " : Thank you: Paul Norman"
|
||||
make import-borders
|
||||
|
||||
echo " "
|
||||
echo "-------------------------------------------------------------------------------------"
|
||||
@@ -242,7 +240,7 @@ echo "====> : Start SQL postprocessing: ./build/tileset.sql -> PostgreSQL "
|
||||
echo " : Source code: https://github.com/openmaptiles/openmaptiles-tools/blob/master/bin/import-sql"
|
||||
# If the output contains a WARNING, stop further processing
|
||||
# Adapted from https://unix.stackexchange.com/questions/307562
|
||||
docker-compose run $DC_OPTS openmaptiles-tools import-sql | \
|
||||
make import-sql | \
|
||||
awk -v s=": WARNING:" '$0~s{print; print "\n*** WARNING detected, aborting"; exit(1)} 1'
|
||||
|
||||
echo " "
|
||||
@@ -274,19 +272,12 @@ echo " : See other MVT tools : https://github.com/mapbox/awesome-vector-til
|
||||
echo " : "
|
||||
echo " : You will see a lot of deprecated warning in the log! This is normal! "
|
||||
echo " : like : Mapnik LOG> ... is deprecated and will be removed in Mapnik 4.x ... "
|
||||
|
||||
docker-compose -f docker-compose.yml -f ./data/docker-compose-config.yml run $DC_OPTS generate-vectortiles
|
||||
|
||||
echo " "
|
||||
echo "-------------------------------------------------------------------------------------"
|
||||
echo "====> : Add special metadata to mbtiles! "
|
||||
docker-compose run $DC_OPTS openmaptiles-tools generate-metadata ./data/tiles.mbtiles
|
||||
docker-compose run $DC_OPTS openmaptiles-tools chmod 666 ./data/tiles.mbtiles
|
||||
make generate-tiles
|
||||
|
||||
echo " "
|
||||
echo "-------------------------------------------------------------------------------------"
|
||||
echo "====> : Stop PostgreSQL service ( but we keep PostgreSQL data volume for debugging )"
|
||||
docker-compose stop postgres
|
||||
make db-stop
|
||||
|
||||
echo " "
|
||||
echo "-------------------------------------------------------------------------------------"
|
||||
@@ -320,13 +311,6 @@ echo "====> : (disk space) We have created a lot of docker images: "
|
||||
echo " : Hint: you can remove with: docker rmi IMAGE "
|
||||
docker images | grep openmaptiles
|
||||
|
||||
|
||||
echo " "
|
||||
echo "-------------------------------------------------------------------------------------"
|
||||
echo "====> : (disk space) We have created this new docker volume for PostgreSQL data:"
|
||||
echo " : Hint: you can remove with : docker volume rm openmaptiles_pgdata "
|
||||
docker volume ls -q | grep openmaptiles
|
||||
|
||||
echo " "
|
||||
echo "-------------------------------------------------------------------------------------"
|
||||
echo "====> : (disk space) We have created the new vectortiles ( ./data/tiles.mbtiles ) "
|
||||
|
||||
Reference in New Issue
Block a user