Long axis

This tool can be used to map the long axis of a polygon feature. The long axis is the longer of the two primary axes of the minimum bounding box (MBB), i.e. the smallest box to completely enclose a feature. The long axis is drawn for each polygon in the input vector file such that it passes through the centre point of the MBB. The output file is therefor a vector of simple two-point polylines forming a vector field in a similar way to the Patch Orientation Vector Field.

See Also:

Scripting:

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

wd = pluginHost.getWorkingDirectory()
inputFile = wd + "input.shp"
outputFile = wd + "output.shp"
args = [inputFile, outputFile]
pluginHost.runPlugin("LongAxis", args, False)

This is a Groovy script also using this tool:

def wd = pluginHost.getWorkingDirectory()
def inputFile = wd + "input.shp"
def outputFile = wd + "output.shp"
String[] args = [inputFile, outputFile]
pluginHost.runPlugin("LongAxis", args, false)

Credits: