A Process is a way of packaging spatial algorithms. You can create a GeoScript Process by name and get access to all of the built in GeoTool's Processes:
def p = new Process("gs:Bounds")
Map results = p.execute(["features": layer])
Or you can create a new Process using a Groovy Closure:
Process p = new Process("convexhull",
"Create a convexhull around the features",
[features: geoscript.layer.Cursor],
[result: geoscript.layer.Cursor],
{ inputs ->
def geoms = new GeometryCollection(inputs.features.collect{f -> f.geom})
def output = new Layer()
output.add([geoms.convexHull])
[result: output]
}
)
Map results = p.execute(["features": layer])
| Type | Name and description |
|---|---|
org.geotools.process.Process |
processThe underlying GeoTools Process |
| Type Params | Return Type | Name and description |
|---|---|---|
|
static java.lang.Object |
convert(java.lang.Object source, java.lang.Class target)Convert the source Object to the target Class if possible. |
|
static java.lang.Class |
convertGeoScriptToGeoToolsClass(java.lang.Class geoScriptClass)Add the ability to dynamically create and register custom Processes |
|
static java.lang.Class |
convertGeoToolsToGeoScriptClass(java.lang.Class geoToolsClass)Convert a GeoTools Class to a correspondng GeoScript Class |
|
java.util.Map |
execute(java.util.Map params)Execute this Process with the given parameters |
|
java.lang.String |
getDescription()Get the description |
|
java.lang.String |
getName()Get the name |
|
java.util.Map |
getParameters()Get the Map of input parameters. |
|
static java.util.List |
getProcessNames()Get a List of the Process names |
|
java.util.Map |
getResults()Get the Map of output results. |
|
java.lang.String |
getTitle()Get the title |
|
java.lang.String |
getVersion()Get the version |
|
static void |
registerProcess(java.lang.String name, java.lang.String description, java.util.Map inputs, java.util.Map outputs, groovy.lang.Closure closure)Register a Process with the GeoScript ProcessFactory |
|
java.lang.String |
toString()The string representation |
| Methods inherited from class | Name |
|---|---|
class java.lang.Object |
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Create a Process by name. If the namespace is not given, "geoscript" is the default.
name - The name of the ProcessCreate a new Process with a Groovy Closure
name - The name of the Processdescription - The descriptioninputs - The input parametersoutputs - The output resultsclosure - The Groovy ClosureConvert the source Object to the target Class if possible. This is used to convert GeoScript and GeoTools objects back and forth
source - The source Objecttarget - The target ClassAdd the ability to dynamically create and register custom Processes
Convert a GeoTools Class to a correspondng GeoScript Class
geoToolsClass - The GeoTools ClassExecute this Process with the given parameters
params - The input parametersGet the description
Get the name
Get the Map of input parameters.
Get a List of the Process names
Get the Map of output results.
Get the title
Get the version
Register a Process with the GeoScript ProcessFactory
name - The name of the Processdescription - The descriptioninputs - The input parametersoutputs - The output resultsclosure - The Groovy ClosureThe string representation
Groovy Documentation