From 1a3fd428792843e415d6c726b79f869aa5ecb34d Mon Sep 17 00:00:00 2001 From: Finn van Krieken Date: Wed, 2 Oct 2024 18:07:14 +0000 Subject: [PATCH] fix renaming of geom column --- dcpy/lifecycle/ingest/transform.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dcpy/lifecycle/ingest/transform.py b/dcpy/lifecycle/ingest/transform.py index fb1e17f0d..fd199d975 100644 --- a/dcpy/lifecycle/ingest/transform.py +++ b/dcpy/lifecycle/ingest/transform.py @@ -97,6 +97,8 @@ def rename_columns( self, df: pd.DataFrame, map: dict[str, str], drop_others=False ) -> pd.DataFrame: renamed = df.copy() + if isinstance(renamed, gpd.GeoDataFrame) and renamed.geometry.name in map: + renamed.rename_geometry(map.pop(renamed.geometry.name), inplace=True) renamed = renamed.rename(columns=map, errors="raise") if drop_others: renamed = renamed[list(map.values())]