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.
pull/1012/head
zstadler 2020-10-15 11:38:11 +03:00 zatwierdzone przez GitHub
rodzic 341c4df171
commit 09b68ed1c2
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
3 zmienionych plików z 21 dodań i 6 usunięć

4
.env
Wyświetl plik

@ -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

Wyświetl plik

@ -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/<area>.dc-config.yml` file, and re-start `./quickstart.sh <area>`
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`

Wyświetl plik

@ -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 " "