Skip to main content

Hi, I'm relatively new to FME and I was wondering if there was a common workbench for converting line features into polygon. Think of a dataset with the usual problems like this:

-None merged line features, which result in polygons like in the image on the right (compair red line on the left to yellow polygon on the right)

- None intersecting lines which result in no polygons at all

- self intersecting lines which result in "small" polygons

- Or identical line features which result in identical polygons

etc. etc.

Without knowing specifically which kind of errors one is to expect in their dataset, how can you clean it, in order for FME to transform the lines into polygons.

I've searched on here allready, and I've found the workbench mentioned in here

https://knowledge.safe.com/questions/3150/fail-to-convert-lines-to-polygons-correctly.html

and this data validation tutorial

https://knowledge.safe.com/articles/54515/data-qa-identifying-self-intersections-with-fme.html

However, my dataset is pretty large, and I don't want to run unneccesary steps. Are there transformers that I can omit? Or transformers that weren't mentioned in the links I posted?

Also does the order in which I transform the data matter? I realize areabuilder should probably be one of the last transformers used, but what about the rest?

I will probably be using both a gml file with line features and transform that in to a shapefile, and

a DGN file with polygon features, and transform that into a shapefile as well.

Just to summarize the transformers I think I will be using so far:

-Matcher

-Geometry Validator

- Geometry Filter

- Snapper

- Intersector

-Area builder

-Area calculator

Thanks in advance.

EDITED:

Test nummer 1 :-)

The Area Builder seems to reject my lines....

I've also tried adding a GeometryValidator before the AreaBuilder, but that also fails... When I stop at the intersector, it does intersect. so intersect does do something. It's only when I continue afterwards, that it fails.

I added two Matchers because I had a lot of initial identical line features which I just wanted to edit out before continuing (that's the first match).

Also I don't have the LineCombiner and the Line extender transformers, two transformers which I think I could use here. What could be the reason for this? I work with FME Professional Edition 2016.1

 

Also, look into the LineCloser transformer. In the first example of the red line, you would need to separate that feature out somehow. If there is any attribution that is common between the features you want to create an area from, you can separate those out using a TestFilter or AttributeFilter. That's going to be your first step.

One additional transformer to consider may be the SmartCleaner_2013 custom transformer on the FME Hub : https://hub.safe.com/transformers/smartcleaner_2013 . This transformer is a one stop shop for eliminating dangles/overshoots/gaps. I would consider testing this transformer on a subset of your data to see if this can achieve a few of your steps in one transformer.


 

Also, look into the LineCloser transformer. In the first example of the red line, you would need to separate that feature out somehow. If there is any attribution that is common between the features you want to create an area from, you can separate those out using a TestFilter or AttributeFilter. That's going to be your first step.
Wouldn't I need the LineCombiner (first) for that example? If I'm not mistaken, the linecloser does exactly what I posted in the example... But that's not what I want. I don't want a triangle polygon, I want a rectangle polygon.

 

 


I'm not sure how good the LineCloser is going to be. If your features are already defined by a single line that wraps around it (maybe with a small gap), then it would be fine. But I suspect that isn't the case (like that red line) so I wouldn't do that.

You can only really leave out a transformer/test if you know that your data is not going to have those problems. For example, if there are no undershoots then there's no need for a LineExtender/Snapper/Whatever. Otherwise you need most of them.

You're right, the order is important because one solution can cause other types of problems which you then need to solve.

I would try the following transformers, in this order:

Snapper: To try and connect points that are close but miss. I would use Segment snapping mode because I don't know if lines will be properly split (eg a line might go from one side of a row of buildings to another, instead of one per building).

LineExtender: Maybe optional, but this will extend all lines (just extend by a small amount) so that any undershoots are dealt with. I would make the extension slightly larger than the Snap tolerance (I think). It doesn't matter if it causes an overshoot because...

Intersector: This will cut off overshoots, and also chop lines that meet at a corner, if they aren't already.

I'd try that first and see what happens. Probably follow up with a check for duplicate points (also in that QA tutorial) because that could be a result of these processes.

Hope that helps. Sorry I have to run now - got a training class to go to! Good luck.


I'm not sure how good the LineCloser is going to be. If your features are already defined by a single line that wraps around it (maybe with a small gap), then it would be fine. But I suspect that isn't the case (like that red line) so I wouldn't do that.

You can only really leave out a transformer/test if you know that your data is not going to have those problems. For example, if there are no undershoots then there's no need for a LineExtender/Snapper/Whatever. Otherwise you need most of them.

You're right, the order is important because one solution can cause other types of problems which you then need to solve.

I would try the following transformers, in this order:

Snapper: To try and connect points that are close but miss. I would use Segment snapping mode because I don't know if lines will be properly split (eg a line might go from one side of a row of buildings to another, instead of one per building).

LineExtender: Maybe optional, but this will extend all lines (just extend by a small amount) so that any undershoots are dealt with. I would make the extension slightly larger than the Snap tolerance (I think). It doesn't matter if it causes an overshoot because...

Intersector: This will cut off overshoots, and also chop lines that meet at a corner, if they aren't already.

I'd try that first and see what happens. Probably follow up with a check for duplicate points (also in that QA tutorial) because that could be a result of these processes.

Hope that helps. Sorry I have to run now - got a training class to go to! Good luck.

 

Thank you, I will try this. I want to try the LineExtender, too.. But I see I don't have this transformer installed, eventhough I'm using FME profesional edition 2016.1. Do you have an idea why this is, and how can I obtain this?

 


 

Thank you, I will try this. I want to try the LineExtender, too.. But I see I don't have this transformer installed, eventhough I'm using FME profesional edition 2016.1. Do you have an idea why this is, and how can I obtain this?

 

 

Try the Extender.

 

Try the Extender.
Yes, at some point it must have been renamed from Extender to LineExtender.

 

 


Reply