From be9b46be504d09b269b38a2b0f70c08f8b084469 Mon Sep 17 00:00:00 2001 From: Christina Butsko Date: Tue, 26 Nov 2024 10:36:46 +0100 Subject: [PATCH] added collection_id to list of default columns; added filtering on requested columns post-query --- src/worldcereal/rdm_api/rdm_interaction.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/worldcereal/rdm_api/rdm_interaction.py b/src/worldcereal/rdm_api/rdm_interaction.py index a86348e..df3a630 100644 --- a/src/worldcereal/rdm_api/rdm_interaction.py +++ b/src/worldcereal/rdm_api/rdm_interaction.py @@ -37,6 +37,7 @@ class RdmInteraction: "quality_score_ct", "extract", "h3_l3_cell", + "collection_id", ] # RDM API Endpoint @@ -455,6 +456,8 @@ def download_samples( # Convert the WKB geometry to a Shapely geometry df["geometry"] = df["wkb_geometry"].apply(lambda x: wkb.loads(bytes(x))) df.drop(columns=["wkb_geometry"], inplace=True) + # Make sure df contains only requested columns + df = df[columns] # Convert the DataFrame to a GeoDataFrame gdf = gpd.GeoDataFrame(df, geometry="geometry", crs="EPSG:4326")