OPENSTREETMAP
MICHAEL FOGLEMAN 2016-03-02
speakerdeck.com/fogleman
Slide 2
Slide 2 text
OpenStreetMap (OSM) is a
collaborative project to
create a free editable map
of the world.
Slide 3
Slide 3 text
No content
Slide 4
Slide 4 text
Not the prettiest maps.
But lots of cool data is in there.
And it’s all freely available!
Slide 5
Slide 5 text
OPENSTREETMAP
STEP 1: ACQUIRE THE DATA
▸ Straight from the source
▸ openstreetmap.org > Export
▸ Bulk downloads
▸ download.geofabrik.de
▸ Through an API
▸ http://wiki.openstreetmap.org/wiki/Overpass_API/
Language_Guide
2016-03-02
Slide 6
Slide 6 text
No content
Slide 7
Slide 7 text
OPENSTREETMAP
STEP 2: UNDERSTAND THE FILE FORMATS
▸ .osm - XML format
▸ .osm.pbf - Binary protocol buffer format (much smaller on disk)
▸ Some tools / parsers only work with one format
▸ Convert between formats:
▸ osmosis --read-xml input.osm --write-pbf output.osm.pbf
▸ Filter the file contents:
▸ osmfilter --keep="highway=" input.osm > output.osm
2016-03-02
Slide 8
Slide 8 text
OPENSTREETMAP
STEP 3: FIND AN OSM PARSER IN YOUR FAVORITE LANGUAGE
▸ Python
▸ http://imposm.org/docs/imposm.parser/latest/
▸ Go
▸ https://github.com/qedus/osmpbf
▸ Javascript
▸ https://github.com/marook/osm-read
▸ https://www.npmjs.com/package/osmparser
▸ Lots of others…
2016-03-02
Slide 9
Slide 9 text
OPENSTREETMAP
STEP 4: UNDERSTAND THE DATA STRUCTURES!
▸ Node (Point)
▸ ID, Latitude, Longitude, Tags
▸ Way (Polyline)
▸ ID, Node IDs, Tags
▸ Relation (Group)
▸ ID, Member IDs, Tags
2016-03-02