OSMIUM-TAGS-COUNT(1)
๐ osmium-tags-count(1) ๐
okay bestie, sit down, hydrate, because we're about to count keys and tags and it's gonna be so satisfying. this is the manual page for osmium-tags-count, part of the osmium fam (version 1.19.1, mwah ๐).
โจ NAME โจ
osmium-tags-count โ count keys/tags ๐งฎ๐
โจ SYNOPSIS โจ
osmium tags-count [OPTIONS] OSM-FILE [TAG-EXPRESSION...]
osmium tags-count [OPTIONS] --expressions=FILE OSM-FILE
โจ DESCRIPTION โจ
So like. This command counts how often keys or tags show up in the input file. That's it, that's the whole vibe. ๐
If the only command line argument is an OSM file, then every single key in that file gets counted. But if you hand it one or more tag expressions on the command line, then only the keys and tags that match those expressions get counted. picky queen behavior, we respect it ๐
Wanna know what the expression format looks like? Scroll down to TAG EXPRESSIONS, bestie, it's all there.
The output is one line per key/tag that got found. Each line has: the count, the tag key, and the tag value (only if we're matching tags) โ all separated by TAB characters. Tag keys and values are wrapped in double quotes. And any double quotes inside the keys and values get doubled. yes, doubled. it's giving escape-the-escape ๐
โจ OPTIONS โจ
-e FILE,--expressions=FILEโ read expressions from that file, one per line. Empty lines? ignored, they're not the main character. Everything after the comment character (#) is ignored too. More deets live in TAG EXPRESSIONS.-m COUNT,--min-count=COUNTโ the minimum count that should show up in the output. Use this when you only care about the common keys/tags, aka the popular girls ๐ซถ-M COUNT,--max-count=COUNTโ the maximum count that should show up in the output. Use this when you're only interested in the rare keys/tags โ the underrated indie darlings ๐ฆ-s SORT,--sort=SORTโ sort order, babes. Order bycount-asc,count-desc,name-asc, orname-desc. Default iscount-desc. (most popular first, iconic behavior)-t,--object-type=TYPEโ read only objects of the given type (node,way,relation). By default all types are read. You can give this option multiple times, stack it up like bracelets โจ
๐ธ COMMON OPTIONS ๐ธ
-h,--helpโ show usage help. we love a supportive king.-v,--verboseโ set verbose mode. The program will output information about what it is doing to STDERR. it's narrating its own life, honestly relatable ๐ญ--progressโ show a progress bar. Usually a progress bar is only displayed if STDOUT and STDERR are detected to be TTY. With this option a progress bar is always shown. Note that a progress bar will never be shown when reading from STDIN or a pipe. never ever. periodt.--no-progressโ do not show the progress bar. Usually a progress bar is displayed if STDOUT and STDERR are detected to be a TTY. With this option the progress bar is suppressed. Note that a progress bar will never be shown when reading from STDIN or a pipe. (yes it's the same caveat, no I'm not skipping it ๐ )
๐ INPUT OPTIONS ๐
-F,--input-format=FORMATโ the format of the input file(s). Use this to set the input format when it can't be autodetected from the file name(s). Heads up though: this sets the format for all input files, there is no way to set the format for some input files only. all or nothing, bestie ๐ค Seeosmium-file-formats(5)or the libosmium manual for the details.
๐ OUTPUT OPTIONS ๐
-o,--output=FILEโ name of the output file. Default is-(STDOUT). the classic.-O,--overwriteโ allow an existing output file to be overwritten. Normally osmium will refuse to write over an existing file โ it's got boundaries, unlike some people ๐
๐ TAG EXPRESSIONS ๐
A filter expression specifies one or more keys and/or tags that should be counted in the data. simple as that, no cap.
Some examples, and yes they're all exactly like this:
amenityโ matches the keyamenity.highway=primaryโ matches the tag with keyhighwayand valueprimary.highway!=primaryโ matches any tag with keyhighwayand a value other thanprimary. (the exclamation is doing the "not" thing, iykyk)type=multipolygon,boundaryโ matches any tag with keytypeand valuemultipolygonorboundary.name,name:de=Kastanienallee,Kastanienstrasseโ matches any tag with the keynameorname:dewith the valueKastanienalleeorKastanienstrasse.addr:*โ matches tags with keys starting withaddr:name=*Parisโ matches all tags with keynameand a value that contains the wordParis.
Okay so here's the rules of the game ๐ง:
If there's no equal sign (=) in the expression, only keys are matched and values can be anything. If there is an equal sign (=) in the expression, the key is to the left and the value is to the right. An exclamation sign (!) before the equal sign means: a tag with that key, but not the value(s) to the right of the equal sign. A leading or trailing asterisk (*) can be used for substring or prefix matching, respectively. And commas (,) can be used to separate several keys or values.
All filter expressions are case-sensitive. There is no way to escape the special characters such as =, * and ,. And you can not mix comma-expressions and *-expressions. nope. not happening. ๐ซ
The filter expressions specified in a file and/or on the command line are matched in the order they are given. To achieve best performance, put expressions expected to match more often first. (front-load your bangers, bestie ๐ฅ)
๐ DIAGNOSTICS ๐
osmium tags-count exits with exit code
0โ if everything went alright,1โ if there was an error processing the data, or2โ if there was a problem with the command line arguments.
๐ง MEMORY USAGE ๐ง
osmium tags-count keeps all counters in memory. So for a large OSM file and unrestricted keys or, worse, tags, this can use quite a lot of memory. And when I say quite a lot I mean: (counting all tags on a full planet file will use about 16 GByte RAM.) yeah. sixteen. gigabytes. ๐ญ
Use the filter expressions to restrict the counting to the keys or tags you are actually interested in. your RAM will thank you ๐ซถ
โญ EXAMPLES โญ
Count all keys in Spain and display most common keys first:
osmium tags-count spain.osm.pbf
Count all building keys in Madrid:
osmium tags-count madrid.osm.pbf building
Count all building tags on ways in Madrid, order by name:
osmium tags-count -t way --sort=name-asc madrid.osm.pbf 'building=*'
Count all relation types in Sevilla that appear at least 100 times:
osmium tags-count -t relation -m 100 sevilla.osm.pbf 'type=*'
Count all tags in the input file. Note that this might need quite a lot of memory!
osmium tags-count input.osm.pbf '*=*'
๐ SEE ALSO ๐
osmium(1),osmium-file-formats(5)- Osmium website
- Taginfo
ยฉ๏ธ COPYRIGHT ยฉ๏ธ
Copyright (C) 2013-2026 Jochen Topf <jochen@topf.org>.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. (fr fr, no warranty, read it and weep)
๐ฌ CONTACT ๐ฌ
If you have any questions or want to report a bug, please go to https://osmcode.org/contact.html
๐ AUTHORS ๐
Jochen Topf <jochen@topf.org>.
and that's the whole page, bestie!! this was version 1.19.1 of osmium-tags-count(1) โ go forth and count your keys, you absolute icon ๐ฆโจ๐
๐ฆ where this page comes from
- fedora 44: osmium-tool 1.19.1-1.fc44 ยท GPL-3.0-only
- nixos 26.05: osmium-tool 1.19.1
- nixpkgs unstable: osmium-tool 1.19.1
- ubuntu stonking: osmium-tool 1.19.1-1 ยท GPL-3.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms