**-a**- Set for 8 cell-neighbors. 4 cell-neighbors are default
**--overwrite**- Allow output files to overwrite existing files
**--help**- Print usage summary
**--verbose**- Verbose module output
**--quiet**- Quiet module output
**--ui**- Force launching GUI dialog

**input**=*name***[required]**- Name of input raster map
**costmap**=*string***[required]**- Name of existing raster file with path-cost information
**output**=*name***[required]**- Name for output raster map
**keyval**=*integer***[required]**- Key value
**method**=*string[,**string*,...]**[required]**- Operation to perform on fragments
- Options:
*distance, path_distance, area, perimeter, shapeindex* **number**=*num[-num][,**num[-num]*,...]**[required]**- Number of nearest neighbors to analyse
**statmethod**=*string***[required]**- Statistical method to perform on the values
- Options:
*average, variance, standard deviation, value, sum* **dmout**=*string*- Output name for distance matrix and id-map (performed if not empty)
**adj_matrix**=*string*- Output name for adjacency matrix (performed if not empty)
**title**=*"phrase"*- Title for resultant raster map

e.g. if a binary map(1 and 2) is used, the the path with the
lowest amount of "1" is chosen
The *number* is the amount of nearest neighbours to be taken and
the calculated distances are processed as assigned in *statmethod*
Operations which *r.pi.fnn* can perform are:

**Distance**- The
*Distance to Nearest*computes the nearest edge-to-edge distance between patches. Counting from the focus patch. **path Distance**- The
*Distance to Nearest*computes the nearest edge-to-edge distance between patches. Unlike*Distance*the distance is computed based on subsequent NN not from the focus patch onwards. The 1th NN is the first patch with the minimal edge-to-edge distance from the focus patch, while 2th NN is the patch with the minimal edge-to-edge distance from the 1th NN patch and so on. **Area**- The
*Area*computes the size of the nearest edge-to-edge distance patch. It is based on*Distance*not on*path Distance*. **Perimeter**- The
*Perimeter*computes the Perimeter of the nearest edge-to-edge distance patch. It is based on*Distance*not on*path Distance*. **SHAPE**- The
*SHAPE*computes the SHAPE Index of the nearest edge-to-edge distance patch. It is based on*Distance*not on*path Distance*.

**Average**- The
*Average*computes the average value defined in*Operations to perform*. **Variance**- The
*Variance*computes the variance defined in*Operations to perform*. **Stand. Dev.**- The
*Stand. Dev.*computes the stddev value defined in*Operations to perform*. **Value**- The
*patch Distance*computes the nearest edge-to-edge distance between two patches. The output of*value*is the actual value. E.g. NN==5 of*area*gives the size of the 5th NN while*Average*gives the average of the area of 1-5th NN.

Merging these options is possible as well: 1-5,8,9,13,15-19,22 etc.

r.mapcalc "cost_raster = if(landclass96==5,1,if(landclass96 == 1, 10, if (landclass96==3,2, if(landclass96==4,1,if(landclass96==6,100)))))" r.pi.fnn input=landclass96 keyval=5 costmap=cost_raster output=fnn1 method=distance number=10 statmethod=average

Scientific concept: Dr. Martin Wegmann

Department of Remote Sensing

Remote Sensing and Biodiversity Unit

University of Wuerzburg, Germany

Port to GRASS GIS 7: Markus Metz

Available at: r.pi.fnn source code (history)

Main index | Raster index | Topics index | Keywords index | Graphical index | Full index

© 2003-2020 GRASS Development Team, GRASS GIS 7.8.3dev Reference Manual