3

I don't want to alter the geometry, just change the geometry type from Polygon to Multipolygon, in order to comply with a constraint.

2 Answers 2

3

You can use Aggregatortransformer.

Be careful what mode you choose. To illustrate, I have 5 polygons in entry. If I choose :

  • Geometry - Assemble One Level : The result is one feature (merging of the 5).
  • Geometry - Assemble Hierarchy : The result is five features. I specify the mergefield (here FID), I have 5 unique values so I will keep the 5 geometries.

enter image description here

2

I agree that the Aggregator is the way to go here, but I don't agree about using the Hierarchy mode. That mode is really only where you want to create, well, a hierarchy of geometries, with a parent containing several children.

What the OP wants here (I believe) is just to tag an individual polygon as a multi-polygon. To do that I would use the Assemble One Level mode, but set the ID as a Group By:

enter image description here

This makes each park in my dataset a multi-polygon feature with a single part:

enter image description here

However, there are a couple of things to be aware of.

Firstly, notice that the Aggregate Type parameter has two options. If you go for a Homogeneous Collection then you'll get an FME IFMEMultiArea geometry as above.

However, if you go with a Heterogeneous Collection, then you'll get an IFMEAggregate geometry, like so:

enter image description here

This is obviously slightly different. Which you should set depends on exactly what you're looking for and what your data format will support; and that brings me to the second point to be aware of...

Forming the geometry like this inside FME is entirely different to what may (or may not) get written to the output format. Without knowing the output format I can't say for sure that it allows either of these geometry types. It may not allow multi-polygon geometry or it may not allow a multi-polygon to have just one part.

In this case, since you have the requirement for multi-polygon features, then your format presumably supports it. You might just need to experiment between the Homogeneous and Heterogeneous types to see which gives the best result in the output, but it should be OK.

But other users reading this (should there be any) need to ensure their format supports this type of geometry.

1
  • 1
    You are awesome Mark, that's what I wanted to do, and it worked perfectly !! Thanks a lot.
    – Eliasse
    Apr 6, 2020 at 9:11

Your Answer

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

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