Removing a certain region from a pbf file

openstreetmap

I have a PBF file from the complete planet and I want to insert that data into a PostGIS database. However, I would like to exclude a certain region, e.g. all data that belongs to the islands of Japan.

How would I go about this?

Best Answer

You should take a look at the osmium-extract command from the "osmium tool" suite.

One of the example config files in (https://github.com/osmcode/osmium-tool/blob/master/extract-example-config/extracts.json) already include two examples on how to exclude a certain region from a larger area:

If your case, you would need to define an outer polygon ring covering the whole globe, then an inner ring with the areas you want to exclude.