2020-06-01 16:54:30 +00:00
#
# First section - common variable initialization
#
2020-05-04 20:41:55 +00:00
# Ensure that errors don't hide inside pipes
SHELL = /bin/bash
.SHELLFLAGS = -o pipefail -c
2019-12-11 14:26:25 +00:00
# Options to run with docker and docker-compose - ensure the container is destroyed on exit
2020-03-06 18:15:54 +00:00
# Containers run as the current user rather than root (so that created files are not root-owned)
2020-06-01 16:54:30 +00:00
DC_OPTS ?= --rm -u $( shell id -u) :$( shell id -g)
2019-12-12 17:40:31 +00:00
Upgrade to tools v5 - rm import-osm, new downloader... (#785)
Update to tools v5. See https://github.com/openmaptiles/openmaptiles-tools/releases/tag/v5.0.0 for the list of all changes. Other OMT-repo specific changes:
* removes `import-osm` docker usage, replacing it with `openmaptiles-tools`
* quickstart builds faster because it uses postgres with preloaded water, natural earth, and lake centerlines tables.
### Makefile targets
* `tools-dev` will open a shell in a docker to experiment and debug (instead of `import-sql-dev` and `import-osm-dev`)
* separated `start-maputnik` from `start-postserve`
* renamed `clean-docker` into `db-destroy` to make it more explicit
* cleaner `db-start`, `db-stop`, `db-destroy` targets
* `db-start-preloaded` is the same as `db-start`, except that it uses `postgis-preloaded` -- an image with preloaded water, natural-earth, and lake centerline data
* `db-start` will not recreate the container if it already exists -- this way if it was started as preloaded, it will not be rebuilt.
* better output messages
### Quickstart
* uses `postgis-preloaded` image by default to make quickstart quicker. To start with a clean db, pass 2 parameters to quickstart, e.g. `./quickstart.sh albania empty`
2020-05-05 15:53:09 +00:00
# If set to a non-empty value, will use postgis-preloaded instead of postgis docker image
2020-06-01 16:54:30 +00:00
USE_PRELOADED_IMAGE ?=
Upgrade to tools v5 - rm import-osm, new downloader... (#785)
Update to tools v5. See https://github.com/openmaptiles/openmaptiles-tools/releases/tag/v5.0.0 for the list of all changes. Other OMT-repo specific changes:
* removes `import-osm` docker usage, replacing it with `openmaptiles-tools`
* quickstart builds faster because it uses postgres with preloaded water, natural earth, and lake centerlines tables.
### Makefile targets
* `tools-dev` will open a shell in a docker to experiment and debug (instead of `import-sql-dev` and `import-osm-dev`)
* separated `start-maputnik` from `start-postserve`
* renamed `clean-docker` into `db-destroy` to make it more explicit
* cleaner `db-start`, `db-stop`, `db-destroy` targets
* `db-start-preloaded` is the same as `db-start`, except that it uses `postgis-preloaded` -- an image with preloaded water, natural-earth, and lake centerline data
* `db-start` will not recreate the container if it already exists -- this way if it was started as preloaded, it will not be rebuilt.
* better output messages
### Quickstart
* uses `postgis-preloaded` image by default to make quickstart quicker. To start with a clean db, pass 2 parameters to quickstart, e.g. `./quickstart.sh albania empty`
2020-05-05 15:53:09 +00:00
2020-05-26 19:19:52 +00:00
# Local port to use with postserve
2020-06-01 16:54:30 +00:00
PPORT ?= 8090
2020-05-26 19:19:52 +00:00
export PPORT
# Local port to use with tileserver
2020-06-01 16:54:30 +00:00
TPORT ?= 8080
2020-05-26 19:19:52 +00:00
export TPORT
2020-04-09 16:05:01 +00:00
# Allow a custom docker-compose project name
i f e q ( $( strip $ ( DC_PROJECT ) ) , )
2020-06-01 16:54:30 +00:00
DC_PROJECT := $( notdir $( shell pwd ) )
DOCKER_COMPOSE := docker-compose
2020-04-21 17:36:07 +00:00
e l s e
2020-06-01 16:54:30 +00:00
DOCKER_COMPOSE := docker-compose --project-name $( DC_PROJECT)
2020-04-09 16:05:01 +00:00
e n d i f
2020-04-24 20:44:02 +00:00
# Make some operations quieter (e.g. inside the test script)
i f e q ( $( strip $ ( QUIET ) ) , )
2020-06-01 16:54:30 +00:00
QUIET_FLAG :=
2020-04-24 20:44:02 +00:00
e l s e
2020-06-01 16:54:30 +00:00
QUIET_FLAG := --quiet
2020-04-24 20:44:02 +00:00
e n d i f
2020-04-09 16:05:01 +00:00
# Use `xargs --no-run-if-empty` flag, if supported
2020-06-01 16:54:30 +00:00
XARGS := xargs $( shell xargs --no-run-if-empty </dev/null 2>/dev/null && echo --no-run-if-empty)
2020-04-09 16:05:01 +00:00
2019-12-16 13:37:34 +00:00
# If running in the test mode, compare files rather than copy them
TEST_MODE ?= no
i f e q ( $( TEST_MODE ) , y e s )
2020-01-23 02:55:22 +00:00
# create images in ./build/devdoc and compare them to ./layers
GRAPH_PARAMS = ./build/devdoc ./layers
2019-12-16 13:37:34 +00:00
e l s e
2020-01-23 02:55:22 +00:00
# update graphs in the ./layers dir
GRAPH_PARAMS = ./layers
2019-12-16 13:37:34 +00:00
e n d i f
2020-06-01 16:54:30 +00:00
# Set OpenMapTiles host
OMT_HOST := http://$( firstword $( subst :, ,$( subst tcp://,,$( DOCKER_HOST) ) ) localhost)
2020-06-04 19:45:04 +00:00
# This defines an easy $(newline) value to act as a "\n". Make sure to keep exactly two empty lines after newline.
d e f i n e n e w l i n e
e n d e f
2020-06-01 16:54:30 +00:00
Rework download area support (#908)
Closes #904
* Make all data-related targets like `download*`, `import-osm`, `import-borders`, and `generate-tiles` into `area`-aware -- making it possible for multiple data files to coexist inside the `./data` dir.
* Add `make download area=... [url=...]` command to automatically download any kind of area by checking Geofabrik, BBBike, and OSM.fr, optionally from a custom URL. Supports `area=planet` too.
* Do not re-download area with `make download-*` if it already exists.
* Automatically rename `<area>-latest.osm.pbf` into `<area>.osm.pbf`
* If `area=...` parameter is not given to `make`, see if there is exactly one `*.osm.pbf` file, and if so, use `*` as the `area`.
* Configure many variables in the .env file, overriding the defaults in tools
* If `<area>.osm.pbf` exists, but `<area>.dc-config.pbf` is missing, generate it using `download-osm make-dc` command.
Also:
* closes #614
* closes #647
* partially addresses #261
2020-06-03 19:37:45 +00:00
#
# Determine area to work on
# If $(area) parameter is not set and data/*.osm.pbf finds only one file, use it as $(area).
# Otherwise all make targets requiring area param will show an error.
# Note: If there are no data files, and user calls make download area=... once,
# they will not need to use area= parameter after that because there will be just a single file.
#
# historically we have been using $(area) rather than $(AREA), so make both work
area ?= $( AREA)
# Ensure the $(AREA) param is set, or try to automatically determine it based on available data files
i f e q ( $( strip $ ( area ) ) , )
# if $area is not set. set it to the name of the *.osm.pbf file, but only if there is only one
data_files := $( wildcard data/*.osm.pbf)
ifneq ( $( word 2,$( data_files) ) ,)
2020-06-05 16:48:48 +00:00
AREA_ERROR := The 'area' parameter ( or env var) has not been set, and there are more than one data/*.osm.pbf files: $( patsubst data/%.osm.pbf,'%' ,$( data_files) )
Rework download area support (#908)
Closes #904
* Make all data-related targets like `download*`, `import-osm`, `import-borders`, and `generate-tiles` into `area`-aware -- making it possible for multiple data files to coexist inside the `./data` dir.
* Add `make download area=... [url=...]` command to automatically download any kind of area by checking Geofabrik, BBBike, and OSM.fr, optionally from a custom URL. Supports `area=planet` too.
* Do not re-download area with `make download-*` if it already exists.
* Automatically rename `<area>-latest.osm.pbf` into `<area>.osm.pbf`
* If `area=...` parameter is not given to `make`, see if there is exactly one `*.osm.pbf` file, and if so, use `*` as the `area`.
* Configure many variables in the .env file, overriding the defaults in tools
* If `<area>.osm.pbf` exists, but `<area>.dc-config.pbf` is missing, generate it using `download-osm make-dc` command.
Also:
* closes #614
* closes #647
* partially addresses #261
2020-06-03 19:37:45 +00:00
else
ifeq ( $( word 1,$( data_files) ) ,)
AREA_ERROR := The 'area' parameter ( or env var) has not been set, and there are no data/*.osm.pbf files
else
# Keep just the name of the data file, without the .osm.pbf extension
area := $( strip $( basename $( basename $( notdir $( data_files) ) ) ) )
# Rename area-latest.osm.pbf to area.osm.pbf
# TODO: This if statement could be removed in a few months once everyone is using the file without the `-latest`?
ifneq ( $( area) ,$( area:-latest= ) )
$( shell mv " data/ $( area) .osm.pbf " " data/ $( area:-latest= ) .osm.pbf " )
area := $( area:-latest= )
$( warning ATTENTION: File data/$( area) -latest.osm.pbf was renamed to $( area) .osm.pbf.)
AREA_INFO := Detected area = $( area) based on the found data/$( area) -latest.osm.pbf ( renamed to $( area) .osm.pbf) . Use 'area' parameter ( or env var) to override.
else
AREA_INFO := Detected area = $( area) based on the found data/ pbf file. Use 'area' parameter ( or env var) to override.
endif
endif
endif
e n d i f
# If set, this file will be downloaded in download-osm and imported in the import-osm targets
PBF_FILE ?= data/$( area) .osm.pbf
# For download-osm, allow URL parameter to download file from a given URL. Area param must still be provided.
i f n e q ( $( strip $ ( url ) ) , )
DOWNLOAD_AREA := $( url)
e l s e
DOWNLOAD_AREA := $( area)
e n d i f
# import-borders uses these temp files during border parsing/import
export BORDERS_CLEANUP_FILE ?= data/borders/$( area) .cleanup.pbf
export BORDERS_PBF_FILE ?= data/borders/$( area) .filtered.pbf
export BORDERS_CSV_FILE ?= data/borders/$( area) .lines.csv
# The file is placed into the $EXPORT_DIR=/export (mapped to ./data)
export MBTILES_FILE ?= $( area) .mbtiles
MBTILES_LOCAL_FILE = data/$( MBTILES_FILE)
# Location of the dynamically-generated imposm config file
export IMPOSM_CONFIG_FILE ?= data/$( area) .repl.json
# download-osm generates this file with metadata about the file
AREA_DC_CONFIG_FILE ?= data/$( area) .dc-config.yml
i f e q ( $( strip $ ( area ) ) , )
define assert_area_is_given
2020-06-05 16:48:48 +00:00
@echo ""
Rework download area support (#908)
Closes #904
* Make all data-related targets like `download*`, `import-osm`, `import-borders`, and `generate-tiles` into `area`-aware -- making it possible for multiple data files to coexist inside the `./data` dir.
* Add `make download area=... [url=...]` command to automatically download any kind of area by checking Geofabrik, BBBike, and OSM.fr, optionally from a custom URL. Supports `area=planet` too.
* Do not re-download area with `make download-*` if it already exists.
* Automatically rename `<area>-latest.osm.pbf` into `<area>.osm.pbf`
* If `area=...` parameter is not given to `make`, see if there is exactly one `*.osm.pbf` file, and if so, use `*` as the `area`.
* Configure many variables in the .env file, overriding the defaults in tools
* If `<area>.osm.pbf` exists, but `<area>.dc-config.pbf` is missing, generate it using `download-osm make-dc` command.
Also:
* closes #614
* closes #647
* partially addresses #261
2020-06-03 19:37:45 +00:00
@echo " ERROR: $( AREA_ERROR) "
@echo ""
@echo " make $@ area=<area-id> "
@echo ""
@echo "To download an area, use make download <area-id>"
@echo "To list downloadable areas, use make list-geofabrik and/or make list-bbbike"
@exit 1
endef
e l s e
ifneq ( $( strip $( AREA_INFO) ) ,)
define assert_area_is_given
@echo " $( AREA_INFO) "
endef
endif
e n d i f
2020-06-01 16:54:30 +00:00
#
# TARGETS
#
2019-12-11 14:26:25 +00:00
.PHONY : all
2020-05-20 15:27:42 +00:00
all : init -dirs build /openmaptiles .tm 2source /data .yml build /mapping .yaml build -sql
2016-10-28 19:56:39 +00:00
2019-12-11 14:26:25 +00:00
.PHONY : help
2016-11-30 04:39:06 +00:00
help :
@echo "=============================================================================="
@echo " OpenMapTiles https://github.com/openmaptiles/openmaptiles "
@echo "Hints for testing areas "
2020-04-09 14:49:35 +00:00
@echo " make list-geofabrik # list actual geofabrik OSM extracts for download -> <<your-area>> "
2016-11-30 04:39:06 +00:00
@echo " ./quickstart.sh <<your-area>> # example: ./quickstart.sh madagascar "
2020-04-09 14:49:35 +00:00
@echo " "
2016-11-30 04:39:06 +00:00
@echo "Hints for designers:"
2020-05-09 17:30:57 +00:00
@echo " make start-maputnik # start Maputnik Editor + dynamic tile server [ see $( OMT_HOST) :8088 ] "
2020-05-26 19:19:52 +00:00
@echo " make start-postserve # start dynamic tile server [ see $( OMT_HOST) : $( PPORT) } ] "
@echo " make start-tileserver # start maptiler/tileserver-gl [ see $( OMT_HOST) : $( TPORT) ] "
2020-04-09 14:49:35 +00:00
@echo " "
2016-11-30 04:39:06 +00:00
@echo "Hints for developers:"
2018-10-12 07:46:09 +00:00
@echo " make # build source code"
2020-04-09 14:49:35 +00:00
@echo " make list-geofabrik # list actual geofabrik OSM extracts for download"
Rework download area support (#908)
Closes #904
* Make all data-related targets like `download*`, `import-osm`, `import-borders`, and `generate-tiles` into `area`-aware -- making it possible for multiple data files to coexist inside the `./data` dir.
* Add `make download area=... [url=...]` command to automatically download any kind of area by checking Geofabrik, BBBike, and OSM.fr, optionally from a custom URL. Supports `area=planet` too.
* Do not re-download area with `make download-*` if it already exists.
* Automatically rename `<area>-latest.osm.pbf` into `<area>.osm.pbf`
* If `area=...` parameter is not given to `make`, see if there is exactly one `*.osm.pbf` file, and if so, use `*` as the `area`.
* Configure many variables in the .env file, overriding the defaults in tools
* If `<area>.osm.pbf` exists, but `<area>.dc-config.pbf` is missing, generate it using `download-osm make-dc` command.
Also:
* closes #614
* closes #647
* partially addresses #261
2020-06-03 19:37:45 +00:00
@echo " make list-bbbike # list actual BBBike OSM extracts for download"
@echo " make download area=albania # download OSM data from any source and create config file"
2020-06-01 16:54:30 +00:00
@echo " make download-geofabrik area=albania # download OSM data from geofabrik.de and create config file"
@echo " make download-osmfr area=asia/qatar # download OSM data from openstreetmap.fr and create config file"
@echo " make download-bbbike area=Amsterdam # download OSM data from bbbike.org and create config file"
2020-06-04 19:45:04 +00:00
@echo " make generate-dc-config # scan data file and generate tile generation config file with bbox"
2018-10-12 07:46:09 +00:00
@echo " make psql # start PostgreSQL console"
@echo " make psql-list-tables # list all PostgreSQL tables"
2020-05-09 17:30:57 +00:00
@echo " make vacuum-db # PostgreSQL: VACUUM ANALYZE"
@echo " make analyze-db # PostgreSQL: ANALYZE"
2020-04-21 17:36:07 +00:00
@echo " make generate-qareports # generate reports [./build/qareports]"
@echo " make generate-devdoc # generate devdoc including graphs for all layers [./layers/...]"
2020-05-09 17:30:57 +00:00
@echo " make bash # start openmaptiles-tools /bin/bash terminal"
@echo " make destroy-db # remove docker containers and PostgreSQL data volume"
@echo " make start-db # start PostgreSQL, creating it if it doesn't exist"
@echo " make start-db-preloaded # start PostgreSQL, creating data-prepopulated one if it doesn't exist"
@echo " make stop-db # stop PostgreSQL database without destroying the data"
@echo " make clean-unnecessary-docker # 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"
2020-04-21 17:36:07 +00:00
@echo " cat quickstart.log # transcript of the last ./quickstart.sh run"
2018-10-12 07:46:09 +00:00
@echo " make help # help about available commands"
2016-11-30 04:39:06 +00:00
@echo "=============================================================================="
2020-03-06 18:15:54 +00:00
.PHONY : init -dirs
init-dirs :
2020-06-08 16:26:11 +00:00
@mkdir -p build/sql/parallel
@mkdir -p build/openmaptiles.tm2source
Rework download area support (#908)
Closes #904
* Make all data-related targets like `download*`, `import-osm`, `import-borders`, and `generate-tiles` into `area`-aware -- making it possible for multiple data files to coexist inside the `./data` dir.
* Add `make download area=... [url=...]` command to automatically download any kind of area by checking Geofabrik, BBBike, and OSM.fr, optionally from a custom URL. Supports `area=planet` too.
* Do not re-download area with `make download-*` if it already exists.
* Automatically rename `<area>-latest.osm.pbf` into `<area>.osm.pbf`
* If `area=...` parameter is not given to `make`, see if there is exactly one `*.osm.pbf` file, and if so, use `*` as the `area`.
* Configure many variables in the .env file, overriding the defaults in tools
* If `<area>.osm.pbf` exists, but `<area>.dc-config.pbf` is missing, generate it using `download-osm make-dc` command.
Also:
* closes #614
* closes #647
* partially addresses #261
2020-06-03 19:37:45 +00:00
@mkdir -p data/borders
2020-04-22 06:48:57 +00:00
@mkdir -p cache
2016-10-23 15:36:48 +00:00
2020-03-06 18:15:54 +00:00
build/openmaptiles.tm2source/data.yml : init -dirs
2020-06-08 16:26:11 +00:00
i f e q ( , $( wildcard build /openmaptiles .tm 2source /data .yml ) )
2020-04-09 16:05:01 +00:00
$( DOCKER_COMPOSE) run $( DC_OPTS) openmaptiles-tools generate-tm2source openmaptiles.yaml --host= "postgres" --port= 5432 --database= "openmaptiles" --user= "openmaptiles" --password= "openmaptiles" > $@
2020-06-08 16:26:11 +00:00
e n d i f
2016-10-23 15:36:48 +00:00
2020-03-06 18:15:54 +00:00
build/mapping.yaml : init -dirs
2020-06-08 16:26:11 +00:00
i f e q ( , $( wildcard build /mapping .yaml ) )
2020-04-09 16:05:01 +00:00
$( DOCKER_COMPOSE) run $( DC_OPTS) openmaptiles-tools generate-imposm3 openmaptiles.yaml > $@
2020-06-08 16:26:11 +00:00
e n d i f
2019-03-22 08:34:00 +00:00
2020-04-22 15:15:20 +00:00
.PHONY : build -sql
build-sql : init -dirs
2020-06-08 16:26:11 +00:00
i f e q ( , $( wildcard build /sql /run_last .sql ) )
@mkdir -p build/sql/parallel
2020-05-20 17:52:18 +00:00
$( DOCKER_COMPOSE) run $( DC_OPTS) openmaptiles-tools bash -c \
' generate-sql openmaptiles.yaml --dir ./build/sql \
2020-06-01 16:46:34 +00:00
&& generate-sqltomvt openmaptiles.yaml \
--key --gzip --postgis-ver 3.0.1 \
2020-06-08 16:26:11 +00:00
--function --fname= getmvt >> ./build/sql/run_last.sql'
e n d i f
2016-10-23 15:36:48 +00:00
2019-12-11 14:26:25 +00:00
.PHONY : clean
2016-10-23 15:36:48 +00:00
clean :
2020-03-06 18:15:54 +00:00
rm -rf build
2016-11-27 10:31:43 +00:00
2020-05-09 17:30:57 +00:00
.PHONY : destroy -db
2020-06-01 16:54:30 +00:00
# TODO: Use https://stackoverflow.com/a/27852388/177275
destroy-db : DC_PROJECT := $( shell echo $ ( DC_PROJECT ) | tr A -Z a -z )
2020-05-09 17:30:57 +00:00
destroy-db :
2020-04-09 16:05:01 +00:00
$( DOCKER_COMPOSE) down -v --remove-orphans
$( DOCKER_COMPOSE) rm -fv
2020-04-24 18:38:36 +00:00
docker volume ls -q -f " name=^ $( DC_PROJECT) _ " | $( XARGS) docker volume rm
2020-03-06 18:15:54 +00:00
rm -rf cache
2016-11-28 22:15:47 +00:00
2020-05-09 17:30:57 +00:00
.PHONY : start -db -nowait
2020-05-20 15:27:42 +00:00
start-db-nowait : init -dirs
Upgrade to tools v5 - rm import-osm, new downloader... (#785)
Update to tools v5. See https://github.com/openmaptiles/openmaptiles-tools/releases/tag/v5.0.0 for the list of all changes. Other OMT-repo specific changes:
* removes `import-osm` docker usage, replacing it with `openmaptiles-tools`
* quickstart builds faster because it uses postgres with preloaded water, natural earth, and lake centerlines tables.
### Makefile targets
* `tools-dev` will open a shell in a docker to experiment and debug (instead of `import-sql-dev` and `import-osm-dev`)
* separated `start-maputnik` from `start-postserve`
* renamed `clean-docker` into `db-destroy` to make it more explicit
* cleaner `db-start`, `db-stop`, `db-destroy` targets
* `db-start-preloaded` is the same as `db-start`, except that it uses `postgis-preloaded` -- an image with preloaded water, natural-earth, and lake centerline data
* `db-start` will not recreate the container if it already exists -- this way if it was started as preloaded, it will not be rebuilt.
* better output messages
### Quickstart
* uses `postgis-preloaded` image by default to make quickstart quicker. To start with a clean db, pass 2 parameters to quickstart, e.g. `./quickstart.sh albania empty`
2020-05-05 15:53:09 +00:00
@echo " Starting postgres docker compose target using $$ {POSTGIS_IMAGE:-default} image (no recreate if exists) " && \
2020-04-22 06:48:57 +00:00
$( DOCKER_COMPOSE) up --no-recreate -d postgres
Upgrade to tools v5 - rm import-osm, new downloader... (#785)
Update to tools v5. See https://github.com/openmaptiles/openmaptiles-tools/releases/tag/v5.0.0 for the list of all changes. Other OMT-repo specific changes:
* removes `import-osm` docker usage, replacing it with `openmaptiles-tools`
* quickstart builds faster because it uses postgres with preloaded water, natural earth, and lake centerlines tables.
### Makefile targets
* `tools-dev` will open a shell in a docker to experiment and debug (instead of `import-sql-dev` and `import-osm-dev`)
* separated `start-maputnik` from `start-postserve`
* renamed `clean-docker` into `db-destroy` to make it more explicit
* cleaner `db-start`, `db-stop`, `db-destroy` targets
* `db-start-preloaded` is the same as `db-start`, except that it uses `postgis-preloaded` -- an image with preloaded water, natural-earth, and lake centerline data
* `db-start` will not recreate the container if it already exists -- this way if it was started as preloaded, it will not be rebuilt.
* better output messages
### Quickstart
* uses `postgis-preloaded` image by default to make quickstart quicker. To start with a clean db, pass 2 parameters to quickstart, e.g. `./quickstart.sh albania empty`
2020-05-05 15:53:09 +00:00
2020-05-09 17:30:57 +00:00
.PHONY : start -db
start-db : start -db -nowait
2019-12-12 17:40:31 +00:00
@echo "Wait for PostgreSQL to start..."
Upgrade to tools v5 - rm import-osm, new downloader... (#785)
Update to tools v5. See https://github.com/openmaptiles/openmaptiles-tools/releases/tag/v5.0.0 for the list of all changes. Other OMT-repo specific changes:
* removes `import-osm` docker usage, replacing it with `openmaptiles-tools`
* quickstart builds faster because it uses postgres with preloaded water, natural earth, and lake centerlines tables.
### Makefile targets
* `tools-dev` will open a shell in a docker to experiment and debug (instead of `import-sql-dev` and `import-osm-dev`)
* separated `start-maputnik` from `start-postserve`
* renamed `clean-docker` into `db-destroy` to make it more explicit
* cleaner `db-start`, `db-stop`, `db-destroy` targets
* `db-start-preloaded` is the same as `db-start`, except that it uses `postgis-preloaded` -- an image with preloaded water, natural-earth, and lake centerline data
* `db-start` will not recreate the container if it already exists -- this way if it was started as preloaded, it will not be rebuilt.
* better output messages
### Quickstart
* uses `postgis-preloaded` image by default to make quickstart quicker. To start with a clean db, pass 2 parameters to quickstart, e.g. `./quickstart.sh albania empty`
2020-05-05 15:53:09 +00:00
$( DOCKER_COMPOSE) run $( DC_OPTS) openmaptiles-tools pgwait
2020-05-09 17:30:57 +00:00
# Wrap start-db target but use the preloaded image
.PHONY : start -db -preloaded
start-db-preloaded : export POSTGIS_IMAGE =openmaptiles /postgis -preloaded
2020-05-20 15:50:54 +00:00
start-db-preloaded : export COMPOSE_HTTP_TIMEOUT =180
2020-05-09 17:30:57 +00:00
start-db-preloaded : start -db
2017-01-20 22:30:02 +00:00
2020-05-09 17:30:57 +00:00
.PHONY : stop -db
stop-db :
2020-04-22 06:48:57 +00:00
@echo "Stopping PostgreSQL..."
2020-04-09 16:05:01 +00:00
$( DOCKER_COMPOSE) stop postgres
2020-03-06 18:15:54 +00:00
2020-04-22 15:15:20 +00:00
.PHONY : list -geofabrik
2020-05-20 15:27:42 +00:00
list-geofabrik : init -dirs
2020-04-22 15:15:20 +00:00
$( DOCKER_COMPOSE) run $( DC_OPTS) openmaptiles-tools download-osm list geofabrik
2020-06-01 16:54:30 +00:00
.PHONY : list -bbbike
list-bbbike : init -dirs
$( DOCKER_COMPOSE) run $( DC_OPTS) openmaptiles-tools download-osm list bbbike
Rework download area support (#908)
Closes #904
* Make all data-related targets like `download*`, `import-osm`, `import-borders`, and `generate-tiles` into `area`-aware -- making it possible for multiple data files to coexist inside the `./data` dir.
* Add `make download area=... [url=...]` command to automatically download any kind of area by checking Geofabrik, BBBike, and OSM.fr, optionally from a custom URL. Supports `area=planet` too.
* Do not re-download area with `make download-*` if it already exists.
* Automatically rename `<area>-latest.osm.pbf` into `<area>.osm.pbf`
* If `area=...` parameter is not given to `make`, see if there is exactly one `*.osm.pbf` file, and if so, use `*` as the `area`.
* Configure many variables in the .env file, overriding the defaults in tools
* If `<area>.osm.pbf` exists, but `<area>.dc-config.pbf` is missing, generate it using `download-osm make-dc` command.
Also:
* closes #614
* closes #647
* partially addresses #261
2020-06-03 19:37:45 +00:00
#
# download, download-geofabrik, download-osmfr, and download-bbbike are handled here
# The --imposm-cfg will fail for some of the sources, but we ignore that error -- only needed for diff mode
#
2020-06-01 16:54:30 +00:00
OSM_SERVERS := geofabrik osmfr bbbike
Rework download area support (#908)
Closes #904
* Make all data-related targets like `download*`, `import-osm`, `import-borders`, and `generate-tiles` into `area`-aware -- making it possible for multiple data files to coexist inside the `./data` dir.
* Add `make download area=... [url=...]` command to automatically download any kind of area by checking Geofabrik, BBBike, and OSM.fr, optionally from a custom URL. Supports `area=planet` too.
* Do not re-download area with `make download-*` if it already exists.
* Automatically rename `<area>-latest.osm.pbf` into `<area>.osm.pbf`
* If `area=...` parameter is not given to `make`, see if there is exactly one `*.osm.pbf` file, and if so, use `*` as the `area`.
* Configure many variables in the .env file, overriding the defaults in tools
* If `<area>.osm.pbf` exists, but `<area>.dc-config.pbf` is missing, generate it using `download-osm make-dc` command.
Also:
* closes #614
* closes #647
* partially addresses #261
2020-06-03 19:37:45 +00:00
ALL_DOWNLOADS := $( addprefix download-,$( OSM_SERVERS) ) download
OSM_SERVER = $( patsubst download,,$( patsubst download-%,%,$@ ) )
2020-04-21 17:36:07 +00:00
.PHONY : $( ALL_DOWNLOADS )
$(ALL_DOWNLOADS) : init -dirs
Rework download area support (#908)
Closes #904
* Make all data-related targets like `download*`, `import-osm`, `import-borders`, and `generate-tiles` into `area`-aware -- making it possible for multiple data files to coexist inside the `./data` dir.
* Add `make download area=... [url=...]` command to automatically download any kind of area by checking Geofabrik, BBBike, and OSM.fr, optionally from a custom URL. Supports `area=planet` too.
* Do not re-download area with `make download-*` if it already exists.
* Automatically rename `<area>-latest.osm.pbf` into `<area>.osm.pbf`
* If `area=...` parameter is not given to `make`, see if there is exactly one `*.osm.pbf` file, and if so, use `*` as the `area`.
* Configure many variables in the .env file, overriding the defaults in tools
* If `<area>.osm.pbf` exists, but `<area>.dc-config.pbf` is missing, generate it using `download-osm make-dc` command.
Also:
* closes #614
* closes #647
* partially addresses #261
2020-06-03 19:37:45 +00:00
@$( assert_area_is_given)
i f n e q ( $( strip $ ( url ) ) , )
2020-06-04 19:45:04 +00:00
$( if $( OSM_SERVER) ,$( error url parameter can only be used with non-specific download target:$( newline) make download area = $( area) url = " $( url) " $( newline) ) )
Rework download area support (#908)
Closes #904
* Make all data-related targets like `download*`, `import-osm`, `import-borders`, and `generate-tiles` into `area`-aware -- making it possible for multiple data files to coexist inside the `./data` dir.
* Add `make download area=... [url=...]` command to automatically download any kind of area by checking Geofabrik, BBBike, and OSM.fr, optionally from a custom URL. Supports `area=planet` too.
* Do not re-download area with `make download-*` if it already exists.
* Automatically rename `<area>-latest.osm.pbf` into `<area>.osm.pbf`
* If `area=...` parameter is not given to `make`, see if there is exactly one `*.osm.pbf` file, and if so, use `*` as the `area`.
* Configure many variables in the .env file, overriding the defaults in tools
* If `<area>.osm.pbf` exists, but `<area>.dc-config.pbf` is missing, generate it using `download-osm make-dc` command.
Also:
* closes #614
* closes #647
* partially addresses #261
2020-06-03 19:37:45 +00:00
e n d i f
2020-06-04 19:45:04 +00:00
i f e q ( , $( wildcard $ ( PBF_FILE ) ) )
@echo " Downloading $( DOWNLOAD_AREA) into $( PBF_FILE) from $( if $( OSM_SERVER) ,$( OSM_SERVER) ,any source ) "
Rework download area support (#908)
Closes #904
* Make all data-related targets like `download*`, `import-osm`, `import-borders`, and `generate-tiles` into `area`-aware -- making it possible for multiple data files to coexist inside the `./data` dir.
* Add `make download area=... [url=...]` command to automatically download any kind of area by checking Geofabrik, BBBike, and OSM.fr, optionally from a custom URL. Supports `area=planet` too.
* Do not re-download area with `make download-*` if it already exists.
* Automatically rename `<area>-latest.osm.pbf` into `<area>.osm.pbf`
* If `area=...` parameter is not given to `make`, see if there is exactly one `*.osm.pbf` file, and if so, use `*` as the `area`.
* Configure many variables in the .env file, overriding the defaults in tools
* If `<area>.osm.pbf` exists, but `<area>.dc-config.pbf` is missing, generate it using `download-osm make-dc` command.
Also:
* closes #614
* closes #647
* partially addresses #261
2020-06-03 19:37:45 +00:00
@$( DOCKER_COMPOSE) run $( DC_OPTS) openmaptiles-tools bash -c ' \
2020-06-04 19:45:04 +00:00
if [ [ " $$ DIFF_MODE " = = "true" ] ] ; then \
download-osm $( OSM_SERVER) " $( DOWNLOAD_AREA) " \
--imposm-cfg " $( IMPOSM_CONFIG_FILE) " \
--output " $( PBF_FILE) " ; \
else \
download-osm $( OSM_SERVER) " $( DOWNLOAD_AREA) " \
--output " $( PBF_FILE) " ; \
Rework download area support (#908)
Closes #904
* Make all data-related targets like `download*`, `import-osm`, `import-borders`, and `generate-tiles` into `area`-aware -- making it possible for multiple data files to coexist inside the `./data` dir.
* Add `make download area=... [url=...]` command to automatically download any kind of area by checking Geofabrik, BBBike, and OSM.fr, optionally from a custom URL. Supports `area=planet` too.
* Do not re-download area with `make download-*` if it already exists.
* Automatically rename `<area>-latest.osm.pbf` into `<area>.osm.pbf`
* If `area=...` parameter is not given to `make`, see if there is exactly one `*.osm.pbf` file, and if so, use `*` as the `area`.
* Configure many variables in the .env file, overriding the defaults in tools
* If `<area>.osm.pbf` exists, but `<area>.dc-config.pbf` is missing, generate it using `download-osm make-dc` command.
Also:
* closes #614
* closes #647
* partially addresses #261
2020-06-03 19:37:45 +00:00
fi '
2020-04-21 17:36:07 +00:00
@echo ""
e l s e
2020-06-04 19:45:04 +00:00
@echo " Data files $( PBF_FILE) already exists, skipping the download. "
e n d i f
.PHONY : generate -dc -config
generate-dc-config :
@$( assert_area_is_given)
Rework download area support (#908)
Closes #904
* Make all data-related targets like `download*`, `import-osm`, `import-borders`, and `generate-tiles` into `area`-aware -- making it possible for multiple data files to coexist inside the `./data` dir.
* Add `make download area=... [url=...]` command to automatically download any kind of area by checking Geofabrik, BBBike, and OSM.fr, optionally from a custom URL. Supports `area=planet` too.
* Do not re-download area with `make download-*` if it already exists.
* Automatically rename `<area>-latest.osm.pbf` into `<area>.osm.pbf`
* If `area=...` parameter is not given to `make`, see if there is exactly one `*.osm.pbf` file, and if so, use `*` as the `area`.
* Configure many variables in the .env file, overriding the defaults in tools
* If `<area>.osm.pbf` exists, but `<area>.dc-config.pbf` is missing, generate it using `download-osm make-dc` command.
Also:
* closes #614
* closes #647
* partially addresses #261
2020-06-03 19:37:45 +00:00
i f e q ( , $( wildcard $ ( AREA_DC_CONFIG_FILE ) ) )
@$( DOCKER_COMPOSE) run $( DC_OPTS) openmaptiles-tools bash -c ' \
2020-06-04 19:45:04 +00:00
download-osm make-dc " $( PBF_FILE) " \
--make-dc " $( AREA_DC_CONFIG_FILE) " \
Rework download area support (#908)
Closes #904
* Make all data-related targets like `download*`, `import-osm`, `import-borders`, and `generate-tiles` into `area`-aware -- making it possible for multiple data files to coexist inside the `./data` dir.
* Add `make download area=... [url=...]` command to automatically download any kind of area by checking Geofabrik, BBBike, and OSM.fr, optionally from a custom URL. Supports `area=planet` too.
* Do not re-download area with `make download-*` if it already exists.
* Automatically rename `<area>-latest.osm.pbf` into `<area>.osm.pbf`
* If `area=...` parameter is not given to `make`, see if there is exactly one `*.osm.pbf` file, and if so, use `*` as the `area`.
* Configure many variables in the .env file, overriding the defaults in tools
* If `<area>.osm.pbf` exists, but `<area>.dc-config.pbf` is missing, generate it using `download-osm make-dc` command.
Also:
* closes #614
* closes #647
* partially addresses #261
2020-06-03 19:37:45 +00:00
--id " $( area) " '
e l s e
2020-06-04 19:45:04 +00:00
@echo " Configuration file $( AREA_DC_CONFIG_FILE) already exists, no need to regenerate. "
2020-04-21 17:36:07 +00:00
e n d i f
2016-11-28 23:27:44 +00:00
2019-12-11 14:26:25 +00:00
.PHONY : psql
2020-05-09 17:30:57 +00:00
psql : start -db -nowait
Upgrade to tools v5 - rm import-osm, new downloader... (#785)
Update to tools v5. See https://github.com/openmaptiles/openmaptiles-tools/releases/tag/v5.0.0 for the list of all changes. Other OMT-repo specific changes:
* removes `import-osm` docker usage, replacing it with `openmaptiles-tools`
* quickstart builds faster because it uses postgres with preloaded water, natural earth, and lake centerlines tables.
### Makefile targets
* `tools-dev` will open a shell in a docker to experiment and debug (instead of `import-sql-dev` and `import-osm-dev`)
* separated `start-maputnik` from `start-postserve`
* renamed `clean-docker` into `db-destroy` to make it more explicit
* cleaner `db-start`, `db-stop`, `db-destroy` targets
* `db-start-preloaded` is the same as `db-start`, except that it uses `postgis-preloaded` -- an image with preloaded water, natural-earth, and lake centerline data
* `db-start` will not recreate the container if it already exists -- this way if it was started as preloaded, it will not be rebuilt.
* better output messages
### Quickstart
* uses `postgis-preloaded` image by default to make quickstart quicker. To start with a clean db, pass 2 parameters to quickstart, e.g. `./quickstart.sh albania empty`
2020-05-05 15:53:09 +00:00
$( DOCKER_COMPOSE) run $( DC_OPTS) openmaptiles-tools sh -c 'pgwait && psql.sh'
2017-11-10 20:28:12 +00:00
2019-12-11 14:26:25 +00:00
.PHONY : import -osm
2020-05-09 17:30:57 +00:00
import-osm : all start -db -nowait
Rework download area support (#908)
Closes #904
* Make all data-related targets like `download*`, `import-osm`, `import-borders`, and `generate-tiles` into `area`-aware -- making it possible for multiple data files to coexist inside the `./data` dir.
* Add `make download area=... [url=...]` command to automatically download any kind of area by checking Geofabrik, BBBike, and OSM.fr, optionally from a custom URL. Supports `area=planet` too.
* Do not re-download area with `make download-*` if it already exists.
* Automatically rename `<area>-latest.osm.pbf` into `<area>.osm.pbf`
* If `area=...` parameter is not given to `make`, see if there is exactly one `*.osm.pbf` file, and if so, use `*` as the `area`.
* Configure many variables in the .env file, overriding the defaults in tools
* If `<area>.osm.pbf` exists, but `<area>.dc-config.pbf` is missing, generate it using `download-osm make-dc` command.
Also:
* closes #614
* closes #647
* partially addresses #261
2020-06-03 19:37:45 +00:00
@$( assert_area_is_given)
2020-05-06 15:27:14 +00:00
$( DOCKER_COMPOSE) run $( DC_OPTS) openmaptiles-tools sh -c 'pgwait && import-osm $(PBF_FILE)'
2018-01-16 08:53:59 +00:00
Upgrade to tools v5 - rm import-osm, new downloader... (#785)
Update to tools v5. See https://github.com/openmaptiles/openmaptiles-tools/releases/tag/v5.0.0 for the list of all changes. Other OMT-repo specific changes:
* removes `import-osm` docker usage, replacing it with `openmaptiles-tools`
* quickstart builds faster because it uses postgres with preloaded water, natural earth, and lake centerlines tables.
### Makefile targets
* `tools-dev` will open a shell in a docker to experiment and debug (instead of `import-sql-dev` and `import-osm-dev`)
* separated `start-maputnik` from `start-postserve`
* renamed `clean-docker` into `db-destroy` to make it more explicit
* cleaner `db-start`, `db-stop`, `db-destroy` targets
* `db-start-preloaded` is the same as `db-start`, except that it uses `postgis-preloaded` -- an image with preloaded water, natural-earth, and lake centerline data
* `db-start` will not recreate the container if it already exists -- this way if it was started as preloaded, it will not be rebuilt.
* better output messages
### Quickstart
* uses `postgis-preloaded` image by default to make quickstart quicker. To start with a clean db, pass 2 parameters to quickstart, e.g. `./quickstart.sh albania empty`
2020-05-05 15:53:09 +00:00
.PHONY : update -osm
2020-05-09 17:30:57 +00:00
update-osm : all start -db -nowait
Upgrade to tools v5 - rm import-osm, new downloader... (#785)
Update to tools v5. See https://github.com/openmaptiles/openmaptiles-tools/releases/tag/v5.0.0 for the list of all changes. Other OMT-repo specific changes:
* removes `import-osm` docker usage, replacing it with `openmaptiles-tools`
* quickstart builds faster because it uses postgres with preloaded water, natural earth, and lake centerlines tables.
### Makefile targets
* `tools-dev` will open a shell in a docker to experiment and debug (instead of `import-sql-dev` and `import-osm-dev`)
* separated `start-maputnik` from `start-postserve`
* renamed `clean-docker` into `db-destroy` to make it more explicit
* cleaner `db-start`, `db-stop`, `db-destroy` targets
* `db-start-preloaded` is the same as `db-start`, except that it uses `postgis-preloaded` -- an image with preloaded water, natural-earth, and lake centerline data
* `db-start` will not recreate the container if it already exists -- this way if it was started as preloaded, it will not be rebuilt.
* better output messages
### Quickstart
* uses `postgis-preloaded` image by default to make quickstart quicker. To start with a clean db, pass 2 parameters to quickstart, e.g. `./quickstart.sh albania empty`
2020-05-05 15:53:09 +00:00
$( DOCKER_COMPOSE) run $( DC_OPTS) openmaptiles-tools sh -c 'pgwait && import-update'
.PHONY : import -diff
2020-05-09 17:30:57 +00:00
import-diff : all start -db -nowait
Upgrade to tools v5 - rm import-osm, new downloader... (#785)
Update to tools v5. See https://github.com/openmaptiles/openmaptiles-tools/releases/tag/v5.0.0 for the list of all changes. Other OMT-repo specific changes:
* removes `import-osm` docker usage, replacing it with `openmaptiles-tools`
* quickstart builds faster because it uses postgres with preloaded water, natural earth, and lake centerlines tables.
### Makefile targets
* `tools-dev` will open a shell in a docker to experiment and debug (instead of `import-sql-dev` and `import-osm-dev`)
* separated `start-maputnik` from `start-postserve`
* renamed `clean-docker` into `db-destroy` to make it more explicit
* cleaner `db-start`, `db-stop`, `db-destroy` targets
* `db-start-preloaded` is the same as `db-start`, except that it uses `postgis-preloaded` -- an image with preloaded water, natural-earth, and lake centerline data
* `db-start` will not recreate the container if it already exists -- this way if it was started as preloaded, it will not be rebuilt.
* better output messages
### Quickstart
* uses `postgis-preloaded` image by default to make quickstart quicker. To start with a clean db, pass 2 parameters to quickstart, e.g. `./quickstart.sh albania empty`
2020-05-05 15:53:09 +00:00
$( DOCKER_COMPOSE) run $( DC_OPTS) openmaptiles-tools sh -c 'pgwait && import-diff'
2020-03-06 18:15:54 +00:00
2020-04-22 06:48:57 +00:00
.PHONY : import -data
2020-05-09 17:30:57 +00:00
import-data : start -db
2020-04-22 06:48:57 +00:00
$( DOCKER_COMPOSE) run $( DC_OPTS) import-data
2020-03-06 18:15:54 +00:00
.PHONY : import -borders
2020-05-09 17:30:57 +00:00
import-borders : start -db -nowait
Rework download area support (#908)
Closes #904
* Make all data-related targets like `download*`, `import-osm`, `import-borders`, and `generate-tiles` into `area`-aware -- making it possible for multiple data files to coexist inside the `./data` dir.
* Add `make download area=... [url=...]` command to automatically download any kind of area by checking Geofabrik, BBBike, and OSM.fr, optionally from a custom URL. Supports `area=planet` too.
* Do not re-download area with `make download-*` if it already exists.
* Automatically rename `<area>-latest.osm.pbf` into `<area>.osm.pbf`
* If `area=...` parameter is not given to `make`, see if there is exactly one `*.osm.pbf` file, and if so, use `*` as the `area`.
* Configure many variables in the .env file, overriding the defaults in tools
* If `<area>.osm.pbf` exists, but `<area>.dc-config.pbf` is missing, generate it using `download-osm make-dc` command.
Also:
* closes #614
* closes #647
* partially addresses #261
2020-06-03 19:37:45 +00:00
@$( assert_area_is_given)
# If CSV borders file already exists, use it without re-parsing
$( DOCKER_COMPOSE) run $( DC_OPTS) openmaptiles-tools sh -c \
2020-06-05 16:48:48 +00:00
'pgwait && import-borders $$([ -f "$(BORDERS_CSV_FILE)" ] && echo load $(BORDERS_CSV_FILE) || echo import $(PBF_FILE))'
2020-03-06 18:15:54 +00:00
2020-04-22 15:15:20 +00:00
.PHONY : import -sql
2020-05-09 17:30:57 +00:00
import-sql : all start -db -nowait
Upgrade to tools v5 - rm import-osm, new downloader... (#785)
Update to tools v5. See https://github.com/openmaptiles/openmaptiles-tools/releases/tag/v5.0.0 for the list of all changes. Other OMT-repo specific changes:
* removes `import-osm` docker usage, replacing it with `openmaptiles-tools`
* quickstart builds faster because it uses postgres with preloaded water, natural earth, and lake centerlines tables.
### Makefile targets
* `tools-dev` will open a shell in a docker to experiment and debug (instead of `import-sql-dev` and `import-osm-dev`)
* separated `start-maputnik` from `start-postserve`
* renamed `clean-docker` into `db-destroy` to make it more explicit
* cleaner `db-start`, `db-stop`, `db-destroy` targets
* `db-start-preloaded` is the same as `db-start`, except that it uses `postgis-preloaded` -- an image with preloaded water, natural-earth, and lake centerline data
* `db-start` will not recreate the container if it already exists -- this way if it was started as preloaded, it will not be rebuilt.
* better output messages
### Quickstart
* uses `postgis-preloaded` image by default to make quickstart quicker. To start with a clean db, pass 2 parameters to quickstart, e.g. `./quickstart.sh albania empty`
2020-05-05 15:53:09 +00:00
$( DOCKER_COMPOSE) run $( DC_OPTS) openmaptiles-tools sh -c 'pgwait && import-sql' | \
2020-05-04 17:28:23 +00:00
awk -v s = ": WARNING:" '$$0~s{print; print "\n*** WARNING detected, aborting"; exit(1)} 1'
2018-01-16 08:53:59 +00:00
Rework download area support (#908)
Closes #904
* Make all data-related targets like `download*`, `import-osm`, `import-borders`, and `generate-tiles` into `area`-aware -- making it possible for multiple data files to coexist inside the `./data` dir.
* Add `make download area=... [url=...]` command to automatically download any kind of area by checking Geofabrik, BBBike, and OSM.fr, optionally from a custom URL. Supports `area=planet` too.
* Do not re-download area with `make download-*` if it already exists.
* Automatically rename `<area>-latest.osm.pbf` into `<area>.osm.pbf`
* If `area=...` parameter is not given to `make`, see if there is exactly one `*.osm.pbf` file, and if so, use `*` as the `area`.
* Configure many variables in the .env file, overriding the defaults in tools
* If `<area>.osm.pbf` exists, but `<area>.dc-config.pbf` is missing, generate it using `download-osm make-dc` command.
Also:
* closes #614
* closes #647
* partially addresses #261
2020-06-03 19:37:45 +00:00
i f n e q ( $( wildcard $ ( AREA_DC_CONFIG_FILE ) ) , )
DC_CONFIG_TILES := -f docker-compose.yml -f $( AREA_DC_CONFIG_FILE)
2020-04-21 17:36:07 +00:00
e n d i f
Rework download area support (#908)
Closes #904
* Make all data-related targets like `download*`, `import-osm`, `import-borders`, and `generate-tiles` into `area`-aware -- making it possible for multiple data files to coexist inside the `./data` dir.
* Add `make download area=... [url=...]` command to automatically download any kind of area by checking Geofabrik, BBBike, and OSM.fr, optionally from a custom URL. Supports `area=planet` too.
* Do not re-download area with `make download-*` if it already exists.
* Automatically rename `<area>-latest.osm.pbf` into `<area>.osm.pbf`
* If `area=...` parameter is not given to `make`, see if there is exactly one `*.osm.pbf` file, and if so, use `*` as the `area`.
* Configure many variables in the .env file, overriding the defaults in tools
* If `<area>.osm.pbf` exists, but `<area>.dc-config.pbf` is missing, generate it using `download-osm make-dc` command.
Also:
* closes #614
* closes #647
* partially addresses #261
2020-06-03 19:37:45 +00:00
.PHONY : generate -tiles
2020-05-20 15:27:42 +00:00
generate-tiles : all start -db
Rework download area support (#908)
Closes #904
* Make all data-related targets like `download*`, `import-osm`, `import-borders`, and `generate-tiles` into `area`-aware -- making it possible for multiple data files to coexist inside the `./data` dir.
* Add `make download area=... [url=...]` command to automatically download any kind of area by checking Geofabrik, BBBike, and OSM.fr, optionally from a custom URL. Supports `area=planet` too.
* Do not re-download area with `make download-*` if it already exists.
* Automatically rename `<area>-latest.osm.pbf` into `<area>.osm.pbf`
* If `area=...` parameter is not given to `make`, see if there is exactly one `*.osm.pbf` file, and if so, use `*` as the `area`.
* Configure many variables in the .env file, overriding the defaults in tools
* If `<area>.osm.pbf` exists, but `<area>.dc-config.pbf` is missing, generate it using `download-osm make-dc` command.
Also:
* closes #614
* closes #647
* partially addresses #261
2020-06-03 19:37:45 +00:00
@$( assert_area_is_given)
@echo " Generating tiles into $( MBTILES_LOCAL_FILE) (will delete if already exists)... "
@rm -rf " $( MBTILES_LOCAL_FILE) "
2020-04-21 17:36:07 +00:00
$( DOCKER_COMPOSE) $( DC_CONFIG_TILES) run $( DC_OPTS) generate-vectortiles
2020-04-22 15:15:20 +00:00
@echo "Updating generated tile metadata ..."
2020-06-01 16:15:36 +00:00
$( DOCKER_COMPOSE) $( DC_CONFIG_TILES) run $( DC_OPTS) openmaptiles-tools \
Rework download area support (#908)
Closes #904
* Make all data-related targets like `download*`, `import-osm`, `import-borders`, and `generate-tiles` into `area`-aware -- making it possible for multiple data files to coexist inside the `./data` dir.
* Add `make download area=... [url=...]` command to automatically download any kind of area by checking Geofabrik, BBBike, and OSM.fr, optionally from a custom URL. Supports `area=planet` too.
* Do not re-download area with `make download-*` if it already exists.
* Automatically rename `<area>-latest.osm.pbf` into `<area>.osm.pbf`
* If `area=...` parameter is not given to `make`, see if there is exactly one `*.osm.pbf` file, and if so, use `*` as the `area`.
* Configure many variables in the .env file, overriding the defaults in tools
* If `<area>.osm.pbf` exists, but `<area>.dc-config.pbf` is missing, generate it using `download-osm make-dc` command.
Also:
* closes #614
* closes #647
* partially addresses #261
2020-06-03 19:37:45 +00:00
mbtiles-tools meta-generate " $( MBTILES_LOCAL_FILE) " ./openmaptiles.yaml --auto-minmax --show-ranges
2018-07-27 13:32:44 +00:00
2020-05-09 17:30:57 +00:00
.PHONY : start -tileserver
start-tileserver : init -dirs
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 "* "
2020-04-21 17:51:03 +00:00
@echo "* Download/refresh maptiler/tileserver-gl docker image"
@echo "* see documentation: https://github.com/maptiler/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 " "
2020-04-21 17:51:03 +00:00
docker pull maptiler/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 "* "
2020-04-21 17:51:03 +00:00
@echo "* Start maptiler/tileserver-gl "
2020-05-26 19:19:52 +00:00
@echo " * ----------------------------> check $( OMT_HOST) : $( TPORT) "
2017-01-11 08:46:19 +00:00
@echo "* "
2017-01-08 12:31:24 +00:00
@echo "***********************************************************"
@echo " "
2020-05-26 19:19:52 +00:00
docker run $( DC_OPTS) -it --name tileserver-gl -v $$ ( pwd ) /data:/data -p $( TPORT) :$( TPORT) maptiler/tileserver-gl --port $( TPORT)
2018-07-27 13:32:44 +00:00
2020-05-09 17:30:57 +00:00
.PHONY : start -postserve
start-postserve : start -db
2018-07-27 13:32:44 +00:00
@echo " "
@echo "***********************************************************"
@echo "* "
2020-05-26 19:19:52 +00:00
@echo " * Bring up postserve at $( OMT_HOST) : $( PPORT) "
2020-05-09 17:30:57 +00:00
@echo "* --> can view it locally (use make start-maputnik)"
2020-04-22 15:15:20 +00:00
@echo "* --> or can use https://maputnik.github.io/editor"
@echo "* "
2020-05-26 19:19:52 +00:00
@echo " * set data source / TileJSON URL to $( OMT_HOST) : $( PPORT) "
2018-07-27 13:32:44 +00:00
@echo "* "
@echo "***********************************************************"
@echo " "
2020-04-09 16:05:01 +00:00
$( DOCKER_COMPOSE) up -d postserve
2020-04-22 15:15:20 +00:00
2020-05-09 17:30:57 +00:00
.PHONY : stop -postserve
stop-postserve :
2020-04-22 15:15:20 +00:00
$( DOCKER_COMPOSE) stop postserve
2020-05-09 17:30:57 +00:00
.PHONY : start -maputnik
start-maputnik : stop -maputnik start -postserve
2018-07-27 13:32:44 +00:00
@echo " "
@echo "***********************************************************"
@echo "* "
@echo "* Start maputnik/editor "
2020-05-15 04:08:37 +00:00
@echo " * ---> go to $( OMT_HOST) :8088 "
2020-05-26 19:19:52 +00:00
@echo " * ---> set data source / TileJSON URL to $( OMT_HOST) : $( PPORT) "
2018-07-27 13:32:44 +00:00
@echo "* "
@echo "***********************************************************"
@echo " "
2019-12-11 14:26:25 +00:00
docker run $( DC_OPTS) --name maputnik_editor -d -p 8088:8888 maputnik/editor
2018-07-27 13:32:44 +00:00
2020-05-09 17:30:57 +00:00
.PHONY : stop -maputnik
stop-maputnik :
2020-04-22 15:15:20 +00:00
-docker rm -f maputnik_editor
2019-12-11 14:26:25 +00:00
.PHONY : generate -qareports
2020-05-09 17:30:57 +00:00
generate-qareports : start -db
2016-12-04 00:37:28 +00:00
./qa/run.sh
2019-03-29 21:15:42 +00:00
# generate all etl and mapping graphs
2020-01-23 02:55:22 +00:00
.PHONY : generate -devdoc
2020-03-06 18:15:54 +00:00
generate-devdoc : init -dirs
2020-01-23 02:55:22 +00:00
mkdir -p ./build/devdoc && \
2020-04-22 06:48:57 +00:00
$( DOCKER_COMPOSE) run $( DC_OPTS) openmaptiles-tools sh -c \
2020-01-23 02:55:22 +00:00
' generate-etlgraph openmaptiles.yaml $( GRAPH_PARAMS) && \
generate-mapping-graph openmaptiles.yaml $( GRAPH_PARAMS) '
2018-07-27 07:53:39 +00:00
2020-05-09 17:30:57 +00:00
.PHONY : bash
2020-05-20 15:27:42 +00:00
bash : init -dirs
2020-04-09 16:05:01 +00:00
$( DOCKER_COMPOSE) run $( DC_OPTS) openmaptiles-tools bash
2018-07-27 07:53:39 +00:00
2020-01-22 21:16:38 +00:00
.PHONY : import -wikidata
2020-05-20 15:27:42 +00:00
import-wikidata : init -dirs
2020-04-22 15:15:20 +00:00
$( DOCKER_COMPOSE) run $( DC_OPTS) openmaptiles-tools import-wikidata --cache /cache/wikidata-cache.json openmaptiles.yaml
2018-07-27 13:32:44 +00:00
2020-05-09 17:30:57 +00:00
.PHONY : reset -db -stats
2020-05-20 15:27:42 +00:00
reset-db-stats : init -dirs
Upgrade to tools v5 - rm import-osm, new downloader... (#785)
Update to tools v5. See https://github.com/openmaptiles/openmaptiles-tools/releases/tag/v5.0.0 for the list of all changes. Other OMT-repo specific changes:
* removes `import-osm` docker usage, replacing it with `openmaptiles-tools`
* quickstart builds faster because it uses postgres with preloaded water, natural earth, and lake centerlines tables.
### Makefile targets
* `tools-dev` will open a shell in a docker to experiment and debug (instead of `import-sql-dev` and `import-osm-dev`)
* separated `start-maputnik` from `start-postserve`
* renamed `clean-docker` into `db-destroy` to make it more explicit
* cleaner `db-start`, `db-stop`, `db-destroy` targets
* `db-start-preloaded` is the same as `db-start`, except that it uses `postgis-preloaded` -- an image with preloaded water, natural-earth, and lake centerline data
* `db-start` will not recreate the container if it already exists -- this way if it was started as preloaded, it will not be rebuilt.
* better output messages
### Quickstart
* uses `postgis-preloaded` image by default to make quickstart quicker. To start with a clean db, pass 2 parameters to quickstart, e.g. `./quickstart.sh albania empty`
2020-05-05 15:53:09 +00:00
$( DOCKER_COMPOSE) run $( DC_OPTS) openmaptiles-tools psql.sh -v ON_ERROR_STOP = 1 -P pager = off -c 'SELECT pg_stat_statements_reset();'
2020-03-06 18:15:54 +00:00
.PHONY : list -views
2020-05-20 15:27:42 +00:00
list-views : init -dirs
Upgrade to tools v5 - rm import-osm, new downloader... (#785)
Update to tools v5. See https://github.com/openmaptiles/openmaptiles-tools/releases/tag/v5.0.0 for the list of all changes. Other OMT-repo specific changes:
* removes `import-osm` docker usage, replacing it with `openmaptiles-tools`
* quickstart builds faster because it uses postgres with preloaded water, natural earth, and lake centerlines tables.
### Makefile targets
* `tools-dev` will open a shell in a docker to experiment and debug (instead of `import-sql-dev` and `import-osm-dev`)
* separated `start-maputnik` from `start-postserve`
* renamed `clean-docker` into `db-destroy` to make it more explicit
* cleaner `db-start`, `db-stop`, `db-destroy` targets
* `db-start-preloaded` is the same as `db-start`, except that it uses `postgis-preloaded` -- an image with preloaded water, natural-earth, and lake centerline data
* `db-start` will not recreate the container if it already exists -- this way if it was started as preloaded, it will not be rebuilt.
* better output messages
### Quickstart
* uses `postgis-preloaded` image by default to make quickstart quicker. To start with a clean db, pass 2 parameters to quickstart, e.g. `./quickstart.sh albania empty`
2020-05-05 15:53:09 +00:00
$( DOCKER_COMPOSE) run $( DC_OPTS) openmaptiles-tools psql.sh -v ON_ERROR_STOP = 1 -A -F"," -P pager = off -P footer = off \
2020-03-06 18:15:54 +00:00
-c "select schemaname, viewname from pg_views where schemaname='public' order by viewname;"
.PHONY : list -tables
2020-05-20 15:27:42 +00:00
list-tables : init -dirs
Upgrade to tools v5 - rm import-osm, new downloader... (#785)
Update to tools v5. See https://github.com/openmaptiles/openmaptiles-tools/releases/tag/v5.0.0 for the list of all changes. Other OMT-repo specific changes:
* removes `import-osm` docker usage, replacing it with `openmaptiles-tools`
* quickstart builds faster because it uses postgres with preloaded water, natural earth, and lake centerlines tables.
### Makefile targets
* `tools-dev` will open a shell in a docker to experiment and debug (instead of `import-sql-dev` and `import-osm-dev`)
* separated `start-maputnik` from `start-postserve`
* renamed `clean-docker` into `db-destroy` to make it more explicit
* cleaner `db-start`, `db-stop`, `db-destroy` targets
* `db-start-preloaded` is the same as `db-start`, except that it uses `postgis-preloaded` -- an image with preloaded water, natural-earth, and lake centerline data
* `db-start` will not recreate the container if it already exists -- this way if it was started as preloaded, it will not be rebuilt.
* better output messages
### Quickstart
* uses `postgis-preloaded` image by default to make quickstart quicker. To start with a clean db, pass 2 parameters to quickstart, e.g. `./quickstart.sh albania empty`
2020-05-05 15:53:09 +00:00
$( DOCKER_COMPOSE) run $( DC_OPTS) openmaptiles-tools psql.sh -v ON_ERROR_STOP = 1 -A -F"," -P pager = off -P footer = off \
2020-03-06 18:15:54 +00:00
-c "select schemaname, tablename from pg_tables where schemaname='public' order by tablename;"
2018-07-27 13:32:44 +00:00
2020-03-06 18:15:54 +00:00
.PHONY : psql -list -tables
2020-05-20 15:27:42 +00:00
psql-list-tables : init -dirs
Upgrade to tools v5 - rm import-osm, new downloader... (#785)
Update to tools v5. See https://github.com/openmaptiles/openmaptiles-tools/releases/tag/v5.0.0 for the list of all changes. Other OMT-repo specific changes:
* removes `import-osm` docker usage, replacing it with `openmaptiles-tools`
* quickstart builds faster because it uses postgres with preloaded water, natural earth, and lake centerlines tables.
### Makefile targets
* `tools-dev` will open a shell in a docker to experiment and debug (instead of `import-sql-dev` and `import-osm-dev`)
* separated `start-maputnik` from `start-postserve`
* renamed `clean-docker` into `db-destroy` to make it more explicit
* cleaner `db-start`, `db-stop`, `db-destroy` targets
* `db-start-preloaded` is the same as `db-start`, except that it uses `postgis-preloaded` -- an image with preloaded water, natural-earth, and lake centerline data
* `db-start` will not recreate the container if it already exists -- this way if it was started as preloaded, it will not be rebuilt.
* better output messages
### Quickstart
* uses `postgis-preloaded` image by default to make quickstart quicker. To start with a clean db, pass 2 parameters to quickstart, e.g. `./quickstart.sh albania empty`
2020-05-05 15:53:09 +00:00
$( DOCKER_COMPOSE) run $( DC_OPTS) openmaptiles-tools psql.sh -v ON_ERROR_STOP = 1 -P pager = off -c "\d+"
2018-07-27 13:32:44 +00:00
2020-05-09 17:30:57 +00:00
.PHONY : vacuum -db
2020-05-20 15:27:42 +00:00
vacuum-db : init -dirs
2018-07-27 13:32:44 +00:00
@echo "Start - postgresql: VACUUM ANALYZE VERBOSE;"
Upgrade to tools v5 - rm import-osm, new downloader... (#785)
Update to tools v5. See https://github.com/openmaptiles/openmaptiles-tools/releases/tag/v5.0.0 for the list of all changes. Other OMT-repo specific changes:
* removes `import-osm` docker usage, replacing it with `openmaptiles-tools`
* quickstart builds faster because it uses postgres with preloaded water, natural earth, and lake centerlines tables.
### Makefile targets
* `tools-dev` will open a shell in a docker to experiment and debug (instead of `import-sql-dev` and `import-osm-dev`)
* separated `start-maputnik` from `start-postserve`
* renamed `clean-docker` into `db-destroy` to make it more explicit
* cleaner `db-start`, `db-stop`, `db-destroy` targets
* `db-start-preloaded` is the same as `db-start`, except that it uses `postgis-preloaded` -- an image with preloaded water, natural-earth, and lake centerline data
* `db-start` will not recreate the container if it already exists -- this way if it was started as preloaded, it will not be rebuilt.
* better output messages
### Quickstart
* uses `postgis-preloaded` image by default to make quickstart quicker. To start with a clean db, pass 2 parameters to quickstart, e.g. `./quickstart.sh albania empty`
2020-05-05 15:53:09 +00:00
$( DOCKER_COMPOSE) run $( DC_OPTS) openmaptiles-tools psql.sh -v ON_ERROR_STOP = 1 -P pager = off -c 'VACUUM ANALYZE VERBOSE;'
2018-07-27 13:32:44 +00:00
2020-05-09 17:30:57 +00:00
.PHONY : analyze -db
2020-05-20 15:27:42 +00:00
analyze-db : init -dirs
2020-03-06 18:15:54 +00:00
@echo "Start - postgresql: ANALYZE VERBOSE;"
Upgrade to tools v5 - rm import-osm, new downloader... (#785)
Update to tools v5. See https://github.com/openmaptiles/openmaptiles-tools/releases/tag/v5.0.0 for the list of all changes. Other OMT-repo specific changes:
* removes `import-osm` docker usage, replacing it with `openmaptiles-tools`
* quickstart builds faster because it uses postgres with preloaded water, natural earth, and lake centerlines tables.
### Makefile targets
* `tools-dev` will open a shell in a docker to experiment and debug (instead of `import-sql-dev` and `import-osm-dev`)
* separated `start-maputnik` from `start-postserve`
* renamed `clean-docker` into `db-destroy` to make it more explicit
* cleaner `db-start`, `db-stop`, `db-destroy` targets
* `db-start-preloaded` is the same as `db-start`, except that it uses `postgis-preloaded` -- an image with preloaded water, natural-earth, and lake centerline data
* `db-start` will not recreate the container if it already exists -- this way if it was started as preloaded, it will not be rebuilt.
* better output messages
### Quickstart
* uses `postgis-preloaded` image by default to make quickstart quicker. To start with a clean db, pass 2 parameters to quickstart, e.g. `./quickstart.sh albania empty`
2020-05-05 15:53:09 +00:00
$( DOCKER_COMPOSE) run $( DC_OPTS) openmaptiles-tools psql.sh -v ON_ERROR_STOP = 1 -P pager = off -c 'ANALYZE VERBOSE;'
2018-07-27 13:32:44 +00:00
2019-12-11 14:26:25 +00:00
.PHONY : list -docker -images
2018-07-27 13:32:44 +00:00
list-docker-images :
docker images | grep openmaptiles
2019-12-11 14:26:25 +00:00
.PHONY : refresh -docker -images
2020-05-20 15:27:42 +00:00
refresh-docker-images : init -dirs
2020-04-22 18:55:13 +00:00
i f n e q ( $( strip $ ( NO_REFRESH ) ) , )
@echo "Skipping docker image refresh"
e l s e
@echo ""
@echo "Refreshing docker images... Use NO_REFRESH=1 to skip."
Upgrade to tools v5 - rm import-osm, new downloader... (#785)
Update to tools v5. See https://github.com/openmaptiles/openmaptiles-tools/releases/tag/v5.0.0 for the list of all changes. Other OMT-repo specific changes:
* removes `import-osm` docker usage, replacing it with `openmaptiles-tools`
* quickstart builds faster because it uses postgres with preloaded water, natural earth, and lake centerlines tables.
### Makefile targets
* `tools-dev` will open a shell in a docker to experiment and debug (instead of `import-sql-dev` and `import-osm-dev`)
* separated `start-maputnik` from `start-postserve`
* renamed `clean-docker` into `db-destroy` to make it more explicit
* cleaner `db-start`, `db-stop`, `db-destroy` targets
* `db-start-preloaded` is the same as `db-start`, except that it uses `postgis-preloaded` -- an image with preloaded water, natural-earth, and lake centerline data
* `db-start` will not recreate the container if it already exists -- this way if it was started as preloaded, it will not be rebuilt.
* better output messages
### Quickstart
* uses `postgis-preloaded` image by default to make quickstart quicker. To start with a clean db, pass 2 parameters to quickstart, e.g. `./quickstart.sh albania empty`
2020-05-05 15:53:09 +00:00
i f n e q ( $( strip $ ( USE_PRELOADED_IMAGE ) ) , )
POSTGIS_IMAGE = openmaptiles/postgis-preloaded \
docker-compose pull --ignore-pull-failures $( QUIET_FLAG) openmaptiles-tools generate-vectortiles postgres
e l s e
docker-compose pull --ignore-pull-failures $( QUIET_FLAG) openmaptiles-tools generate-vectortiles postgres import-data
e n d i f
2020-04-22 18:55:13 +00:00
e n d i f
2018-07-27 13:32:44 +00:00
2019-12-11 14:26:25 +00:00
.PHONY : remove -docker -images
2018-07-27 13:32:44 +00:00
remove-docker-images :
@echo "Deleting all openmaptiles related docker image(s)..."
2020-04-09 16:05:01 +00:00
@$( DOCKER_COMPOSE) down
2020-04-21 17:36:07 +00:00
@docker images "openmaptiles/*" -q | $( XARGS) docker rmi -f
@docker images "maputnik/editor" -q | $( XARGS) docker rmi -f
2020-04-21 17:51:03 +00:00
@docker images "maptiler/tileserver-gl" -q | $( XARGS) docker rmi -f
2018-07-27 13:32:44 +00:00
2020-05-09 17:30:57 +00:00
.PHONY : clean -unnecessary -docker
clean-unnecessary-docker :
2018-07-27 13:32:44 +00:00
@echo "Deleting unnecessary container(s)..."
2020-06-08 16:40:04 +00:00
@docker ps -a -q --filter "status=exited" | $( XARGS) docker rm
2018-07-27 13:32:44 +00:00
@echo "Deleting unnecessary image(s)..."
2020-04-09 16:05:01 +00:00
@docker images | grep \< none\> | awk -F" " '{print $$3}' | $( XARGS) docker rmi
2020-04-09 14:49:35 +00:00
.PHONY : test -perf -null
2020-05-20 15:27:42 +00:00
test-perf-null : init -dirs
2020-04-09 16:05:01 +00:00
$( DOCKER_COMPOSE) run $( DC_OPTS) openmaptiles-tools test-perf openmaptiles.yaml --test null --no-color
2020-05-06 15:36:15 +00:00
.PHONY : build -test -pbf
2020-05-20 15:27:42 +00:00
build-test-pbf : init -dirs
2020-05-06 15:36:15 +00:00
docker-compose run $( DC_OPTS) openmaptiles-tools /tileset/.github/workflows/build-test-data.sh