Last active
December 18, 2015 12:08
-
-
Save abulte/5780242 to your computer and use it in GitHub Desktop.
Geocode an address in Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# Copyright 2013 Alexandre Bulté <alexandre[at]bulte[dot]net> | |
# | |
# This Source Code Form is subject to the terms of the Mozilla Public | |
# License, v. 2.0. If a copy of the MPL was not distributed with this | |
# file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
## Requirements | |
# pip install pygeocoder | |
from pygeocoder import Geocoder | |
address = "1 route de Versailles, 78117 Chateaufort, France" | |
results = Geocoder.geocode(address) | |
if len(results) > 0: | |
print '(%s,%s)' % results[0].coordinates | |
else: | |
print 'No result.' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment