[OSM-dev] cleanways: A program to clean the ways in a .osm file

Paul Norman penorman at mac.com
Sat Mar 24 00:01:22 GMT 2012


I have written a short, simple, and stupid program to remove all the ways
and nodes from a .osm file that report with severity=normal from WTFE.

This was written for the specific purpose of building a clean coastline file
and may not work for other uses.

The code may be found at https://github.com/pnorman/cleanway

Warnings:
There is little sanity checking. It trusts that the OSM file is a valid OSM
XML file generated by the API or jxapi.
It downloads single-threaded. Large files are slow.
It drops all tags from nodes.
It drops all relations.
It drops objects even if they might be able to reverted to a previous
version.
It builds a list in memory of objects to remove. This may lead to issues
with memory on planet-sized files.
It might not work well if you get a HTTP error.

Features:
Removes nodes and nodes from ways if they report as severity=normal
Automatically accepts v1 objects which were not created by decliners
Doesn't try to build a DOM, so it should work on large files
Works in chunks of 50k objects




More information about the dev mailing list