Skip to main content

PyPI version fury.io Conda Version Documentation Status pre-commit.ci status tests codecov GitHub license Binder status DOI

swisslandstats-geopy

Extended pandas-like interface for the Swiss Federal Statistics Geodata (GEOSTAT).

Citation: Bosch M. 2019. "swisslandstats-geopy: Python tools for the land statistics datasets from the Swiss Federal Statistical Office". The Journal Open Source Software 4(40), 1511. https://doi.org/10.21105.joss.01511

Many datasets of the GEOSTAT inventory are provided in a relational database format which allows storing a coolection of variables into a single CSV file, nevertheless, libraries to process geographical raster data aree rarely capable of processing such format. Therefore, the aim of swisslandstats-geopy is to provide an extended pandas DataFrame interface to such inventory (see the "Features" section below).

The target audience of swisslandstats-geopy is researchers and developers in environmental sciences and GIS, who intend to produce repeatable and reproducible computational workflows that make use of the geodata inventory provided by the SFSO.

Features

  • Automatically read CSV files from the GEOSTAT inventory into dataframes
  • Export columns into numpy arrays and GeoTIFF files
  • Clip dataframes by vector geometries
  • Plot information as raster maps
import swisslandstats as sls

ldf = sls.load_dataset(dataset_key="sls")
ldf.plot("LU09_4", cmap=sls.noas04_4_cmap, legend=True)

landstats

vaud_ldf = ldf.clip_by_nominatim("Vaud, Switzerland")
vaud_ldf.plot("LU09_4", cmap=sls.noas04_4_cmap, legend=True)

landstats-vaud

See the example notebook for a more thorough overview and example uses with the land use statistics and population and household statistics. You might click the Binder badge above to execute it interactively in your browser.

Examples of applications of the library in the academic literature include:

  • The assessment of the carbon sequestration for the canton of Vaud (see the dedicated GitHub repository with the materials necessary to reproduce the results)
  • The evaluation of the spatio-temporal patterns of LULC change in the urban agglomerations of Zurich, Bern and Lausanne (see the dedicated GitHub repository with the materials necessary to reproduce the results).

Installation

With conda

The easiest way to install swisslandstats-geopy is with conda as in:

conda install -c conda-forge swisslandstats-geopy

With pip

If you want to be able to clip dataframes by vector geometries, you will need geopandas (and osmnx to clip dataframes from place names e.g., "Zurich, Switzerland"). The easiest way to install such requirements is via conda as in:

conda install -c conda-forge geopandas osmnx rasterio

Although rasterio can be installed via pip, it is recommended to install it via conda to avoid potential issues with GDAL (such as the support of the Swiss EPSG coordinate reference systems).

Then you can install swisslandstats-geopy via pip as in:

pip install swisslandstats-geopy

TODO

  • Add missing colormaps
    • Automatically assign columns to cmaps when plotting
  • Exceptions for no land use/land cover columns
  • Implement methods to merge DataFrames from multiple csv files

Release files for swisslandstats-geopy 0.12.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for swisslandstats-geopy 0.12.0
File Size Uploaded
swisslandstats_geopy-0.12.0.tar.gz 31.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for swisslandstats-geopy 0.12.0
File Interpreter ABI Platform
swisslandstats_geopy-0.12.0-py3-none-any.whl Python 3 none any Details

Total release size: 58.8 kB

Release files / swisslandstats_geopy-0.12.0.tar.gz

Download URL swisslandstats_geopy-0.12.0.tar.gz
Size 31.3 kB
Tags Source
SHA-256 checksum
How to use checksums
4be5ab1fed9485c2e5918766e2fe487d18b0738cc7aeb538c52b3ac333eeba18
BLAKE2b-256 checksum
How to use checksums
3d8d56ed2cd1698b9a92d5a247a7d9418c6eb9ffd75b6341d18ce6eb64880602
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 27, 2025.

Transparency log

Release files / swisslandstats_geopy-0.12.0-py3-none-any.whl

Download URL swisslandstats_geopy-0.12.0-py3-none-any.whl
Size 27.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a7cd764159a481d73c29c809487e9ed21ed552967fdfa3100fed50e43e6b5186
BLAKE2b-256 checksum
How to use checksums
571d2185b1397c1324da991f9252d798abac0e8bed6ab92bd427b10514478495
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 27, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.12.0 This release

2 release files

0.11.0

2 release files

0.10.0

2 release files

0.9.0

2 release files

0.8.0

1 release file

0.7.3

1 release file

0.7.2

1 release file

0.7.1

1 release file

0.7.0

1 release file

0.6.1

1 release file

0.6.0

1 release file

0.5.1

1 release file

0.5.0

1 release file

0.4.1

1 release file

0.4.0

2 release files

0.3.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page