rafaqz / Rasters.jl

Raster manipulation for the Julia language
MIT License
214 stars 36 forks source link

rasterize! throws error on 0-element Vector #767

Open alex-s-gardner opened 1 month ago

alex-s-gardner commented 1 month ago

Should a 0-element Vector simply be skipped when Rasterizing or is there good reason to return an error?

ERROR: BoundsError: attempt to access 0-element Vector{ArchGDAL.IGeometry{ArchGDAL.wkbMultiPolygon}} at index [1]
alex-s-gardner commented 1 month ago

My fault... I was passing in an empty GeoDataFrame

rafaqz commented 1 month ago

Probably we should check and throw a nicer error

tiemvanderdeure commented 1 month ago

For rasterize! or rasterize with a to, another option is to just return a Raster filled with missingval.

rafaqz commented 1 month ago

Yep that makes more sense