Skip to main content

No project description provided

Project description

duva 🕊️

Reverse geocode Swedish coordinates to RegSO areas.

Install

pip install duva

Usage

from duva import locate, locate_many, enrich_df, from_code, from_name, search

# Single coordinate (WGS84)
locate(x=17.88, y=59.35)
# {'regsonamn': 'Blackeberg', 'kommunnamn': 'Stockholm', 'lansnamn': 'Stockholms län', ...}

# As object
result = locate(x=17.88, y=59.35, as_object=True)
result.regsonamn  # 'Blackeberg'

# List of coordinates
locate_many([(17.88, 59.35), (18.07, 59.28)])

# Enrich a Polars DataFrame
enrich_df(df, x_col="lon", y_col="lat")

# Lookup by RegSO code
from_code("0180R009")

# Lookup by name (returns list since names are not unique across Sweden)
from_name("Blackeberg")
from_name("Östermalm")  # returns all areas named Östermalm across Sweden

# Search by partial name with optional kommun/län filters
search("östermalm")
search("östermalm", kommunnamn="Borlänge")
search("centrum", lansnamn="Stockholms län")
search("centrum", kommunnamn="Sollentuna", lansnamn="Stockholms län")

RegSO object

Field Type Example Description
regsokod str 0180R009 SCB area code
regsonamn str Blackeberg Area name
kommunkod str 0180 Municipality code
kommunnamn str Stockholm Municipality name
lanskod str 01 County code
lansnamn str Stockholms län County name
not_on_land bool False True if coordinate is over water
offshore bool False True if outside any municipality boundary (international water)
objektidentitet str 141f6a1d-... SCB internal UUID
objekttyp str regso Always regso
version str 2025_v2 Dataset version
referensdatum str 20250101 Dataset reference date

Notes

  • Input coordinates must be WGS84 (standard GPS)
  • Raises ValueError for invalid coordinates or coordinates outside Sweden
  • Area names are not unique across Sweden — from_name and search return lists
  • Based on SCB's RegSO 2025 and municipality boundaries

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

duva-0.3.4.tar.gz (19.4 MB view details)

Uploaded Source

Built Distribution

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

duva-0.3.4-py3-none-any.whl (19.4 MB view details)

Uploaded Python 3

File details

Details for the file duva-0.3.4.tar.gz.

File metadata

  • Download URL: duva-0.3.4.tar.gz
  • Upload date:
  • Size: 19.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for duva-0.3.4.tar.gz
Algorithm Hash digest
SHA256 986d57f2eb1c55c3dd791052c8911886ed83a18f3d7d03ceb3121a37ccd8bd8d
MD5 88b491a6164ebf2f68762fcaffa56d7a
BLAKE2b-256 ffb0628832e9233effda3a3645940a36dd3159f99b198490f0f0ac42a5f330e5

See more details on using hashes here.

Provenance

The following attestation bundles were made for duva-0.3.4.tar.gz:

Publisher: python-publish.yml on Koutakis/duva

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file duva-0.3.4-py3-none-any.whl.

File metadata

  • Download URL: duva-0.3.4-py3-none-any.whl
  • Upload date:
  • Size: 19.4 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for duva-0.3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 c8f7ee222e40fe47f1a4b29759cbb7a8bee0017b091bd287d47fa333aa9b3271
MD5 42d2b7cda3d13489bf55f4d0bd13cb25
BLAKE2b-256 e4fcf342e240c9aba18b998d42791ace6f9ecd9792da1fd68b671adb816f8f98

See more details on using hashes here.

Provenance

The following attestation bundles were made for duva-0.3.4-py3-none-any.whl:

Publisher: python-publish.yml on Koutakis/duva

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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