Question

Extract polygons from a tiff/jpg raster

  • 28 June 2018
  • 4 replies
  • 17 views

Hello,

I want to extract polygons from a raster by using "RasterToPolygonCoercer" but the result doesn't look very promising and I am lost for ideas.

I would be happy for any hint to solve my problem.

Thanks :)

Input:

...and output:


4 replies

Userlevel 4
Badge +25

The polygons that come out of the RasterToPolygonCoercer should have their RGB values as attributes. If you for example dissolve them (using a Dissolver) using those attributes to group by you're a step closer to getting vector data out of it. Keep in mind that it very much depends on the quality of the input raster.

Userlevel 4

You could also look into the RasterToPolygonCoercer.

However, based on your screen capture I'm guessing it's not going to be an easy task. You may need to simplify the raster quite a lot first to get rid of labels, sub-pixel details (anti-aliasing) etc. Perhaps the RasterExpressionEvaluator could be helpful for this, see https://knowledge.safe.com/articles/1226/using-conditions-with-the-rasterexpressionevaluato.html

Badge +1

I had a play and achieved the following result using the 'BW_Raster_Extraction' custom transformer that I uploaded onto the FMEHUB. I did however add a few extra transformers and used random colours for the final output:

FME Workspace

Badge +3

Bitmaptracing a raster with way too many colors is neigh impossible or at least very hard. (maybe something for machine learning)

 

Done that a lot in inscape (uses potrace) and illustrator.

You should try to pre-process the image, reduce the number of colors down to observable number of features, well ideally.

Hard to reduce colors created by anti-aliasing for instance.

The posted pic does not stand a chance, is very small of course.

Here is inkscape using potrace, traced according to luminosity values. (creates lots of objects,which requires cleaning)

You could fiddle with python using PIL and autotrace or potrace libraries.

Gives you more control. But pre-processing is still required.

 

 

Reply