Relation:boundary

From OpenStreetMap Wiki
Jump to: navigation, search
Available languages
Public-images-osm logo.svg boundary
Boundary.png
Description
For grouping boundaries and marking enclaves/exclaves.
Group: Properties
Members
  • Way - inner
  • Way - outer
  • Node - admin_centre
  • Relation - subarea
Status: Unspecified

boundary=* relations are used for grouping boundaries and marking enclaves/exclaves.

Relations are used in order to:

  • Avoid name:left=*, name:right=*, nation:right=*, and region:right=*. This has been replaced by one relation per country, province, city, etc.
  • Make it easier to stitch all the parts of a border to each other
  • Avoid multiple duplicated ways above each other.

Way tags

Boundary ways should have boundary=administrative and the admin_level=* for the highest border (when a country, state, county are on the same way the admin_level would be 2). source=* is always recommended.

Because boundaries can be rendered both from relations and individual ways, tagging the ways is, in the strictest sense optional. However this causes render issues (see this Github discussion for the details: basically overlapping relations are causing ways to render differently for no clear reason because the dashing will not overlap perfectly) and ways in the database that had no tags of their own, which is undesirable.

Boundary relationships are useful for many tools, but not necessary for rendering purposes, which is why boundary lines should be tagged to allow for the renderer to use them again.

Old direction dependent tags like name:left=*/name:right=* can be removed.

Relation tags

Key Value Discussion
type boundary also deprecated type multipolygon is used (see software implementation notes)
boundary administrative for a real boundary (sometimes in the middle of a river or 12 Miles away from coastline)
land_area administrative for coastline and real boundaries on land
name a name
admin_level the admin level

If you have a land-locked administrative area in the region you should set both: boundary=administrative and land_area=administrative. If the land_area is not the same as the boundary, make two relations, one with land_area=administrative and one with boundary=administrative.

Relation members

Element Role Recurrence? Discussion
Way outer one or more The multiple ways that form the closed border
Way inner zero or more Enclaves of this border - the multiple ways that form the closed inner borders
Relation subarea zero or more Refer to relations of sublevel boundaries inside this administrative level.
Note: Optional, disputed and redundant (references to sub levels may also be found with spatial queries). Also referencing other relations makes editing more complicated in some cases.
Node admin_centre zero or one Node representing the administrative centre (a capital, county seat etc.), usually a town, city or village (depending of the boundary level, see place=*).
Node label zero or one Node representing where to draw the label. (This is currently not supported by Mapnik rendering)
Way (blank) - Old, use outer instead
Way enclave - Old, use inner instead
Way exclave - Old, use outer instead

Note: The ways don't have to be closed, But all ways together should form closed rings making the border. For not closed, linear border, see Proposal:Relation boundary segment.

Examples

Baarle Nassau is a good use case for this relation. It has exclaves in enclaves. The exclaves in the enclaves of Belgium would just be added as exclaves to the relation of the Netherlands, the dutch province Noord-Brabant and the village border.

Tagging examples
C is A's enclave and B's exclave:
<relation id="1">
  <tag k="type" v="boundary" />
  <tag k="boundary" v="administrative" />
  <tag k="land_area" v="administrative" />
  <tag k="admin_level" v="2" />
  <tag k="name" v="light green country" />
  <member type="way" id="AB" role="outer" />
  <member type="way" id="AC" role="inner" />
</relation>
<relation id="2">
  <tag k="type" v="boundary" />
  <tag k="boundary" v="administrative" />
  <tag k="land_area" v="administrative" />
  <tag k="admin_level" v="2" />
  <tag k="name" v="dark green country" />
  <member type="way" id="AB" role="outer" />
  <member type="way" id="AC" role="outer" />
</relation>
C is A's enclave and B's exclave.
D is an exclave of B, but not an enclave of A since it also shares a border with C:
<relation id="1">
  <tag k="type" v="boundary" />
  <tag k="boundary" v="administrative" />
  <tag k="land_area" v="administrative" />
  <tag k="admin_level" v="2" />
  <tag k="name" v="light green country" />
  <member type="way" id="AB" role="outer" />
  <member type="way" id="AC1" role="outer" />
  <member type="way" id="AC2" role="outer" />
  <member type="way" id="AD" role="outer" />
</relation>
<relation id="2">
  <tag k="type" v="boundary" />
  <tag k="boundary" v="administrative" />
  <tag k="land_area" v="administrative" />
  <tag k="admin_level" v="2" />
  <tag k="name" v="dark green country" />
  <member type="way" id="AB" role="outer" />
  <member type="way" id="BC" role="outer" />
  <member type="way" id="AD" role="outer" />
  <member type="way" id="CD" role="outer" />
</relation>
<relation id="3">
  <tag k="type" v="boundary" />
  <tag k="boundary" v="administrative" />
  <tag k="land_area" v="administrative" />
  <tag k="admin_level" v="2" />
  <tag k="name" v="purple country" />
  <member type="way" id="AC1" role="outer" />
  <member type="way" id="AC2" role="outer" />
  <member type="way" id="CD" role="outer" />
  <member type="way" id="BC" role="outer" />
</relation>
D is an exclave of B, but not an enclave of A since it also shares a border with C.

There are more examples!

Software implementation

Software should support all deprecated types until they disappear in database:

  • type=multipolygon as well as type=boundary (An administrative boundary can be definitively recognised through the existing boundary=* tag)
  • role=(blank) for role=outer (note blank role is obsolete for multipolygons as well, but usually defaults to outer)

Tools