1OSMIUM-TAGS-COUNT(1) OSMIUM-TAGS-COUNT(1)
2
3
4
6 osmium-tags-count - count keys/tags
7
9 osmium tags-count [OPTIONS] OSM-FILE [TAG-EXPRESSION...]
10 osmium tags-count [OPTIONS] --expressions=FILE OSM-FILE
11
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
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
47 default all types are read. This option can be given multiple
48 times.
49
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
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
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
84 osmium will refuse to write over an existing file.
85
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
118 expression, the key is to the left and the value to the right. An
119 exclamation sign (“!”) before the equal sign means: A tag with that
120 key, but not the value(s) to the right of the equal sign. A leading or
121 trailing asterisk (“*”) can be used for substring or prefix matching,
122 respectively. Commas (“,”) can be used to separate several keys or
123 values.
124
125 All filter expressions are case-sensitive. There is no way to escape
126 the special characters such as “=”, “*” and “,”. You can not mix
127 comma-expressions and “*”-expressions.
128
129 The filter expressions specified in a file and/or on the command line
130 are matched in the order they are given. To achieve best performance,
131 put expressions expected to match more often first.
132
134 osmium tags-count exits with exit code
135
136 0 if everything went alright,
137
138 1 if there was an error processing the data, or
139
140 2 if there was a problem with the command line arguments.
141
143 osmium tags-count keeps all counters in memory. For a large OSM file
144 and unrestricted keys or, worse, tags, this can use quite a lot of mem‐
145 ory. (Counting all tags on a full planet file will use about 16 GByte
146 RAM.)
147
148 Use the filter expressions to restrict the counting to the keys or tags
149 you are actually interested in.
150
152 Count all keys in Spain and display most common keys first:
153
154 osmium tags-count spain.osm.pbf
155
156 Count all building keys in Madrid:
157
158 osmium tags-count madrid.osm.pbf building
159
160 Count all building tags on ways in Madrid, order by name:
161
162 osmium tags-count -t way --sort=name-asc madrid.osm.pbf 'building=*'
163
164 Count all relation types in Sevilla that appear at least 100 times:
165
166 osmium tags-count -t relation -m 100 sevilla.osm.pbf 'type=*'
167
168 Count all tags in the input file. Note that this might need quite a
169 lot of memory!
170
171 osmium tags-count input.osm.pbf '*=*'
172
174 · osmium(1), osmium-file-formats(5)
175
176 · Osmium website (https://osmcode.org/osmium-tool/)
177
178 · Taginfo (https://github.com/taginfo/taginfo/)
179
181 Copyright (C) 2013-2020 Jochen Topf <jochen@topf.org>.
182
183 License GPLv3+: GNU GPL version 3 or later
184 <https://gnu.org/licenses/gpl.html>. This is free software: you are
185 free to change and redistribute it. There is NO WARRANTY, to the
186 extent permitted by law.
187
189 If you have any questions or want to report a bug, please go to
190 https://osmcode.org/contact.html
191
193 Jochen Topf <jochen@topf.org>.
194
195
196
197 1.12.1 OSMIUM-TAGS-COUNT(1)