I'm currently trying to detect contour lines from a georeferenced raster image, which looks like this:

enter image description here

With the help of FME I could extract the lines very good. But they are divided at every section. For clarification I coloured some of them:

enter image description here

Now my question: Does anyone know a workaround for this? Or is there already a tracing algorithm, which combines the separated lines to individual lines.

  • Maybe GRASS v.net with tool connect and a threshold to connect gaps : grass.osgeo.org/grass82/manuals/v.net.html . It might work in some cases with a small gap, but can create aberrations if the threshold is too big, by connecting the wrong line. Feb 21, 2023 at 10:17
  • 1
    Do your vector contours have attributes like elevation?
    – Mapperz
    Feb 21, 2023 at 16:39
  • I'd probably try the Snapper transformer. If you can add elevation as an attribute, as @Mapperz suggested, then use that as a Group-By attribute to ensure contours of different elevation don't snap together. Feb 21, 2023 at 18:04
  • Unfortunately my detected lines have no elevation information.
    – mawagi
    Feb 22, 2023 at 7:16

1 Answer 1


Depending on the case, I would use the Snapper / Line extender with then a line combiner based on the featureType

enter image description here

The LineCombiner would be used to combine the same adjacent segments into "bigger" lines.

enter image description here

(Above sample extracted from FME Desktop LineCombiner Help)

Note: if you choose to use the extender, you may have to intersect the lines then remove the small bits of lines by using a length calculator and remove the small size lines with a tester.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.