openmaptiles icon indicating copy to clipboard operation
openmaptiles copied to clipboard

Generate two tiles on the same server simultaneously

Open xinyuluo opened this issue 3 years ago • 3 comments

Hi, I'm new to OMT. I posted this question on StackOverflow initially because it's not really an issue but a question regarding OMT usage, but I didn't manage to get an answer so trying my luck here.

For the following questions I refer to the following steps in the instruction:

make clean                  # clean / remove existing build files
make                        # generate build files
make start-db               # start up the database container.
make import-data            # Import external data from OpenStreetMapData, Natural Earth and OpenStreetMap Lake Labels.
make import-osm             # import data into postgres
make import-wikidata        # import Wikidata
make import-sql             # create / import sql funtions 
make generate-bbox-file     # compute data bbox -- not needed for the whole planet
make generate-tiles-pg      # generate tiles

if I understand correctly, import-sql imports SQL based on map data in Postgres (imported in import-ism step), and the last step uses these SQL functions to generate tiles. My questions are:

  • Is it possible to run two tile generating process of two regions at the same time on one server? It seems that only import-osm step specifies the PBF file (with area=<area-id>), and neither import sql nor generate-tiles-pg need this specification. So it's not clear to me if Postgres has a way to somehow differentiate data coming from two regions and generate tiles separately, if I run two processes at the same time on the same sever.
  • Is it required to rerun the following steps (make clean, make, make start-db, make import-data, make import-wikidata) when generating new tiles, if there's already tiles generated? Because it seems to me that only import-osm and import-sql are data-dependent steps.

Thank you !!

xinyuluo avatar Nov 12 '21 15:11 xinyuluo

Hi, if you run make generate-tiles-pg area=area1 it will generate tiles in the bbox defined in area1.bbox. If you run the second process by generate-tiles-pg area=area2 then it will generate tiles in the bbox of area2.bbox.

If you will use OpenMapTiles-Tools v6.0.1, then you could append different areas during import-osm step by adding APPEND_MODE=true into .env (https://github.com/openmaptiles/openmaptiles-tools/pull/365)

TomPohys avatar Nov 12 '21 16:11 TomPohys

Hi @TomPohys thanks for the fast reply. My use case is that, im currently generating tile for the planet, but it is taking a long time and I'd like to do some quick tests on a few smaller regions (e.g. California) while the planet tile is being generated. It seems possible to start a second process from your answer. To clarify, do I run the same set of steps for the 2nd process (make clean, make, make start-db, ...) ? I don't want to accidentally corrupt or remove planet data that is still in process.

xinyuluo avatar Nov 12 '21 17:11 xinyuluo

Hi, If you already have planet data in the database, you do not have to run make import-osm or make import-sql again.

The tile generation process is using https://github.com/openmaptiles/openmaptiles-tools/blob/master/bin/generate-tiles. Which is using variables in .env file e.g. BBOX which defines an area for tile generation.

The BBOX variable could be replaced with any other values (during make download area=north-america/us/california is created california.bbox file which include BBOX of California) e.g. -124.85,32.17,-113.95,42.12 (used https://boundingbox.klokantech.com/ with CSV format)

You can also set BBOX varialbe by export BBOX=-124.85,32.17,-113.95,42.12 and then make generate-tiles-pg.

When you have already started the database (you can check it by docker ps) you do not have to start it again.

TomPohys avatar Nov 24 '21 11:11 TomPohys