alxmrs / dask-ee

Google Earth Engine Feature Collections via Dask Dataframes
Apache License 2.0
64 stars 3 forks source link

Initial attempt to get dask-geopandas working. #14

Open alxmrs opened 5 months ago

giswqs commented 5 months ago

Found a relevant issue: https://github.com/geopandas/dask-geopandas/issues/197 Still investigating.

giswqs commented 5 months ago

Here is a snippet for convert a dask dataframe to dask geodataframe. We need to more generic way for converting other geometry types besides points.

import dask.dataframe as dd
import dask_geopandas as dgpd

# load some data
ddf = dd.read_csv(
    "https://github.com/opengeos/datasets/releases/download/world/world_cities.csv",
)

# subset for faster iteration
ddf = ddf.partitions[0:5]

# convert to dask geodataframe
# Assign the geometry column using vanilla Dask
ddf = ddf.assign(geometry=dgpd.points_from_xy(ddf, "longitude", "latitude"))
# Refer to the geometry column by name
dgdf = dgpd.from_dask_dataframe(ddf, geometry="geometry")
dgdf.crs = "EPSG:4326"
dgdf.head()
dgdf.compute().explore()

image