### Look up Icelandic street addresses and postcodes
Python module to look up and get information about Icelandic street addresses and postcodes. The underlying data is taken from [Staðfangaskrá](https://opingogn.is/dataset/stadfangaskra), the official Icelandic Address Registry maintained by [Registers Iceland](https://www.skra.is) ([CC-BY](http://opendefinition.org/licenses/cc-by/)), and from the postcode table provided by [Postur.is](https://www.postur.is/einstaklingar/posthus/postnumer/gagnaskrar/).
## Installation
```
$ pip install iceaddr
```
## Examples
### Look up address with postcode:
```python
>>> from iceaddr import iceaddr_lookup
>>> a = iceaddr_lookup('Austurstræti', number=14, postcode=101)
>>> pprint.pprint(a)
[{'bokst': '',
'byggd': 1,
'heiti_nf': 'Austurstræti',
'heiti_tgf': 'Austurstræti',
'hnitnum': 10083839,
'husnr': 14,
'landnr': 100852,
'lat_wgs84': 64.147529217656,
'long_wgs84': -21.9389394651385,
'postnr': 101,
'serheiti': '',
'stadur_nf': 'Reykjavík',
'stadur_tgf': 'Reykjavík',
'svaedi': 'Höfuðborgarsvæðið',
'svfnr': 0,
'tegund': 'Þéttbýli',
'vidsk': '',
'x_isn93': 356999.259090909,
'y_isn93': 408290.561363636}]
```
### Look up address with place name
```python
>>> from iceaddr import iceaddr_lookup
>>> a = iceaddr_lookup('Öldugötu', number=4, placename='Reykjavík')
>>> pprint.pprint(a)
[{'bokst': '',
'byggd': 1,
'heiti_nf': 'Öldugata',
'heiti_tgf': 'Öldugötu',
'hnitnum': 10017023,
'husnr': 4,
'landnr': 100570,
'lat_wgs84': 64.1484874806941,
'long_wgs84': -21.9452072913341,
'postnr': 101,
'serheiti': '',
'stadur_nf': 'Reykjavík',
'stadur_tgf': 'Reykjavík',
'svaedi': 'Höfuðborgarsvæðið',
'svfnr': 0,
'tegund': 'Þéttbýli',
'vidsk': '',
'x_isn93': 356699.479545455,
'y_isn93': 408411.468181818}]
```
Street and place names can be provided in either nominative or dative 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.
```python
>>> from iceaddr import iceaddr_lookup
>>> iceaddr_lookup('Dúfnahólar', number=10)
[]
>>> res = iceaddr_lookup('Öldugata', number=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()`:
```python
>>> 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.
### Keys
| Key | |
| ------------- |---------------------------------------------------------|
| bokst | House letter |
| byggd | |
| heiti_nf | Street name (nominative case), e.g. 'Öldugata' |
| heiti_tgf | Street name (dative case), e.g. 'Öldugötu' |
| hnitnum | |
| husnr | House number |
| landnr | |
| lat_wgs84 | Latitude (WGS84 coordinates) |
| long_wgs84 | Longitude (WGS84 coordinates) |
| postnr | Postcode (e.g. 101) |
| serheiti | Special name |
| stadur_nf | Place name (nominative case), e.g. 'Selfoss' |
| stadur_tgf | Place name (dative case), e.g. 'Selfossi' |
| svaedi | Area (e.g. 'Höfuðborgarsvæðið', 'Norðurland') |
| svfnr | |
| tegund | Postcode (e.g. 101) |
| vidsk | Additional information |
| x_isn93 | Coordinate X (ISN93) |
| y_isn93 | Coordinate Y (ISN93) |
| svaedi | Area (e.g. 'Norðurland' or 'Höfuðborgarsvæðið' |
| stadur_nf | Place name (nominative case), e.g. 'Selfoss' |
| stadur_tgf | Place name (dative case), e.g. 'Selfossi' |
| tegund | Type (either 'Þéttbýli' (urban) or 'Dreifbýli' (rural)) |
### Postcodes
```python
>>> 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]
>>>
```
```python
>>> from iceaddr import postcodes
>>> postcodes[400]
{ 'svaedi': 'Vesturland og Vestfirðir',
'stadur_nf': 'Ísafjörður',
'stadur_tgf': 'Ísafirði',
'tegund': 'Þéttbýli' }
```
## Version History
* 0.2: Added `iceaddr_suggest`, result limit, changed key names for postcode dicts
* 0.1.2: Initial release
## BSD License
Copyright (C) 2018 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.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| iceaddr-0.2.tar.gz | 5.5 MB | Without provenance | Details for iceaddr-0.2.tar.gz |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| iceaddr-0.2-py3-none-any.whl | Python 3 | none | any | Details for iceaddr-0.2-py3-none-any.whl |
| iceaddr-0.2-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for iceaddr-0.2-py2.py3-none-any.whl |
Total release size: 16.6 MB
Release files / iceaddr-0.2.tar.gz
| Download URL | iceaddr-0.2.tar.gz |
|---|---|
| Size | 5.5 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1708b83aca9fddc9af6ed1e283da07000eaaaae2f0440e1f8f6679d032e6e4d1
|
|
BLAKE2b-256 checksum How to use checksums |
ce4ed9a1be6198ca6523da351dfde47ff16092d10c0f17f50cf387bd883e81d9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0
|
Release files / iceaddr-0.2-py3-none-any.whl
| Download URL | iceaddr-0.2-py3-none-any.whl |
|---|---|
| Size | 5.5 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c69a6a645af45c44a385319fcf10c60f1e5054ce21ac5a5c1378d72377f063ea
|
|
BLAKE2b-256 checksum How to use checksums |
d68dfe3eab324eb1ffee6edf6f5396fd2d409deefd26aa64d0f5da2467465a66
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0
|
Release files / iceaddr-0.2-py2.py3-none-any.whl
| Download URL | iceaddr-0.2-py2.py3-none-any.whl |
|---|---|
| Size | 5.5 MB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
2031d3ec70bb343f552b34768365ca4b13abeead4934b86f8203f193ff8aec46
|
|
BLAKE2b-256 checksum How to use checksums |
29c2610471073b98c4343f7627a656ea19911cb98fa975869afbcfca68aba8fb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0
|
Security for iceaddr 0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.