Python for the Swiss Federal Statistics Geodata
Project description
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 andGeoTIFF
files - Clip dataframes by vector geometries
- Plot information as raster maps
import swisslandstats as sls
ldf = sls.from_url()
ldf.plot("LU09_4", cmap=sls.noas04_4_cmap, legend=True)
vaud_ldf = ldf.clip_by_nominatim("Vaud, Switzerland")
vaud_ldf.plot("LU09_4", cmap=sls.noas04_4_cmap, legend=True)
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for swisslandstats_geopy-0.11.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd8a4a9e85ffea53d27584a05cc4328cca2e96aa4c6d5c4b3c7940bde42fa0b9 |
|
MD5 | 3e3ef8b97a447ee0013b8bdbcd181d3f |
|
BLAKE2b-256 | 5ba48d8b029c5bba2c74a21368a3aabf82323bc5529017a065d3158127fda7fa |
Hashes for swisslandstats_geopy-0.11.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d185eba842509124be063e3ec11f42d712afba5083371e5978c39241e096c8f4 |
|
MD5 | b572333a193c5e31b6710077b7cb610e |
|
BLAKE2b-256 | d66980dcfcc66074f941687be874b92e48ce1a9a7388781fdb4a8858641bee63 |