From OpenStreetMap Wiki
Jump to: navigation, search

Nominatim Structured Files

Nominatim is able to export pre-indexed data from the indexing database in a format suitable for importing into another minimal nominatim database, or for use with other applications which require a heirachy of places. Nominatim is also able to produce diff files as part of the indexing process to bring an existing minimal nominatim database up to date. Together these two data sets can be used in a similar way to the OSM planet file and OSM Minutely diffs to keep a nominatim database up to date with minimal cpu overhead.

Both the nominatim planet file and the nominatim diff files use the same format with the minor difference that the planet file only contains <add> operations

Nominatim Pre-Indexed Files

An example npi file format:

 <?xml version="1.0" encoding="UTF8"?>
 <osmStructured version="0.1" generator="Nominatim" sourcedb="e4d909c290d0fb1ca068ffaddf22cbd0" timestamp="2011-01-01">
   <feature place_id="36158088" type="W" id="33302331" key="landuse" value="retail" rank="22" importance="22">
     <name type="name">Shell SLEX Northbound</name>
     <continent rank="0" type="N" id="378734054" key="place" value="locality" distance="0.0127811048114559" isaddress=""/>
     <state rank="8" type="N" id="305704424" key="place" value="state" distance="0.296977463632872" isaddress="f"/>
     <state rank="8" type="N" id="305704568" key="place" value="state" distance="0.246752269883336" isaddress="t"/>
     <state rank="10" type="N" id="14443959" key="place" value="region" distance="0.271147585017007" isaddress="f"/>
     <state rank="10" type="N" id="26036361" key="place" value="region" distance="0.228389123545531" isaddress="t"/>
     <city rank="16" type="N" id="198493613" key="place" value="city" distance="0.294577966270114" isaddress="f"/>
     <city rank="16" type="N" id="198503203" key="place" value="city" distance="0.0331528651762685" isaddress="t"/>
     <city rank="16" type="N" id="198505154" key="place" value="town" distance="0.0299385099596638" isaddress="f"/>
     <city rank="16" type="N" id="198531889" key="place" value="town" distance="0.0135530343139954" isaddress="f"/>
     <city rank="16" type="N" id="305569393" key="place" value="village" distance="0.036373978052996" isaddress="f"/>
     <city rank="16" type="N" id="315513000" key="place" value="village" distance="0.0324685819608394" isaddress="f"/>
     <city rank="16" type="N" id="315994217" key="place" value="village" distance="0.0427182796799726" isaddress="f"/>
     <city rank="16" type="N" id="315994230" key="place" value="village" distance="0.0255895259533197" isaddress="f"/>
     <city rank="16" type="N" id="315995121" key="place" value="village" distance="0.0246156479780285" isaddress="f"/>
     <city rank="16" type="N" id="315996295" key="place" value="village" distance="0.0278559308575992" isaddress="f"/>
     <city rank="16" type="N" id="360201049" key="place" value="village" distance="0.0247099132188705" isaddress="f"/>
     <city rank="16" type="N" id="360206196" key="place" value="village" distance="0.0374557809209434" isaddress="f"/>
     <city rank="16" type="N" id="909921970" key="place" value="village" distance="0.0447539982061371" isaddress="f"/>
     <city rank="16" type="N" id="909921977" key="place" value="village" distance="0.0316518672861616" isaddress="f"/>
     <city rank="16" type="N" id="943217686" key="place" value="village" distance="0.0485227561982041" isaddress="f"/>
     <city rank="16" type="N" id="943217687" key="place" value="village" distance="0.0448449224033224" isaddress="f"/>
     <city rank="16" type="N" id="943990486" key="place" value="village" distance="0.0490603326469319" isaddress="f"/>
     <city rank="16" type="N" id="1048628239" key="place" value="village" distance="0.03068200127202" isaddress="f"/>
     <city rank="16" type="N" id="1048628242" key="place" value="village" distance="0.0132977863240898" isaddress="f"/>
     <city rank="16" type="N" id="1048628679" key="place" value="village" distance="0.0284743661900493" isaddress="f"/>
     <city rank="16" type="N" id="1050742642" key="place" value="village" distance="0.0289811094091223" isaddress="f"/>
     <city rank="16" type="N" id="1050742987" key="place" value="village" distance="0.0289811094091223" isaddress="f"/>
    <osmGeometry>POLYGON((121.0707862 14.3121991,121.0710894 14.3126083,121.0740231 14.3100578,121.0734367 14.3094153,121.0721856 14.3106202,121.0707862 14.3121991))</osmGeometry>


Overall information about this dump or diff


Software used to generate this file


Unique ID used to identify the source database used to generate the planet/diff file. If diffs and the planet are from the same source db nominatim is able to use various short cuts to improve performance.

 timestamp="2011-02-11 07:04:00"

timestamp of the newest data present in the file (based on the dates in the OSM minute updates)


last diff id present in the file. Starting the diff import process from diffid+1 guarantees that no data will be missed.


Type of operation to be used with this data



OSM id of this data


Equivalent to place_id (as used in the API) for this item. Will only be used if sourcedb IDs match.


Type of feature


Calculated address rank of this feature. Values are in the range 0 to 30 where 0 is most important and 30 is house/building level features


Indicator of how important this feature is. Values in the range 0 to 1 where 1 is most important.


OSM source for the name (i.e. name, name:en, official_name)


OSM admin_level (or calculated value). Range 0 to 15 - see wiki.


valid tags are: continent, state, city, town, village


Calculated address rank of this feature. Values are in the range 0 to 30 where 0 is most important and 30 is house/building level features


OSM id of this data


Type of feature


Distance to the feature in degrees


Is this item part of the address value "t" & "f". Items labelled "f" are considered as search terms but do not form part of the address. Most applications outside of search will probably want to discard all "f" terms.

 POLYGON((121.0707862 14.3121991,121.0710894 14.3126083,121.0740231 14.3100578,121.0734367 14.3094153,121.0721856 

OSM geometry of the feature as a GEOS/postgis compatible string

Nominatim Pre-Indexed Directories

 Generated planet files  
 Files providing a list of diff files per day
 Diff files in sequential order XXX/XXX/XXX is number XXXXXXXXX split into sub-directories

Using npi files to create a nominatim installation

  • Download and build nominatim
 svn co
 cd nominatim/nominatim
  • Create the database
 ../setup.php --create-db --create-functions --create-minimal-tables
  • Download and import the most recent npi planet file
 wget http://.../export/planet/latest.npi.bz2 
  • Import the pre-indexed file (SLOW - a couple of days)
 ./nominatim -I -F latest.npi.bz2 ../settings/partitionedtags.def
 partitionedtags.def is a list of the tags that should be seperated into their own table
 for faster searching (e.g. amenity=hotel) in general this is the same list as special keywords.
  • Create the website

This will create the required symlinks. Please make sure your web server follows symlinks

 ../setup.php --create-website /var/www/html
  • Bring the system up to date (how long this takes depends on how far behind the dump is)
 ../update.php --import-npi-all