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

NAME

6       osmium-tags-filter - filter objects matching specified keys/tags
7

SYNOPSIS

9       osmium tags-filter [OPTIONS] OSM-FILE FILTER-EXPRESSION...
10       osmium tags-filter [OPTIONS] --expressions=FILE OSM-FILE
11

DESCRIPTION

13       Get objects matching at least one of the specified expressions from the
14       input and write them to the output.  Expressions can either  be  speci‐
15       fied  on  the  command  line or in an expressions file.  See the FILTER
16       EXPRESSIONS section for a description of the filter expression format.
17
18       All objects matching the expressions will be  read  from  OSM-FILE  and
19       written  to the output.  All objects referenced from those objects will
20       also be added to the output unless the option  --omit-referenced/-R  is
21       used.   This applies to nodes referenced in ways and members referenced
22       in relations.
23
24       If the option --omit-referenced/-R is used, the input file is read only
25       once, otherwise the input file will possibly be read up to three times.
26
27       Objects  will  be  written  out  in  the  order  they  are found in the
28       OSM-FILE.
29
30       The  command  will  only  work  correctly  on  history  files  if   the
31       --omit-referenced/-R  option  is  used.  The command can not be used on
32       change files.
33

OPTIONS

35       -e FILE, --expressions=FILE
36              Read expressions from the specified file, one per  line.   Empty
37              lines  are  ignored.  Everything after the comment character (#)
38              is also ignored.  See the FILTER EXPRESSIONS section for further
39              details.
40
41       -i, --invert-match
42              Invert the sense of matching.  Exclude all objects with matching
43              tags.
44
45       -R, --omit-referenced
46              Omit the nodes referenced from matching ways and members  refer‐
47              enced from matching relations.
48
49       -t, --remove-tags
50              Remove  tags  from  objects  that  are  not  matching the filter
51              expression but are included to  complete  references  (nodes  in
52              ways  and  members of relations).  If an object is both matching
53              the filter and used as a reference it will keep its tags.
54

COMMON OPTIONS

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

INPUT OPTIONS

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

OUTPUT OPTIONS

84       -f, --output-format=FORMAT
85              The  format  of  the output file.  Can be used to set the output
86              file format if it can’t be autodetected  from  the  output  file
87              name.   See  osmium-file-formats(5)  or the libosmium manual for
88              details.
89
90       --fsync
91              Call fsync after writing the output file to force flushing  buf‐
92              fers to disk.
93
94       --generator=NAME
95              The  name and version of the program generating the output file.
96              It will be added to the header of the output file.   Default  is
97osmium/” and the version of osmium.
98
99       -o, --output=FILE
100              Name of the output file.  Default is `-' (STDOUT).
101
102       -O, --overwrite
103              Allow  an  existing  output  file  to  be overwritten.  Normally
104              osmium will refuse to write over an existing file.
105
106       --output-header=OPTION=VALUE
107              Add output header option.  This command line option can be  used
108              multiple  times for different OPTIONs.  See the libosmium manual
109              for a list of available header options.  For some  commands  you
110              can  use  the special format “OPTION!” (ie.  an exclamation mark
111              after the OPTION and no value set) to set the value to the  same
112              as in the input file.
113

FILTER EXPRESSIONS

115       A filter expression specifies a tag or tags that should be found in the
116       data and the type of object (node, way, or  relation)  that  should  be
117       matched.
118
119       The  object  type(s) comes first, then a slash (/) and then the rest of
120       the expression.  Object types are specified as  `n'  (for  nodes),  `w'
121       (for  ways), `r' (for relations), and `a' (for areas - closed ways with
122       4 or more nodes and relations with type=multipolygon  or  type=boundary
123       tag).   Any combination of them can be used.  If the object type is not
124       specified, the expression matches all object types.
125
126       Some examples:
127
128       n/amenity
129              Matches all nodes with the key “amenity”.
130
131       nw/highway
132              Matches all nodes or ways with the key “highway”.
133
134       /note  Matches objects of any type with the key “note”.
135
136       note   Matches objects of any type with the key “note”.
137
138       w/highway=primary
139              Matches all ways with the key “highway” and value “primary”.
140
141       w/highway!=primary
142              Matches all ways with the key “highway” and a value  other  than
143              “primary”.
144
145       r/type=multipolygon,boundary
146              Matches  all  relations with key “type” and value “multipolygon”
147              or “boundary”.
148
149       w/name,name:de=Kastanienallee,Kastanienstrasse
150              Matches any way with a “name” or “name:de” tag  with  the  value
151              “Kastanienallee” or “Kastanienstrasse”.
152
153       n/addr:*
154              Matches all nodes with any key starting with “addr:”
155
156       n/name=*Paris
157              Matches all nodes with a name that contains the word “Paris”.
158
159       a/building
160              Matches any closed ways with 4 or more nodes or relations tagged
161              “building”.  Relations must also have a tag  “type=multipolygon”
162              or “type=boundary”.
163
164       If there is no equal sign (“=”) in the expression only keys are matched
165       and values can be anything.  If there is an equal  sign  (“=”)  in  the
166       expression,  the  key  is  to  the left and the value to the right.  An
167       exclamation sign (“!”) before the equal sign means:  A  tag  with  that
168       key, but not the value(s) to the right of the equal sign.  A leading or
169       trailing asterisk (“*”) can be used for substring or  prefix  matching,
170       respectively.   Commas  (“,”)  can  be used to separate several keys or
171       values.
172
173       All filter expressions are case-sensitive.  There is no way  to  escape
174       the  special  characters  such  as  “=”,  “*” and “,”.  You can not mix
175       comma-expressions and “*”-expressions.
176
177       The filter expressions specified in a file and/or on the  command  line
178       are  matched in the order they are given.  To achieve best performance,
179       put expressions expected to match more often first.
180
181       Area matches (with leading “a/”)  do  not  check  whether  the  matched
182       object  is  a  valid  (multi)polygon, they only check whether an object
183       might possibly be turned into a (multi)polygon.  This is the  case  for
184       all  closed ways (where the first and last node are the same) with 4 or
185       more nodes and for all relations that have an  additional  “type=multi‐
186       polygon” or “type=boundary” tag.
187

