1OSMIUM-TAGS-COUNT(1)                                      OSMIUM-TAGS-COUNT(1)
2
3
4

NAME

6       osmium-tags-count - count keys/tags
7

SYNOPSIS

9       osmium tags-count [OPTIONS] OSM-FILE [TAG-EXPRESSION...]
10       osmium tags-count [OPTIONS] --expressions=FILE OSM-FILE
11

DESCRIPTION

13       Count  how  often  keys  or tags appear in the input file.  If the only
14       command line argument is an  OSM  file,  all  keys  in  this  file  are
15       counted.  If there are one or more tag expressions on the command line,
16       only the keys and tags matching those expressions are counted.
17
18       See the TAG EXPRESSIONS section for a  description  of  the  expression
19       format.
20
21       The  output  has  one  line  per key/tag found.  Each line contains the
22       count, the tag key, and the tag value (if matching tags)  separated  by
23       TAB  characters.   Tag keys and values are surrounded by double quotes.
24       Any double quotes in the keys and values are doubled.
25

OPTIONS

27       -e FILE, --expressions=FILE
28              Read expressions from the specified file, one per  line.   Empty
29              lines  are  ignored.  Everything after the comment character (#)
30              is also ignored.  See the TAG EXPRESSIONS  section  for  further
31              details.
32
33       -m COUNT, --min-count=COUNT
34              The  minimum  count that should be in the output.  Used when you
35              are only interested in common keys/tags.
36
37       -M COUNT, --max-count=COUNT
38              The maximum count that should be in the output.  Used  when  you
39              are only interested in rare keys/tags.
40
41       -s SORT, --sort=SORT
42              Sort  order.  Order by “count-asc”, “count-desc”, “name-asc”, or
43              “name-desc”.  Default is “count-desc”.
44
45       -t, --object-type=TYPE
46              Read only objects of given type (node, way, relation).   By  de‐
47              fault  all  types  are  read.  This option can be given multiple
48              times.
49

COMMON OPTIONS

51       -h, --help
52              Show usage help.
53
54       -v, --verbose
55              Set verbose mode.  The program  will  output  information  about
56              what it is doing to STDERR.
57
58       --progress
59              Show  progress bar.  Usually a progress bar is only displayed if
60              STDOUT and STDERR are detected to be TTY.  With  this  option  a
61              progress  bar  is  always  shown.  Note that a progress bar will
62              never be shown when reading from STDIN or a pipe.
63
64       --no-progress
65              Do not show progress bar.  Usually a progress bar  is  displayed
66              if STDOUT and STDERR are detected to be a TTY.  With this option
67              the progress bar is suppressed.  Note that a progress  bar  will
68              never be shown when reading from STDIN or a pipe.
69

INPUT OPTIONS

71       -F, --input-format=FORMAT
72              The  format  of the input file(s).  Can be used to set the input
73              format if it can’t be autodetected from the file name(s).   This
74              will  set the format for all input files, there is no way to set
75              the format for some  input  files  only.   See  osmium-file-for‐
76              mats(5) or the libosmium manual for details.
77

OUTPUT OPTIONS

79       -o, --output=FILE
80              Name of the output file.  Default is `-' (STDOUT).
81
82       -O, --overwrite
83              Allow  an  existing output file to be overwritten.  Normally os‐
84              mium will refuse to write over an existing file.
85

TAG EXPRESSIONS

87       A filter expression specifies one or more keys and/or tags that  should
88       be counted in the data.
89
90       Some examples:
91
92       amenity
93              Matches the key “amenity”.
94
95       highway=primary
96              Matches the tag with key “highway” and value “primary”.
97
98       highway!=primary
99              Matches  any tag with key “highway” and a value other than “pri‐
100              mary”.
101
102       type=multipolygon,boundary
103              Matches any tag with key  “type”  and  value  “multipolygon”  or
104              “boundary”.
105
106       name,name:de=Kastanienallee,Kastanienstrasse
107              Matches  any tag with the key “name” or “name:de” with the value
108              “Kastanienallee” or “Kastanienstrasse”.
109
110       addr:* Matches tags with keys starting with “addr:”
111
112       name=*Paris
113              Matches all tags with key “name” and a value that  contains  the
114              word “Paris”.
115
116       If there is no equal sign (“=”) in the expression only keys are matched
117       and values can be anything.  If there is an equal sign (“=”) in the ex‐
118       pression, the key is to the left and the value to the right.  An excla‐
119       mation sign (“!”) before the equal sign means: A tag with that key, but
120       not the value(s) to the right of the equal sign.  A leading or trailing
121       asterisk (“*”) can be used for substring or  prefix  matching,  respec‐
122       tively.  Commas (“,”) can be used to separate several keys or values.
123
124       All  filter  expressions are case-sensitive.  There is no way to escape
125       the special characters such as “=”, “*”  and  “,”.   You  can  not  mix
126       comma-expressions and “*”-expressions.
127
128       The  filter  expressions specified in a file and/or on the command line
129       are matched in the order they are given.  To achieve best  performance,
130       put expressions expected to match more often first.
131

DIAGNOSTICS

133       osmium tags-count exits with exit code
134
135       0      if everything went alright,
136
137       1      if there was an error processing the data, or
138
139       2      if there was a problem with the command line arguments.
140

MEMORY USAGE

142       osmium  tags-count  keeps all counters in memory.  For a large OSM file
143       and unrestricted keys or, worse, tags, this can use quite a lot of mem‐
144       ory.   (Counting all tags on a full planet file will use about 16 GByte
145       RAM.)
146
147       Use the filter expressions to restrict the counting to the keys or tags
148       you are actually interested in.
149

EXAMPLES

151       Count all keys in Spain and display most common keys first:
152
153              osmium tags-count spain.osm.pbf
154
155       Count all building keys in Madrid:
156
157              osmium tags-count madrid.osm.pbf building
158
159       Count all building tags on ways in Madrid, order by name:
160
161              osmium tags-count -t way --sort=name-asc madrid.osm.pbf 'building=*'
162
163       Count all relation types in Sevilla that appear at least 100 times:
164
165              osmium tags-count -t relation -m 100 sevilla.osm.pbf 'type=*'
166
167       Count  all  tags  in the input file.  Note that this might need quite a
168       lot of memory!
169
170              osmium tags-count input.osm.pbf '*=*'
171

SEE ALSO

173osmium(1), osmium-file-formats(5)
174
175       • Osmium website (https://osmcode.org/osmium-tool/)
176
177       • Taginfo (https://github.com/taginfo/taginfo/)
178
180       Copyright (C) 2013-2021 Jochen Topf <jochen@topf.org>.
181
182       License  GPLv3+:  GNU  GPL  version  3  or  later  <https://gnu.org/li
183       censes/gpl.html>.   This  is  free software: you are free to change and
184       redistribute it.  There is NO WARRANTY, to the extent permitted by law.
185

CONTACT

187       If you have any questions or  want  to  report  a  bug,  please  go  to
188       https://osmcode.org/contact.html
189

AUTHORS

191       Jochen Topf <jochen@topf.org>.
192
193
194
195                                    1.13.1                OSMIUM-TAGS-COUNT(1)
Impressum