2016-10-28 19:56:39 +00:00
|
|
|
all: build/openmaptiles.tm2source/data.yml build/mapping.yaml build/tileset.sql
|
|
|
|
|
2016-11-30 04:39:06 +00:00
|
|
|
help:
|
|
|
|
@echo "=============================================================================="
|
|
|
|
@echo " OpenMapTiles https://github.com/openmaptiles/openmaptiles "
|
|
|
|
@echo "Hints for testing areas "
|
|
|
|
@echo " make download-geofabrik-list # list actual geofabrik OSM extracts for download -> <<your-area>> "
|
|
|
|
@echo " make list # list actual geofabrik OSM extracts for download -> <<your-area>> "
|
|
|
|
@echo " ./quickstart.sh <<your-area>> # example: ./quickstart.sh madagascar "
|
|
|
|
@echo " "
|
|
|
|
@echo "Hints for designers:"
|
2018-07-27 13:32:44 +00:00
|
|
|
@echo " make start-postserve # start Postserver + Maputnik Editor [ see localhost:8088 ] "
|
2017-01-08 12:31:24 +00:00
|
|
|
@echo " make start-tileserver # start klokantech/tileserver-gl [ see localhost:8080 ] "
|
2016-11-30 04:39:06 +00:00
|
|
|
@echo " "
|
|
|
|
@echo "Hints for developers:"
|
2018-10-12 07:46:09 +00:00
|
|
|
@echo " make # build source code"
|
2016-11-30 04:39:06 +00:00
|
|
|
@echo " make download-geofabrik area=albania # download OSM data from geofabrik, and create config file"
|
2018-10-12 07:46:09 +00:00
|
|
|
@echo " make psql # start PostgreSQL console"
|
|
|
|
@echo " make psql-list-tables # list all PostgreSQL tables"
|
2017-01-20 22:30:02 +00:00
|
|
|
@echo " make psql-vacuum-analyze # PostgreSQL: VACUUM ANALYZE"
|
|
|
|
@echo " make psql-analyze # PostgreSQL: ANALYZE"
|
2016-12-04 00:37:28 +00:00
|
|
|
@echo " make generate-qareports # generate reports [./build/qareports]"
|
2019-03-22 08:34:00 +00:00
|
|
|
@echo " make generate-devdoc # generate devdoc including graphs for all layers [./build/devdoc]"
|
|
|
|
@echo " make etl-graph # hint for generating a single etl graph"
|
|
|
|
@echo " make mapping-graph # hint for generating a single mapping graph"
|
2018-10-12 07:46:09 +00:00
|
|
|
@echo " make import-sql-dev # start import-sql /bin/bash terminal"
|
|
|
|
@echo " make import-osm-dev # start import-osm /bin/bash terminal (imposm3)"
|
|
|
|
@echo " make clean-docker # remove docker containers, PG data volume"
|
|
|
|
@echo " make forced-clean-sql # drop all PostgreSQL tables for clean environment"
|
2016-12-06 17:43:32 +00:00
|
|
|
@echo " make docker-unnecessary-clean # clean unnecessary docker image(s) and container(s)"
|
2016-11-30 04:39:06 +00:00
|
|
|
@echo " make refresh-docker-images # refresh openmaptiles docker images from Docker HUB"
|
|
|
|
@echo " make remove-docker-images # remove openmaptiles docker images"
|
|
|
|
@echo " make pgclimb-list-views # list PostgreSQL public schema views"
|
2018-10-12 07:46:09 +00:00
|
|
|
@echo " make pgclimb-list-tables # list PostgreSQL public schema tables"
|
|
|
|
@echo " cat .env # list PG database and MIN_ZOOM and MAX_ZOOM information"
|
2019-03-22 08:34:00 +00:00
|
|
|
@echo " cat quickstart.log # backup of the last ./quickstart.sh"
|
2018-10-12 07:46:09 +00:00
|
|
|
@echo " make help # help about available commands"
|
2016-11-30 04:39:06 +00:00
|
|
|
@echo "=============================================================================="
|
|
|
|
|
2019-03-22 08:34:00 +00:00
|
|
|
build:
|
|
|
|
mkdir -p build
|
2016-10-23 15:36:48 +00:00
|
|
|
|
2019-03-22 08:34:00 +00:00
|
|
|
build/openmaptiles.tm2source/data.yml: build
|
2019-03-29 21:15:42 +00:00
|
|
|
mkdir -p build/openmaptiles.tm2source
|
2019-03-22 08:34:00 +00:00
|
|
|
docker-compose run --rm openmaptiles-tools generate-tm2source openmaptiles.yaml --host="postgres" --port=5432 --database="openmaptiles" --user="openmaptiles" --password="openmaptiles" > build/openmaptiles.tm2source/data.yml
|
2016-10-23 15:36:48 +00:00
|
|
|
|
2019-03-22 08:34:00 +00:00
|
|
|
build/mapping.yaml: build
|
|
|
|
docker-compose run --rm openmaptiles-tools generate-imposm3 openmaptiles.yaml > build/mapping.yaml
|
|
|
|
|
|
|
|
build/tileset.sql: build
|
|
|
|
docker-compose run --rm openmaptiles-tools generate-sql openmaptiles.yaml > build/tileset.sql
|
2016-10-23 15:36:48 +00:00
|
|
|
|
|
|
|
clean:
|
2016-11-15 22:02:28 +00:00
|
|
|
rm -f build/openmaptiles.tm2source/data.yml && rm -f build/mapping.yaml && rm -f build/tileset.sql
|
2016-11-27 10:31:43 +00:00
|
|
|
|
2016-11-28 22:15:47 +00:00
|
|
|
clean-docker:
|
|
|
|
docker-compose down -v --remove-orphans
|
|
|
|
docker-compose rm -fv
|
|
|
|
docker volume ls -q | grep openmaptiles | xargs -r docker volume rm || true
|
|
|
|
|
2018-07-27 13:32:44 +00:00
|
|
|
db-start:
|
|
|
|
docker-compose up -d postgres
|
2017-01-20 22:30:02 +00:00
|
|
|
|
2016-11-27 10:31:43 +00:00
|
|
|
download-geofabrik:
|
2016-11-28 23:27:44 +00:00
|
|
|
@echo =============== download-geofabrik =======================
|
2016-11-27 10:31:43 +00:00
|
|
|
@echo Download area : $(area)
|
2016-11-28 23:53:52 +00:00
|
|
|
@echo [[ example: make download-geofabrik area=albania ]]
|
2016-11-28 23:27:44 +00:00
|
|
|
@echo [[ list areas: make download-geofabrik-list ]]
|
2016-11-27 10:31:43 +00:00
|
|
|
docker-compose run --rm import-osm ./download-geofabrik.sh $(area)
|
2016-11-28 23:27:44 +00:00
|
|
|
ls -la ./data/$(area).*
|
|
|
|
@echo "Generated config file: ./data/docker-compose-config.yml"
|
2016-12-04 00:37:28 +00:00
|
|
|
@echo " "
|
|
|
|
cat ./data/docker-compose-config.yml
|
|
|
|
@echo " "
|
2016-11-28 23:27:44 +00:00
|
|
|
|
2018-07-27 13:32:44 +00:00
|
|
|
psql: db-start
|
2019-02-11 12:41:00 +00:00
|
|
|
docker-compose run --rm import-osm ./psql.sh
|
2017-11-10 20:28:12 +00:00
|
|
|
|
2019-03-22 08:34:00 +00:00
|
|
|
import-osm: db-start all
|
2018-01-16 08:53:59 +00:00
|
|
|
docker-compose run --rm import-osm
|
|
|
|
|
2019-03-22 08:34:00 +00:00
|
|
|
import-sql: db-start all
|
2018-07-27 13:32:44 +00:00
|
|
|
docker-compose run --rm import-sql
|
2018-07-27 07:53:39 +00:00
|
|
|
|
2019-03-22 08:34:00 +00:00
|
|
|
import-osmsql: db-start all
|
2018-07-27 13:32:44 +00:00
|
|
|
docker-compose run --rm import-osm
|
2018-01-16 08:53:59 +00:00
|
|
|
docker-compose run --rm import-sql
|
|
|
|
|
2019-03-22 08:34:00 +00:00
|
|
|
generate-tiles: db-start all
|
2018-01-16 08:53:59 +00:00
|
|
|
rm -rf data/tiles.mbtiles
|
2018-07-27 07:53:39 +00:00
|
|
|
if [ -f ./data/docker-compose-config.yml ]; then \
|
|
|
|
docker-compose -f docker-compose.yml -f ./data/docker-compose-config.yml run --rm generate-vectortiles; \
|
|
|
|
else \
|
|
|
|
docker-compose run --rm generate-vectortiles; \
|
|
|
|
fi
|
2018-01-16 08:53:59 +00:00
|
|
|
docker-compose run --rm openmaptiles-tools generate-metadata ./data/tiles.mbtiles
|
|
|
|
docker-compose run --rm openmaptiles-tools chmod 666 ./data/tiles.mbtiles
|
|
|
|
|
2018-07-27 13:32:44 +00:00
|
|
|
|
2017-01-08 12:31:24 +00:00
|
|
|
start-tileserver:
|
2017-01-11 08:46:19 +00:00
|
|
|
@echo " "
|
2017-01-08 12:31:24 +00:00
|
|
|
@echo "***********************************************************"
|
2017-01-11 08:46:19 +00:00
|
|
|
@echo "* "
|
|
|
|
@echo "* Download/refresh klokantech/tileserver-gl docker image"
|
|
|
|
@echo "* see documentation: https://github.com/klokantech/tileserver-gl"
|
|
|
|
@echo "* "
|
2017-01-08 12:31:24 +00:00
|
|
|
@echo "***********************************************************"
|
2017-01-11 08:46:19 +00:00
|
|
|
@echo " "
|
2017-01-08 12:31:24 +00:00
|
|
|
docker pull klokantech/tileserver-gl
|
2017-01-11 08:46:19 +00:00
|
|
|
@echo " "
|
2017-01-08 12:31:24 +00:00
|
|
|
@echo "***********************************************************"
|
2017-01-11 08:46:19 +00:00
|
|
|
@echo "* "
|
2017-01-08 12:31:24 +00:00
|
|
|
@echo "* Start klokantech/tileserver-gl "
|
|
|
|
@echo "* ----------------------------> check localhost:8080 "
|
2017-01-11 08:46:19 +00:00
|
|
|
@echo "* "
|
2017-01-08 12:31:24 +00:00
|
|
|
@echo "***********************************************************"
|
|
|
|
@echo " "
|
2018-07-27 13:32:44 +00:00
|
|
|
docker run -it --rm --name tileserver-gl -v $$(pwd)/data:/data -p 8080:80 klokantech/tileserver-gl
|
|
|
|
|
|
|
|
start-postserve:
|
|
|
|
@echo " "
|
|
|
|
@echo "***********************************************************"
|
|
|
|
@echo "* "
|
|
|
|
@echo "* Bring up postserve at localhost:8090/tiles/{z}/{x}/{y}.pbf"
|
|
|
|
@echo "* "
|
|
|
|
@echo "***********************************************************"
|
|
|
|
@echo " "
|
|
|
|
docker-compose up -d postserve
|
|
|
|
docker pull maputnik/editor
|
|
|
|
@echo " "
|
|
|
|
@echo "***********************************************************"
|
|
|
|
@echo "* "
|
|
|
|
@echo "* Start maputnik/editor "
|
|
|
|
@echo "* ----------------------------> check localhost:8088 "
|
|
|
|
@echo "* "
|
|
|
|
@echo "***********************************************************"
|
|
|
|
@echo " "
|
|
|
|
docker rm -f maputnik_editor || true
|
|
|
|
docker run --name maputnik_editor -d -p 8088:8888 maputnik/editor
|
|
|
|
|
2016-12-04 00:37:28 +00:00
|
|
|
generate-qareports:
|
|
|
|
./qa/run.sh
|
|
|
|
|
2019-03-29 21:15:42 +00:00
|
|
|
build/devdoc:
|
2016-12-04 00:37:28 +00:00
|
|
|
mkdir -p ./build/devdoc
|
2019-03-22 08:34:00 +00:00
|
|
|
|
|
|
|
layers = $(notdir $(wildcard layers/*)) # all layers
|
|
|
|
|
2019-03-29 21:15:42 +00:00
|
|
|
etl-graph:
|
2019-03-22 08:34:00 +00:00
|
|
|
@echo 'Use'
|
|
|
|
@echo ' make etl-graph-[layer] to generate etl graph for [layer]'
|
|
|
|
@echo ' example: make etl-graph-poi'
|
|
|
|
@echo 'Valid layers: $(layers)'
|
|
|
|
|
|
|
|
# generate etl graph for a certain layer, e.g. etl-graph-building, etl-graph-place
|
2019-03-29 21:15:42 +00:00
|
|
|
etl-graph-%: layers/% build/devdoc
|
2019-10-27 01:28:43 +00:00
|
|
|
docker run --rm -u $$(id -u $${USER}):$$(id -g $${USER}) -v $$(pwd):/tileset openmaptiles/openmaptiles-tools generate-etlgraph layers/$*/$*.yaml ./build/devdoc
|
|
|
|
cp ./build/devdoc/etl_$*.png layers/$*/etl_diagram.png
|
2019-03-22 08:34:00 +00:00
|
|
|
|
|
|
|
mappingLayers = $(notdir $(patsubst %/mapping.yaml,%, $(wildcard layers/*/mapping.yaml))) # layers with mapping.yaml
|
|
|
|
|
|
|
|
# generate mapping graph for a certain layer, e.g. mapping-graph-building, mapping-graph-place
|
2019-03-29 21:15:42 +00:00
|
|
|
mapping-graph:
|
2019-03-22 08:34:00 +00:00
|
|
|
@echo 'Use'
|
|
|
|
@echo ' make mapping-graph-[layer] to generate mapping graph for [layer]'
|
|
|
|
@echo ' example: make mapping-graph-poi'
|
|
|
|
@echo 'Valid layers: $(mappingLayers)'
|
|
|
|
|
|
|
|
mapping-graph-%: ./layers/%/mapping.yaml build/devdoc
|
2019-10-27 01:28:43 +00:00
|
|
|
docker run --rm -u $$(id -u $${USER}):$$(id -g $${USER}) -v $$(pwd):/tileset openmaptiles/openmaptiles-tools generate-mapping-graph layers/$*/$*.yaml ./build/devdoc/mapping-diagram-$*
|
|
|
|
cp ./build/devdoc/mapping-diagram-$*.png layers/$*/mapping_diagram.png
|
2019-03-22 08:34:00 +00:00
|
|
|
|
2019-03-29 21:15:42 +00:00
|
|
|
# generate all etl and mapping graphs
|
2019-03-22 08:34:00 +00:00
|
|
|
generate-devdoc: $(addprefix etl-graph-,$(layers)) $(addprefix mapping-graph-,$(mappingLayers))
|
2018-07-27 07:53:39 +00:00
|
|
|
|
|
|
|
import-sql-dev:
|
|
|
|
docker-compose run --rm import-sql /bin/bash
|
|
|
|
|
|
|
|
import-osm-dev:
|
|
|
|
docker-compose run --rm import-osm /bin/bash
|
2018-07-27 13:32:44 +00:00
|
|
|
|
|
|
|
# the `download-geofabrik` error message mention `list`, if the area parameter is wrong. so I created a similar make command
|
|
|
|
list:
|
|
|
|
docker-compose run --rm import-osm ./download-geofabrik-list.sh
|
|
|
|
|
|
|
|
# same as a `make list`
|
|
|
|
download-geofabrik-list:
|
|
|
|
docker-compose run --rm import-osm ./download-geofabrik-list.sh
|
|
|
|
|
|
|
|
download-wikidata:
|
|
|
|
mkdir -p wikidata && docker-compose run --rm --entrypoint /usr/src/app/download-gz.sh import-wikidata
|
|
|
|
|
|
|
|
psql-list-tables:
|
2019-02-11 12:41:00 +00:00
|
|
|
docker-compose run --rm import-osm ./psql.sh -P pager=off -c "\d+"
|
2018-07-27 13:32:44 +00:00
|
|
|
|
|
|
|
psql-pg-stat-reset:
|
2019-02-11 12:41:00 +00:00
|
|
|
docker-compose run --rm import-osm ./psql.sh -P pager=off -c 'SELECT pg_stat_statements_reset();'
|
2018-07-27 13:32:44 +00:00
|
|
|
|
|
|
|
forced-clean-sql:
|
2019-02-11 12:41:00 +00:00
|
|
|
docker-compose run --rm import-osm ./psql.sh -c "DROP SCHEMA IF EXISTS public CASCADE ; CREATE SCHEMA IF NOT EXISTS public; "
|
|
|
|
docker-compose run --rm import-osm ./psql.sh -c "CREATE EXTENSION hstore; CREATE EXTENSION postgis; CREATE EXTENSION unaccent; CREATE EXTENSION fuzzystrmatch; CREATE EXTENSION osml10n; CREATE EXTENSION pg_stat_statements;"
|
|
|
|
docker-compose run --rm import-osm ./psql.sh -c "GRANT ALL ON SCHEMA public TO public;COMMENT ON SCHEMA public IS 'standard public schema';"
|
2018-07-27 13:32:44 +00:00
|
|
|
|
|
|
|
pgclimb-list-views:
|
2019-02-11 12:41:00 +00:00
|
|
|
docker-compose run --rm import-osm ./pgclimb.sh -c "select schemaname,viewname from pg_views where schemaname='public' order by viewname;" csv
|
2018-07-27 13:32:44 +00:00
|
|
|
|
|
|
|
pgclimb-list-tables:
|
2019-02-11 12:41:00 +00:00
|
|
|
docker-compose run --rm import-osm ./pgclimb.sh -c "select schemaname,tablename from pg_tables where schemaname='public' order by tablename;" csv
|
2018-07-27 13:32:44 +00:00
|
|
|
|
|
|
|
psql-vacuum-analyze:
|
|
|
|
@echo "Start - postgresql: VACUUM ANALYZE VERBOSE;"
|
2019-02-11 12:41:00 +00:00
|
|
|
docker-compose run --rm import-osm ./psql.sh -P pager=off -c 'VACUUM ANALYZE VERBOSE;'
|
2018-07-27 13:32:44 +00:00
|
|
|
|
|
|
|
psql-analyze:
|
|
|
|
@echo "Start - postgresql: ANALYZE VERBOSE ;"
|
2019-02-11 12:41:00 +00:00
|
|
|
docker-compose run --rm import-osm ./psql.sh -P pager=off -c 'ANALYZE VERBOSE;'
|
2018-07-27 13:32:44 +00:00
|
|
|
|
|
|
|
list-docker-images:
|
|
|
|
docker images | grep openmaptiles
|
|
|
|
|
|
|
|
refresh-docker-images:
|
|
|
|
docker-compose pull --ignore-pull-failures
|
|
|
|
|
|
|
|
remove-docker-images:
|
|
|
|
@echo "Deleting all openmaptiles related docker image(s)..."
|
|
|
|
@docker-compose down
|
|
|
|
@docker images | grep "openmaptiles" | awk -F" " '{print $$3}' | xargs --no-run-if-empty docker rmi -f
|
|
|
|
@docker images | grep "osm2vectortiles/mapbox-studio" | awk -F" " '{print $$3}' | xargs --no-run-if-empty docker rmi -f
|
|
|
|
@docker images | grep "klokantech/tileserver-gl" | awk -F" " '{print $$3}' | xargs --no-run-if-empty docker rmi -f
|
|
|
|
|
|
|
|
docker-unnecessary-clean:
|
|
|
|
@echo "Deleting unnecessary container(s)..."
|
|
|
|
@docker ps -a | grep Exited | awk -F" " '{print $$1}' | xargs --no-run-if-empty docker rm
|
|
|
|
@echo "Deleting unnecessary image(s)..."
|
|
|
|
@docker images | grep \<none\> | awk -F" " '{print $$3}' | xargs --no-run-if-empty docker rmi
|