From 05a0c9fd40cc0c14772d9b767d16656a258c6a11 Mon Sep 17 00:00:00 2001 From: Ivor Bosloper Date: Fri, 15 May 2026 23:41:22 +0200 Subject: [PATCH 1/2] Renew the de_by converter --- CHANGELOG.md | 2 ++ fiboa_cli/datasets/de_by.py | 47 +++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 fiboa_cli/datasets/de_by.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 98daecc..c0bce2e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +- Converter for Bavaria, Germany + ## [v0.21.0] - 2026-02-16 - Update vecorel-cli diff --git a/fiboa_cli/datasets/de_by.py b/fiboa_cli/datasets/de_by.py new file mode 100644 index 0000000..20b757d --- /dev/null +++ b/fiboa_cli/datasets/de_by.py @@ -0,0 +1,47 @@ +import geopandas as gpd +from vecorel_cli.conversion.admin import AdminConverterMixin + +from ..conversion.fiboa_converter import FiboaBaseConverter +from .commons.hcat import AddHCATMixin, load_ec_mapping + + +class Converter(AdminConverterMixin, AddHCATMixin, FiboaBaseConverter): + sources = "https://geodaten.bayern.de/odd/m/3/daten/ln/landnutzung.gpkg" + avoid_range_request = True + + id = "de_by" + admin_subdivision_code = "BY" + short_name = "Germany, Bavaria" + title = "Field boundaries for Bavaria, Germany" + description = """A field block (German: "Feldblock") is a contiguous agricultural area surrounded by permanent boundaries, which is cultivated by one or more farmers with one or more crops, is fully or partially set aside or is fully or partially taken out of production.""" + license = "CC-BY-4.0" + attribution = "Datenquelle: Bayerische Vermessungsverwaltung – www.geodaten.bayern.de" + providers = [ + { + "name": "Bayerische Vermessungsverwaltung", + "url": "https://www.ldbv.bayern.de", + "roles": ["producer", "licensor"], + } + ] + mapping_file = "https://fiboa.org/code/de/de_by.csv" + ec_mapping_csv = "https://fiboa.org/code/de/de_by.csv" + + columns = { + "geometry": "geometry", + "uuid": "id", + "datumderletztenueberpruefung": "determination:datetime", + "bewirtschaftung": "crop:code", + "crop:name": "crop:name", + } + + def layer_filter(self, layer: str, uri: str) -> bool: + return layer == "ln_landwirtschaft" + + def migrate(self, gdf: gpd.GeoDataFrame): + gdf = super().migrate(gdf) + self.ec_mapping = load_ec_mapping(self.ec_mapping_csv, url=self.mapping_file) + gdf = gdf[gdf["bewirtschaftung"].isin([row["original_code"] for row in self.ec_mapping])] + + mapping_crop = {row["original_code"]: row["original_name"] for row in self.ec_mapping} + gdf["crop:name"] = gdf["bewirtschaftung"].map(mapping_crop) + return gdf From d46e31d380bf58b8081c29afc17a9a3bdd0593e2 Mon Sep 17 00:00:00 2001 From: Ivor Bosloper Date: Thu, 21 May 2026 00:02:40 +0200 Subject: [PATCH 2/2] Align provider with new standard --- fiboa_cli/datasets/de_by.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/fiboa_cli/datasets/de_by.py b/fiboa_cli/datasets/de_by.py index 20b757d..70b2926 100644 --- a/fiboa_cli/datasets/de_by.py +++ b/fiboa_cli/datasets/de_by.py @@ -16,13 +16,7 @@ class Converter(AdminConverterMixin, AddHCATMixin, FiboaBaseConverter): description = """A field block (German: "Feldblock") is a contiguous agricultural area surrounded by permanent boundaries, which is cultivated by one or more farmers with one or more crops, is fully or partially set aside or is fully or partially taken out of production.""" license = "CC-BY-4.0" attribution = "Datenquelle: Bayerische Vermessungsverwaltung – www.geodaten.bayern.de" - providers = [ - { - "name": "Bayerische Vermessungsverwaltung", - "url": "https://www.ldbv.bayern.de", - "roles": ["producer", "licensor"], - } - ] + provider = "Bayerische Vermessungsverwaltung " mapping_file = "https://fiboa.org/code/de/de_by.csv" ec_mapping_csv = "https://fiboa.org/code/de/de_by.csv"