Skip to main content

Pydantic models on Norwegian municipalities (Norske kommuner).

Project description

Norske Kommuner

pre-commit pre-commit.ci status PyPI - Status Download Stats

Pydantic models on Norwegian municipalities (Norske kommuner).

from norske_kommuner import kommuner, get_kommune_by_nr

#  Loop over all kommuner:
for kommune in kommuner.values():
    print(kommune)

#  Get kommunenummer
print (kommuner['Stavanger'].kommunenummer) # 1103

# Can also get kommune by kommunenr
print(get_kommune_by_nr('1103')) #  Stavanger

# Each kommune is a pydantic model and have pydantic functionality like exporting to json
print(kommuner['Stavanger'].json())

Last line will output

{
    "avgrensningsboks": {
        "coordinates":   [[[5.49903313381, 58.884658939559], [5.49903313381, 59.312103554166], [6.131310442607, 59.312103554166], [6.131310442607, 58.884658939559], [5.49903313381, 58.884658939559]]],
        "crs": {
            "properties": {
                "name": "EPSG:4258"
            },
            "type": "name"
        },
        "type": "Polygon"
    },
    "fylkesnavn": "Rogaland",
    "fylkesnummer": "11",
    "gyldigeNavn": [
        {
            "navn": "Stavanger",
            "prioritet": 1,
            "sprak": "Norwegian"
        },
        {
            "navn": null,
            "prioritet": 2,
            "sprak": null
        },
        {
            "navn": null,
            "prioritet": 3,
            "sprak": null
        }
    ],
    "kommunenavn": "Stavanger",
    "kommunenavnNorsk": "Stavanger",
    "kommunenummer": "1103",
    "punktIOmrade": {
        "coordinates": [
            5.712610778068,
            59.10201328799
        ],
        "crs": {
            "properties": {
                "name": "EPSG:4258"
            },
            "type": "name"
        },
        "type": "Point"
    },
    "samiskForvaltningsomrade": false
}

Uses data and models from "Åpent API fra Kartverket for administrative enheter"

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

norske_kommuner-0.4.0.tar.gz (52.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

norske_kommuner-0.4.0-py3-none-any.whl (56.2 kB view details)

Uploaded Python 3

File details

Details for the file norske_kommuner-0.4.0.tar.gz.

File metadata

  • Download URL: norske_kommuner-0.4.0.tar.gz
  • Upload date:
  • Size: 52.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.1 Linux/5.15.133.1-microsoft-standard-WSL2

File hashes

Hashes for norske_kommuner-0.4.0.tar.gz
Algorithm Hash digest
SHA256 bdb06d7ce3d0d0b10e090426c9db6a45bbd0da48b825aac803a0710934528fd7
MD5 5211f31627f51a7b7891465b7debf5c8
BLAKE2b-256 6b79bf7731ab6ae8ccbfc54ec948682a2ee65bacb5f46fabc6b2258ca7f55ea8

See more details on using hashes here.

File details

Details for the file norske_kommuner-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: norske_kommuner-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 56.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.1 Linux/5.15.133.1-microsoft-standard-WSL2

File hashes

Hashes for norske_kommuner-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 716112c7dc63cc699f3b68501eb01425f7edcf19e7188e9b139f77e326be5df7
MD5 9489f4a4b3970129169ee423ff2cae35
BLAKE2b-256 9a03f9ad75013ec743828f83ed87ff20527642d2aab01ef5fd24e52b37062a96

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page