I want to extract some amenity(atm) from a pbf file. Here is what i've found.

osmosis --read-pbf myfile.pbf --tf accept-nodes amenity=atm --write-xml atm.osm

Myfile.pbf is a file for Paris area (France). It's 211Mo.
The atm.osm file is 1.8Go I think it's really big for only ATM of Paris. So is it the good way to extract atm?
I also tried with rarely amenity and it's always a 1.8Go file.
Is there a way to read atm.osm to know if the data is good?
If I'm not on the right way I want to extract ATM from the data to insert it in the future in a database.

  • You are pulling in too much data because you only filter nodes but keep all ways and relations. You have to specify --tf reject-ways --tf reject-relations if you want to ignore ways and relations.
    – scai
    Commented May 18, 2015 at 17:03

2 Answers 2


I found a different query :

osmosis --read-pbf myfile.pbf --node-key-value keyValueList='amenity.atm' --write-xml atm.osm

I got a 250ko xml file with all the atm. Hope it can help other peolple

  • 1
    Note that this will not extract all ATMs. There are ATMs are tagged with atm=yes (about 100.000 worldwide). This tag is used in combination with amenity=bank and does not only appear on nodes but also on ways and even some relations.
    – scai
    Commented May 17, 2015 at 19:17
  • so atm=yes are atm in banks? So what is the other query I need to do?
    – BoumTAC
    Commented May 17, 2015 at 23:31
  • See my answer.
    – scai
    Commented May 18, 2015 at 17:02

Try the following queries:

# read all nodes with amenity=atm or atm=yes, ignore ways and relations
osmosis --read-xml data.osm --tf accept-nodes amenity=atm --tf reject-ways --tf reject-relations --write-xml amenity_atm_nodes.osm
osmosis --read-xml data.osm --tf accept-nodes atm=yes     --tf reject-ways --tf reject-relations --write-xml atm_yes_nodes.osm

# read all ways with amenity=atm or atm=yes, keep only related nodes, ignore relations
osmosis --read-xml data.osm --tf accept-ways  amenity=atm --used-node --tf reject-relations --write-xml amenity_atm_ways.osm
osmosis --read-xml data.osm --tf accept-ways  atm=yes     --used-node --tf reject-relations --write-xml atm_yes_ways.osm

# read all relations with amenity=atm or atm=yes, keep only related ways and nodes
osmosis --read-xml data.osm --tf accept-relations amenity=atm --used-way --tf accept-relations atm=yes --used-node --write-xml amenity_atm_relations.osm
osmosis --read-xml data.osm --tf accept-relations atm=yes     --used-way --tf accept-relations atm=yes --used-node --write-xml atm_yes_relations.osm

# merge all files together
osmosis --rx amenity_atm_nodes.osm --rx atm_yes_nodes.osm \
        --rx amenity_atm_ways.osm --rx atm_yes_ways.osm \
        --rx amenity_atm_relations.osm --rx atm_yes_relations.osm \
        --merge --merge --merge --merge --merge --wx atm.osm

However the second block (the part with the ways) seems to pull in slightly too much data. No idea what I'm doing wrong, maybe someone can fix it. And the syntax is just horrible. Also you can probably speed up things a lot by using pipes instead of calling osmosis again and again for each sub task.

Alternatively you may also think about just using Overpass API. Constructing tag filters with Overpass API is a little simpler and you don't even have to download the whole area beforehand. Here is an example query on overpass turbo:

This has been generated by the overpass-turbo wizard.
The original search was:
“amenity=atm or atm=yes in Paris”
// fetch area “Paris” to search in
// gather results
  // query part for: “amenity=atm”
  // query part for: “atm=yes”
// print results
out body;
out skel qt;

Your Answer

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

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