<html><head></head><body><div class="ydpa83a2988yahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:16px;"><div></div>
<div dir="ltr" data-setdir="false">Hi Maris,</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">thanks for your answer.</div><div dir="ltr" data-setdir="false">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).</div><div dir="ltr" data-setdir="false">However, it is not so clear when it comes to r.resamp.filter.</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">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).</div><div dir="ltr" data-setdir="false">Here is a gist for the code: <span><a href="https://gist.github.com/bniebuhr/70882e74f705f8a64a395abcd412bd98" class="">neighbors_vs_resamp_filter.py (github.com)</a>, run from the PERMANENT mapset.</span><div><br></div></div><div dir="ltr" data-setdir="false">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.</div><div dir="ltr" data-setdir="false">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.</div><div dir="ltr" data-setdir="false"><span><span style="color: rgb(0, 0, 0); font-family: Helvetica Neue, Helvetica, Arial, sans-serif; font-size: 16px;"><br></span></span></div><div dir="ltr" data-setdir="false"><span><span style="color: rgb(0, 0, 0); font-family: Helvetica Neue, Helvetica, Arial, sans-serif; font-size: 16px;">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.</span></span><br></div><div dir="ltr" data-setdir="false">But, if I use the "average" method in r.neighbors, can they be comparable? Am I missing something central here?<br></div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">Best</div><div dir="ltr" data-setdir="false">Bernardo</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false"><br></div><div><br></div>
</div><div id="yahoo_quoted_6418276858" class="yahoo_quoted">
<div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
<div>
Em quarta-feira, 3 de novembro de 2021 18:30:25 GMT+1, Maris Nartiss <maris.gis@gmail.com> escreveu:
</div>
<div><br></div>
<div><br></div>
<div><div dir="ltr">If the computational region is set to match input map, r.neighbours<br clear="none">will produce output in the same resolution. r.resamp.* will work if<br clear="none">the computational region differs from the input map.<br clear="none">Do not use r.neighbours with a different computational region, as<br clear="none">GRASS internally is using nearest neighbour method for resampling –<br clear="none">the result might not be what you expect to have.<br clear="none"><br clear="none">TL;DR:<br clear="none">for same resolution output – r.neighbours<br clear="none">for different resolution (e.g. count per km²) – r.resamp.*<br clear="none"><br clear="none">Māris.<br clear="none"><br clear="none">trešd., 2021. g. 3. nov., plkst. 15:26 — lietotājs Bernardo Santos via<br clear="none">grass-user (<<a shape="rect" ymailto="mailto:grass-user@lists.osgeo.org" href="mailto:grass-user@lists.osgeo.org">grass-user@lists.osgeo.org</a>>) rakstīja:<div class="yqt7498511575" id="yqtfd12358"><br clear="none">><br clear="none">> Dear all,<br clear="none">><br clear="none">> 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?<br clear="none">><br clear="none">> My inputs are rasterized versions of points, lines, or polygon features.<br clear="none">><br clear="none">> If it is better, I can bring a reprex here to discuss it more deeply.<br clear="none">><br clear="none">> Best regards,<br clear="none">> Bernardo Niebuhr<br clear="none">> _______________________________________________<br clear="none">> grass-user mailing list<br clear="none">> <a shape="rect" ymailto="mailto:grass-user@lists.osgeo.org" href="mailto:grass-user@lists.osgeo.org">grass-user@lists.osgeo.org</a><br clear="none">> <a shape="rect" href="https://lists.osgeo.org/mailman/listinfo/grass-user" target="_blank">https://lists.osgeo.org/mailman/listinfo/grass-user</a><br clear="none"></div></div></div>
</div>
</div></body></html>