Proposal:Postal Addresses

From OpenStreetMap Wiki
Jump to navigation Jump to search

The current version is an extension of previously abandoned proposal, and was widely used in Belarus, but replaced with Key:addr.

Another widely accepted approaches for tagging addresses are documented at Key:addr and Proposed features/House numbers/Karlsruhe Schema

This is a proposal for a set of tags and members making a relation to represent postal addresses.

An address consists of hierarchy of address elements. This hierarchy is mapped to a hierarchy of relations, each of which is_in the parent address area. The list of possible address elements is taken from RFC 4119. An exception is the postal code (pc), which can appear anywhere in the hierarchy.

Related proposals

Alternative addressing approach (most widely accepted actually) :

Tags

Key Value Discussion
type address Marks the relation as part of a postal address.
address:type country|a1|a2|... The most specific address elements applicable to this relation. See below for definitions.
name string The name of the area denoted by the relation. Shared with other definitions.
address:country|a1|a2|... string The content of the address element indicated by the second part of the tag name. See below for definitions.

This can be left out for the address element indicated by the address:type tag if the string is identical to the one given by the name tag.

Members

Way or Node Role Recurrence? Discussion
relation is_in zero or one* The parent node from which higher level address elements are taken. The parent node must have type=address. However, the address:type may be missing for intermediate areas that don't appear in postal addresses.
* Multiple parent nodes may be allowed for other relation types; in this case, exactly one must have type=address to avoid ambiguous addresses.
relation alt_is_in zero or more Alternative parent node. This may be used if a site, building, etc. has multiple addresses.
node label zero or one A hint for the renderer where to place the label (name) of the area. Shared with other definitions.
area border zero or one The outline of the area associated with the postal address. Shared with other definitions.
node way area none zero or more Anything that has the postal address or more specific addresses. Should not be used for relations; these should have is_in=this relation instead.

Address Elements

The address elements are used in address:type and in address:element tags. The civicLoc format defined in RFC 4119 is used:

Addr. Element Definition Example
country countries or nations, as defined by the ISO 3166-MA. USA, Taiwan, Palestine
a1 national subdivisions (state, region, province, prefecture) New York
a2 county, parish, gun (JP), district (IN) King's County
a3 city, township, shi (JP) New York
a4 city division, borough, city district, ward, chou (JP) Manhattan
a5 neighborhood, block Morningside Heights
a6 street Broadway
prd Leading street direction N, W
pod Trailing street suffix SW
sts Street suffix Avenue, Platz, Street
hno House number, numeric part only 123
hns House number suffix A, 1/2
lmk Landmark or vanity address Low Library
loc (not applicable to OSM) Additional location information Room 543
flr (not applicable to OSM) Floor 5
nam (not applicable to OSM) Name (residence, business or office occupant) Hans Mayer
pc Postal code 10027-0401, AA9A 9AA, 12345

Examples

A simple street address

This is the example from RFC 4119, the representation of which is the following XML fragment:

  <cl:civicAddress>
          <cl:country>US</cl:country>
          <cl:A1>New York</cl:A1>
          <cl:A3>New York</cl:A3>
          <cl:A6>Broadway</cl:A6>
          <cl:HNO>123</cl:HNO>
          <cl:LOC>Suite 75</cl:LOC>
          <cl:PC>10027-0401</cl:PC>
  </cl:civicAddress>

  <relation id="10000">
    <tag k="address:type" v="country" />
    <tag k="name" v="USA" />
    <tag k="long_name" v="United States of America" />
  </relation>
  
  <relation id="10001">
    <member type="relation" role="is_in" ref="10000" />
    <tag k="address:type" v="a1" />
    <tag k="name" v="New York" />
    <tag k="address:a1" v="NY" />
  </relation>
    
  <relation id="10002">
    <member type="relation" role="is_in" ref="10001" />
    <tag k="address:type" v="a3" />
    <tag k="name" v="New York" />
    <tag k="address:a1" v="NY" />
  </relation>
  
 <relation id="10011">
    <member type="relation" role="is_in" ref="10002" />
    <tag k="address:type" v="a6" />
    <tag k="name" v="Broadway" />
  </relation>
  
  <relation id="10012">
    <member type="relation" role="is_in" ref="10011" />
    <tag k="address:type" v="hno" />
    <tag k="name" v="123" />
  </relation>

