###what is osm
"Wikipedia of maps"
So, a global dataset of anything people map
And it's yours (and everyone's)
More than just basemaps, a huge source of data
###why is this exciting? You can use it to power your apps and do cool data analysis
Like an app that tells you the prices of a cup of coffee in your city
Or you could use it to make cool maps.
To start using OSM data, we need to know
-
What's in the dataset
-
How to access it
###OSM data
######what's inside OSM?
The Elements of OSM data:
Each node, way, or relation has information stored about it.
All information is stored as tags of Key-Value pairs.
So a node with a name of New York City would store it with a tag like this:
["name":"New York City"]
Let's go to OpenStreetMap and explore the dataset a bit.
It's helpful to look at standards for tagging OSM features when you are editing or querying data.
###using osm data
There are two ways we can work with OSM data:
- Download a data file and work with it locally (PostGIS or QGIS)
- Directly query the OSM dataset with the Overpass API
####Downloading data
Common sources:
- Planet.osm- a 575 gb file of the global dataset
- Continent
- Metro-Area
Available formats:
- XML (native)
- PBF (xml binary-smaller and faster)
- GeoJSON
- Shapefile
####osm data tools
###licensing
"OpenStreetMap® is open data, licensed under the Open Data Commons Open Database License (ODbL) by the OpenStreetMap Foundation (OSMF)."
Give Attribution
Recognize the license (link to the copyright page)
###example
We'll use OSM data to tell us where we could grab drinks.
We need to know:
1.Where we are
2.Where the bars are
We'll use the Overpass API since we don't need the entire city's data. We're just asking for a couple of nodes nearby.
Allows you to request specific data (with a query).
Has it's own query language.
Can be used as a backend for real-time osm applications.
Get our location
143 Roebling Street, #2, Brooklyn, NY
Get bar locations:
How would we query for bars near us?
We're looking for a specific type of node.
This tag will be helpful:
Since the Overpass Query Language can be confusing, let's use a tool that helps us build our query.
Once we're comfortable with the language for querying, we can directly download data from the command line or through a script:
overpass api
wget -O osm_bars.osm "http://overpass-api.de/api/interpreter?data=[out:json][timeout:25];(node["amenity"="bar"](40.70995118412107,-73.9604287147522,40.718236246820766,-73.9545578956604););out body;>;out skel qt;"
###additional resources