Skip to main content
Question

Extract polygons from a tiff/jpg raster


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

redgeographics
Celebrity
Forum|alt.badge.img+50

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.


david_r
Celebrity
  • June 28, 2018

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


fme-phile
Forum|alt.badge.img+1
  • September 14, 2019

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


gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • September 18, 2019

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.

 

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings