I got a raster image with 2m pixel size, there are some areas with value 1 (black) and roads with value NA (white):
It is made from a rasterized shape:
Now I resample my raster to 5 m pixels, the roads are now sometimes gone. How can I preserve these structures? Eg cut out the streets in this resolution.
if (anyNA(x)) return NA else return x[1])
.aggregate(layer,fact=5, fun = modal, na.rm = TRUE)