Intermediate address elements

Regierungsbezirke (~ administrative districts) in Bavaria are at a level between a1 and a2. Fortunately, they don't appear in addresses. As there is no address element defined for this hierarchy level, it does not have an address:type tag.

This example is the Landkreis Rosenheim, which is part of Regierungsbezirk Oberbayern in the German state of Bavaria.

  <relation id="15000">
    <member type="relation" role="is_in" ref="15001" />
    <tag k="type" v="address" />
    <tag k="address:type" v="a2" />
    <tag k="name" v="Landkreis Rosenheim" />
  </relation>
  
  <relation id="15001">
    <member type="relation" role="is_in" ref="15002" />
    <tag k="type" v="address" />
    <tag k="name" v="Oberbayern" />
  </relation>
  
  <relation id="15003">
    <member type="relation" role="is_in" ref="15004" />
    <tag k="type" v="address" />
    <tag k="address:type" v="a1" />
    <tag k="name" v="Bayern" />
    <tag k="name:en" v="Bavaria" />
    <tag k="long_name" v="Freistaat Bayern" />
    <tag k="long_name:en" v="Free State of Bavaria" />
  </relation>
  
  <relation id="15004">
    <tag k="type" v="address" />
    <tag k="address:type" v="country" />
    <tag k="name" v="Deutschland" />
    <tag k="name:en" v="Germany" />
    <tag k="long_name" v="Bundesrepublik Deutschland" />
    <tag k="long_name:en" v="Federal Republic of Germany" />
  </relation>

A building with multiple addresses

This building, part of Munich University, has multiple addresses:

  • Schellingstraße 12, 80539 München
  • Amalienstraße 52, 80539 München
  <relation id="20000">
    <member type="relation" role="is_in" ref="20001" />
    <member type="relation" role="alt_is_in" ref="20002" />
    <tag k="type" v="address" />
    <member ... /><!-- the objects belonging to the site -->
  </relation>
  
  <relation id="20001">
    <member type="relation" role="is_in" ref="20003" />
    <tag k="type" v="address" />
    <tag k="address:type v="hno" />
    <tag k="name" v="52" />
  </relation>
  
  <relation id="20002">
    <member type="relation" role="is_in" ref="20004" />
    <tag k="type" v="address" />
    <tag k="address:type v="hno" />
    <tag k="name" v="12" />
  </relation>
  
  <relation id="20003">
    <member type="relation" role="is_in" ref="20005" />
    <tag k="type" v="address" />
    <tag k="address:type v="a6" />
    <tag k="name" v="Amalienstraße" />
  </relation>
  
  <relation id="20004">
    <member type="relation" role="is_in" ref="20005" />
    <tag k="type" v="address" />
    <tag k="address:type v="a6" />
    <tag k="name" v="Schellingstraße" />
  </relation>
  
  <relation id="20005">
    <member type="relation" role="is_in" ref="..." />
    <tag k="type" v="address" />
    <tag k="address:type v="pc" />
    <tag k="name" v="80539" />
  </relation>

crossing boundaries

