# Nominatim — Open Source Geocoding with OpenStreetMap Data > A search engine for OpenStreetMap data that provides geocoding, reverse geocoding, and address lookups. ## Install Save as a script file and run: # Nominatim — Open Source Geocoding with OpenStreetMap Data ## Quick Use ```bash # Search for a place curl "https://nominatim.openstreetmap.org/search?q=Berlin&format=json&limit=1" # Reverse geocode curl "https://nominatim.openstreetmap.org/reverse?lat=52.52&lon=13.405&format=json" # Self-hosted install sudo apt install nominatim nominatim import --osm-file planet.osm.pbf ``` ## Introduction Nominatim is the geocoding engine behind OpenStreetMap's search. It converts addresses and place names into coordinates (geocoding) and coordinates into addresses (reverse geocoding). You can use the public API for light usage or self-host your own instance for production workloads. ## What Nominatim Does - Geocodes free-form text queries into latitude/longitude coordinates with confidence scores - Reverse geocodes coordinates into structured addresses with house number, street, city, and country - Provides address lookup by OpenStreetMap node, way, or relation IDs - Returns results in JSON, GeoJSON, XML, or HTML format - Supports structured queries with separate fields for street, city, country, and postal code ## Architecture Overview Nominatim imports OpenStreetMap data into a PostgreSQL database with PostGIS extensions. It builds a search index using a custom tokenizer that handles street abbreviations, language variants, and compound place names. The API is a Python (Falcon) web application that translates search queries into SQL, leveraging PostgreSQL full-text search and spatial indexes for fast lookups. ## Self-Hosting & Configuration - Requires PostgreSQL 12+ with PostGIS and a server with sufficient RAM (64 GB+ for a full planet import) - Import data from planet.osm.pbf for global coverage or use country/region extracts for smaller deployments - Run behind Nginx or Apache as a WSGI application using Uvicorn or Gunicorn - Configure tokenizer settings, language preferences, and result limits in the project settings - Update the database incrementally with osm2pgsql replication diffs for near-real-time data freshness ## Key Features - Covers the entire globe using OpenStreetMap's community-maintained dataset - Multi-language support with transliteration and local language variants - Structured and unstructured search modes for flexible querying - Incremental updates without full re-import for keeping data current - Docker images available for simplified deployment ## Comparison with Similar Tools - **Google Geocoding API** — proprietary with per-request pricing; Nominatim is free and self-hostable - **Pelias** — modular geocoder supporting multiple data sources; Nominatim is tightly integrated with OSM - **Photon** — Elasticsearch-based geocoder using Nominatim data; lighter to run but depends on Nominatim exports - **MapTiler Geocoding** — hosted service with curated data; Nominatim gives full control over data and updates - **HERE Geocoder** — enterprise geocoding; Nominatim offers comparable coverage without license fees ## FAQ **Q: How much hardware do I need for self-hosting?** A: A full planet import requires 64+ GB RAM and 1 TB+ SSD. Country-level extracts (e.g., Germany) can run on 8-16 GB RAM with much less storage. **Q: Can I use the public Nominatim API in production?** A: The public API at nominatim.openstreetmap.org has a usage policy limiting requests to 1 per second and requiring a valid User-Agent. For production use, self-host your own instance. **Q: How current is the data?** A: Self-hosted instances can apply minutely or daily OSM diffs. The public instance updates roughly once a day. **Q: Does Nominatim support autocomplete?** A: Nominatim is designed for full search queries rather than keystroke-by-keystroke autocomplete. For autocomplete, consider Photon or a custom Elasticsearch index built from Nominatim data. ## Sources - https://github.com/osm-search/Nominatim - https://nominatim.org/release-docs/latest/ --- Source: https://tokrepo.com/en/workflows/asset-24a11e90 Author: Script Depot