Raster to Vector - Centerline Extraction. 2010 Edition

From fmepedia

Back in 2008, I made a centerline extraction demo.

I mention in that article, that the only way FME could convert raster to vector is through RasterToPointCoercer, which was later renamed to RasterCellCoercer due to updated functionality - now, it can change cells not only to points but also to polygons.

In 2010, we got a better tool that allows accomplishing the same task much more effective - I already published an article showing how RasterExtentsCoercer can be used for vectorization.

Now we don't have to deal with making points, transferring raster cell values, replacing points with polygons and dissolving them.

With the first step, we prepare our raster to vectorization using RasterExpressionEvaluator:

if((abs(A[0]-A[1]) <= 3 && abs(A[0]-A[2]) <= 3) || (abs(A[0]-A[1]) <= 4 &&(A[0]-A[2]) > 20), 0,255)

The expression above makes all roads black, and the rest sets to white, which becomes NODATA in the next transformer (RasterBandNodataSetter). After that we are ready to make vector from all the roads - this is the place where we need RasterExtentsCoercer.

As result, the big portion of the workspace made in FME 2008 becomes unnecessary (including four custom transformers) - on the picture below, it is shown as hatched red area:

We replaced all that with just three transformers:

But what is even more important, by doing this, we significantly improved performance:

FME 2008
 RasterToPointCoercer 
FME 2010
 RasterExtentsCoercer 
5 minutes 18.0 seconds7.9 seconds

On a bigger raster, this difference will be even more noticeable.

Downloads

The updated workspace
The source raster

Attached Files
filesizedate
Newin2010.png51.5 kB01/06/10
Obsoletein2010.png45.5 kB01/06/10
centerlineextractor2010.fmw87.9 kB01/06/10
raster2.png201.9 kB01/06/10
raster6.png78.0 kB01/06/10
User Comments Add a new comment