public class VectorToRasterProcess extends Object implements VectorProcess
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.
Constructor and Description |
---|
VectorToRasterProcess() |
Modifier and Type | Method and Description |
---|---|
GridCoverage2D |
execute(SimpleFeatureCollection features,
Integer rasterWidth,
Integer rasterHeight,
String title,
String attribute,
Envelope bounds,
ProgressListener progressListener) |
static GridCoverage2D |
process(SimpleFeatureCollection features,
Object attribute,
Dimension gridDim,
Envelope 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.opengis.geometry.Envelope, org.opengis.util.ProgressListener) to rasterize an individual feature.
|
public static GridCoverage2D process(SimpleFeatureCollection features, Object attribute, Dimension gridDim, Envelope bounds, String covName, ProgressListener monitor) throws VectorToRasterException
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.opengis.util.ProgressListener).
features
- the feature collection to be (wholly or partially) rasterizedattribute
- source of values for the output grid: either a String
for the name
of a numeric feature property or an org.opengis.filter.expression.Expression
that
evaluates to a numeric valuegridWidthInCells
- width (cell) of the output rastergridHeightInCells
- height (cell) of the output rasterbounds
- bounds (world coordinates) of the output rastercovName
- a name for the output rastermonitor
- an optional ProgressListener
(may be null
org.geotools.process.raster.VectorToRasterException
VectorToRasterException
public GridCoverage2D execute(SimpleFeatureCollection features, Integer rasterWidth, Integer rasterHeight, String title, String attribute, Envelope bounds, ProgressListener progressListener)
protected void processFeature(SimpleFeature feature, Object attribute) throws Exception
feature
- the feature to be rasterizedinput
- the intput parameters (ignored in this implementation)Exception
Copyright © 1996–2019 Geotools. All rights reserved.