<div dir="ltr"><br><br>On Mon, May 28, 2018 at 6:16 PM, Moritz Lennert <<a href="mailto:mlennert@club.worldonline.be">mlennert@club.worldonline.be</a>> wrote:<br>><br>> Hi,<br>><br>> AFAIU kernel density calculations, one takes a number of points and redistributes this total number across the entire region using a specified kernel function as estimator as to the spatial pattern of this redistribution. The total sum should correspond to the total number of points in the input. Is this understanding correct ?<br>><br>> In v.kernel, this seems to be dependent on the resolution:<br>><br>> echo "4.5,4.5" | v.in.ascii in=- sep=comma out=testpoint<br>><br>> g.region n=9 s=0 w=0 e=9 res=1<br>> v.kernel in=testpoint out=testrast  radius=5 kernel=gaussian --o<br>> r.univar testrast<br>> [...]<br>> sum: 0.999544365566944<br>><br>><br>> but<br>> g.region n=9 s=0 w=0 e=9 res=2<br>> v.kernel in=testpoint out=testrast  radius=5 kernel=gaussian --o<br>> r.univar testrast<br>> [...]<br>> sum: 0.308567902849234<br>><br><div>> IMHO, the sum should always be close to 1, or ?</div><div><br></div><div>I think not, because the Gaussian kernel is a general Gaussian function with user-defined sigma = dmax / 4 [0]. The sum would be close to 1 only for a normal function (special case of the Gaussian function) with sigma determined from the observed distances. For the Gaussian kernel, the sum of the output raster should increase with higher resolution and constant sigma.</div><div><br></div><div>Markus M<br></div><div><br></div><div><br></div><div>[0] <a href="https://trac.osgeo.org/grass/browser/grass/trunk/vector/v.kernel/main.c#L434">https://trac.osgeo.org/grass/browser/grass/trunk/vector/v.kernel/main.c#L434</a><br></div>><br>> If we consider that the value per pixel is in points/squared map unit, i.e. in a meter-projection, points/m2, then we would have to multiply the output value, which can be done with the multiplier parameter. In this case, a resolution of 2, means we have 4m2, so:<br>><br>> v.kernel in=testpoint out=testrast  radius=5 kernel=gaussian multiplier=4 --o<br>> r.univar testrast<br>> [...]<br>> sum: 1.23427161139693<br>><br>> So this is close, but not very precise.<br>><br>> So, do I understand correctly that the density calculated is by squared map unit ? Would it make more sense to make the output by pixel ? If not, and so if the multiplier option is the way to go, this should probably go into the manual, which currently sounds as if this parameter is only for the network version of v.kernel:<br>><br>> "The multiplier option is needed to overcome the limitation that the resulting density in case of a vector map output is stored as category (integer). The density result stored as category may be multiplied by this number. "<br>><br>> Moritz<br>> _______________________________________________<br>> grass-dev mailing list<br>> <a href="mailto:grass-dev@lists.osgeo.org">grass-dev@lists.osgeo.org</a><br>> <a href="https://lists.osgeo.org/mailman/listinfo/grass-dev">https://lists.osgeo.org/mailman/listinfo/grass-dev</a><br><br></div>