[GRASS-dev] patch for v.nn.py

Moritz Lennert mlennert at club.worldonline.be
Sun Sep 15 13:42:42 PDT 2013

On 14/09/13 21:01, Michael Barton wrote:
> Moritz,
> This is a nice addition.

Actually, not that nice. I just reread one of the papers you give as 
reference [1] and it clearly states that the equation that you use for 
estimating the expected mean nearest neighbor distance "cannot be used 
for irregularly shaped study areas"...

> Thanks, I'm really swamped right now. Do you want to add it to the script and add your name to the authors?

I'll see what else I can find in the literature about how to calculate 
the expected mean distance to see if having the actual study area 
measures is really useful. If yes, I'll add the patch myself.

BTW, shouldn't the scripts v.nn.py and v.lda.py go into the addons svn ? 
If you agree then I can add them there, with or without my patch. I've 
also locally modified v.lda.py a bit to allow easier (to me at least) 
use of the results.


[1] http://www.geog.ucsb.edu/~dongmei/ppa/ppa.html

> Michael Barton
> School of Human Evolution&Social Change
> Center for Social Dynamics&  Complexity
> Arizona State University
> ...Sent from my iPad
> On Sep 14, 2013, at 9:11 AM, "Moritz Lennert"<mlennert at club.worldonline.be>  wrote:
>> Michael,
>> I've attached a patch to your very useful v.nn.py addon script. The patch provides the following:
>> - a change of option names from input1,2 to 'from' and 'to'
>> - the possibility to provide a vector map with polygons giving the contours of the study area for which to calculate the nearest neighbor coefficient - the script just gets the total of all areas and all perimeters in the given map
>> - the possibility to provide numerical values for area and perimeter
>> Even though some people argue that the absolute value of the coefficient does not mean much and that the exact size of the study area does not have an influence on the relative values of the coefficient, I think it is a plus to have the possibility to circumscribe the area. Especially since in its current state the module gets the area and perimenter from the current region and as this is a vector module most people won't even think about region settings. (Running the module in the default n=1 s=0 w=0 e=1 region gives very weird coefficient values.
>> Up to you to decide whether you want to add this into your script.
>> BTW: the script works perfectly in grass7 as well.
>> Moritz
>> <v.nn.py.diff>

More information about the grass-dev mailing list