Raster to Vector
Article Number: 000001228 - Last Modified: Dec 7, 2011
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.
Consider a raster where 10 represents river, and 11 represents water body. This is an easier problem then trying to convert shades of blue to water and shades of black to roads etc which isnt usually feasible.
The steps are as follows:
-
Downsample with a Resampler to a smaller raster / larger cell size if your input is too big (anything bigger than 1000 x 1000 will take some time to process)
-
Use a RasterCellValueReplacer to set all cells to 0 except the cell value for the theme you want to vectorize. So for rivers = 10, replace all values <=9 and >=11 with 0
-
Use a RasterBandNodataSetter or RasterPaletteNoDataSetter to set your no data value to 0
-
Use a RasterCellCoercer to convert all non-zero cells to polygons. Make sure you have the extract no data values set to 'No'
-
Dissolve the cell polygons together
-
Smooth with Generalizer
Some additional steps may be needed depending on the geometry / shape of the data. For example, a small 1/4 cell width buffer might help connect diagonal lines into continuous line like polygons, otherwise you may get many separate cell polygons almost touching at the corners. There are also tricks to try to convert polygons back to lines but you will have to play around with combinations of Generalizer settings, negative buffers etc to see what you can achieve. |
Suggested Similar Articles