FME – Raster to polygon

The last couple of weeks i have been working on a raster to vector conversion in FME, and thought it would be nice to share my experiences here at my blog. This might be the start to a FME special series here at the blog with short explanations of different topics within FME. To read this raster to vector special click the read more link below.

What i wanted to do was to create polygons representing each of the rastercells, and extract the value from the raster and copy this value to the attribute table of the polygon.

I started off importing the raster to my workspace. One could also do this as a batch operation, importing multiple rasters.
To convert the raster cell to polygon i used the the ‘RasterCellCoercer’. This transformer decomposes each of the raster features into individual points or polygons. However, the transformer does not extract the value, even when enabling the “preserve attributes” option.
To be able to extract the value from each of the raster cells into an attribute i used the transformer ‘ElevationExtractor’. This tool extracts the z-value from each of the raster cells into a defined attribute. The default is “_elevation”.
That is basically it. You can now add your output writer and add the user attribute you want to store the raster cell value from the “_elevation” attribute. Remember that your output feature must be equal to either the point or polygon option that you selected in the ‘RasterCellCoercer’.
If you have selected multiple rasters, you could write each out to its original filename using fanout by “fme_basename”.
Here is my workspace:

This entry was posted in FME Special, Tips and tagged , , . Bookmark the permalink.

Leave a Reply