Extracting Riverbank features

Hi,
I do some research involed within geomorphology and I wanted to see if it were possible to extract all riverbank features of openstreetmaps. I’ve downloaded the 13.8gb pbf file from http://download.bbbike.org/osm/planet/ and i’ve attempted to process the data by the following commands

osmconvert planet-latest.osm.pbf -o=file.osm
osmfilter file.05m --keep=“waterway=riverbank” -o=output.o5m

However in the first step using osmconvert I receive the following error

osmconvert Error: node nanodegrees must be 100:10000

So i have a few questions if anyone could be so kind as to answer/lead me to another link/post

  1. What does that mean?
  2. How do i resolve that?
  3. Is the osmfilter step appropriate for that?
  4. Is there a betterway to extract that information (ultimatley I want to get a GIS compatible dataset of riverbanks)

Cheers,
Bjorn

Hello Bjorn,
maybe you should try to do it with Overpass API.

Hi,

Have a try with GDAL and OSM driver http://www.gdal.org/ogr/drv_osm.html

Check first that the osmconf.ini file includes waterway attribute for lines

[lines]
# common attributes
osm_id=yes
osm_version=no
osm_timestamp=no
osm_uid=no
osm_user=no
osm_changeset=no

# keys to report as OGR fields
attributes=name,highway,waterway,aerialway,barrier,man_made

The command which saves all the waterway lines from the OSM extract of Finland into a shapefile is

ogr2ogr -f "ESRI Shapefile" -sql "select * from lines where waterway is not null" osm_waterways.shp finland.osm.pbf

It took 4 minutes with an old laptop to run the command and convert 19324 features into a shapefile. I have never tried this with the planet file and it may be too big for GDAL. The result is for sure GIS compatible and it does not need to be shapefile but any format that GDAL/OGR supports for writing can be used as well http://gdal.org/ogr/ogr_formats.html

Cheers,
Bjorn

Hi JRA,
Id like to ask a follow up question if you don’t mind. Would you know how to apply a similar concept but using the “othertags” that are not part of the osmconf.ini? As expected the entire world is too big to save as a shapefile but it does include a lot of unecessary when using waterway that I dont need. The docs say

“other_tags” field
When keys are not strictly identified in the osmconf.ini file, the key value pair is appended in a “other_tags” field, with a syntax compatible with the PostgreSQL HSTORE type. See the COLUMN_TYPES layer creation option of the PG driver.

For example :

ogr2ogr -f PostgreSQL “PG:dbname=osm” test.pbf -lco COLUMN_TYPES=other_tags=hstore

I’ve tried to follow the documentation there but i dont quiet understand how to apply hstore to my particular case and considering osm is a new feature i dont see any tutorials online.

Any help would be appreciated,
Cheers,
Bjorn

I am not sure about what you want to do exactly but the following command creates the points, lines, multilinestrings, multipolygons, and other_relations tables into PostGIS and saves attributes which are not converted into normal attributes to hstore field. Parameters -progress and -gt are not necessary. You can read what they mean from ogr2ogr documentation.

ogr2ogr -f postgresql PG:“dbname=‘db’ host=‘localhost’ port=‘5432’ user=‘user’ password=‘passwd’” finland-latest.osm.pbf -overwrite -skipfailures -lco COLUMN_TYPES=other_tags=hstore -progress -gt 2000

Notice, that the fields which you want to use in SQL select must be included in the list of normal OGR attributes, and that means that they will not go to “other_tags” field. GDAL is not perfect for filtering OSM data.