0

I got a raster image with 2m pixel size, there are some areas with value 1 (black) and roads with value NA (white):

enter image description here

It is made from a rasterized shape:

enter image description here

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.

enter image description here

3
  • 1
    And for clarity, you don't have the original vector data at this point? You have a raster you need to resample?
    – Spacedman
    Commented Nov 23, 2021 at 18:08
  • 2
    I would go for an aggregation with a function like if (anyNA(x)) return NA else return x[1]).
    – JRR
    Commented Nov 23, 2021 at 18:51
  • Right now I use aggregate in R, na.rm should do the same as your suggested if statement. aggregate(layer,fact=5, fun = modal, na.rm = TRUE)
    – sfetan
    Commented Nov 24, 2021 at 8:19

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.