OpenStreetMap has a ton of data...on some things. It's a good place to get "base map" data like roads, rivers or other features. Addresses, businesses and other amenties may not be complete. But you can improve the data to make them complete!
First, let's take a look at the interface.
Buttons:
- Run fires off the code in the window. Result appears on the map to the right.
- Share gives you a link of the current query to..umm...share
- Export makes a sandwich. No! It allows you to download the result in GeoJSON, GPX, KML or XML.
- Wizard helps your construct queries
- Save keeps your query for the future
- Load brings up any saved queries
- Settings pick a new background, language and spin cycle
- Help not as effective as 911
You can write a query to get anything in OpenStreetMap. The only real limit seems to be size and your ImAgInAtIoN. So, trying to download the nation's freeway system may not be possible. But you could for Los Angeles County.
A good start is defining what you want in terms of OSM's tags.
For instance, to download all the water fountains in Griffith Park you'll need to use OSM's tag amenity=drinking_watter. A quick Google search of search of the OSM Wiki will help you.
The easiest thing to do is to drop amenity=drinking_watter
into Overpass turbo's "Wizard" if the map is showing Griffith Park.
/*
This has been generated by the overpass-turbo wizard.
The original search was:
“amenity=drinking_water”
*/
[out:json][timeout:25];
// gather results
(
// query part for: “amenity=drinking_water”
node["amenity"="drinking_water"]({{bbox}});
way["amenity"="drinking_water"]({{bbox}});
relation["amenity"="drinking_water"]({{bbox}});
);
// print results
out body;
>;
out skel qt;
One common problem is to create a line map of just the freeways for reference (and nothing else). The Census provides a file for primary roads, but it excludes highways like the 101.
It takes a combination of secondary and primary roads to get all the "freeways" like the 101 and the 134.
But the census file also includes roads like Santa Monica Boulevard which we wouldn't want to include.
The OSM tagging for freeways (and any roads or paths) is to use highway=
Freeways fit into highway=motorway
/*
This has been generated by the overpass-turbo wizard.
The original search was:
“highway=motorway”
*/
[out:json][timeout:25];
// gather results
(
// query part for: “highway=motorway”
node["highway"="motorway"]({{bbox}});
way["highway"="motorway"]({{bbox}});
relation["highway"="motorway"]({{bbox}});
);
// print results
out body;
>;
out skel qt;
You can leave the attributes out and just get anything that's a node, way or relation.
By default the bounding box defaults to the boundaries of the map. {{box}}
But you can specify your own boundaries using this order
(lat_min, lon_min, lat_max, lon_max)
/*
This has been generated by the overpass-turbo wizard.
The original search was:
“"Drinking Water"”
*/
[out:json][timeout:25];
// gather results
(
// query part for: “"Drinking Water"”
node(35.4808,-118.4676,35.6666,-118.2051);
way(35.4808,-118.4676,35.6666,-118.2051);
relation(35.4808,-118.4676,35.6666,-118.2051);
);
// print results
out body;
>;
out skel qt;
You can search for data in the past by adding a date next to the timeout. You'll also need to change out body;
to out meta;
/*
This has been generated by the overpass-turbo wizard.
The original search was:
“amenity=drinking_water”
*/
[out:json][timeout:25][date:"2016-08-21T00:00:00Z"];
// gather results
(
// query part for: “amenity=drinking_water”
node["amenity"="drinking_water"]({{bbox}});
way["amenity"="drinking_water"]({{bbox}});
relation["amenity"="drinking_water"]({{bbox}});
);
// print results
out meta;
>;
out skel qt;
You can download straight out of Overpass turbo if you're request is too big.
http://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_API_by_Example