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


I am using node-osmium for parsing a .pbf file. It works pretty well but I am missing some information: class and type of the osm-object e.g. class=amenity, type=parking

These are available in objects I get e.g with overpass or nominatim.

My question ist, if this information is simply not available in the returned object, or if I did not find the correct method to receive it.

asked 25 Apr '17, 15:07

autumnus's gravatar image

accept rate: 0%

OpenStreetMap objects don't have a "class" and "type". Rather, they can have any number of tags and values. Nominatim simplifies that into a "class" and "type" - for example, something tagged building=house will boil down to class=building, type=house in Nominatim. Nominatim tries to guess what the "important" thing is about the object but if something is tagged amenity=place_of_worship and shop=books at the same time, Nominatim will have to choose and neither choice is "clearly correct". Overpass doesn't do this; it returns the full list of tags and their values, just as Osmium does. Osmium exposes the tags through the "tags" and "get_value_by_key" methods on the Object class, see:

permanent link

answered 25 Apr '17, 22:11

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
accept rate: 23%

edited 26 Apr '17, 08:49

scai's gravatar image

scai ♦

I new about the functions "tags()" and "get_value_by_key()" and I recognized that Nominatim sometimes has two lines in its database with the same osm_id and different class and type. The fact, that the class and type are somehow "calculated" is new to me. That helps a lot and saves me time, as I don't have to search any more :-) Thanks!

(26 Apr '17, 12:54) autumnus

Follow this question

By Email:

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



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "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:


question asked: 25 Apr '17, 15:07

question was seen: 3,424 times

last updated: 26 Apr '17, 12:54

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