Skip to main content

License Python 3.10 Release PyPI Build

iceaddr

iceaddr logo

Look up Icelandic street addresses, postcodes and placenames

iceaddr is a pure Python >= 3.10 package to look up information about Icelandic streets, addresses, placenames, landmarks, locations and postcodes. The underlying data is contained in a local SQLite database assembled from the following sources:

Since no networking takes place, lookups are very fast and can be performed offline. The package is useful for geocoding and reverse geocoding of Icelandic addresses and placenames, as well as validating addresses and postcodes. No external dependencies are required.

For joining address results with other Icelandic public datasets, prefer the heinum field when the other dataset identifies the address itself. heinum is the address number (Icelandic: staðfanganúmer or heitinúmer; upstream field name: HEINUM). The hnitnum field identifies the address point coordinate.

Installation

The latest version of iceaddr is available via PyPI.

pip install iceaddr

Examples

Look up address with postcode

>>> from iceaddr import iceaddr_lookup
>>> a = iceaddr_lookup('Austurstræti', number=14, postcode=101)
>>> pprint(a)
[{'bokst': '',
  'byggd': 1,
  'heinum': 1001754,
  'heiti_nf': 'Austurstræti',
  'heiti_tgf': 'Austurstræti',
  'hnitnum': 10083839,
  'husnr': 14,
  'landnr': 100852,
  'lat_wgs84': 64.14752922,
  'long_wgs84': -21.93893947,
  'lysing': 'Miðborg',
  'postnr': 101,
  'serheiti': '',
  'stadur_nf': 'Reykjavík',
  'stadur_tgf': 'Reykjavík',
  'svaedi_nf': 'Höfuðborgarsvæðið',
  'svaedi_tgf': 'Höfuðborgarsvæðinu',
  'svfheiti': 'Reykjavíkurborg',
  'svfnr': 0,
  'tegund': 'Stærra dreifbýli',
  'vidsk': ''}]
>>> a[0]["heinum"]
1001754

Look up address with placename

>>> from iceaddr import iceaddr_lookup
>>> a = iceaddr_lookup('Öldugötu', 4, 'Reykjavík')
>>> pprint(a)
[{'bokst': '',
  'byggd': 1,
  'heinum': 1020228,
  'heiti_nf': 'Öldugata',
  'heiti_tgf': 'Öldugötu',
  'hnitnum': 10017023,
  'husnr': 4,
  'landnr': 100570,
  'lat_wgs84': 64.14848748,
  'long_wgs84': -21.94520729,
  'lysing': 'Miðborg',
  'postnr': 101,
  'serheiti': '',
  'stadur_nf': 'Reykjavík',
  'stadur_tgf': 'Reykjavík',
  'svaedi_nf': 'Höfuðborgarsvæðið',
  'svaedi_tgf': 'Höfuðborgarsvæðinu',
  'svfheiti': 'Reykjavíkurborg',
  'svfnr': 0,
  'tegund': 'Stærra dreifbýli',
  'vidsk': ''}]
>>> a[0]["heinum"]
1020228

Street and place names can be provided in either nominative (nf.) or dative (þgf.) case (e.g. both 'Öldugata' and 'Öldugötu' will work, as will both 'Selfoss' and 'Selfossi').

Please note that iceaddr_lookup() returns a list of zero or more addresses matching the criterion.

>>> from iceaddr import iceaddr_lookup
>>> iceaddr_lookup('Dúfnahólar', 10)
[]
>>> res = iceaddr_lookup('Öldugata', 9)
>>> [(a['postnr'], a['stadur_nf']) for a in res]
[(101, 'Reykjavík'), (220, 'Hafnarfjörður'), (621, 'Dalvík')]

For natural search string queries, the module provides iceaddr_suggest():

>>> from iceaddr import iceaddr_suggest
>>> a = iceaddr_suggest('Öldugata 4, Rey')
>>> [n['stadur_tgf'] for n in a]
['Reykjavík', 'Reyðarfirði']
>>> a = iceaddr_suggest('Öldugö', limit=200)
>>> len(a)
151

The default limit on results from both functions is 50.

Find closest address

Given a set of WGS84 coordinates, the nearest_addr() function returns a list of the nearest addresses in the database:

>>> from iceaddr import nearest_addr
>>> addr = nearest_addr(64.148446, -21.944933)[0]
>>> print(f"{addr['heiti_nf']} {addr['husnr']}")
Öldugata 4

A corresponding function, nearest_addr_with_dist(), returns the same results but also includes the distance in kilometers to each address.

Address Keys

