[GRASS-user] r.neighbors vs r.resamp.filter

Bernardo Santos bernardo_brandaum at yahoo.com.br
Thu Nov 4 02:13:11 PDT 2021

 Hi Maris,
thanks for your answer.For me what you say is clear when it comes to r.resamp.interp (output has a finer scale resolution then the input) or r.resamp.stats (result has a coarser resolution).However, it is not so clear when it comes to r.resamp.filter.
I used a "roadsmajor" map form the NC dataset as an example to calculate the density, considering a neighborhood of 150m (just some random value, multiple of the map resolution, 30m).Here is a gist for the code: neighbors_vs_resamp_filter.py (github.com), run from the PERMANENT mapset.
Both r.neighbors and r.resamp.filter produce maps with similar resolution (=30m, the original resolution), and the results are quite comparable, visually, even though different.Probably (at least part of) the differences are due to different filters/algorithms. I am not sure exactly how many pixels are considered in each filter when I set the radius as 150m in r.resamp.filter, for example. Maybe if I chose a Gaussian filter (which is possible in both modules) the results would be more similar.
I understand r.neighbors has other statistics it is possible to compute (which are not present in r.resamp.filter), and r.resamp.filter has multiple types of combination of filters which are not possible in r.neighbors, so they complement each other.
But, if I use the "average" method in r.neighbors, can they be comparable? Am I missing something central here?


    Em quarta-feira, 3 de novembro de 2021 18:30:25 GMT+1, Maris Nartiss <maris.gis at gmail.com> escreveu:  
 If the computational region is set to match input map, r.neighbours
will produce output in the same resolution. r.resamp.* will work if
the computational region differs from the input map.
Do not use r.neighbours with a different computational region, as
GRASS internally is using nearest neighbour method for resampling –
the result might not be what you expect to have.

for same resolution output – r.neighbours
for different resolution (e.g. count per km²) – r.resamp.*


trešd., 2021. g. 3. nov., plkst. 15:26 — lietotājs Bernardo Santos via
grass-user (<grass-user at lists.osgeo.org>) rakstīja:
> Dear all,
> I am working with human infrastructure data (houses, trails, roads and railways, dams, etc) and I need to create maps of density (in space) of each type of infrastructure, for different spatial extents (i.e. considering different neighborhood sizes). So far I've been using r.neighbors to do this, but some colleagues and collaborators are using r.resamp.filter instead. I took a good look at each and made some tests to compare, but I am not sure what are the real differences between each. Has this been developed or discussed somewhere?
> My inputs are rasterized versions of points, lines, or polygon features.
> If it is better, I can bring a reprex here to discuss it more deeply.
> Best regards,
> Bernardo Niebuhr
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/grass-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20211104/62b50b28/attachment.html>

More information about the grass-user mailing list