I'm installing my own Nominatim instance and decided I don't need as many regions as I imported. The docs don't say how to drop/remove regions, so is there a way or do I have to start from scratch? asked 28 Jul '20, 19:45 RenegadeTech |
There's no such feature. If the issue is disk space you could delete tables needed for updates (http://nominatim.org/release-docs/latest/admin/Import-and-Update/#dropping-data-required-for-dynamic-updates) but of course then you cannot update the data regularly any more. In https://github.com/osm-search/Nominatim/blob/master/lib/setup/SetupClass.php#L647 you can see which tables and indices would NOT be deleted, the planet_* tables will safe the most space. Updates (http://nominatim.org/release-docs/latest/admin/Import-and-Update/#updates) work by downloading OSM change files (https://wiki.openstreetmap.org/wiki/OsmChange) and loading then into the database. Those can include additions, changes to objects, deletions. You could create a change file by comparing the data you have currently in the database against what you want in the database, a lot of deletions basically. Say you imported countryA and countryB, and now you only want countryB in the dababase: With Osmosis: https://wiki.openstreetmap.org/wiki/Osmosis
Note, you need to convert between .pbf (binary) and .osm (XML) file formats before. With Osmium: https://osmcode.org/osmium-tool/manual.html#working-with-change-files
Then you import the change file:
That's based on https://github.com/osm-search/Nominatim/blob/master/utils/update.php code (many variables say osmosis but these days it runs pyosmium really). That's untested, I'm not aware anybody has done it and I would double-check on the https://lists.openstreetmap.org/listinfo/geocoding mailing list and create a database backup first. answered 30 Jul '20, 11:03 mtmail |