Key Value description
bokst House letter, e.g. "A", "b"
byggd Settlement number within municipality
heinum Address number, unique ID for the address itself
heiti_nf Street name (nominative case, nf.), e.g. 'Öldugata'
heiti_tgf Street name (dative case, þgf.), e.g. 'Öldugötu'
hnitnum Unique address point coordinate ID
husnr House number
landnr Land registry number
lat_wgs84 Latitude (WGS84), for geospatial lookup/display
long_wgs84 Longitude (WGS84), for geospatial lookup/display
postnr Postcode (e.g. 101)
serheiti Special name
stadur_nf Placename (nominative case), e.g. 'Selfoss'
stadur_tgf Placename (dative case), e.g. 'Selfossi'
svaedi_nf Region (nominative case), e.g. 'Höfuðborgarsvæðið'
svaedi_tgf Region (dative case), e.g. 'Höfuðborgarsvæðinu'
svfheiti Municipality name (e.g. 'Borgarbyggð')
svfnr Municipality code (e.g. 3609)
tegund Type (either 'Þéttbýli' (urban) or 'Dreifbýli' (rural))
vidsk Additional information

Postcodes

Info about a given postcode

>>> from iceaddr import postcode_lookup
>>> postcode_lookup(400)
{   "svaedi_nf": "Vesturland og Vestfirðir",
    "svaedi_tgf": "Vesturlandi og Vestfjörðum",
    "stadur_nf": "Ísafjörður",
    "stadur_tgf": "Ísafirði",
    "tegund": "Þéttbýli"}
# Accepts string or int
>>> postcode_lookup("107")
{   "svaedi_nf": "Höfuðborgarsvæðið",
    "svaedi_tgf": "Höfuðborgarsvæðinu",
    "stadur_nf": "Reykjavík",
    "stadur_tgf": "Reykjavík",
    "tegund": "Þéttbýli",
    "lysing": "Vesturbær"}
>>> from iceaddr import POSTCODES
>>> pprint(POSTCODES[101])
{   "svaedi_nf": "Höfuðborgarsvæðið",
    "svaedi_tgf": "Höfuðborgarsvæðinu",
    "stadur_nf": "Reykjavík",
    "stadur_tgf": "Reykjavík",
    "tegund": "Þéttbýli",
    "lysing": "Miðborg"}

Get postcodes for a placename ("örnefni")

>>> from iceaddr import postcodes_for_placename
>>> postcodes_for_placename('Ísafjörður')
[400, 401]
>>> postcodes_for_placename('Kópavogi')
[200, 201, 202, 203]
>>> postcodes_for_placename('kópav', partial=True)
[200, 201, 202, 203]

Get postcodes for a region ("svæði")

>>> from iceaddr import postcodes_for_region
>>> postcodes_for_region('Norðurland')
[530, 531, 540, 541, 545, ...]
>>> postcodes_for_region('Höfuðborgarsvæðið')
[101, 102, 103, 104, 105, ...]

Placenames ("örnefni")

>>> from iceaddr import placename_lookup
>>> placename_lookup('Meðalfellsvatn')
[{'flokkur': 'Vatnaörnefni Mið',
  'id': 2339,
  'lat_wgs84': 64.3112049,
  'long_wgs84': -21.5997926,
  'nafn': 'Meðalfellsvatn'}]

If more than one placename match is found, the results are ordered by size, with precedence given to municipalities and densely populated areas.

>>> placename_lookup("Egilsstað", partial=True)
[{'flokkur': 'Þéttbýli',
  'id': 63208,
  'lat_wgs84': 65.2637152,
  'long_wgs84': -14.3931143,
  'nafn': 'Egilsstaðir'},
 {'flokkur': 'Landörnefni Lítið',
  'id': 108285,
  'lat_wgs84': 65.3516154,
  'long_wgs84': -20.610947,
  'nafn': 'Egilsstaðir'}]

Find closest placenames ("örnefni")

Given a set of WGS84 coordinates, the nearest_placenames() function returns a list of the nearest placenames in the database:

>>> from iceaddr import nearest_placenames
>>> pn = nearest_placenames(64.148446, -21.944933, limit=1)[0]
>>> print(pn["nafn"])
Landakotsvöllur

A corresponding function, nearest_placenames_with_dist(), returns the same results but also includes the distance in kilometers to each placename.

Municipalities

Municipality names and corresponding codes are available in the MUNICIPALITIES dict:

>>> from iceaddr import MUNICIPALITIES
>>> MUNICIPALITIES[3609]
Borgarbyggð

Utility functions

>>> from iceaddr import distance
>>> distance((64.1466, -21.9426), (48.8566, 2.3522)) # Between Reykjavík and Paris
2233.1554832351285 # km
>>> from iceaddr import in_iceland
>>> in_iceland((64.1466, -21.9426)) # Reykjavík
True
>>> in_iceland((48.8566, 2.3522)) # Paris
False

