OpenNameSearch
This script is for building a basic tile Nominatim server with OpenStreetMap data*.
Load OSM Data
Load city, country, continent or planet OSM data.
Postgres, PostGIS, and osm2pgsql
Script installs Postgres, PostGIS, and osm2pgsql.
Apache HTTPD
Installs and configures Apache for http or https
Results in xml, json, or html
Queries can return HTML, XMl, or JSON.
Optional and Tiger Data
Load Optional and/or Tiger data.
GeoCoding and Reverse Lookups
Geocoding and Reverse GeoCoding.
Running the script
Only for use on a clean Ubuntu 14 install!!
Before proceeding, see 'Limitations' section above.
1. Get script from GitHub
2. Make it executable
chmod 755 OpenNameSearch.sh
3. Script usage is:
./OpenNameSearch.sh pbf_url
Loading Optional Data and Tiger Data:
setup_nm_user; install_prerequisites; install_postgresql; install_nominatim; #download_optional_data; #uncomment if you want optional data. Adds 30Gb to install size import_osm_data; setup_nm_apache; enable_nm_updates; #install_housenumber; #uncomment to download and install Tiger Census Data
Example: Load OSM Delaware Data
./OpenNameSearch.sh http://download.geofabrik.de/north-america/us/delaware-latest.osm.pbf
Go to YourDomain.com/nominatim
Once installation completes, navigate to the IP/nominatim or hostname/nominatim.
You should see a page as below:

Enter a search and check your installation.
Querying Data
Nominatim can return data as XML, HTML, JSON, and JSON V2
Examples:XML:
https://dc.acugis.com/search.php?format=xml&q=White+House%2C+Washington+D.C.&addressdetails=1JSON:
https://dc.acugis.com/search.php?format=json&q=White+House%2C+Washington+D.C.&addressdetails=1JSON V2:
https://dc.acugis.com/search.php?format=json&q=White+House%2C+Washington+D.C.&addressdetails=1HTML (Requires Tile Provider):
https://dc.acugis.com/search.php?format=html&q=White+House%2C+Washington+D.C.&addressdetails=1
See the Nominatom Wiki for Usage Details
Attribution
Use of OpenStreetMap data requires attribution
<a href="https://openstreetmap.org" target="_blank">© OpenStreetMap contributors. </a>
Warnings, Limitations, and Stuff You Should Know
This script is intended for use only on a clean Ubuntu install.
You will need to secure your installation.
OpenStreetMap Nominiatim has a lot of great data and it's growing daily. However, if you are looking for geocoding services with fuller coverage and support, there are a number of options:
Getting good performance requires tuning, optimization, and tweaking.
Database tuning is a craft and an art form. This script is intended only to get build a working Nominatim server with OSM data with minimal effort.
This script is provided without warranty and use of the script is used at your own peril.
We are not affiliated with, or endorsed by, OpenStreetMap
Loading New Data or Replacing Data
To load an additional PBF, load multiple PBFs, or simply drop your old data start over with a different PBF, use our reload-OpenNameSearch.sh script via GitHUB a PBF, The simplest method is to use our reload-opennamesearch.sh script.
Usage is:
./reload-OpenNameSearch.sh [PBF_URL1] [PBF_URL2] ...
If you prefer to do so manually, the full script is below.
#!/bin/bash -e #Usage: reload-OpenNameSearch.sh [PBF_URL1] [PBF_URL2] ... #Script will drop old nominatim database and import new map. NM_USER='ntim'; #nominatim website NM_VER='2.5.1' #Merge multiple pbf files into one, so we can import into Nominatim function merge_osm_maps(){ apt-get -y install osmctools COUNTER=$(echo ${PBF_FILES} | wc -w); PIPES='' for f in ${PBF_FILES}; do if [ $COUNTER -eq 1 ]; then PBF_FILE="/home/${NM_USER}/all.pbf" osmconvert ${PIPES} ${f} -o=${PBF_FILE} else mkfifo p${COUNTER} PIPES+="p${COUNTER} " osmconvert ${f} --out-o5m -o=p${COUNTER} & let COUNTER=COUNTER-1 fi done chown ${NM_USER}:${NM_USER} ${PBF_FILE} rm ${PIPES} } function import_osm_data(){ NP=$(grep -c 'model name' /proc/cpuinfo) let C_MEM=$(free -m | grep -i 'mem:' | sed 's/[ \t]\+/ /g' | cut -f4,7 -d' ' | tr ' ' '+')-200 su - ${NM_USER} <&1 | tee setup.log exit 0 EOF service apache2 restart } ################################# PBF_FILES='' cd /home/${NM_USER} #download pbf file/s for f in $@; do PBF_URL="$f" PBF_FILE="/home/${NM_USER}/${PBF_URL##*/}" if [ ! -f ${PBF_FILE} ]; then wget ${PBF_URL} chown ${NM_USER}:${NM_USER} ${PBF_FILE} fi PBF_FILES+=" ${PBF_FILE}"; done if [ $# -gt 1 ]; then #if we have more that 1 pbf file merge_osm_maps; fi import_osm_data; rm ${PBF_FILES}
FAQs
Credits
The following are used in the script.
GeoFabrik Extracts of OSM Data
Script created by:
AcuGIS
We Make GIS Simple
Keep Going
You have a working tile server. Keep going...
GeoFabrik (Frederik Ramm Talks and Publications)