Getting shapefile of river from OpenStreetMap?
Use the Overpass Turbo API!
First, I'd go to openstreetmap.org,
You can either
1) Search for the feature you're after. I chose "south platte river", which runs through Denver. This gives the fields and tags that are used by OSM to store the data:
2) Identify the tags and values of the features you're after by
- Zooming all the way into the map
- Click on the layers icon on the right (the three sheets of paper)
- Click on the last menu entry (
Map data
or something similar in your language) - The features on the map turn blue (make sure you're zoomed in far enough to see
- Click on the feature you're after
- The Tags and Values appear on left side of the screen, and you can proceed below...
Then go on over to the Overpass Turbo page, then click Wizard
Using information, the name value is South Platte River, and the waterway value is river, so you can build a query like this:
name="South Platte River" and waterway=river
Then click "build and run query"
The query will run and the result will show on the map:
Next click the "Export" option:
I like the geoJSON option
Click "Save"
Open the file in QGIS, and away you go!
You can do a 'save as' to save it as a new type of vector layer...
In your case, you could also use the waterway=river
query to get all the rivers in the area you're after, and you can draw a manual selection box to narrow down the geography.
@underdark showed me this.
The new QuickOSM plugin for QGIS provides a nice GUI to use the Overpass API. You can specify the key-value pairs that you want and it also offers user-friendly ways to filter by location: either bounding box or even by just specifying the region name like "Austria" for features within Austrian borders.
You can filter your OSM data with GDAL by bounding box and by attributes and save the results directly into any vector format that is supported by GDAL. Install GDAL version 1.10 or higher and read the manual pages of the OSM driver http://www.gdal.org/drv_osm.html and ogr2ogr http://gdal.org/ogr2ogr.html. This task with rivers and lakes can be done with default settings but it is often necessary to edit the osmconf.ini file first.
Rivers can be found from the OSM data by tag "waterway=river" and GDAL saves them into layer "lines". Lakes you find by "natural=water" and they go to layer "multipolygons". If your aim is to make shapefiles you must save rivers and lakes to different files because lines and polygons can't be saved into a same shapefile.
Examples below are using the india-latest.osm.pbf file from geofabrik. The basic commands to use:
ogr2ogr -f "ESRI Shapefile" -spat 76 22 77 23 -sql "select * from lines where waterway='river'" rivers.shp india-latest.osm.pbf --config ogr_interleaved_reading yes
ogr2ogr -f "ESRI Shapefile" -spat 76 22 77 23 -sql "select * from multipolygons where natural='water'" lakes.shp india-latest.osm.pbf --config ogr_interleaved_reading yes
Place your own BBOX into the -spat parameter in EPSG:4326 units.
Ogr2ogr is flexible and has lots of options. Read the manual page carefully.