Metadata

Get information about the database version, etc.:

>>> from iceaddr import iceaddr_metadata
>>> meta = iceaddr_metadata()
>>> pprint(meta["date_created"].date())
'2025-11-22'

Build process

To build your own version of the package, you need to have Python >=3.10 installed. Then, after (optionally) creating a virtual environment, run the following command from the repository root to install dependencies:

pip install ".[dev,build]"

Then run the following command to build the database:

bash build.sh

This creates an SQLite3 database in the repo root named iceaddr.db. Move this file to src/iceaddr/ and you can now install your own freshly built version of the package:

pip install .

Version History

  • 0.6.2: Updated address and placename data. Address lookups now include unique heinum identifier. Now requires Python 3.10+ (04/09/2026)
  • 0.6.1: Updated address and placename data. Added iceaddr_metadata function. Better package metadata. (29/12/2025)
  • 0.6.0: nearest_* functions now use R-Trees for much faster lookups. Added nearest_*_with_dist functions. Updated address and placename data. (22/11/2025)
  • 0.5.10: Updated address and placename data. Added region_for_postcode function. Minor optimizations (07/11/2025)
  • 0.5.9: Updated address and placename data. Fixed bug in placename_lookup function (31/07/2025)
  • 0.5.8: Updated address and placename data. Added municipality name data to address records. Now requires Python 3.9+ (26/02/2025)
  • 0.5.7: Updated address and placename data. Now requires Python 3.8+ (20/09/2024)
  • 0.5.6: Updated address and placename data (11/08/2023)
  • 0.5.5: Updated address and placename data. Removed ISN93 coords. Now requires Python 3.7+ (11/12/2022)
  • 0.5.4: Updated address and placename data (09/11/2022)
  • 0.5.3: Updated address, postcode and placename data, various minor fixes (19/05/2022)
  • 0.5.2: Updated address and placename data, fixed issue with installing on Windows (25/06/2021)
  • 0.5.1: Fixes and additions in placename data (16/10/2020)
  • 0.5.0: Support for address number ranges, fix in house number lookup, new nearest_addr and nearest_placenames functions, updated data (15/10/2020)
  • 0.4.0: Updated address, placename and postcode data. Better handling of house letters in address lookup (06/05/2020)
  • 0.3.3: Minor placename additions, smarter ordering of placename lookup results (08/01/2019)
  • 0.3.2: Added municipalities and various BÍN placenames to ornefni database (02/01/2019)
  • 0.3.1: Added more placenames from LMÍ data, support for multithreaded use
  • 0.3.0: Added placename_lookup to look up coordinates for Icelandic placenames + minor fixes (10/12/2018)
  • 0.2.0: Added iceaddr_suggest, result limit, changed key names for postcode dicts (22/10/2018)
  • 0.1.2: Initial public release (10/10/2018)

BSD License

Copyright (C) 2018-2025 Sveinbjorn Thordarson

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Metadata

Release files for iceaddr 0.6.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for iceaddr 0.6.2
File Size Uploaded
iceaddr-0.6.2.tar.gz 23.6 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for iceaddr 0.6.2
File Interpreter ABI Platform
iceaddr-0.6.2-py3-none-any.whl Python 3 none any Details

Total release size: 47.4 MB

Release files / iceaddr-0.6.2.tar.gz

Download URL iceaddr-0.6.2.tar.gz
Size 23.6 MB
Tags Source
SHA-256 checksum
How to use checksums
846bde031510ad35b4fe0f88d1a0a78e0bc35a38189a5de9c6bd386a83bae766
BLAKE2b-256 checksum
How to use checksums
375d682c3a98bc860f9ab9c8161c04645b131874748cca285051f5b0973912f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Release files / iceaddr-0.6.2-py3-none-any.whl

Download URL iceaddr-0.6.2-py3-none-any.whl
Size 23.8 MB
Tags Python 3
SHA-256 checksum
How to use checksums
1863c99f8075d746177634f0d633be7d1691716abb32b1078d5e7071acc2fd20
BLAKE2b-256 checksum
How to use checksums
74fedb79475f87eca484c8d9397b62f6784e04e89b83ee7c59fe1557ad339452
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Release history Release notifications | RSS feed

This release

0.6.2 This release

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.9

2 release files

0.5.8

2 release files

0.5.7

2 release files

0.5.6

2 release files

0.5.5

1 release file

0.5.4

1 release file

0.5.3

1 release file

0.5.2

1 release file

0.5.1

1 release file

0.5.0

1 release file

0.4.0

1 release file

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3

2 release files

0.2

3 release files

0.1.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page