Example 1The attached workspace shows an example use of the Rasterizer transformer. The Rasterizer has now been split into two transformers with slightly different functions, ImageRasterizer & NumericRasterizer
NB: For privacy/copyright reasons the source data isn't attached
In this example, an Ordnance Survey NTF vector dataset is turned into a GeoTIFF raster dataset. Available settings are the grid size of the raster and the background colour. In this case the grid is 1000 x 1000 so, for a 1000m square dataset, it gives a 1m resolution. The background colour is a medium grey. The original vector features were assigned a white colour (fme_color=1,1,1).
Above: an ImageRasterizer transformer was used to convert an Ordnance Survey vector dataset (left) into a GeoTIFF raster dataset (right).
Example 2This scenario shows how a DWG file with multiple layers can be transformed into a raster with the ImageRasterizer transformer.
The source DWG file consists of the following layers:
- elevation points
- tile boundary
Before rasterizing, the following steps are performed:
- Change existing colors in a certain coding system to more traditional for raster or paper maps
- Extract contour elevation for separating regular contours (every 10 metres) from index contours (every 50 metres)
- Extract elevation and then add and stroke labels for elevation points
- Replace elevation points with small circles for better visibility
- Split waterbodies into areas and outlines for setting different fill and outline colors
- Force everything to 2D so fme_color is used during rasterization
- Buffer and create a donut from the tile boundary to make the boundary thicker
- Set priority and sort features so contours are on top of hydrography etc
- Reproject from LL83 to UTM83-12 (just to show that it's also possible)
After that, the result is sent to the ImageRasterizer and then to a raster writer, in our case, GeoTIFF.
In some cases, multiple ImageRasterizers may be used if different rasterization parameters are required. For example, antialiacing is good for contours, but not very good for rectangular tile boundaries - it's the case where we should use two rasterizers for a contour file with a frame. When more than one ImageRasterizer is used, a RasterMosaicker is also required to bring all the rasters into one.
RasterizationOne.fmwt shows how to use one ImageRasterizer for multiple layers. It's well commented, use it as a main example. RasterizationMany.fmwt shows multiple ImageRasterizers and RasterMosaicker, which combines all the rasters together.
Suggested Similar Articles
The goal is to take data in 3 different formats (IDRISI, SHAPE and PNG), combine it, and write it all to one georeferenced PNG file.
There are several different ways in FME to convert from raster to vector. However, because the data models are so different, any such conversion is always an interpretation, so you have to think exactly how you want to interpret your raster before you can do this kind of conversion. For example, you could take an integer raster, interpret it as grey scale, and then look for lines that you want to interpret as vector lines. Or you could take the same raster, interpret it as elevation, and then generate a vector surface model TIN based on those elevation points. So you can get radically different results based on your interpretation. Perhaps you want to classify your integer raster. This is not that hard to do though it takes a few transformers and some processing. In fact, any vector / raster conversion is always process intensive.
Several examples of how the RasterInterpretationCoercer can help you optimize your raster data for display or further processing.
Overview of raster processing in FME.
The RasterCellCoercer vectorizes raster data by converting each cell into either a point feature or polygon feature.