I have set up a tile server using the instructions by switch2osm (Manually building a tile server (Ubuntu 22.04) – Switch2OSM and Updating your database as people edit OpenStreetMap – Switch2OSM). Basically I am using osm2pgsql to install the data and osm2pgsql-replication to update it.
For data I have used the Alps region by Geofabrik. Everything worked well but unfortunately they have now resized this region and the new polygon doesn’t match the area I need anymore. I would need to use the Europe region to get everything I need instead but this one is huge so I would prefer combining a number of smaller regions.
However I am unsure how to do this. There are some instructions here (Merging 2 countries with osm2pgsql - OSM Help) but this does not seem to work with updates, does it? Could somebody please list the commands required to a) install n regions and b) update these n regions on one tile server? Is it even possible with osm2pgsql-replication or do I need to go for the hacky approach with pyosmium (Updating your database as people edit OpenStreetMap – Switch2OSM)?
Updating from diffs is significantly more complicated when multiple diff sources are involved. I recommend you work out the PBF size by adding up all the country sizes on the download site and if it’s more than 10GB, go with all of Europe.
The guide you linked uses osm2pgsql replication. A better place to start would be the PyOsmium guide which would be useful as a reference, but do not try to follow it out of the box. This isn’t a “hacky” approach, it’s just lower level.
Broadly speaking, an update script needs to download the diffs, process the diffs, apply to the database, update its state, and handle expired tiles. You must write the script that does this.
You will need state files for each region you’re downloading, and you will download the diffs and merge them with osmium-tool. When that’s merged, you apply it to the database and only then update the state files locally. osm2pgsql can output the dirty tiles.
Thank you - yes sorry, I put the wrong link, I did mean the one you have added now.
Ok, that’s about what I feared. I said “hacky” because upon first look these tools look outdated and fragile to use to me, but maybe I’m wrong. I will have a look as I could probably stay under 10GB for the area I need. But maybe it’s just so much easier to go for Europe that I will simply accept the additional overhead, let’s see.
I would download Europe and if there is too much you don’t need, just crop to a reasonable bounding box for your area, e.g. with osmium-tool, much easier than merging several (overlapping) extracts.
Just a quick feedback:
Import Europe: 5-6 days
Import Alps: 6h
Import Switzerland: 1h