Centroid (raster)

This tool computes the centroid of raster polygons. The input raster should contain polygons with unique identifiers. The output raster grid will contain the nearest pixels corresponding to the centroid of the enclosing polygon. The user can optionally output the centroid locations to a text file.

See Also:

Scripting:

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

wd = pluginHost.getWorkingDirectory()
inputFile = wd + "input.dep"
outputFile = wd + "output.dep"
textOutput = "false"
args = [inputFile, outputFile, textOutput]
pluginHost.runPlugin("Centroid", args, False)

This is a Groovy script also using this tool:

def wd = pluginHost.getWorkingDirectory()
def inputFile = wd + "input.dep"
def outputFile = wd + "output.dep"
def textOutput = "true"
String[] args = [inputFile, outputFile, textOutput]
pluginHost.runPlugin("Centroid", args, false)

Credits: