rafaqz / Rasters.jl

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

Can't rasterize a MultiLineString with `shape = :polygon`? #743

Open asinghvi17 opened 1 week ago

asinghvi17 commented 1 week ago

From geocompjl:


julia> california_raster1 = Rasters.rasterize(
           last,
           california_borders; # GI.MultiLineString
           fill = 1,
           res = 0.5, shape = :polygon
       )
ERROR: MethodError: no method matching Rasters.Edges(::GeoInterface.MultiLineStringTrait, ::GeoInterface.Wrappers.MultiLineString{…}, ::Tuple{…}; allocs::Rasters.Allocs{…})

Closest candidates are:
  Rasters.Edges(::Any, ::Any, ::Any) got unsupported keyword argument "allocs"
   @ Rasters ~/.julia/dev/Rasters/src/methods/burning/edges.jl:43
  Rasters.Edges(::Union{GeoInterface.AbstractCurveTrait, GeoInterface.AbstractMultiPolygonTrait, GeoInterface.AbstractPolygonTrait}, ::Any, ::Any; allocs, kw...)
   @ Rasters ~/.julia/dev/Rasters/src/methods/burning/edges.jl:48
  Rasters.Edges(::Any, ::Any; kw...)
   @ Rasters ~/.julia/dev/Rasters/src/methods/burning/edges.jl:47

Stacktrace:
  [1] Rasters.Edges(geom::GeoInterface.Wrappers.MultiLineString{…}, dims::Tuple{…}; kw::@Kwargs{…})
    @ Rasters ~/.julia/dev/Rasters/src/methods/burning/edges.jl:47
  [2] _burn_polygon!(B::Raster{…}, trait::GeoInterface.MultiLineStringTrait, geom::GeoInterface.Wrappers.MultiLineString{…}; fill::Bool, boundary::Symbol, geomextent::Extent{…}, verbose::Bool, allocs::Rasters.Allocs{…}, kw::@Kwargs{…})
    @ Rasters ~/.julia/dev/Rasters/src/methods/burning/polygon.jl:20

does this just need a dispatch or update?

rafaqz commented 1 week ago

Currently you can make a polygon a line but not the opposite.