NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

I'm trying to filter rivers, highways and water from a planet file in Osmosis as follows:

osmosis \
--read-pbf-fast file="planet-latest.osm.pbf" workers=8 \
--buffer \
--tf accept-relations natural=water waterway=riverbank highway=*  \
--used-way \
--used-node \
--write-pbf planet-RELATIONS.osm.pbf

osmosis \
--read-pbf-fast file="planet-latest.osm.pbf" workers=8 \
--buffer \
--tf accept-ways natural=water waterway=riverbank highway=* \
--tf reject-relations \
--used-node \
--write-pbf planet-WAYS.osm.pbf

#MERGE RELATIONS AND WAYS
osmosis \
--read-pbf-fast file="planet-RELATIONS" workers=8 \
--read-pbf-fast file="planet-WAYS" workers=8 \
--merge \
--write-pbf planet-MERGED-highway-water-riverbank.osm.pbf

After that I turn the .pbf into GeoJSON with Ogr2ogr and then into .mbtiles with Tippecanoe. The highways and water work perfectly, but the rivers are messy: parts of every river works well while some parts have broken polygons, and others parts are shown as multilinestrings even though they should(?) be polygons.

If you have any pointers on how to filter rivers properly I'd greatly appreciate it! (If this is the wrong forum for this question please redirect me!)

asked 29 Jul '17, 21:11

Azei's gravatar image

Azei
15113
accept rate: 0%


Not sure what osmosis and ogr2ogr are doing exactly, try with osmium:

osmium tags-filter planet-latest.osm.pbf natural=water waterway=riverbank highway \
    -o planet-highway-water-riverbank.osm.pbf

Much easier command line and much faster than osmosis.

There is also an osmium export command that can convert this into GeoJSON, but it is not in the released version yet and only available in the export branch on github.

permanent link

answered 29 Jul '17, 21:32

Jochen%20Topf's gravatar image

Jochen Topf
5.2k55074
accept rate: 31%

2

It turns out ogr2ogr was the problem, converting waterway=river to lines when doing the .pbf to .geojson conversion when really they should be converted to polygons. With osmium export I got that working, thanks alot!

Also for the record, osmium tags-filter turns out to be orders of magnitude faster and simpler than osmosis for anyone interested.

(30 Jul '17, 12:24) Azei
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×252
×73
×66

question asked: 29 Jul '17, 21:11

question was seen: 3,598 times

last updated: 30 Jul '17, 12:24

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum