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?

BestBernardo


    Em quarta-feira, 3 de novembro de 2021 18:30:25 GMT+1, Maris Nartiss 
<maris....@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.

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

Māris.

trešd., 2021. g. 3. nov., plkst. 15:26 — lietotājs Bernardo Santos via
grass-user (<grass-user@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@lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/grass-user
  
_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

Reply via email to