Patch orientation

This tool calculates the orientation of polygon features based on a regression analysis. It is the direction component of the Linearity Index (i.e. r-squared value). Note that polygons are oriented-type data (e.g. N-S, E-W, NE-SW, NW-SE) and that this orientation is expressed as an angle between 0 and 180 degrees clockwise from north. This algorithm works very well at finding the orientation of streamlined features.

The tool works for either raster or vector input files. If a raster file is input, the grid should contain polygons with unique identifiers. Raster input files also require the name of the output raster file (where the patch orientation will be assigned to each feature in the input file) and the specified option of outputting text. If a vector shapefile is specified as the input file, the only required input is the name of the file. The patch orientation values calculated for each vector polygon feature will be placed in the accompanying database file (.dbf) as a new field (ORIENT). The resulting database file will be automatically displayed after the tool has completed.

For most polygons, the results will be based on reduced major axis (RMA) regression line, although ordinary least-squares (OLS) regression is used when a polygon is nearly vertically or horizontally aligned. Note that this provides a similar measure of polygon direction to that of the elongation direction (ELONG_DIR) output from the Elongation Ratio tool. Elongation, is however, based on the calculation of the Minimum Bounding Box long-axis rather than linear regression analysis.

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
args = [inputFile, outputFile, textOutput]
pluginHost.runPlugin("PatchOrientation", 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 + "output.dep"
def textOutput = "true"
String[] args = [inputFile, outputFile, textOutput]
pluginHost.runPlugin("PatchOrientation", args, False)

Credits: