Online geocoding - alabarga/geospatial-python GitHub Wiki

some datasets have only an address column without latitude and longitude columns to represent your data geographically. In that case, you need to convert your data into a geographic format. The process of converting addresses to geographic information — Latitude and Longitude — to map their locations is called Geocoding.

Geocoding is the conversion of a human-readable location name into a numeric (or other machine-processable) location such as a longitude and latitude. For example:

London => [geocoding] => {latitude: -0.81, longitude: 51.745}

Geocoding is a common need when working with data as you may only have human-readable locations (e.g. “London” or a zip code like “12245”) but for a computer to display the data on a map or query it requires one to have actual numerical geographical coordinates.

Aside: in the example just given we’ve the term “London” has been converted to a point with a single Latitude and Longitude. Of course, London (the City in the UK) covers a significant area and so a polygon would be a better representation. However, for most purposes a single point is all we need.

https://www.geofabrik.de/data/geocoding.html https://opencagedata.com/demo https://locationiq.com/docs https://maps.locationiq.com/web_leaflet.php#zoom=12&lat=51.8363&lon=107.5838 https://towardsdatascience.com/geocoding-and-reverse-geocoding-using-python-36a6ad275535

In theory, to do geocoding we just need a database that lists place names and their corresponding coordinates. Several, such open databases exist including geonames and OpenStreetMap.

However, we don’t want to have to do the lookups ourselves – that would either involve programming or a lot of very tedious scrolling.

As a result, various web services have been built which allow look ups online or over a web API. These services also assist in find the best match for a given name – for a given simple place name such as London there may be several matching locations (e.g. London, UK and London, Ontario) and one needs some way to match and rank these alternatives.

There are a variety of Geocoding services. We recommend using one based on open data such as the MapQuest Nominatim service which uses the Open Street Map_ database. This service provides both “human-readable” service (HTML)

London HTML

and a “machine-readable” API (JSON and XML) for automated Geocoding.

London JSON

Right, so now it’s time to get your hands dirty.


Once you’ve finished – drop us a link to what you have produced in the comments below – that could just be a full geocoded dataset – or a beautiful map, go as far as you need!