Python-Geocoder.org
$pip install geocoder
@DenisCarriere
What is Geocoding?
Seoul, Korea
“Seoul, Korea”
(37.55, 126.99)
Installation
PyPi
$ pip install geocoder
GitHub
$ git clone https://github.com/DenisCarriere/geocoder.git
$ cd geocoder
$ python setup.py install
Simple to use
>>> import geocoder
>>> g = geocoder.google(‘Ottawa, ON’)
>>> g.json
...
Python-Geocoder.org
@DenisCarriere
g.json
Simple & Clean JSON Output
{
"provider": "osm",
"lng": 127.032,
"lat": 37.466,
"housenumber": 70,
"street": "Maeheongil",
"district": "Yangjae-dong",
"postal": 06769,
"city": "Seoul",
"country": "South Korea",
}
Python-Geocoder.org
@DenisCarriere
g.bbox
Bounding Box
Python-Geocoder.org
@DenisCarriere
g.geojson
GeoJSON
Python-Geocoder.org
@DenisCarriere
Reverse Geocoding
Python-Geocoder.org
@DenisCarriere
Geocoding with Proximity
Python-Geocoder.org
@DenisCarriere
>>> import geocoder
>>> latlng = [45.3, -66.1]
>>> location = “200 Queen Street”
>>> g = geocoder.mapbox(location, proxmity=latlng)
>>> g.province
"New Brunswick, Canada"
Using different providers
Python-Geocoder.org
@DenisCarriere
>>> import geocoder
>>> g = geocoder.mapbox(‘<Location>’)
>>> g = geocoder.bing(‘<Location>’)
>>> g = geocoder.osm(‘<Location>’)
>>> g = geocoder.mapzen(‘<Location>’)
Mapzen is broken?
Python-Geocoder.org
@DenisCarriere
>>> g = geocoder.mapzen(‘<Location>’)
AttributeError: 'module' object has no attribute 'mapzen'
2 more Weeks!!
Command Line Interface
$ geocode “Ottawa ON” -p google
Python-Geocoder.org
@DenisCarriere
QGIS Field Calculator
import geocoder��@qgsfunction(group='Geocoder')�def geocode(location, feature, parent):� g = geocoder.google(location)� return g.wkt
Python-Geocoder.org
@DenisCarriere
Playing with Open Data
City of Ottawa
data.ottawa.ca
City of Toronto
toronto.ca/open
City of Vancouver
data.vancouver.ca
Geo-Spatial Formats
Accuracy &
Quality
Locality
Route
Street
Address
Geo-Databases
Python-Geocoder.org
$pip install geocoder
@DenisCarriere