We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5d7c5d0 commit 83addc4Copy full SHA for 83addc4
1 file changed
xvec/accessor.py
@@ -960,11 +960,12 @@ def to_geodataframe(
960
if geometry is None:
961
geometry = df.index.name
962
df = df.reset_index()
963
-
964
# ensure CRS of all columns is preserved
965
for c in df.columns:
966
if c in self._geom_coords_all:
967
- df[c] = gpd.GeoSeries(df[c], crs=self._obj[c].attrs.get("crs", None))
+ # As of xarray 2024.4.0, the type is preserved in the case of non-multiindex
+ if df[c].dtype == "object":
968
+ df[c] = gpd.GeoSeries(df[c], crs=self._obj[c].attrs.get("crs", None))
969
970
if geometry is not None:
971
if geometry not in self._geom_coords_all: # variable geometry
0 commit comments