This is an example where the boundaries for the postal code cross the boundaries of a city district and where a street crosses multiple districts and postal codes.

  • Leopoldstraße 3, 80802 München (district: Maxvorstadt)
  • Leopoldstraße 15, 80802 München (district: Schwabing-Freimann)
  • Leopoldstraße 115, 80804 München (district: Schwabing-Freimann)
  <relation id="30000">
    <member type="relation" role="is_in" ref="..." />
    <tag k="type" v="address" />
    <tag k="address:type v="a3" />
    <tag k="name" v="München" />
    <tag k="name:en" v="Munich" />
  </relation>
  
  <relation id="30010">
    <member type="relation" role="is_in" ref="30000" />
    <tag k="type" v="address" />
    <tag k="address:type v="a4" />
    <tag k="name" v="Maxvorstadt" />
  </relation>
  
  <relation id="30011">
    <member type="relation" role="is_in" ref="30000" />
    <tag k="type" v="address" />
    <tag k="address:type v="a4" />
    <tag k="name" v="Schwabing-Freimann" />
  </relation>
  
  <relation id="30020">
    <member type="relation" role="is_in" ref="30010" />
    <tag k="type" v="address" />
    <tag k="address:type v="pc" />
    <tag k="name" v="80802" />
  </relation>
  
  <relation id="30021">
    <member type="relation" role="is_in" ref="30011" />
    <tag k="type" v="address" />
    <tag k="address:type v="pc" />
    <tag k="name" v="80802" />
  </relation>
  
  <relation id="30022">
    <member type="relation" role="is_in" ref="30010" />
    <tag k="type" v="address" />
    <tag k="address:type v="pc" />
    <tag k="name" v="80807" />
  </relation>
  
  <relation id="30030">
    <member type="relation" role="is_in" ref="30020" />
    <member type="relation" role="is_in" ref="30033" />
    <tag k="type" v="address" />
    <tag k="address:type v="a6" />
    <tag k="name" v="Leopoldstraße" />
  </relation>
  
  <relation id="30040">
    <member type="relation" role="is_in" ref="30030" />
    <tag k="type" v="address" />
    <tag k="address:type" v="hno" />
    <tag k="name" v="3" />
  </relation>
    
  <relation id="30031">
    <member type="relation" role="is_in" ref="30020" />
    <member type="relation" role="is_in" ref="30033" />
    <tag k="type" v="address" />
    <tag k="address:type v="a6" />
    <tag k="name" v="Leopoldstraße" />
  </relation>
  
  <relation id="30041">
    <member type="relation" role="is_in" ref="30031" />
    <tag k="type" v="address" />
    <tag k="address:type" v="hno" />
    <tag k="name" v="15" />
  </relation>
    
  <relation id="30032">
    <member type="relation" role="is_in" ref="30020" />
    <member type="way" ... />
    <tag k="type" v="address" />
    <tag k="address:type v="a6" />
    <tag k="name" v="Leopoldstraße" />
  </relation>
  
  <relation id="30042">
    <member type="relation" role="is_in" ref="30032" />
    <tag k="type" v="address" />
    <tag k="address:type" v="hno" />
    <tag k="name" v="115" />
  </relation>

Note that each of the three parts of the street has a different type=address relation. Note that each of these three relations has multiple is_in members but only one of them points to another type=address relation (the other one is a hypothetical type=street relation).

multiple address elements in one address part

streets

A street can have a complex name, which will usually be given in a single relation:

  <relation id="12345">
    <member type="relation" role="is_in" ref="..." />
    <tag k="type" v="address" />
    <tag k="address:type" v="sts" />
    <tag k="name" v="West 75th Street" />
    <tag k="address:a6" v="75th" />
    <tag k="address:prd" v="West" />
    <tag k="address:sts" v="Street" />
  </relation>

  <relation id="23456">
    <member type="relation" role="is_in" ref="..." />
    <tag k="type" v="address" />
    <tag k="address:type" v="prd" />
    <tag k="name" v="Äußere Münchner Straße" />
    <tag k="address:a6" v="Münchner Straße" />
    <tag k="address:prd" v="Äußere" />
  </relation>

suffixes

Usually, suffixes will have the street, not the house number as their parents:

  <relation id="40000">
    <member type="relation" role="is_in" ref="..." />
    <tag k="type" v="address" />
    <tag k="address:type" v="a6" />
    <tag k="name" v="Musterstraße" />
  </relation>
  
  <relation id="40001">
    <member type="relation" role="is_in" ref="40000" />
    <tag k="type" v="address" />
    <tag k="address:type" v="'''hno'''" />
    <tag k="name" v="1" />
  </relation>
  
  <relation id="40002">
    <member type="relation" role="is_in" ref="'''40000'''" />
    <tag k="type" v="address" />
    <tag k="address:type" v="'''hns'''" />
    <tag k="name" v="1a" />
    <tag k="address:hno" v="1" />
    <tag k="address:hns" v="a" />
  </relation>

Discussion

Discussion on the talk page

See also