DIAGNOSTICS

189       osmium tags-filter exits with exit code
190
191       0      if everything went alright,
192
193       1      if there was an error processing the data, or
194
195       2      if there was a problem with the command line arguments.
196

MEMORY USAGE

198       osmium  tags-filter  does all its work on the fly and only keeps tables
199       of object IDs it needs in main  memory.   If  the  --omit-referenced/-R
200       option is used, no IDs are kept in memory.
201

EXAMPLES

203       Get all amenity nodes from the Berlin PBF file:
204
205              osmium tags-filter -o amenties.osm.pbf berlin.osm.pbf n/amenity
206
207       Get all objects (nodes, ways, or relations) with a note tag:
208
209              osmium tags-filter -R -o notes.osm.pbf berlin.osm.pbf note
210
211       Get all nodes and ways with a highway tag and all relations tagged with
212       type=restriction plus all referenced objects:
213
214              osmium tags-filter -o filtered.osm.pbf planet.osm.pbf \
215                  nw/highway r/type=restriction
216

SEE ALSO

218       · osmium(1), osmium-file-formats(5)
219
220       · Osmium website (https://osmcode.org/osmium-tool/)
221
223       Copyright (C) 2013-2019 Jochen Topf <jochen@topf.org>.
224
225       License     GPLv3+:     GNU     GPL     version     3     or      later
226       <https://gnu.org/licenses/gpl.html>.   This  is  free software: you are
227       free to change and redistribute it.   There  is  NO  WARRANTY,  to  the
228       extent permitted by law.
229

CONTACT

231       If  you  have  any  questions  or  want  to  report a bug, please go to
232       https://osmcode.org/contact.html
233

AUTHORS

235       Jochen Topf <jochen@topf.org>.
236
237
238
239                                    1.11.1               OSMIUM-TAGS-FILTER(1)
Impressum