org.geotools.process.raster
Class VectorToRasterProcess

java.lang.Object
  extended by org.geotools.process.impl.AbstractProcess
      extended by org.geotools.process.feature.AbstractFeatureCollectionProcess
          extended by org.geotools.process.raster.VectorToRasterProcess
All Implemented Interfaces:
Process

public class VectorToRasterProcess
extends AbstractFeatureCollectionProcess

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.

Author:
Steve Ansari, NOAA, Michael Bedward

Field Summary
 
Fields inherited from class org.geotools.process.impl.AbstractProcess
factory
 
Constructor Summary
VectorToRasterProcess(VectorToRasterFactory factory)
          Constructor
 
Method Summary
 java.util.Map<java.lang.String,java.lang.Object> execute(java.util.Map<java.lang.String,java.lang.Object> input, org.opengis.util.ProgressListener monitor)
          Retrieves the input parameters from the supplied Map, conducts some basic checking, and then carries out the vector to raster conversion.
static GridCoverage2D process(FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> features, java.lang.Object attribute, java.awt.Dimension gridDim, org.opengis.geometry.Envelope bounds, java.lang.String covName, org.opengis.util.ProgressListener monitor)
          A static helper method that can be called directy to run the process.
protected  void processFeature(org.opengis.feature.simple.SimpleFeature feature, java.util.Map<java.lang.String,java.lang.Object> input)
          This method is called by execute(java.util.Map, org.opengis.util.ProgressListener) to rasterize an individual feature.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VectorToRasterProcess

public VectorToRasterProcess(VectorToRasterFactory factory)
Constructor

Parameters:
factory -
Method Detail

process

public static GridCoverage2D process(FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> features,
                                     java.lang.Object attribute,
                                     java.awt.Dimension gridDim,
                                     org.opengis.geometry.Envelope bounds,
                                     java.lang.String covName,
                                     org.opengis.util.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, org.opengis.util.ProgressListener).

Parameters:
features - the feature collection to be (wholly or partially) rasterized
attribute - 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 value
gridWidthInCells - width (cell) of the output raster
gridHeightInCells - height (cell) of the output raster
bounds - bounds (world coordinates) of the output raster
covName - a name for the output raster
monitor - an optional ProgressListener (may be null
Returns:
a new grid coverage
Throws:
VectorToRasterException

execute

public java.util.Map<java.lang.String,java.lang.Object> execute(java.util.Map<java.lang.String,java.lang.Object> input,
                                                                org.opengis.util.ProgressListener monitor)
                                                         throws VectorToRasterException
Retrieves the input parameters from the supplied Map, conducts some basic checking, and then carries out the vector to raster conversion.

Parameters:
input - input parameters from those defined in VectorToRasterFactory
monitor - a ProgressListener object, or null if monitoring is not required
Returns:
a Map of result objects
Throws:
VectorToRasterException - if unable to rasterize the features as requested
See Also:
VectorToRasterFactory.getResultInfo(java.util.Map)

processFeature

protected void processFeature(org.opengis.feature.simple.SimpleFeature feature,
                              java.util.Map<java.lang.String,java.lang.Object> input)
                       throws java.lang.Exception
This method is called by execute(java.util.Map, org.opengis.util.ProgressListener) to rasterize an individual feature.

Specified by:
processFeature in class AbstractFeatureCollectionProcess
Parameters:
feature - the feature to be rasterized
input - the intput parameters (ignored in this implementation)
Throws:
java.lang.Exception


Copyright © 1996-2010 Geotools. All Rights Reserved.