2020-01-29

The buildings added to OpenStreetMap as part of the Edmonds import contained many redundant points, i.e. points in a line that contribute nothing to the shape of the building:

To clean these up I created a small script for the JOSM Scripting Plugin to detect and select them. Starting with a selection of buildings, it returns a selection of points that:

The script is roughly:

selection.ways.filter(isBuilding).forEach((building) => {
forEachVertex(building, (a, b, c) => {
if (180 - angle(a, b, c) β‰ˆ 0 && !isTagged(b) && !isGlued(b)) {
yield b;
}
});
});

Usage consists of:

  1. Select some buildings for analysis, e.g. Search β†’ new building.
  2. Run the script.
  3. Review the selected nodes, deselecting false positives.
  4. Delete the selected nodes.

Using this method I removed approximately 15,000 imported nodes from OpenStreetMap in changesets like this.