OpenStreetBrowser/Category Tags

From OpenStreetMap Wiki
Jump to navigation Jump to search

A category consists of tags (e.g. name, description) and some (0..n) rules. On this page all tags are documented.

Category

A category is a collection of Rules (see below). The category itself should have the following tags:

name, name:lang The name of the category in the main language (see lang-tag) and translations.
description, description:lang A longer description of the category.
lang The main language of this category (default: en)
id the id of the category ; if the id is already taken a random id is set and a tag 'id:message' added

Sub-category definition

A sub-category is a category displayed/selected in OpenStreetBrowser by selecting/displaying first the category it belongs to. A sub-category is defined in the same way as any other category - it's only the listing of a sub-category in it's parent category that makes it a sub-category. A common option is to use hide=yes (see below) for a sub-category so that it is not displayed in the category list.

Additional Tags

These tags are also valid for a category.

sub_categories IDs of sub-categories of this list, separated by ";"
hide Set to yes to hide category in list (it can still be a sub category)
no_overlay If this tag is set to 'yes', no overlay will be generated for this category
overlays Show additional overlays for this category (";"-separated)

Rule

Rule-Tags define how an object will be displayed on the map and in the category list. Some tags (marked as "PARSED") will be preprocessed before being displayed. E.g. if the tag "icon_text" is set to "[name];[ref]" then either the objects tag "name" or "ref" is printed on the map.

Strings which are enclosed in square brackets ([...]) are replaced by their according tags. Multiple variants are possible, separated by ';'. E.g. (the default): "[ref] - [name];[name];[ref];[operator]". If not all tags of a variant get a result, the next variant is tried.

Primary tags

A rule should have at least the following tags:

name, name:lang The name of this rule.
match List all objects matching these tags, e.g. "amenity=bar" (see Match-Rules)
importance How important is this object? Objects will be returned ordered by decreasing importance. This also defines from which zoom level an object will appear on the map. Available values: global, international, national, regional, urban, suburban, local. See below for more information.
  • Please use global, international and national with caution, these can lead to very long processing times currently.
type Search this object in following types (Default: "polygon;point"):
  • point: All nodes with tags. Object ids have the form: "node_12345"
  • line: All ways with tags which are not closed. Object ids have the form: "way_12345"
  • polygon: All closed lines with tags, excluding lines which are outer member of a multipolygon relations AND all multipolygons (if multipolygon has only one outer member, tags of relation and outer member are combined). Object ids have the form "way_12345" or "rel_12345".
  • rel: All relations (NOTE: not working right now). Object ids have the form "rel_12345".

Text tags

icon_text What tag(s) should be used to display a name under the icon. (PARSED)

Notes:

  • Currently no icon_text for type 'line' will be printed, if an icon_label is defined instead. When using icon_text on type 'line', the shield does not repeat.
  • Defaults to "[name];[ref];[operator]" for types point and polygon
icon_text_data More interesting data is found in the following tags (e.g., a restaurant's cuisine, a power line's voltage, ...) - (PARSED, e.g. "[cuisine]", "[voltage] - [wires];[voltage]")

Notes:

  • Currently not possible for type 'line'.
  • As style the same as for icon_text_style will be used with a font-size decreased by 2.
icon_label A text on top of icon (e.g. ref-tag indicating motorway number displayed on top of an oval symbol). You can format the text similar to icon_text. Use icon_text_style to define a style for this text.
line_text A text, which will be printed on the line. For type 'line' only.

Notes:

  • Defaults to "[name];[ref];[operator]"
list_text The text which appears in the category list in the sidebar (default: "[ref] - [name];[name];[ref];[operator]")

Style tags

icon URL of an icon (preferably SVG)
icon_style Describes the style of the image of the icon css-like. For valid values see [1] (or [2] for lines), though 'file', 'width', 'height' and 'type' will be auto-generated. If this value is applied to the category, it's a default for all rules.
icon_text_style Describes the style of the text under the icon. For valid values see [3], though 'name', 'dy' and 'vertical_alignment' will be auto-generated. If this value is applied to the category, it's a default for all rules. Example: "fill: #ff0000; halo_fill: #000000; size: 14;".
icon_label_style Describes the style of the text on top of the icon. For valid values see [4], though 'name' will be auto-generated.
line_text_style Format the text. See icon_text_style
polygon_style A style for a polygon. For values see [5].
line_style A style for a line. For values see [6].

Other tags

group Group objects by list of tags (see display_name). Those objects will be merged to a single object. This accounts for nicer street names or single names on multiple public transportation stops.

Match-Rules

A rule can match one or several tags, e.g. "amenity=place_of_worship religion=christian" which would match an object with amenity=place_of_worship AND religion=christian. The tags are separated by whitespace. You can create synonyms like "amenity=atm, atm=yes", this would match either amenity=atm OR atm=yes.

This is the syntax for matches:

tag=value Match a tag-value pair
tag=value1;value2 The tag can have one of the specified values, separated by ;
tag=* The tag can have any value, but it may not be empty
tag!=value1;value2 Matches all values of the tag (it can even be empty), but not one of the specified values
tag!=* The tag may not have a value
tag=*!=value1;value2 The tag needs to have a value, but not one of the specified values
tag>value The tag is interpreted as number, and has to be bigger than value (possible operators: >, <, >=, <=)
tag>value1<=value2 The value has to be bigger than value1, but smaller or equal value2
  • If a value contains spaces, it has to be written in double quotes (e.g. "30 km").
  • If a value of an object contains ';', they will be interpreted as a list of different values. E.g. amenity=bar;cafe is an amenity, which serves the function of a bar and a café.

Number parsing

If the text values will be parsed to numbers, the following rules apply:

regexp description example(s)
[0-9]+ an integer value 1234
[0-9]+\.[0-9]+ a float 123.4
[0-9]+,[0-9]+ in many countries a , is common instead of . 123,4
number( )*.* a dimension unit (see separate table) is provided, either directly after the number or separated by whitespace "123 m" or "123m"

Possible dimsion units (default units in bold):

m Meter
mm, cm, km 0.001, 0,01, 1000 Meters
m^2 or m² or m2, a, ha, km^2 or km² or km2 Areas: square metres, ares (100 m²), hectar (10 000 m²), square kilometers (1 000 000 m²)
in, ft, yd, mile(s), league(s) Inch, Feet, Yards, Leagues
V, kV Volt, Kilovolt (1000 V)
acre(s) ~4046 m²

Importance

Dependent on the importance an object will be visible from a specific zoom level:

importance shown in list icon on map icon+label on map
global z1 z2 z4
international z4 z5 z8
national z7 z8 z10
regional z10 z11 z13
urban z12 z13 z15
suburban z14 z15 z16
local z16 z17 z18

See also