adding geocoder to any application

July 05, 2025
python osm
Nominatim is an official openstreet map API to access data with geocoding as well as reverse geocoding
adding geocoder to any application

Geocoding is an important piece of technology in the Geospatial domain, since it allows conversion between humand readable addresses and it's correspondant latitude and longitudes. There are many businesses which are majorly dependendent on this technology. Many companies have their products as geocoding API servcies which are backed by their own hyperlocal datasets such as Google maps, Mapbox , etc. while for global use cases these companies are very good, but almost every major countries have couple of companies which has better datasets. e.g. India as MapMyIndia, OLA maps, etc. but one major problem with all of these APIs is that they are paid and their cost is directly proportional to the number of queries that you make to the platform. Meaning that for academics or general purpose applications they might not be a good fit. 

Just like Google Maps, we also have Open street Map which is a community led Free and Open Source Mapping service, it allows users to add new data points as well as use this data in any application. open steet map has a geocoding API as a service knows as Nominatim.

 

What is Nominatim? 

Nominatim is a free API as a service which allows users to fetch OSM data. Because this is a free API, you don't need to sign up or anything to get API_KEY. But downside is that it has strict policy and rate limit to use in product grade applications. Good thing about Nominatim is that you can install it on your server and have a local working copy. You can checkout official documentation on Ubuntu server or using docker as well. 

 

Searching Address via Nominatim

Simplest way to integrate Nominatim is to make GET Call as following

curl --location 'https://nominatim.openstreetmap.org/search?q=taj mahal&format=json'

this will return a dictionary of the result

[
    {
        "place_id": 227834986,
        "licence": "Data © OpenStreetMap contributors, ODbL 1.0. http://osm.org/copyright",
        "osm_type": "way",
        "osm_id": 375257537,
        "lat": "27.1750075",
        "lon": "78.0421013",
        "class": "tourism",
        "type": "attraction",
        "place_rank": 30,
        "importance": 0.5933320965509387,
        "addresstype": "tourism",
        "name": "Taj Mahal",
        "display_name": "Taj Mahal, Taj East Gate Road, Taj Ganj, Agra, Uttar Pradesh, 282004, India",
        "boundingbox": [
            "27.1745358",
            "27.1754823",
            "78.0415593",
            "78.0426212"
        ]
    },
    {
        "place_id": 14422682,
        "licence": "Data © OpenStreetMap contributors, ODbL 1.0. http://osm.org/copyright",
        "osm_type": "way",
        "osm_id": 297791252,
        "lat": "-15.5644237",
        "lon": "-47.3367111",
        "class": "landuse",
        "type": "construction",
        "place_rank": 22,
        "importance": 0.10672248340581367,
        "addresstype": "construction",
        "name": "Taj Mahal",
        "display_name": "Taj Mahal, Vila Pantanal, Formosa, Região Geográfica Imediata de Águas Lindas de Goiás, Região Integrada de Desenvolvimento do Distrito Federal e Entorno, Região Geográfica Intermediária de Luziânia-Águas Lindas de Goiás, Goiás, Região Centro-Oeste, Brasil",
        "boundingbox": [
            "-15.5650361",
            "-15.5638579",
            "-47.3373823",
            "-47.3360305"
        ]
    }
]

If you are planning to use this data in mapping application, replace format=geojson

curl --location 'https://nominatim.openstreetmap.org/search?q=taj mahal&format=geojson'

which will return geojson