Question

Calculate polygon length?

  • 8 October 2014
  • 3 replies
  • 10 views

Badge
Hello all,

 

 

I'm trying to calculate polygon length. I know it's a pretty complex thing to do, since I need to calculate the medial axis using a CenterLineReplacer, then a LengthCalculator to calculate the length.

 

 

The thing is, I've got some pretty complex geometry at times (donutholes, multiparts) but it doesn't seem to be the problem (Using Deaggregator and DonutHoleExtractor). FME takes pretty long on these, stating:

 

WARN  |CenterLineReplacer: Unable to prepare geometry for skeleton construction

 

WARN  |CenterLineReplacer: Failed to convert geometry on feature to a straight-skeleton representation.

 

 

After a while, it even halts the entire Workbench. 

 

 

Is there a better alternative to all this? I've got >8000 polygons, all very different in complexity, so I'm hoping to do this without having to filter out which geometry it halts on. I don't have a lot of Python experience, is it possible with a little bit of Python?

 

 

Thanks in advance!

3 replies

Badge +3
Try smoothing and simplifying the polygons. (this might need to be done couple of times in sequence)

 

(in my script i seem to only drop small hole donuts)

 

 

I did waterlength estimate this way, 6666 objects, 2.17 mins. Medial axis.
Badge
I'm afraid that won't help. I dropped all the donut holes, deaggregated all polygons, and ran it through a generalizer as well. It still freezes though. 

 

 

Total amount of polygons are ~30000 polygons.
Badge +3
I think the warnig are pretty normal.

 

Mine give these too.

 

U cannot be sure that every object in a dataset has the required range of properties for the Centerline replacer.

 

 

If it halts and dont output any errorlog its hard to find wich object(s) is/are the culprits.

 

 

I would try running sample sizes, feed it like 5000 at a time using maybe a workspacerunner.

 

 

Also i don't just generalize them.

 

I smooth them then simplify, smooth again simplify again. (for an entier city i found 2x is enough)

 

That's 4x a generalizer in a row.

 

Then run the centerline replacer.

 

 

Reply