This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

Exporting entire railway network

0

I need to export entire world railway network from planet file. I want to store them in PosGis database as collection of points and lines. I would like to simplify she shapes and remove parallel lines (in case of multiple tracks) In case of stations I need always to have point (even if in original it is shape). I made some experiments with osmium but without success - I don't know how to merge all tags relations and ways into lines. Any advice

asked 26 Aug '18, 13:47

jkan997's gravatar image

jkan997
11112
accept rate: 0%

edited 26 Aug '18, 21:16

aseerel4c26's gravatar image

aseerel4c26 ♦
32.6k18248554

1

Is using osmium a requirement or would some other tool also be fine for you?

(26 Aug '18, 15:18) aseerel4c26 ♦

Any free tool that will handle planet XML is fine.

(26 Aug '18, 20:25) jkan997

okay, I have made your question's tags less specific to osmium. Since only the railway network is quite sparse data, I guess that going via Overpass API (instead of the full planet) might be a better option. But I neither know osmium nor the Overpass query languages good enough to help any further.

(26 Aug '18, 21:18) aseerel4c26 ♦

Osmium is quite straightforward. You might just pick every tag you need, for example water-related I needed:

osmium tags-filter -o planet-water.osm.pbf planet-latest.osm.pbf natural=water landuse=reservoir landuse=basin waterway=dock

It can also do much more complex things, see the documentation:

https://osmcode.org/osmium-tool/manual.html

(27 Aug '18, 00:30) kocio

Source code available on GitHub .