Iceland postal code database

From OpenStreetMap Wiki
Jump to navigation Jump to search

Íslandspóstur -- the operator of Iceland's postal system -- has granted permission to use their postal code records under terms compatible with the OpenStreetMap license (see [1]). The terms of use set no restrictions on the use of data although we're asked to keep the data in our database up to date so as to not cause any confusion, which is of course in our best interest as well as theirs.

The data files are available on the website, both in CSV and XML format.


Besides the obvious postal code uses this data has a complete listing of every street in Iceland which mail is delivered to, which along with the public domain listing of national highways allows us to compute our progress on pretty much anything navigatable by a motorcar in Iceland.


Description of the XML data format, in particular translations of what the XML element names mean (they're in Icelandic). Both of the files offered are encoded in ISO-8859-1.

Póstnúmer - Postal codes

A complete listing of the postal codes in Iceland, data:

<Postnumeraskra>                                                  <!-- Postal code record -->
  <Upplysingar>                                                   <!-- Metadata -->
    <Texti>Íslandspóstur Hf. - Póstnúmeraskrá</Texti>             <!-- Text describing the file -->
    <Url></Url>   <!-- Url -->
    <Dags>22.01.2009</Dags>                                       <!-- Date (DD.MM.YYY) -->
    <Klukkan>07:00:57</Klukkan>                                   <!-- Time -->
    <Fjoldi_numera>148</Fjoldi_numera>                            <!-- Number of postal codes in the file -->

  <Postnumer>                                                     <!-- Postal code -->
    <Numer>101</Numer>                                            <!-- Number -->
    <Heiti>Reykjavík</Heiti>                                      <!-- Descriptive name of the place that uses the code, e.g. Town or City  -->
    <Heimili>Pósthússtræti 5</Heimili>                            <!-- "Home" probably the address of the designated post office for the postal code -->

Götuskrá - Street record

A record of every street in Iceland which has mail delivered to it, and its postal code, data:

<Gotuskra>                                                       <!-- Street record -->
  <Upplysingar>                                                  <!-- Metadata -->
    <Texti>Íslandspóstur Hf. - Götuskrá</Texti>                  <!-- Text describing the file -->
    <Url></Url>   <!-- Url -->
    <Dags>22.01.2009</Dags>                                      <!-- Date (DD.MM.YYY) -->
    <Klukkan>07:01:03</Klukkan>                                  <!-- Time -->
    <Fjoldi_gatna>12432</Fjoldi_gatna>                           <!-- Number of streets in the file -->

  <Gata>                                                         <!-- Street -->
    <Id>199</Id>                                                 <!-- A unique identifier for this record, what we'll use to update the data -->
    <Pnr>104</Pnr>                                               <!-- Postal code for this street -->
    <Heiti_nf>Langholtsvegur</Heiti_nf>                          <!-- The nominative form of the street name -->
    <Heiti_thgf>Langholtsvegi</Heiti_thgf>                       <!-- The dative form of the street name -->

Proposed tagging

Postal codes

Do we need to import this data directly at all? We could define areas which delimit the postal code but this would be extra work and would be implicit anyway since the streets that define the area have postal_code=* on them. The only thing we should need to tag is that a given amenity=post_office is the principle post office serving a given postal code.


We should import the dative form of the name from this dataset, this is very useful for search engines as users expect to be able to search for things like Langholtsvegi 25, Reykjavík.

--- We should tag street relations with the postal code data instead of the ways themselves. That way, we avoid multiple copies of the same tags. Otherwise there's a danger of data inconsistency if one way is changed but the others aren't and we also avoid unneccessary redundancy. - Svavar Kjarrval 18:50, 24 June 2012 (BST)


A program will need to be written to import the data. Things to consider

  • The only thing we have to go by to map the street record to our data is the name=* of the street. This isn't unique for the country but is usually (always) unique within the boundary of a single town/city, but not unique across e.g. the capital area. The import script will need to operate on pre-prepered bounding polygons, a bbox or something similar and know that the area being worked on has a given default postal code.
  • The data will have to be kept up-to-date once it's in the database.
    • This is relatively easy and just a matter of going over ways that have götuskrá:id=* and making sure that the other tags on the way agree with the street record, if not notifying the operator. The current OSM DB should also be compared to older versions of götuskrá to see if any ways have been deleted there.
    • The tool should check if a götuskrá:id=* exists in the street record that's not in our database, preferably distinguishing between things that have never existed in the OSM database since the first import and things that have recently appeared in the street record.
  • We could manually mark street relations with the götuskrá:id and make a program/script which fills in the rest of the data and updates it according to the postal code database. It would take some work to begin with to tag the relations but the error rate should be very low. - Svavar Kjarrval 02:52, 4 July 2012 (BST)