Skip to content
Prev 28796 / 29559 Next

Identify specific pixel neighbours

Hi Paulo,

you could use a focal analysis approach using the "terra" package. You
could build for each category (e.g., "urban", "forest", etc)
a raster with an indicator coding (1 and 0) and then apply simple kernel
(weight matrix, as below) doing the summation of the neighboring pixels.

1 1 1
1 NA 1
1 1 1

If the resulting pixel (at the center of the kernel) is >0 means that one
of the neighboring pixels is of the considered category.

But maybe there are specialized packages doing directly this.

Sincerely,

Sebastiano


*      Sebastiano Trevisani, Ph.D.*
*            Associate Professor*
*Applied and Environmental Geology*


*  https://orcid.org/0000-0001-8436-7798
<https://orcid.org/0000-0001-8436-7798>*
*IUAV University of Venice: www.iuav.it <http://www.iuav.it/>*

*Address: Dorsoduro 2206,  Venice 30123, Italy Tel:    +39. 041. 257
1299Mail:    strevisani at iuav.it <strevisani at iuav.it> *
*"Le opinioni espresse sono riferibili esclusivamente all'autore e non *
* riflettono in alcun modo una posizione ufficiale dello IUAV "*
*"The views expressed are purely those of the writer and may not in
any circumstances be regarded as stating an official position of the IUAV."*


On Tue, Nov 9, 2021 at 6:40 PM Paulo Flores Ribeiro <
paulo.flores.mail at gmail.com> wrote: