Skip to content

Filters🔗

osmium.filter.EmptyTagFilter 🔗

Bases: osmium._osmium.BaseFilter

Filter class which only lets pass objects which have at least one tag.

__init__() -> None 🔗

Create a new filter object.

osmium.filter.EntityFilter 🔗

Bases: osmium._osmium.BaseFilter

Filter class which lets pass objects according to their type.

__init__(entities: osm_entity_bits) -> None 🔗

Crate a new filter object. Only objects whose type is listed in entities can pass the filter.

osmium.filter.GeoInterfaceFilter 🔗

Bases: osmium._osmium.BaseFilter

Filter class, which adds a geo_interface attribute to object which have geometry information.

The filter can process node, way and area types. All other types will be dropped. To create geometries for ways, the location cache needs to be enabled. Relations and closed ways can only be transformed to polygons when the area handler is enabled.

__init__(drop_invalid_geometries: bool = ..., tags: Iterable[str] = ...) -> None 🔗

Create a new filter object. The filter will usually drop all objects that do not have a geometry. Set drop_invalid_geometries to False to just let them pass.

The filter will normally add all tags it finds as properties to the GeoInterface output. To filter the tags to relevant ones, set tags to the desired list.

osmium.filter.IdFilter 🔗

Bases: osmium._osmium.BaseFilter

Filter class which only lets pass objects with given IDs.

This filter usually only makes sense when used together with a type restriction, set using enable_for().

__init__(ids: Iterable[int]) -> None 🔗

Create a new filter object. ids contains the IDs the filter should let pass. It can be any iterable over ints.

osmium.filter.KeyFilter 🔗

Bases: osmium._osmium.BaseFilter

Filter class which lets objects pass which have tags with at least one of the listed keys.

This filter functions like an OR filter. To create an AND filter (a filter that lets object pass that have tags with all the listed keys) you need to chain multiple KeyFilter objects.

__init__(*keys: str) -> None 🔗

Create a new filter object. The parameters list the keys by which the filter should choose the objects. At least one key is required.

osmium.filter.TagFilter 🔗

Bases: osmium._osmium.BaseFilter

Filter class which lets objects pass which have tags with at least one of the listed key-value pair.

This filter functions like an OR filter. To create an AND filter (a filter that lets object pass that have tags with all the listed key-value pairs) you need to chain multiple TagFilter objects.

__init__(*tags: Tuple[str, str]) -> None 🔗

Create a new filter object. The parameters list the key-value pairs by which the filter should choose objects. Each pair must be a tuple with two strings and at least one pair is required.