Indexof

Lite v2.0Geographic Information Systems › Filter power=substation without power=terminal in Osmium | GIS Tutorial › Last update: About

Filter power=substation without power=terminal in Osmium | GIS Tutorial

How to Filter power=substation Without Getting power=terminal Points in Osmium

When working with OpenStreetMap (OSM) power infrastructure data, the osmium tags-filter command is the industry standard for speed. However, a simple filter for power=substation often returns power=terminal or power=insulator nodes. This happens because Osmium, by default, may include nodes that are members of the ways or relations you are filtering for. In 2026, precision in GIS Data Engineering requires a more nuanced approach to tag expressions.

1. The Problem: Why Terminals Appear

In the OSM data model, a substation is typically mapped as an Area (Way) or a Relation. These geometries are composed of Nodes. If those nodes have their own tags (like power=terminal), a broad filter can sometimes pull them into your output file depending on your filter flags.

2. Solution 1: Use the Negative Filter Expression

The most direct way to ensure your output contains only substations and absolutely no terminals is to combine an Inclusion and an Exclusion in a single pass. Osmium allows you to chain filters where the last match wins, or use specific boolean-like logic.

The Command:

osmium tags-filter input.osm.pbf \
    w/power=substation r/power=substation \
    n/power=substation \
    -o substations_only.osm.pbf --overwrite

To explicitly reject terminals, use the "not" (!) operator or simply filter specifically for the keys you want. However, a better approach is to filter by Object Type. Most power=terminal features are Nodes (n), while power=substation features are usually Ways (w) or Relations (r).

3. Solution 2: Filtering by Type and Tag Combined

If you only want the boundaries of the substations and don't care about the internal point infrastructure, restrict your filter to non-node objects:

osmium tags-filter input.osm.pbf wr/power=substation -o filtered_substations.pbf

By using wr/, you are telling Osmium to only look at Ways and Relations. Since power=terminal is almost exclusively applied to Nodes, they are automatically ignored.

4. Comparison: Osmium Filter Strategies

Filter Logic Osmium Syntax Result
Broad Filter power=substation Includes substations + some related child nodes.
Strict Type Filter wr/power=substation Only the substation polygons and relations. No points.
Inclusion/Exclusion power=substation power=terminal! Specifically removes any object tagged as terminal.

5. Avoiding "Broken" Geometries

A common "Super User" mistake is filtering out the nodes so strictly that the substation polygons lose their shape. If you use wr/power=substation, you must ensure your subsequent processing (like PyOsmium or QGIS) can still find the un-tagged nodes that define the shape of the way.

Pro Tip: Always use the --add-until-node or -add-references logic if you are moving the data into a database like PostGIS, otherwise you will have "empty" ways without coordinates.

Conclusion

To stop power=terminal points from cluttering your power=substation filter in Osmium, the most efficient method in 2026 is to restrict your filter to Ways and Relations (wr/). This leverages the inherent structure of OSM power mapping to provide a clean GIS dataset. If you must include substation nodes but exclude terminals, use the explicit exclusion syntax power=terminal! to maintain high data integrity for your spatial analysis.

Keywords

osmium tags-filter power substation, exclude power=terminal osmium, OSM data filtering tutorial, osmium-tool examples 2026, GIS power infrastructure mapping, OpenStreetMap PBF filtering, osmium negative filter, spatial data engineering OSM.

Profile: Stop unwanted power=terminal points in your OSM extracts. Learn how to use Osmium tags-filter expressions to isolate substations while excluding terminal nodes. - Indexof

About

Stop unwanted power=terminal points in your OSM extracts. Learn how to use Osmium tags-filter expressions to isolate substations while excluding terminal nodes. #geographic-information-systems #filterpowersubstationwithoutpowerterminal


Edited by: Eshita Nahar & Rachel Suen

Close [x]
Loading special offers...

Suggestion