NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

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's gravatar image

RenegadeTech
46225
accept rate: 0%


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

osmosis --read-xml file="countryAandB.osm" --read-xml file="countryB.osm" --derive-change --write-xml-change file="mychanges.osc"

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

osmium derive-changes countryAandB.osm.pbf countryB.osm.pbf -o mychanges.osc

Then you import the change file:

osm2pgsql/osm2pgsql --hstore --latlong --append --slim --number-processes 1 --output gazetteer --style settings/import-full.style --database nominatim mychanges.osc

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.

permanent link

answered 30 Jul '20, 11:03

mtmail's gravatar image

mtmail
4.8k1574
accept rate: 27%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×689
×230
×118
×31
×30

question asked: 28 Jul '20, 19:45

question was seen: 2,467 times

last updated: 30 Jul '20, 11:03

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum