Description
Description
I am experiencing an issue when trying to reproject a dask_geopandas.GeoSeries
or dask_geopandas.GeoDataFrame
to a new CRS. The set_crs
and to_crs
methods return an AttributeError
indicating that the Series
or DataFrame
object has no attribute set_crs
or to_crs
.
I'm guessing this has to do with the fact that the geometry was created using dask_geopandas.points_from_xy
, though even when I compute the GeoDataFrame, save it to disk, and re-read it using dask_geopandas.read_parquet
, the issue still persists.
Code to reproduce
import pandas as pd
import dask.dataframe as dd
import dask_geopandas as dgpd
df = pd.DataFrame(
{
"value": [1, 2, 3],
"decimallatitude": [34.05, 36.16, 40.71],
"decimallongitude": [-118.24, -115.15, -74.00],
}
)
ddf = dd.from_pandas(df, npartitions=2)
geom = dgpd.points_from_xy(
ddf, "decimallongitude", "decimallatitude", crs="EPSG:4326"
)
ddf["geometry"] = geom
ddf = dgpd.from_dask_dataframe(ddf[["value", "geometry"]])
geom = geom.to_crs("EPSG:6933") # <-- returns AttributeError
ddf = ddf.to_crs("EPSG:6933") # <-- also returns AttributeError
Error Message
The following error is raised when attempting to use to_crs
on geom
alone:
AttributeError: 'Series' object has no attribute 'to_crs'
And on ddf
:
AttributeError: 'DataFrame' object has no attribute 'to_crs'
Expected Behavior
I expect the to_crs
method to reproject either a dask_geopandas.GeoSeries
or dask_geopandas.GeoDataFrame
to the new CRS without raising an error.
System Information
python: 3.11
dask-geopandas: 0.3.1
dask: 2024.9.0
pandas: 2.2.2
OS: Ubuntu 22.04.4 LTS