From 003c7e07e06419ae95155584768c55218db85a1d Mon Sep 17 00:00:00 2001 From: alepr Date: Thu, 9 Jul 2026 09:20:33 -0400 Subject: [PATCH 1/2] Fix: ensure correct CRS in ee_to_gdf (fixes #2818) --- geemap/common.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/geemap/common.py b/geemap/common.py index 2237ec3988..716d5c2a96 100644 --- a/geemap/common.py +++ b/geemap/common.py @@ -8957,7 +8957,11 @@ def ee_to_gdf( if sort_columns: gdf = gdf.reindex(sorted(gdf.columns), axis=1) - gdf.crs = crs + gdf = gdf.set_crs("EPSG:4326") + + if crs: + gdf = gdf.to_crs(crs) + return gdf From 6f83fc59603436b66341b61a0eb2c327c52fe83e Mon Sep 17 00:00:00 2001 From: alepr Date: Thu, 9 Jul 2026 18:23:16 -0400 Subject: [PATCH 2/2] Fix CRS handling and add documentation for reprojection logic --- geemap/common.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/geemap/common.py b/geemap/common.py index 716d5c2a96..68a89be828 100644 --- a/geemap/common.py +++ b/geemap/common.py @@ -8947,7 +8947,10 @@ def ee_to_gdf( kwargs["expression"] = ee_object kwargs["fileFormat"] = "GEOPANDAS_GEODATAFRAME" - + # Get the source CRS to ensure we can reproject back to it later + # This is important because ee.data.computeFeatures will return a GeoDataFrame + # reprojected to EPSG:4326, Docs in + # https://developers.google.com/earth-engine/apidocs/ee-data-computefeatures crs = ee_object.first().geometry().projection().crs().getInfo() gdf = ee.data.computeFeatures(kwargs) @@ -8956,10 +8959,11 @@ def ee_to_gdf( if sort_columns: gdf = gdf.reindex(sorted(gdf.columns), axis=1) - + # Standardize CRS: Set as 4326 initially as a base, then reproject + # to the original geometry's CRS if it differs from 4326. gdf = gdf.set_crs("EPSG:4326") - if crs: + if crs and crs.upper() != "EPSG:4326": gdf = gdf.to_crs(crs) return gdf