Open
Description
using NaturalEarth, Rasters, GeometryOps
countries = naturalearth("admin_0_countries", 110);
dx = Dim{:X}(-180:180)
dy = Dim{:Y}(-90:90)
# you can not rasterize non-numeric attributes into an array
ras = rasterize(first, countries; res=1.0, fill=:NAME, missingval="test", crs=EPSG(4326));
# but you can create raster of non-numerical values
ras = Raster(fill("test", (dx, dy)))
#but again you can not raterize on-numeric attributes, even if one initializes a non-numeric array
ras = rasterize!(first, ras, countries; fill=:NAME, missingval="test", crs=EPSG(4326));
ERROR: MethodError: no method matching zero(::Type{String})
The function `zero` exists, but no method is defined for this combination of argument types.
Closest candidates are:
zero(::Type{Union{}}, Any...)
@ Base number.jl:310
zero(::Type{Dates.DateTime})
@ Dates ~/.julia/juliaup/julia-1.11.0-rc1+0.aarch64.apple.darwin14/share/julia/stdlib/v1.11/Dates/src/types.jl:458
zero(::Type{Dates.Date})
@ Dates ~/.julia/juliaup/julia-1.11.0-rc1+0.aarch64.apple.darwin14/share/julia/stdlib/v1.11/Dates/src/types.jl:459
...
Stacktrace:
[1] _reduce_init(f::typeof(first), ::Type{String})
@ Rasters ~/Documents/GitHub/Rasters.jl/src/methods/rasterize.jl:15
[2] Rasters.Rasterizer(geom::Vector{…}, fill::Symbol, fillitr::Vector{…}; reducer::Function, op::Nothing, missingval::String, shape::Nothing, eltype::Nothing, init::Nothing, boundary::Symbol, filename::Nothing, verbose::Bool, progress::Bool, threaded::Bool, kw::@Kwargs{…})
@ Rasters ~/Documents/GitHub/Rasters.jl/src/methods/rasterize.jl:133
[3] Rasters.Rasterizer(data::GeoJSON.FeatureCollection{…}; fill::Symbol, geomcolumn::Nothing, kw::@Kwargs{…})
@ Rasters ~/Documents/GitHub/Rasters.jl/src/methods/rasterize.jl:168
[4] Rasterizer
@ ~/Documents/GitHub/Rasters.jl/src/methods/rasterize.jl:145 [inlined]
[5] rasterize(data::GeoJSON.FeatureCollection{…}; to::Nothing, fill::Symbol, threaded::Bool, kw::@Kwargs{…})
@ Rasters ~/Documents/GitHub/Rasters.jl/src/methods/rasterize.jl:419
[6] rasterize(reducer::Function, data::GeoJSON.FeatureCollection{…}; kw::@Kwargs{…})
@ Rasters ~/Documents/GitHub/Rasters.jl/src/methods/rasterize.jl:396
[7] top-level scope
@ ~/Documents/GitHub/ItsLivePlayground.jl/src/issue_with_cellarea.jl:1
Some type information was truncated. Use `show(err)` to see complete types.