Sample and Demos

Converting Vector data to Raster

Article Number: 000001570 - Last Modified: Jun 29, 2015

FME can be used to convert vector data (points, lines, areas) into raster data by overlaying the vectors onto a raster grid.

Example 1

The 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).

Workspace Screenshot

User-added image

Output Screenshots

User-added image User-added image
Above: an ImageRasterizer transformer was used to convert an Ordnance Survey vector dataset (left) into a GeoTIFF raster dataset (right).

Example 2

This 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:
  • contours
  • elevation points
  • streams
  • lakes
  • 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.

User-added image

In some cases, multiple ImageRasterizers may be used if different rasterization parameters are required. For example, anti-aliasing 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

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.

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.

This scenario shows how to prepare raster tiles from vector data for web mapping platforms.

Introduction into Minecraft world making with FME 2015

PDF format is a destination format designed for displaying 3D data in Adobe PDF files.