Thanks for splitting the thread, and for trying the packages. I am assuming you did read the docstring of the transform:
Rasterize(grid)
Rasterize(grid, var₁ => agg₁, ..., varₙ => aggₙ)
Rasterize geometries within specified grid.
Rasterize(nx, ny)
Rasterize(nx, ny, var₁ => agg₁, ..., varₙ => aggₙ)
Alternatively, use the grid with size nx by ny obtained with discretization of the bounding box.
Duplicates of a variable varᵢ are aggregated with aggregation function aggᵢ. If an aggregation function is not defined for variable varᵢ, the default aggregation function will be used.
Default aggregation function is mean for continuous variables and first otherwise.
Examples
≡≡≡≡≡≡≡≡
grid = CartesianGrid(10, 10)
Rasterize(grid)
Rasterize(10, 10)
Rasterize(grid, 1 => last, 2 => maximum)
Rasterize(10, 10, 1 => last, 2 => maximum)
Rasterize(grid, :a => first, :b => minimum)
Rasterize(10, 10, :a => first, :b => minimum)
Rasterize(grid, "a" => last, "b" => maximum)
Rasterize(10, 10, "a" => last, "b" => maximum)
You can specify the grid
(e.g. CartesianGrid
) on which the rasterization will occur, and then pass aggregation functions per variable as in the example, to decide what to do with the matches.
Do I understand correctly that you want to take the mode
of the land types within a pixel?
I would try something like:
geotable |> Rasterize(grid, "Code_18" => mode)
That will return a new geotable over the grid with the most frequent land type in each pixel.