| name | iceaddr |
| description | Icelandic address geocoding — address lookup, reverse geocoding, postcodes via the iceaddr Python library. |
iceaddr - Icelandic Address Geocoding
Python library for Icelandic address lookup, geocoding, and reverse geocoding. Uses a bundled SQLite database from Staðfangaskrá (official address registry).
Install: uv add iceaddr
Address Lookup
from iceaddr import iceaddr_lookup
results = iceaddr_lookup("Laugavegur", number=22, postcode=101)
results = iceaddr_lookup("Laugavegur", limit=50)
results = iceaddr_lookup("Hlíðarhjalli", number=41, letter="E", postcode=200)
Address Fields
| Field | Description |
|---|
hnitnum | Unique 8-digit location ID |
heiti_nf | Street name (nominative) |
heiti_tgf | Street name (dative) |
husnr | House number |
bokst | Letter suffix (a, b, etc) |
postnr | Postal code |
svfnr | Municipality code |
lat_wgs84 | Latitude |
long_wgs84 | Longitude |
lysing | Area description |
stadur_nf | Place name |
svfheiti | Municipality name |
Address Autocomplete
from iceaddr import iceaddr_suggest
suggestions = iceaddr_suggest("Laugav", limit=10)
Reverse Geocoding
from iceaddr import nearest_addr, nearest_addr_with_dist
lat, lng = 64.1466, -21.9426
addresses = nearest_addr(lat, lng, limit=5)
results = nearest_addr_with_dist(lat, lng, limit=5)
Placenames
from iceaddr import placename_lookup, nearest_placenames
places = placename_lookup("Þingvellir")
places = nearest_placenames(64.1466, -21.9426, limit=5)
Postcodes
from iceaddr import postcode_lookup, POSTCODES, region_for_postcode
info = postcode_lookup(101)
POSTCODES
region_for_postcode(101)
Municipalities
from iceaddr import MUNICIPALITIES, municipality_for_municipality_code
MUNICIPALITIES
municipality_for_municipality_code(0)
municipality_for_municipality_code(1000)
Geo Utilities
from iceaddr import in_iceland, distance
in_iceland((64.1466, -21.9426))
in_iceland((51.5074, -0.1278))
distance((64.15, -21.95), (64.26, -21.12))
Common Tasks
Verify an address exists
def verify_address(street, number, postcode):
results = iceaddr_lookup(street, number=number, postcode=postcode)
return len(results) > 0
Geocode a full address string
import re
def geocode_address(address_str):
"""Parse and geocode 'Laugavegur 22, 101 Reykjavík'"""
match = re.match(r'^([^0-9]+)\s*(\d+)([a-zA-Z]?)(?:,?\s*(\d{3}))?', address_str)
if not match:
return None
street, num, letter, postcode = match.groups()
results = iceaddr_lookup(
street.strip(),
number=int(num),
letter=letter or None,
postcode=int(postcode) if postcode else None
)
return results[0] if results else None
Find addresses within radius
def addresses_within_radius(lat, lng, radius_km=1):
"""Find all addresses within radius_km of a point"""
results = nearest_addr_with_dist(lat, lng, limit=1000)
return [(addr, dist) for addr, dist in results if dist <= radius_km]
Data Source
- Staðfangaskrá from Registers Iceland (Þjóðskrá Íslands)
- IS 50V Örnefni placename data from National Land Survey
- Postcodes from Íslandspóstur
Database is bundled with the package and updated periodically.
Caveats
hnitnum (8-digit) ≠ heinum from HMS kaupskrá (7-digit)
- Some addresses have multiple entries (one per apartment letter)
- Rural addresses may have less precise coordinates