{"id":17688131,"url":"https://github.com/sveinbjornt/iceaddr","last_synced_at":"2025-12-29T12:45:07.586Z","repository":{"id":49165614,"uuid":"152338718","full_name":"sveinbjornt/iceaddr","owner":"sveinbjornt","description":"Python package to look up information about Icelandic street addresses, postcodes and placenames","archived":false,"fork":false,"pushed_at":"2025-03-27T16:55:05.000Z","size":83450,"stargazers_count":25,"open_issues_count":0,"forks_count":2,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-11T10:03:17.560Z","etag":null,"topics":["address","address-validation","coordinates","iceland","municipalities","placenames","postcode","postcode-validation","postcodes","python","street"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/iceaddr/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sveinbjornt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"custom":["https://paypal.me/sveinbjornt","sveinbjorn.org/donations"]}},"created_at":"2018-10-10T00:22:12.000Z","updated_at":"2025-03-27T16:55:09.000Z","dependencies_parsed_at":"2024-05-12T21:23:27.907Z","dependency_job_id":"3a8a03e7-8ed2-46df-b340-073255268fda","html_url":"https://github.com/sveinbjornt/iceaddr","commit_stats":{"total_commits":126,"total_committers":4,"mean_commits":31.5,"dds":0.2936507936507936,"last_synced_commit":"f2eb8673cfb69e037794c68fb5c78812bf8f7847"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sveinbjornt%2Ficeaddr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sveinbjornt%2Ficeaddr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sveinbjornt%2Ficeaddr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sveinbjornt%2Ficeaddr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sveinbjornt","download_url":"https://codeload.github.com/sveinbjornt/iceaddr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248629349,"owners_count":21136240,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["address","address-validation","coordinates","iceland","municipalities","placenames","postcode","postcode-validation","postcodes","python","street"],"created_at":"2024-10-24T11:43:30.677Z","updated_at":"2025-12-29T12:45:07.581Z","avatar_url":"https://github.com/sveinbjornt.png","language":"Python","funding_links":["https://paypal.me/sveinbjornt","sveinbjorn.org/donations"],"categories":[],"sub_categories":[],"readme":"[![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)\n[![Python 3.9](https://img.shields.io/badge/python-3.9-blue.svg)](https://www.python.org/downloads/release/python-390/)\n[![Release](https://shields.io/github/v/release/sveinbjornt/iceaddr?display_name=tag)](https://github.com/sveinbjornt/iceaddr/releases)\n[![PyPI](https://img.shields.io/pypi/v/iceaddr)](https://pypi.org/project/iceaddr/)\n[![Build](https://github.com/sveinbjornt/iceaddr/actions/workflows/python-package.yml/badge.svg)](https://github.com/sveinbjornt/iceaddr/actions)\n\n# iceaddr\n\n\u003cimg src=\"https://raw.githubusercontent.com/sveinbjornt/iceaddr/refs/heads/master/iceaddr_logo.svg\" width=\"192\" height=\"192\" align=\"right\" style=\"float: right; margin-left: 30px;\" alt=\"iceaddr logo\"\u003e\n\n### Look up Icelandic street addresses, postcodes and placenames\n\n`iceaddr` is a pure Python \u003e= 3.9 package to look up information about\nIcelandic streets, addresses, placenames, landmarks, locations and postcodes.\nThe underlying data is contained in a local SQLite database assembled\nfrom the following sources:\n\n* [Staðfangaskrá](https://opingogn.is/dataset/stadfangaskra), the official Icelandic address registry maintained by [Registers Iceland](https://www.skra.is) (*Þjóðskra*, [license](https://vefsafn.is/is/20170111023510/http://www.skra.is/?PageId=401e3483-e1ac-48c9-aec0-5159581d2222))\n* [IS 50V Örnefni](https://opingogn.is/dataset/is-50v-ornefni-isn93) from the [National Land Survey of Iceland](https://www.lmi.is) (*Landmælingar Íslands*, [CC BY 4.0](https://www.natt.is/is/midlun/opin-gogn))\n* The postcode table provided by [Postur.is](https://www.postur.is/gogn/Gotuskra/postnumer.txt), with supplementary data from [Icelandic Wikipedia](https://is.wikipedia.org/wiki/Listi_yfir_%C3%ADslensk_p%C3%B3stn%C3%BAmer)\n* Municipality data provided by the [Icelandic Government](https://www.government.is/lisalib/getfile.aspx?itemid=4289e993-446d-11eb-812c-005056bc8c60)\n\nSince no networking takes place, lookups are very fast and can be performed\noffline. The package is useful for geocoding and reverse geocoding of Icelandic\naddresses and placenames, as well as validating addresses and postcodes.\nNo external dependencies are required.\n\n## Installation\n\nThe latest version of `iceaddr` is available via [PyPI](https://pypi.org/project/iceaddr/).\n\n```bash\npip install iceaddr\n```\n\n## Examples\n\n### Look up address with postcode\n\n```python\n\u003e\u003e\u003e from iceaddr import iceaddr_lookup\n\u003e\u003e\u003e a = iceaddr_lookup('Austurstræti', number=14, postcode=101)\n\u003e\u003e\u003e pprint(a)\n[{'bokst': '',\n  'byggd': 1,\n  'heiti_nf': 'Austurstræti',\n  'heiti_tgf': 'Austurstræti',\n  'hnitnum': 10083839,\n  'husnr': 14,\n  'landnr': 100852,\n  'lat_wgs84': 64.147529217656,\n  'long_wgs84': -21.9389394651385,\n  'postnr': 101,\n  'serheiti': '',\n  'stadur_nf': 'Reykjavík',\n  'stadur_tgf': 'Reykjavík',\n  'svaedi_nf': 'Höfuðborgarsvæðið',\n  'svaedi_tgf': 'Höfuðborgarsvæðinu',\n  'svfheiti': 'Reykjavíkurborg',\n  'svfnr': 0,\n  'tegund': 'Þéttbýli',\n  'vidsk': ''}]\n```\n\n### Look up address with placename\n\n```python\n\u003e\u003e\u003e from iceaddr import iceaddr_lookup\n\u003e\u003e\u003e a = iceaddr_lookup('Öldugötu', 4, 'Reykjavík')\n\u003e\u003e\u003e pprint(a)\n[{'bokst': '',\n  'byggd': 1,\n  'heiti_nf': 'Öldugata',\n  'heiti_tgf': 'Öldugötu',\n  'hnitnum': 10017023,\n  'husnr': 4,\n  'landnr': 100570,\n  'lat_wgs84': 64.1484874806941,\n  'long_wgs84': -21.9452072913341,\n  'postnr': 101,\n  'serheiti': '',\n  'stadur_nf': 'Reykjavík',\n  'stadur_tgf': 'Reykjavík',\n  'svaedi_nf': 'Höfuðborgarsvæðið',\n  'svaedi_tgf': 'Höfuðborgarsvæðinu',\n  'svfheiti': 'Reykjavíkurborg',\n  'svfnr': 0,\n  'tegund': 'Þéttbýli',\n  'vidsk': ''}]\n```\n\nStreet and place names can be provided in either nominative (nf.) or\ndative (þgf.) case (e.g. both 'Öldugata' and 'Öldugötu' will work, as\nwill both 'Selfoss' and 'Selfossi').\n\nPlease note that `iceaddr_lookup()` returns a list of zero or more\naddresses matching the criterion.\n\n```python\n\u003e\u003e\u003e from iceaddr import iceaddr_lookup\n\u003e\u003e\u003e iceaddr_lookup('Dúfnahólar', 10)\n[]\n\u003e\u003e\u003e res = iceaddr_lookup('Öldugata', 9)\n\u003e\u003e\u003e [(a['postnr'], a['stadur_nf']) for a in res]\n[(101, 'Reykjavík'), (220, 'Hafnarfjörður'), (621, 'Dalvík')]\n```\n\nFor natural search string queries, the module provides `iceaddr_suggest()`:\n\n```python\n\u003e\u003e\u003e from iceaddr import iceaddr_suggest\n\u003e\u003e\u003e a = iceaddr_suggest('Öldugata 4, Rey')\n\u003e\u003e\u003e [n['stadur_tgf'] for n in a]\n['Reykjavík', 'Reyðarfirði']\n\u003e\u003e\u003e a = iceaddr_suggest('Öldugö', limit=200)\n\u003e\u003e\u003e len(a)\n151\n```\n\nThe default limit on results from both functions is 50.\n\n### Find closest address\n\nGiven a set of WGS84 coordinates, the `nearest_addr()` function returns\na list of the nearest addresses in the database:\n\n```python\n\u003e\u003e\u003e from iceaddr import nearest_addr\n\u003e\u003e\u003e addr = nearest_addr(64.148446, -21.944933)[0]\n\u003e\u003e\u003e print(f\"{addr['heiti_nf']} {addr['husnr']}\")\nÖldugata 4\n```\n\n### Address Keys\n\n| Key           | Value description                                       |\n| ------------- |---------------------------------------------------------|\n| bokst         | House letter, e.g. \"A\", \"b\"                             |\n| byggd         | Byggðarnúmer in municipality                            |\n| heiti_nf      | Street name (nominative case, nf.), e.g. 'Öldugata'     |\n| heiti_tgf     | Street name (dative case, þgf.), e.g. 'Öldugötu'        |\n| hnitnum       | Hnitnúmer staðfangahnits                                |\n| husnr         | House number                                            |\n| landnr        | Hlaupandi sex stafa auðkennisnúmer í landeignaskrá HMS  |\n| lat_wgs84     | Latitude (WGS84 coordinates)                            |\n| long_wgs84    | Longitude (WGS84 coordinates)                           |\n| postnr        | Postcode (e.g. 101)                                     |\n| serheiti      | Special name                                            |\n| stadur_nf     | Placename (nominative case), e.g. 'Selfoss'             |\n| stadur_tgf    | Placename (dative case), e.g. 'Selfossi'                |\n| svaedi_nf     | Region (nominative case), e.g. 'Höfuðborgarsvæðið'      |\n| svaedi_tgf    | Region (dative case), e.g. 'Höfuðborgarsvæðinu'         |\n| svfheiti      | Municipality name (e.g. 'Borgarbyggð')                  |\n| svfnr         | Municipality code (e.g. 3609)                           |\n| tegund        | Type (either 'Þéttbýli' (urban) or 'Dreifbýli' (rural)) |\n| vidsk         | Additional information                                  |\n\n### Postcodes\n\n#### Info about a given postcode\n\n```python\n\u003e\u003e\u003e from iceaddr import postcode_lookup\n\u003e\u003e\u003e postcode_lookup(400)\n{   \"svaedi_nf\": \"Vesturland og Vestfirðir\",\n    \"svaedi_tgf\": \"Vesturlandi og Vestfjörðum\",\n    \"stadur_nf\": \"Ísafjörður\",\n    \"stadur_tgf\": \"Ísafirði\",\n    \"tegund\": \"Þéttbýli\"}\n# Accepts string or int\n\u003e\u003e\u003e postcode_lookup(\"107\")\n{   \"svaedi_nf\": \"Höfuðborgarsvæðið\",\n    \"svaedi_tgf\": \"Höfuðborgarsvæðinu\",\n    \"stadur_nf\": \"Reykjavík\",\n    \"stadur_tgf\": \"Reykjavík\",\n    \"tegund\": \"Þéttbýli\",\n    \"lysing\": \"Vesturbær\"}\n```\n\n```python\n\u003e\u003e\u003e from iceaddr import POSTCODES\n\u003e\u003e\u003e pprint(POSTCODES[101])\n{   \"svaedi_nf\": \"Höfuðborgarsvæðið\",\n    \"svaedi_tgf\": \"Höfuðborgarsvæðinu\",\n    \"stadur_nf\": \"Reykjavík\",\n    \"stadur_tgf\": \"Reykjavík\",\n    \"tegund\": \"Þéttbýli\",\n    \"lysing\": \"Miðborg\"}\n```\n\n#### Get postcodes for a placename (\"örnefni\")\n\n```python\n\u003e\u003e\u003e from iceaddr import postcodes_for_placename\n\u003e\u003e\u003e postcodes_for_placename('Ísafjörður')\n[400, 401]\n\u003e\u003e\u003e postcodes_for_placename('Kópavogi')\n[200, 201, 202, 203]\n\u003e\u003e\u003e postcodes_for_placename('kópav', partial=True)\n[200, 201, 202, 203]\n```\n\n#### Get postcodes for a region (\"svæði\")\n\n```python\n\u003e\u003e\u003e from iceaddr import postcodes_for_region\n\u003e\u003e\u003e postcodes_for_region('Norðurland')\n[530, 531, 540, 541, 545, ...]\n\u003e\u003e\u003e postcodes_for_region('Höfuðborgarsvæðið')\n[101, 102, 103, 104, 105, ...]\n```\n\n### Placenames (\"örnefni\")\n\n```python\n\u003e\u003e\u003e from iceaddr import placename_lookup\n\u003e\u003e\u003e placename_lookup('Meðalfellsvatn')\n[{'flokkur': 'Vatnaörnefni Mið',\n  'id': 2339,\n  'lat_wgs84': 64.3112049,\n  'long_wgs84': -21.5997926,\n  'nafn': 'Meðalfellsvatn'}]\n```\n\nIf more than one placename match is found, the results are ordered by size,\nwith precedence given to municipalities and densely populated areas.\n\n```python\n\u003e\u003e\u003e placename_lookup(\"Egilsstað\", partial=True)\n[{'flokkur': 'Þéttbýli',\n  'id': 63208,\n  'lat_wgs84': 65.2637152,\n  'long_wgs84': -14.3931143,\n  'nafn': 'Egilsstaðir'},\n {'flokkur': 'Landörnefni Lítið',\n  'id': 108285,\n  'lat_wgs84': 65.3516154,\n  'long_wgs84': -20.610947,\n  'nafn': 'Egilsstaðir'}]\n```\n\n### Find closest placenames (\"örnefni\")\n\nGiven a set of WGS84 coordinates, the `nearest_placenames()` function\nreturns a list of the nearest placenames in the database:\n\n```python\n\u003e\u003e\u003e from iceaddr import nearest_placenames\n\u003e\u003e\u003e pn = nearest_placenames(64.148446, -21.944933, limit=1)[0]\n\u003e\u003e\u003e print(pn[\"nafn\"])\nLandakotsvöllur\n```\n\n### Metadata\n\nGet information about the database version, etc.:\n\n```python\n\u003e\u003e\u003e from iceaddr import iceaddr_metadata\n\u003e\u003e\u003e meta = iceaddr_metadata()\n\u003e\u003e\u003e pprint(meta[\"date_created\"].date())\n'2025-11-22'\n```\n\n## Build process\n\nTo build your own version of the package, you need to have\nPython \u003e=3.9 installed. Then, after (optionally) creating a virtual\nenvironment, run the following command from the repository root to\ninstall dependencies:\n\n```bash\npip install \".[dev,build]\"\n```\n\nThen run the following command to build the database:\n\n```bash\nbash build.sh\n```\n\nThis creates an SQLite3 database in the repo root named `iceaddr.db`.\nMove this file to `src/iceaddr/` and you can now install your own\nfreshly built version of the package:\n\n```bash\npip install .\n```\n\n## Version History\n\n* 0.6.1: Updated address and placename data. Added `iceaddr_metadata` function. Better package metadata. (29/12/2025)\n* 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)\n* 0.5.10: Updated address and placename data. Added `region_for_postcode` function. Minor optimizations (07/11/2025)\n* 0.5.9: Updated address and placename data. Fixed bug in `placename_lookup` function (31/07/2025)\n* 0.5.8: Updated address and placename data. Added municipality name data to address records. Now requires Python 3.9+ (26/02/2025)\n* 0.5.7: Updated address and placename data. Now requires Python 3.8+ (20/09/2024)\n* 0.5.6: Updated address and placename data (11/08/2023)\n* 0.5.5: Updated address and placename data. Removed ISN93 coords. Now requires Python 3.7+ (11/12/2022)\n* 0.5.4: Updated address and placename data (09/11/2022)\n* 0.5.3: Updated address, postcode and placename data, various minor fixes (19/05/2022)\n* 0.5.2: Updated address and placename data, fixed issue with installing on Windows (25/06/2021)\n* 0.5.1: Fixes and additions in placename data (16/10/2020)\n* 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)\n* 0.4.0: Updated address, placename and postcode data. Better handling of house letters in address lookup (06/05/2020)\n* 0.3.3: Minor placename additions, smarter ordering of placename lookup results (08/01/2019)\n* 0.3.2: Added municipalities and various [BÍN](https://bin.arnastofnun.is/) placenames to ornefni database (02/01/2019)\n* 0.3.1: Added more placenames from LMÍ data, support for multithreaded use\n* 0.3.0: Added `placename_lookup` to look up coordinates for Icelandic placenames + minor fixes (10/12/2018)\n* 0.2.0: Added `iceaddr_suggest`, result limit, changed key names for postcode dicts (22/10/2018)\n* 0.1.2: Initial public release (10/10/2018)\n\n## BSD License\n\nCopyright (C) 2018-2025 [Sveinbjorn Thordarson](mailto:sveinbjorn@sveinbjorn.org)\n\nRedistribution and use in source and binary forms, with or without modification,\nare permitted provided that the following conditions are met:\n\n1. Redistributions of source code must retain the above copyright notice, this\nlist of conditions and the following disclaimer.\n\n2. Redistributions in binary form must reproduce the above copyright notice, this\nlist of conditions and the following disclaimer in the documentation and/or other\nmaterials provided with the distribution.\n\n3. Neither the name of the copyright holder nor the names of its contributors may\nbe used to endorse or promote products derived from this software without specific\nprior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\nIN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\nINDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\nNOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\nPROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\nWHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\nARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\nPOSSIBILITY OF SUCH DAMAGE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsveinbjornt%2Ficeaddr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsveinbjornt%2Ficeaddr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsveinbjornt%2Ficeaddr/lists"}