Skip to main content

Reverse geo-coding using Open Street Maps - a best alternative for Google Maps

In my previous post, i have explained how to consume ESRI Rest API for reverse geocoding. In this Article i will explain how to use "nominatim" for reverse geo-coding.

Nominatim (from the Latin, 'by name') is a tool to search OSM data by name and address and to generate synthetic addresses of OSM points (reverse geocoding). It can be found at nominatim.openstreetmap.org.

Nominatim is also used as one of the sources for the search box on the OpenStreetMap home page. Several companies provide hosted instances of Nominatim that you can query via an API,

Just like in my earlier blog, i took Charminar coordinates for testing!

ReverseGeocoding- xml URL

https://nominatim.openstreetmap.org/reverse?format=xml&lat=17.3616&lon=78.4747&zoom=18&addressdetails=1

--XML RESPONSE FROM NOMINATIM SERVER----------
<reversegeocode timestamp="Mon, 10 Dec 18 09:29:01 +0000" attribution="Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright" querystring="format=xml&lat=17.3616&lon=78.4747&zoom=18&addressdetails=1">
<result place_id="133270429" osm_type="way" osm_id="238186115" ref="Charminar" lat="17.3616024" lon="78.4746421377397" boundingbox="17.3614645,17.3617436,78.4744871,78.4747917">
Char Minar, Charminar Circle, Ward 49 Ghansi Bazar, Greater Hyderabad Municipal Corporation South Zone, Hyderabad, Telangana, 500002, India
</result>
<addressparts>
<attraction>Char Minar</attraction>
<road>Charminar Circle</road>
<suburb>Ward 49 Ghansi Bazar</suburb>
<city_district>Greater Hyderabad Municipal Corporation South Zone</city_district>
<city>Hyderabad</city>
<state_district>Hyderabad</state_district>
<state>Telangana</state>
<postcode>500002</postcode>
<country>India</country>
<country_code>in</country_code>
</addressparts>
</reversegeocode>

-----END OF RESPONSE------------------------------------



ReverseGeocoding- jsonv2 url

https://nominatim.openstreetmap.org/reverse?format=jsonv2&lat=17.3616&lon=78.4747

-----JSON RESPONSE FROM NOMINATIM SERVER--------

{"place_id":"133270429","licence":"Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright","osm_type":"way","osm_id":"238186115","lat":"17.3616024","lon":"78.4746421377397","place_rank":"30","category":"tourism","type":"attraction","importance":"0.392830388816127","addresstype":"tourism","name":"Char Minar","display_name":"Char Minar, Charminar Circle, Ward 49 Ghansi Bazar, Greater Hyderabad Municipal Corporation South Zone, Hyderabad, Telangana, 500002, India","address":{"attraction":"Char Minar","road":"Charminar Circle","suburb":"Ward 49 Ghansi Bazar","city_district":"Greater Hyderabad Municipal Corporation South Zone","city":"Hyderabad","state_district":"Hyderabad","state":"Telangana","postcode":"500002","country":"India","country_code":"in"},"boundingbox":["17.3614645","17.3617436","78.4744871","78.4747917"]}


-----END OF RESPONSE------------------------------------



See you guys in my next Article! you can reach me at  sree@itoolz.in for any info

Comments

Popular posts from this blog

Google Map API alternative for your GPS Tracking website reverse geocoding

Google Map API for reverse Geo-coding of Address information is not free now. You have some limitations for daily usage. being in GPS tracking world, we will need Reverse Geo-coding for all the vehicles we track. In this Blog i will discuss some alternatives to Google maps for reverse Geo-coding. ESRI REST API: ESRI has a rest api using which you can reverse Geo-coding your Latitude and Longitude into an Address. The REST url returns a Json string with required Address information. For Example i have below information of CharMinar area (an Historical Monument in Hyderbad,India) Country India Latitude 17.361431 Longitude 78.474533 DMS Lat 17° 21' 41.1516'' N DMS Long 78° 28' 28.3188'' E The REST API to get reverse geo coded address http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/reverseGeocode?location=78.474533%2C17.361431&langCode=fr&outSR=&forStorage=false&f=pjson The REST response in json as below { "address&