This tool delineates the minimum bounding box (MBB) for a group of vectors. The MBB is the smallest box to completely enclose a feature. The algorithm works by rotating the feature, calculating the axis-aligned bounding box for each rotation, and finding the box with the smallest area. The minimum bounding boxes are output as polylines by default, but can optionally be output as vector polygons. The MBB is needed to compute several shape indices, such as the Elongation Ratio, Patch Orientation, and the Patch Orientation Vector Field. In addition, the MBB is related to the Layer Footprint, which is an axis-aligned bounding box, and the Minimum Convex Hull, which is the enclosing convex polygon of a feature.
The following is an example of a Python script that uses this tool:
wd = pluginHost.getWorkingDirectory()
inputFile = wd + "input.shp"
outputFile = wd + "output.shp"
outputPolygons = "true"
args = [inputFile, outputFile, outputPolygons]
pluginHost.runPlugin("MinimumBoundingBox", 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"
def outputPolygons = "false"
String[] args = [inputFile, outputFile, outputPolygons]
pluginHost.runPlugin("MinimumBoundingBox", args, false)