# Norske Kommuner
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/AndersSteenNilsen/norske-kommuner/main.svg)](https://results.pre-commit.ci/latest/github/AndersSteenNilsen/norske-kommuner/main)
[![PyPI - Status](https://img.shields.io/pypi/status/norske-kommuner?logo=pypi&logoColor=white)](https://pypi.org/project/norske-kommuner/)
[![Download Stats](https://img.shields.io/pypi/dm/norske-kommuner?logo=pypi&logoColor=white)](https://pypistats.org/packages/norske-kommuner)
Pydantic models on Norwegian municipalities (Norske kommuner).
```python
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
```json
{
"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](https://ws.geonorge.no/kommuneinfo/v1/)"
Raw data
{
"_id": null,
"home_page": "https://github.com/AndersSteenNilsen/norske-kommuner",
"name": "norske-kommuner",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7,<4.0",
"maintainer_email": "",
"keywords": "kommuner,municipalities,norway",
"author": "Anders Steen",
"author_email": "asteennilsen@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/47/c9/9fd6d63d6e715939f69ba477d54b56ac83512a060a6afec498e39d05bad8/norske_kommuner-0.3.0.tar.gz",
"platform": null,
"description": "# Norske Kommuner\n[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)\n[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/AndersSteenNilsen/norske-kommuner/main.svg)](https://results.pre-commit.ci/latest/github/AndersSteenNilsen/norske-kommuner/main)\n[![PyPI - Status](https://img.shields.io/pypi/status/norske-kommuner?logo=pypi&logoColor=white)](https://pypi.org/project/norske-kommuner/)\n[![Download Stats](https://img.shields.io/pypi/dm/norske-kommuner?logo=pypi&logoColor=white)](https://pypistats.org/packages/norske-kommuner)\n\nPydantic models on Norwegian municipalities (Norske kommuner).\n\n```python\nfrom norske_kommuner import kommuner, get_kommune_by_nr\n\n# Loop over all kommuner:\nfor kommune in kommuner.values():\n print(kommune)\n\n# Get kommunenummer\nprint (kommuner['Stavanger'].kommunenummer) # 1103\n\n# Can also get kommune by kommunenr\nprint(get_kommune_by_nr('1103')) # Stavanger\n\n# Each kommune is a pydantic model and have pydantic functionality like exporting to json\nprint(kommuner['Stavanger'].json())\n\n```\n\nLast line will output\n```json\n{\n \"avgrensningsboks\": {\n \"coordinates\": [[[5.49903313381, 58.884658939559], [5.49903313381, 59.312103554166], [6.131310442607, 59.312103554166], [6.131310442607, 58.884658939559], [5.49903313381, 58.884658939559]]],\n \"crs\": {\n \"properties\": {\n \"name\": \"EPSG:4258\"\n },\n \"type\": \"name\"\n },\n \"type\": \"Polygon\"\n },\n \"fylkesnavn\": \"Rogaland\",\n \"fylkesnummer\": \"11\",\n \"gyldigeNavn\": [\n {\n \"navn\": \"Stavanger\",\n \"prioritet\": 1,\n \"sprak\": \"Norwegian\"\n },\n {\n \"navn\": null,\n \"prioritet\": 2,\n \"sprak\": null\n },\n {\n \"navn\": null,\n \"prioritet\": 3,\n \"sprak\": null\n }\n ],\n \"kommunenavn\": \"Stavanger\",\n \"kommunenavnNorsk\": \"Stavanger\",\n \"kommunenummer\": \"1103\",\n \"punktIOmrade\": {\n \"coordinates\": [\n 5.712610778068,\n 59.10201328799\n ],\n \"crs\": {\n \"properties\": {\n \"name\": \"EPSG:4258\"\n },\n \"type\": \"name\"\n },\n \"type\": \"Point\"\n },\n \"samiskForvaltningsomrade\": false\n}\n```\n\n>Uses data and models from \"[\u00c5pent API fra Kartverket for administrative enheter](https://ws.geonorge.no/kommuneinfo/v1/)\"\n",
"bugtrack_url": null,
"license": "",
"summary": "Pydantic models on Norwegian municipalities (Norske kommuner).",
"version": "0.3.0",
"project_urls": {
"Homepage": "https://github.com/AndersSteenNilsen/norske-kommuner",
"Repository": "https://github.com/AndersSteenNilsen/norske-kommuner"
},
"split_keywords": [
"kommuner",
"municipalities",
"norway"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "5f5fd2e9461b2716d7395b4d5d5d01a65fbdd0057fd45ffe657d2b8919243cf3",
"md5": "8e778174407c6825eab5f76f0eeb3d34",
"sha256": "a531f342177b94388d1fe038f472f807cfaad8a9ca2ce94228e6672ffa9c956a"
},
"downloads": -1,
"filename": "norske_kommuner-0.3.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8e778174407c6825eab5f76f0eeb3d34",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7,<4.0",
"size": 48716,
"upload_time": "2023-11-22T14:51:13",
"upload_time_iso_8601": "2023-11-22T14:51:13.896947Z",
"url": "https://files.pythonhosted.org/packages/5f/5f/d2e9461b2716d7395b4d5d5d01a65fbdd0057fd45ffe657d2b8919243cf3/norske_kommuner-0.3.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "47c99fd6d63d6e715939f69ba477d54b56ac83512a060a6afec498e39d05bad8",
"md5": "42d06dc4baf29989c4b993a30b7478fa",
"sha256": "45441f63e81afd3951a868d5bcd27d655348119a6b405f8fa13a88ba1cdf6de7"
},
"downloads": -1,
"filename": "norske_kommuner-0.3.0.tar.gz",
"has_sig": false,
"md5_digest": "42d06dc4baf29989c4b993a30b7478fa",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7,<4.0",
"size": 45031,
"upload_time": "2023-11-22T14:51:15",
"upload_time_iso_8601": "2023-11-22T14:51:15.869124Z",
"url": "https://files.pythonhosted.org/packages/47/c9/9fd6d63d6e715939f69ba477d54b56ac83512a060a6afec498e39d05bad8/norske_kommuner-0.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-11-22 14:51:15",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "AndersSteenNilsen",
"github_project": "norske-kommuner",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"tox": true,
"lcname": "norske-kommuner"
}