Compactness ratio

The compactness ratio is an indicator of polygon shape complexity. The compactness ratio is defined as the polygon area divided by its perimeter. Unlike some other shape parameters (e.g. shape complexity index), complexity ratio does not standardize to a simple Euclidean shape. Although widely used for landscape analysis, complexity ratio, like its inverse, the perimeter-area ratio, exhibits the undesirable property of polygon size dependence (Mcgarigal et al. 2002). That is, holding shape constant, an increase in polygon size will cause a change in the compactness ratio.

If a raster image is input, the user must specify the name of the output raster file, which will be raster layer containing the input features assigned the compactness ratio. The user may also optionally choose to output text data if a raster file is input. Raster-based perimeter estimation uses the accurate, anti-aliasing algorithm of Prashker (2009). Zero values in the input raster can be optionally treated as background values.

If a vector file (shapefile) is input, the output data will be displayed as a new field (COMPACT) in the database file (.dbf). There is no need to specify an output raster file when a vector is input or the other two optional parameters.

See Also:

Scripting:

The following is an example of a Python script that uses this tool:

wd = pluginHost.getWorkingDirectory()
inputFile = wd + "polygons.shp" # vector input
outputFile = "" # ignored for vector input
textOutput = "false" # also ignored
zerosAreBackground = "false" # also ignored
args = [inputFile, outputFile, textOutput, zerosAreBackground]
pluginHost.runPlugin("CompactnessRatio", args, False)

This is a Groovy script also using this tool:

def wd = pluginHost.getWorkingDirectory()
def inputFile = wd + "polygons.dep" // raster input
def outputFile = wd + "compactness.dep"
def textOutput = "true"
def zerosAreBackground = "true"
String[] args = [inputFile, outputFile, textOutput, zerosAreBackground]
pluginHost.runPlugin("CompactnessRatio", args, False)

Credits:

References: