Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions docs/user_manual/04-Working-with-Filters.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,21 @@ KeyFilter multiple times:

### TagFilter

This filter works exactly the same as the KeyFilter, only it looks for the
presence of whole tags (key and value) in the tag list of the object.
This filter works like KeyFilter, allowing both AND and OR combinations, but
it requires whole tags (key and value) in the object's tag list.
Tags are given as two-element tuples.

!!! example
```python
print("Objects with 'highway=primary' _or_ 'surface=asphalt' tags:",
sum(1 for o in osmium.FileProcessor('../data/liechtenstein.osm.pbf')
.with_filter(osmium.filter.TagFilter(('highway','primary'), ('surface','asphalt')))))

print("Objects with 'highway=primary' _and_ 'surface=asphalt' tags:",
sum(1 for o in osmium.FileProcessor('../data/liechtenstein.osm.pbf')
.with_filter(osmium.filter.TagFilter(('highway','primary')))
.with_filter(osmium.filter.TagFilter(('surface','asphalt')))))
```

### IdFilter

Expand Down