kopia lustrzana https://github.com/openmaptiles/openmaptiles
Use 5.3 - new bbox value (#1012)
Migrate to tools 5.3 and use the new bbox value. * Use 5.3 - new bbox value * Return correct bbox for meta-generate mbtiles-tools meta-generate is now able to use bbox from *.bbox file Thanks @nyurikpull/1032/head
rodzic
72af34612a
commit
97ffabcb49
7
.env
7
.env
|
@ -4,7 +4,7 @@
|
|||
TILESET_FILE=openmaptiles.yaml
|
||||
|
||||
# Use 3-part patch version to ignore patch updates, e.g. 5.0.0
|
||||
TOOLS_VERSION=5.2
|
||||
TOOLS_VERSION=5.3
|
||||
|
||||
# Make sure these values are in sync with the ones in .env-postgres file
|
||||
PGDATABASE=openmaptiles
|
||||
|
@ -13,8 +13,9 @@ PGPASSWORD=openmaptiles
|
|||
PGHOST=postgres
|
||||
PGPORT=5432
|
||||
|
||||
# By default, tile generation is done for the full extent of the given area.
|
||||
# Modify BBOX below to overwrite it.
|
||||
# BBOX may get overwritten by the computed bbox of the specific area:
|
||||
# make generate-bbox-file
|
||||
# By default, the Makefile will use the content of data/$(area).bbox file if it exists.
|
||||
BBOX=-180.0,-85.0511,180.0,85.0511
|
||||
|
||||
# Which zooms to generate in make generate-tiles
|
||||
|
|
60
Makefile
60
Makefile
|
@ -153,9 +153,32 @@ ifeq ($(strip $(DIFF_MODE)),true)
|
|||
export IMPOSM_CONFIG_FILE = data/$(area).repl.json
|
||||
endif
|
||||
|
||||
# download-osm generates this file with metadata about the file
|
||||
AREA_DC_CONFIG_FILE ?= data/$(area).dc-config.yml
|
||||
# Load area-specific bbox file that gets generated by the download-osm --bbox
|
||||
AREA_BBOX_FILE ?= data/$(area).bbox
|
||||
ifneq (,$(wildcard $(AREA_BBOX_FILE)))
|
||||
cat := $(if $(filter $(OS),Windows_NT),type,cat)
|
||||
BBOX := $(shell $(cat) ${AREA_BBOX_FILE})
|
||||
export BBOX
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(area)),)
|
||||
define assert_area_is_given
|
||||
@echo ""
|
||||
@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
|
||||
else
|
||||
ifneq ($(strip $(AREA_INFO)),)
|
||||
define assert_area_is_given
|
||||
@echo "$(AREA_INFO)"
|
||||
endef
|
||||
endif
|
||||
endif
|
||||
|
||||
#
|
||||
# TARGETS
|
||||
|
@ -185,7 +208,7 @@ help:
|
|||
@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"
|
||||
@echo " make generate-dc-config # scan data file and generate tile generation config file with bbox"
|
||||
@echo " make generate-bbox-file # compute bounding box of a data file and store it in a file"
|
||||
@echo " make psql # start PostgreSQL console"
|
||||
@echo " make psql-list-tables # list all PostgreSQL tables"
|
||||
@echo " make vacuum-db # PostgreSQL: VACUUM ANALYZE"
|
||||
|
@ -295,10 +318,12 @@ ifeq (,$(wildcard $(PBF_FILE)))
|
|||
@echo "Downloading $(DOWNLOAD_AREA) with replication support into $(PBF_FILE) and $(IMPOSM_CONFIG_FILE) from $(if $(OSM_SERVER),$(OSM_SERVER),any source)"
|
||||
@$(DOCKER_COMPOSE) run $(DC_OPTS) openmaptiles-tools download-osm $(OSM_SERVER) "$(DOWNLOAD_AREA)" \
|
||||
--imposm-cfg "$(IMPOSM_CONFIG_FILE)" \
|
||||
--bbox "$(AREA_BBOX_FILE)" \
|
||||
--output "$(PBF_FILE)"
|
||||
else
|
||||
@echo "Downloading $(DOWNLOAD_AREA) into $(PBF_FILE) from $(if $(OSM_SERVER),$(OSM_SERVER),any source)"
|
||||
@$(DOCKER_COMPOSE) run $(DC_OPTS) openmaptiles-tools download-osm $(OSM_SERVER) "$(DOWNLOAD_AREA)" \
|
||||
--bbox "$(AREA_BBOX_FILE)" \
|
||||
--output "$(PBF_FILE)"
|
||||
endif
|
||||
@echo ""
|
||||
|
@ -320,16 +345,13 @@ else
|
|||
endif
|
||||
endif
|
||||
|
||||
.PHONY: generate-dc-config
|
||||
generate-dc-config:
|
||||
.PHONY: generate-bbox-file
|
||||
generate-bbox-file:
|
||||
@$(assert_area_is_given)
|
||||
ifeq (,$(wildcard $(AREA_DC_CONFIG_FILE)))
|
||||
@$(DOCKER_COMPOSE) run $(DC_OPTS) openmaptiles-tools bash -c ' \
|
||||
download-osm make-dc "$(PBF_FILE)" \
|
||||
--make-dc "$(AREA_DC_CONFIG_FILE)" \
|
||||
--id "$(area)"'
|
||||
ifeq (,$(wildcard $(AREA_BBOX_FILE)))
|
||||
@$(DOCKER_COMPOSE) run $(DC_OPTS) openmaptiles-tools download-osm bbox "$(PBF_FILE)" "$(AREA_BBOX_FILE)"
|
||||
else
|
||||
@echo "Configuration file $(AREA_DC_CONFIG_FILE) already exists, no need to regenerate."
|
||||
@echo "Configuration file $(AREA_BBOX_FILE) already exists, no need to regenerate."
|
||||
endif
|
||||
|
||||
.PHONY: psql
|
||||
|
@ -375,17 +397,14 @@ import-sql: all start-db-nowait
|
|||
$(DOCKER_COMPOSE) run $(DC_OPTS) openmaptiles-tools sh -c 'pgwait && import-sql' | \
|
||||
awk -v s=": WARNING:" '1{print; fflush()} $$0~s{print "\n*** WARNING detected, aborting"; exit(1)}'
|
||||
|
||||
ifneq ($(wildcard $(AREA_DC_CONFIG_FILE)),)
|
||||
DC_CONFIG_TILES := -f docker-compose.yml -f $(AREA_DC_CONFIG_FILE)
|
||||
endif
|
||||
.PHONY: generate-tiles
|
||||
generate-tiles: all start-db
|
||||
@$(assert_area_is_given)
|
||||
@echo "Generating tiles into $(MBTILES_LOCAL_FILE) (will delete if already exists)..."
|
||||
@rm -rf "$(MBTILES_LOCAL_FILE)"
|
||||
$(DOCKER_COMPOSE) $(DC_CONFIG_TILES) run $(DC_OPTS) generate-vectortiles
|
||||
$(DOCKER_COMPOSE) run $(DC_OPTS) generate-vectortiles
|
||||
@echo "Updating generated tile metadata ..."
|
||||
$(DOCKER_COMPOSE) $(DC_CONFIG_TILES) run $(DC_OPTS) openmaptiles-tools \
|
||||
$(DOCKER_COMPOSE) run $(DC_OPTS) openmaptiles-tools \
|
||||
mbtiles-tools meta-generate "$(MBTILES_LOCAL_FILE)" $(TILESET_FILE) --auto-minmax --show-ranges
|
||||
|
||||
.PHONY: start-tileserver
|
||||
|
@ -534,3 +553,12 @@ test-perf-null: init-dirs
|
|||
.PHONY: build-test-pbf
|
||||
build-test-pbf: init-dirs
|
||||
docker-compose run $(DC_OPTS) openmaptiles-tools /tileset/.github/workflows/build-test-data.sh
|
||||
|
||||
.PHONY: debug
|
||||
debug: ## Use this target when developing Makefile itself to verify loaded environment variables
|
||||
@$(assert_area_is_given)
|
||||
@echo file_exists = $(wildcard $(AREA_BBOX_FILE))
|
||||
@echo AREA_BBOX_FILE = $(AREA_BBOX_FILE) , $$AREA_ENV_FILE
|
||||
@echo BBOX = $(BBOX) , $$BBOX
|
||||
@echo MIN_ZOOM = $(MIN_ZOOM) , $$MIN_ZOOM
|
||||
@echo MAX_ZOOM = $(MAX_ZOOM) , $$MAX_ZOOM
|
||||
|
|
|
@ -38,6 +38,8 @@ services:
|
|||
DIFF_MODE: ${DIFF_MODE}
|
||||
MIN_ZOOM: ${MIN_ZOOM}
|
||||
MAX_ZOOM: ${MAX_ZOOM}
|
||||
#Provide BBOX from *.bbox file if exists, else from .env
|
||||
BBOX: ${BBOX}
|
||||
# Imposm configuration file describes how to load updates when enabled
|
||||
IMPOSM_CONFIG_FILE: ${IMPOSM_CONFIG_FILE}
|
||||
# Which files to use during import-borders processing
|
||||
|
|
|
@ -263,13 +263,15 @@ make test-perf-null
|
|||
|
||||
echo " "
|
||||
echo "-------------------------------------------------------------------------------------"
|
||||
|
||||
if [[ "$(source .env ; echo "$BBOX")" = "-180.0,-85.0511,180.0,85.0511" ]]; then
|
||||
if [[ "$area" != "planet" ]]; then
|
||||
echo "====> : Compute bounding box for tile generation"
|
||||
make generate-dc-config ${MIN_ZOOM:+MIN_ZOOM="${MIN_ZOOM}"} ${MAX_ZOOM:+MAX_ZOOM="${MAX_ZOOM}"}
|
||||
make generate-bbox-file ${MIN_ZOOM:+MIN_ZOOM="${MIN_ZOOM}"} ${MAX_ZOOM:+MAX_ZOOM="${MAX_ZOOM}"}
|
||||
else
|
||||
echo "====> : Skipping bbox calculation when generating the entire planet"
|
||||
fi
|
||||
|
||||
else
|
||||
echo "====> : Bounding box is set in .env file"
|
||||
fi
|
||||
|
|
Ładowanie…
Reference in New Issue