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

osmconvert - CSV and relations / ways

1

Hello,

I have a question. Using osmconvert can reasonably be saved in CSV relations and ways?

With the nodes do not have a problem. Simply:

./osmconvert europe-latest.osm.pbf --out-csv --csv="@id @lat @lon"

The current record in the CSV relations and ways, however, does not make sense to me ...

It looks like this:

relation    3903876     
relation    3903985     
relation    3903986     
relation    3903987     
relation    3903988     
relation    3903989     
relation    3903990

How to identify what is in relation to what?

asked 06 Jan '15, 20:45

Rysiu's gravatar image

Rysiu
26334
accept rate: 0%


3 Answers:

1

Ways and relations are too complex to be output in a CSV file. If you want to process ways and relations, other avenues might be more promising, e.g. writing a program that reads the OSM file (using e.g. the Osmium library), or loading the OSM file into a database with osm2pgsql and then running your analysis on the database.

If you really need a text file with one OSM object per line, try Osmium's "OPL" format.

answered 06 Jan '15, 22:42

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
82.5k927201273
accept rate: 23%

How big will the MySQL database if the file osm.bz2 takes almost 900 MB?

(06 Jan '15, 22:54) Rysiu

0

As @Frederik said, relations & ways are complicated. osm2psql can output a pgsimp format, which is a directory of tab separated files (which are like CSVs). It might do what you want.

answered 07 Jan '15, 10:26

rorym's gravatar image

rorym
5.4k1449100
accept rate: 11%

0

The --csv="@id @lat @lon" in your question suggests that you need just IDs and coordinates. Maybe the option --all-to-nodes will help. It will retrieve the coordinates for all your ways and relations.

https://wiki.openstreetmap.org/wiki/Osmconvert#Dispose_of_Ways_and_Relations_and_Convert_them_to_Nodes

answered 07 Jan '15, 20:44

Marqqs's gravatar image

Marqqs
448510
accept rate: 22%

Source code available on GitHub .