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

How do I know what the field names are in .osm files.

0

I want to use osmconvert to convert an osm file to a csv file with just the street, city, state, latitude/longitude fields. But I don't know what the actual field names are in the osm file. How do I open it to see or is there a list somewhere? The .osm file is rather large, so if there was a cmd line to view fields, that would be easier. Thanks!

asked 13 Sep '12, 22:08

JMB5's gravatar image

JMB5
16334
accept rate: 0%

edited 13 Sep '12, 22:09


2 Answers:

1

If you want to see what the most commonly used keys are worldwide, have a look at Taginfo. You can use standard GNU/Unix utilities to look at what's in the ".osm" file, if it's too big for a text editor. If you're on Windows and don't have things like "grep" available, have a look at Unxutils, which is a native build of most of the common GNU utilities for Windows, or Cygwin, which is a slightly different approach to solving the same problem.

For example, looking at a small .osm file that I happen to have lying around:

c:\Temp\osm\new>grep 'k="highway"' local_101017_01.osm | wc
    3182     9546   109056

I can see that there are 3182 "highway" items (roads, paths, bus stops etc.)

To see what sort of highway items there are I can do:

c:\Temp\osm\new>grep 'k="highway"' local_101017_01.osm | \utils\sort -u | more

  tag k="highway" v="bridleway"
  tag k="highway" v="bus_stop"
  tag k="highway" v="cycleway"
  tag k="highway" v="footway"
  tag k="highway" v="ford"

(rest of output truncated and chevrons removed)

answered 13 Sep '12, 23:36

SomeoneElse's gravatar image

SomeoneElse ♦
36.9k71370866
accept rate: 16%

0

Have a look at the similar program osmfilter.

It has features to produce a listing for all used keys in an osm file, see Osmfilter#Getting_Tag_Statistics

answered 15 Sep '12, 14:35

stephan75's gravatar image

stephan75
12.6k556210
accept rate: 6%

Source code available on GitHub .