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

Hello,

i have got a file osm form ..geofabric and i want to get from that file infomration like - street name , city name , housenumber and coordinates to csv file. to achive that i used osmconverter

and almost everything is fine but , how can i know the name od columns used in osm file ? how can gat all columns from osm file ?

i used a comand like this osmconvert and.osm --csv="@id @oname osm_id @o type @lon @lat @version @uid @user smoking designation addr:postcode addr:city a ddr:street addr:housenumber @" --csv-headline --out-csv -o="final.csv"

asked 04 Oct '16, 12:05

marbo4's gravatar image

marbo4
11112
accept rate: 0%

edited 04 Oct '16, 12:07


OSM data doesn't have a fixed number of attributes.

If you need to get "all" tag information from a specific OSM extract in to a fixed format column format you will need to first do a pass over the file to determine all keys that are present, or simply write a small script that does this in one pass (which might be a bit painful for a large extract).

permanent link

answered 04 Oct '16, 12:40

SimonPoole's gravatar image

SimonPoole ♦
44.7k13326701
accept rate: 18%

Hm, hm Thnx for answer.

But i don't know how can I Pass over the file ? which program ? QGIS ? I try to use Qgis with plugin QuickOSM but it's crashes every time . File are to large.

(13 Oct '16, 07:29) marbo4

As Simon said, you need to know the structure before you can create a csv. I can imagine some sort of parser to do this, but that only makes sense if you often have this problem. What I would do myself is use the PBF download from Geofabrik, then convert to spatialite. This can then easily be queried in QGIS. Common tags already are their own column, less common tags are merged together in an "other tags" column. These can still be queried with some creativity, but you can also edit the config file behind the process to get the columns straight into your spatialite database.

Here's a step by step:

  • Download OSGEO4W (if you're on windows, and don't use GDAL/OGR already):
  • Install and make sure to include GDAL and QGIS.
  • Open the Osgeo shell. An icon should have been added to your desktop.
  • It looks just like a DOS terminal. Use the cd command to navigate to where your .pbf is
  • This command will create your spatialite database:

    ogr2ogr -f SQLITE -dsco SPATIALITE=yes yourdatabasefile.sqlite themapyoudownloaded.osm.pbf

  • You can use the sqlite file in an easy program like Gaia GIS. This will often work better than QGIS for heavier data manipulation.

  • You can drag and drop the data into QGIS and query the data there to create map layers.
  • Exactly how the data is treated in the conversion from PBF to SQLITE is defined in osmconf.ini (if you have more than one QGIS installs, you might have several of these files!). This is quite easy to adapt to your needs.
permanent link

answered 17 Oct '16, 10:01

joost%20schouppe's gravatar image

joost schouppe
3.4k245087
accept rate: 12%

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:

×47
×42

question asked: 04 Oct '16, 12:05

question was seen: 7,150 times

last updated: 17 Oct '16, 10:01

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