Package org.geotools.process.vector
Class VectorToRasterProcess
- Object
-
- VectorToRasterProcess
-
- All Implemented Interfaces:
VectorProcess
public class VectorToRasterProcess extends Object implements VectorProcess
A Process to rasterize vector features in an input FeatureCollection.A feature attribute is specified from which to extract the numeric values that will be written to the output grid coverage. At present only int or float values are written to the output grid coverage. If the attribute is of type Long it will be coerced to int values and a warning will be logged. Similarly if the attribute is of type Double it will be coerced to float and a warning logged.
- Since:
- 2.6
- Author:
- Steve Ansari, NOAA, Michael Bedward
-
-
Constructor Summary
Constructors Constructor Description VectorToRasterProcess()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description GridCoverage2D
execute(SimpleFeatureCollection features, Integer rasterWidth, Integer rasterHeight, String title, String attribute, Bounds bounds, ProgressListener progressListener)
static GridCoverage2D
process(SimpleFeatureCollection features, Object attribute, Dimension gridDim, Bounds bounds, String covName, ProgressListener monitor)
A static helper method that can be called directy to run the process.protected void
processFeature(SimpleFeature feature, Object attribute)
This method is called by execute(org.geotools.data.simple.SimpleFeatureCollection, java.lang.Integer, java.lang.Integer, java.lang.String, java.lang.String, org.geotools.api.geometry.Bounds, org.geotools.api.util.ProgressListener) to rasterize an individual feature.
-
-
-
Method Detail
-
process
public static GridCoverage2D process(SimpleFeatureCollection features, Object attribute, Dimension gridDim, Bounds bounds, String covName, ProgressListener monitor) throws VectorToRasterException
A static helper method that can be called directy to run the process.The process interface is useful for advertising functionality to dynamic applications, but for 'hands on' coding this method is much more convenient than working via the Process.execute(java.util.Map<java.lang.String, java.lang.Object>, org.geotools.api.util.ProgressListener).
- Parameters:
features
- the feature collection to be (wholly or partially) rasterizedattribute
- source of values for the output grid: either aString
for the name of a numeric feature property or anorg.geotools.api.filter.expression.Expression
that evaluates to a numeric valuegridDim
- size of the output rasterbounds
- bounds (world coordinates) of the output rastercovName
- a name for the output rastermonitor
- an optionalProgressListener
(may benull
- Returns:
- a new grid coverage
- Throws:
org.geotools.process.raster.VectorToRasterException
VectorToRasterException
-
execute
public GridCoverage2D execute(SimpleFeatureCollection features, Integer rasterWidth, Integer rasterHeight, String title, String attribute, Bounds bounds, ProgressListener progressListener)
-
processFeature
protected void processFeature(SimpleFeature feature, Object attribute) throws Exception
This method is called by execute(org.geotools.data.simple.SimpleFeatureCollection, java.lang.Integer, java.lang.Integer, java.lang.String, java.lang.String, org.geotools.api.geometry.Bounds, org.geotools.api.util.ProgressListener) to rasterize an individual feature.- Parameters:
feature
- the feature to be rasterized- Throws:
Exception
-
-