Python geocoding (simple)

To get a “good enough” WGS84 latitude and longitude for a given address, I found a tiny python library called python-omgeo.

 

from omgeo import Geocoder

class OmGeocoder():
def __init__(self):
self.geocoder = Geocoder()

def geocode(self, address):
result = self.geocoder.geocode(address)
best = result[‘candidates’][0]
return best.y, best.x

And you are done.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.