1 of 20

Python-Geocoder.org

$pip install geocoder

@DenisCarriere

2 of 20

What is Geocoding?

Seoul, Korea

“Seoul, Korea”

(37.55, 126.99)

3 of 20

4 of 20

Installation

PyPi

$ pip install geocoder

GitHub

$ git clone https://github.com/DenisCarriere/geocoder.git

$ cd geocoder

$ python setup.py install

5 of 20

Simple to use

>>> import geocoder

>>> g = geocoder.google(‘Ottawa, ON’)

>>> g.json

...

Python-Geocoder.org

@DenisCarriere

6 of 20

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

7 of 20

g.bbox

Bounding Box

Python-Geocoder.org

@DenisCarriere

8 of 20

g.geojson

GeoJSON

Python-Geocoder.org

@DenisCarriere

9 of 20

Reverse Geocoding

Python-Geocoder.org

@DenisCarriere

10 of 20

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"

11 of 20

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>’)

12 of 20

Mapzen is broken?

Python-Geocoder.org

@DenisCarriere

>>> g = geocoder.mapzen(‘<Location>’)

AttributeError: 'module' object has no attribute 'mapzen'

2 more Weeks!!

13 of 20

Command Line Interface

$ geocode “Ottawa ON” -p google

Python-Geocoder.org

@DenisCarriere

14 of 20

QGIS Field Calculator

import geocoder��@qgsfunction(group='Geocoder')�def geocode(location, feature, parent):� g = geocoder.google(location)� return g.wkt

Python-Geocoder.org

@DenisCarriere

15 of 20

Playing with Open Data

City of Ottawa

data.ottawa.ca

City of Toronto

toronto.ca/open

City of Vancouver

data.vancouver.ca

16 of 20

Geo-Spatial Formats

  • Shapefile
  • GeoJSON
  • KML
  • CSV
  • Excel

17 of 20

Accuracy &

Quality

Locality

Route

Street

Address

18 of 20

Geo-Databases

19 of 20

  • Pull Request

  • GitHub Stars

  • Submit Issue

20 of 20

Python-Geocoder.org

$pip install geocoder

@DenisCarriere