Converting from Vector to Raster
From Fmepedia
Created by: Dean Hintz
How can I translate a vector dataset into raster?
- Differences between vector and raster
- Destination:
- data representation
- data type
- coordinate system
The first thing to understand is that vector and raster are completely different spatial data models. Vector is composed of points , lines, and polygons, defined by x,y coordinates and raster is a grid composed of rows and columns of cells each with a specific cell value such as a number (Int32) or color. You cannot translate directly from a vector dataset, such as shape, to a raster dataset, such as USGS DEM. These are totally alien data representations. There is no automatic way of converting a vector line to pixel cells and cell values without making many assumptions about interpretation.
What you can do is use FME to transform the vector data in such a way that it can be reinterpreted as raster. So you can take the same source vector data and use a Rasterizer to make a color image or picture, or a RasterDEMgenerator to make a raster DEM from 3D vector features. This is a good example of 2 totally different reinterpretations of the same source into 2 different rasters. The Rasterizer can make the source polygons into groups of pixels with colors based on the z value, while the RasterDEMgenerator will use the polygon z values to interpolate an elevation model.
It is also important to understand that FME processes rasters very differently from vector. A vector feature is a single geometric object such as a point or line, whereas in raster FME considers a single feature to be an entire grid of data, such as an image or DEM. So sometimes an entire dataset is also one feature type and one feature, although this can change through processing, as one dataset in one format may become multiple feature types or features such as when a multi layer raster is separated out into its component bands, or 3 bands are combined to form an RGB color raster. When going form vector to raster, thousands of points or lines are often required to create a single DEM raster.
You also need to consider the limitations and requirements of the destination raster format. For example, consider USGS DEM. The RasterDEMGenerator produces Real64, but USGSDEM only accepts Int32 or less. We need to use a RasterInterpretationCoercer to convert the Real64 cell values to Int32. Also, if you want to write to USGS DEM, you need to choose a coordinate system with a datum such as NAD27, NAD83, WGS72, or WGS84, such as 'LL84-SECONDS'. You can use FME to reproject to this coordinate system. An alternative would be to choose a format that does not restrict coordinate system, such as GeoTIFF.
For a quick reference guide to transformers including raster and surface modeling I would highly recommend reviewing the online transformers guide available at: http://downloads.safe.com/fme/brochures/transformers.pdf
along with the Functions and Factories (Transformers), and Readers and Writers (Formats) guides.
I would also highly recommend reviewing:
* http://www.fmepedia.com/index.php/Rasterization_scenario * http://www.fmepedia.com/index.php/Category:Dmitris_Raster_Studio
