For some experiments on OSM data size, I am using osmfilter to remove ways and relations with certain tags from the planet dump. But AFAIK osmfilter does not remove the corresponding nodes. So I'm left with a huge number of nodes that are not used by anything, and that distort my data size results.

Is there a tool to remove unused nodes (those that have no tags and are not referenced by either a way or a relation) from OSM data files (e.g. .pbf or .osm.bz2 files)?

  • Do you want to keep the data in native OSM format?
    – user30184
    Dec 2, 2014 at 8:51
  • Yes, I do. I'm doing size comparisons on the resulting data sets, and the results are more reliable when input and output are in the same format. Also, directly processing these files is usually faster that first storing all data in a database by one to two orders of magnitude.
    – Dreamer
    Dec 2, 2014 at 8:57

1 Answer 1


You could drop all the data (--drop-*) and keep only the bits you're interested in (--keep-*)

Cfr http://wiki.openstreetmap.org/wiki/Osmfilter#Drop_all_Nodes.2C_Ways_or_Relations

You can also try with osmosis http://wiki.openstreetmap.org/wiki/Osmosis/Detailed_Usage

  • I don't understand how the various drop and keep options in osmfilter could be combined to remove only unused nodes. Osmosis could be a partial solution, as it has an option to only keep nodes that are used somewhere else (--used-node). But this would also delete those nodes that are not used anywhere, but that have tags themselves. I'd like to keep these.
    – Dreamer
    Dec 2, 2014 at 12:42
  • I was suggesting to give command to drop all the data and give the command to keep only the needed tags at the same time, I guess it could work...
    – sabas
    Dec 3, 2014 at 8:58

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .