1

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)?

2
  • Do you want to keep the data in native OSM format?
    – user30184
    Commented 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
    Commented Dec 2, 2014 at 8:57

1 Answer 1

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

2
  • 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
    Commented 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
    Commented Dec 3, 2014 at 8:58

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.