Skip to content

Error when using leafmap.get_3dep_dem() (Whitebox section example) #42

@MUHAMMAD-MEHDI12

Description

@MUHAMMAD-MEHDI12

Dear Dr. Wu,

I hope you are doing well. First of all, thank you for your excellent work on leafmap and whitebox. I am trying to reproduce one of the examples in the documentation, but I ran into an issue.

My setup and data details:

gdf is a valid GeoDataFrame (CRS = EPSG:3857) containing a single polygon.

Geometry type: <class 'shapely.geometry.polygon.Polygon'>

Environment: Windows, Anaconda (geopandas, shapely, rasterio, numpy, whitebox, latest leafmap and almost all other necessary libraries are installed).

Code I ran:

array = leafmap.get_3dep_dem(
gdf,
resolution=30,
output="dem.tif",
dst_crs="EPSG:3857",
to_cog=True,
overwrite=True,
)
array

Error message:

TypeError: ufunc 'create_collection' not supported for the input types,
and the inputs could not be safely coerced to any supported types
according to the casting rule 'safe'
...
File ".../leafmap/common.py", line 10585, in get_3dep_dem
geometry = geometry.geometry.unary_union

I am not sure how to solve this problem, since I am using the same code provided in your documentation. Could you please advise whether get_3dep_dem() expects a GeoDataFrame, a GeoSeries, or a shapely geometry object as input?

Thank you very much for your time and guidance.

Best regards,
Muhammad Mehdi
University of the Punjab, Lahore Pakistan
Institute of Geography
email: geomehdi12@gmail.com

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions