Skip to content

MaptimeNYC/getting-osm-data

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 

Repository files navigation

getting-osm-data

###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

  1. What's in the dataset

  2. 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"]

A cafe would look like this:

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:

  1. Download a data file and work with it locally (PostGIS or QGIS)
  2. Directly query the OSM dataset with the Overpass API

####Downloading data

Common sources:

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: amenity_bar

Since the Overpass Query Language can be confusing, let's use a tool that helps us build our query.

Overpass Turbo

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published