6

I'd like to get a comma separated list of all the valid values under the key 'amenity'. Is there anywhere that I can get this? I know they are listed on the wiki, but for programming purposes I need a full list and don't feel like copying each entry in the list manually (it will take ages).

For context I'm writing a C# SDK for Overpass API, and I'm creating an enum called AmenityType. It looks something like this:

public enum AmenityType
{
    invalid, 
    bar,
    bbq,
    biergarten,
    cafe,
    drinking_water,
    fast_food,
    food_court,
    ice_cream,
    pub,
    restaurant,
    college,
    kindergarten,
    library,
    public_bookcase,
    school,
    fire_station,
    fountain,
    place_of_worship,       
}

Now I just need all the values!

3 Answers 3

5

You can also take a look at the most popular amenity values at taginfo. This list is available via JSON. Moreover taginfo offers downloads for all databases.

1
  • I would upvote you but don't have enough rep yet :/
    – mchristos
    Dec 7, 2016 at 11:18
2

There is an easy way to get the requested information if you have direct access to an OSM raw-data file, preferably in .pbf or .o5m format. If .pbf format, you need to convert it to .o5m first. In this example the file contains OSM data of the German region "Bremen":

osmconvert bremen.pbf -o=bremen.o5m

Then you can retrieve the "amenity" tag values:

osmfilter bremen.o5m --out-key=amenity

Further information can be found here:

https://wiki.openstreetmap.org/wiki/osmconvert#Converting_Files

https://wiki.openstreetmap.org/wiki/osmfilter#Getting_Tag_Statistics

1

If you have OSM data in a database then just use SELECT DISTINCT on amenity. That will give you all the amenity types in your data (if not the entire globe).

Alternatively, with minimal editing, copy the table from the OSM page and select the one column you want.

2
  • I'm not sure what you meant about SELECT DISTINCT. I have my own instance of the Overpass API, and I only know how to query the data via the API (query language). Anyway I managed by copying the table into Microsoft Word, and eventually getting the text into the form I wanted. Thanks
    – mchristos
    Dec 7, 2016 at 9:12
  • 1
    Overpass API does not support something like SELECT DISTINCT at this time, so this answer does at least not apply without switching a different database.
    – mmd
    Dec 7, 2016 at 13:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.