From 09b68ed1c2fd7e2aa7b97d7b0e7d6a2445792d6c Mon Sep 17 00:00:00 2001 From: zstadler Date: Thu, 15 Oct 2020 11:38:11 +0300 Subject: [PATCH] Allow `BBOX` to be set in `.env` file (#1013) * Allow setting `BBOX` to be set in `.env` file Currently, the `BBOX` setting in `.env` is ignored for all areas except `planet`. On the other hand, the `planet` area is an overkill for any `BBOX` setting other than the default - `-180.0,-85.0511,180.0,85.0511`. With this PR, `quickstart.sh` would not override a modified `BBOX` value in `.env`. Also, this provides a way to avoid the pessimistic `BBOX` computation for `osmfr` extracts, as described in https://github.com/openmaptiles/openmaptiles-tools/pull/297#issuecomment-700792702 #### Currently - If the user does not do anything, `quickstart.sh` and `make generate-tiles` create an `mbtiles` file for the full extent of the data source. This applies to `planet` and other data sources. - If a user sets the `BBOX` value in `.env` and a `planet` data source is used, `quickstart.sh` and `make generate-tiles` create an `mbtiles` file for the extent set in the `.env` file. - If a user sets the `BBOX` value in `.env` and a non-`planet` data source is used, it is ignored - `quickstart.sh` and `make generate-tiles` create an `mbtiles` file for the full extent of the data source. #### Problem statement While users of a `planet` data source have a simple way to override the default extend of the tile generation, users of other data sources have no simple way of doing that. In fact, for such users the `BBOX` setting in the `.env` file is ignored and therefore misleading. #### Proposal - If the user does not do anything, `quickstart.sh` and `make generate-tiles` create an `mbtiles` file for the full extent of the data source. This applies to `planet` and other data sources. - If a user sets the `BBOX` value in `.env`, `quickstart.sh` and `make generate-tiles` create an `mbtiles` file for the extent set in the `.env` file. This applies to `planet` and other data sources. --- .env | 4 ++-- QUICKSTART.md | 11 +++++++++++ quickstart.sh | 12 ++++++++---- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/.env b/.env index a685bd8e..297913e4 100644 --- a/.env +++ b/.env @@ -13,8 +13,8 @@ PGPASSWORD=openmaptiles PGHOST=postgres PGPORT=5432 -# BBOX may get overwritten by the computed bbox of the specific area: -# make generate-dc-config +# By default, tile generation is done for the full extent of the given area. +# Modify BBOX below to overwrite it. BBOX=-180.0,-85.0511,180.0,85.0511 # Which zooms to generate in make generate-tiles diff --git a/QUICKSTART.md b/QUICKSTART.md index b656faae..53851518 100644 --- a/QUICKSTART.md +++ b/QUICKSTART.md @@ -397,6 +397,17 @@ Hints: * Small increments! Never starts with the `MAX_ZOOM = 14` * The suggested `MAX_ZOOM = 14` - use only with small extracts +### Set the bounding box to generate + +By default, tile generation is done for the full extent of the area. +If you want to generate a tiles for a smaller extent, modify the settings in the `.env` file, the default: +* `BBOX=-180.0,-85.0511,180.0,85.0511` + +Delete the `./data/.dc-config.yml` file, and re-start `./quickstart.sh ` + +Hint: +* The [boundingbox.klokantech.com](https://boundingbox.klokantech.com/) site can be used to find a bounding box (CSV format) using a map. + ### Check other commands `make help` diff --git a/quickstart.sh b/quickstart.sh index 26970c79..9e931a8e 100755 --- a/quickstart.sh +++ b/quickstart.sh @@ -263,11 +263,15 @@ make test-perf-null echo " " echo "-------------------------------------------------------------------------------------" -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}"} +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}"} + else + echo "====> : Skipping bbox calculation when generating the entire planet" + fi else - echo "====> : Skipping bbox calculation when generating the entire planet" + echo "====> : Bounding box is set in .env file" fi echo " "