Skip to main content
Question

Extract polygons from a tiff/jpg raster

  • June 28, 2018
  • 4 replies
  • 249 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:

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

4 replies

redgeographics
Celebrity
Forum|alt.badge.img+60
  • Celebrity
  • 3701 replies
  • June 28, 2018

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
  • 8394 replies
  • 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
  • 18 replies
  • 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
  • 2252 replies
  • 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.