Skip to main content

I have buildings with very complicated roof structures which I need to extrude to the terrain level to create new models.

During the process I need to use the GeometryCoercer to convert them to fmepolygons. The process was unsuccessful as many surfaces were missing.

This error message was indicated..

GeometryCoercer: Cannot coerce from IFMETriangleFan to fme_polygon

How can I overcome this ?

Takashi, can you help me?

Hi @annachong, as far as I know, there is no transformer to transform a TriangleFan to Polygons by a single step. Probably you need to use a series of some transformers.

I found two possible ways.

Triangulator -> GeometryCoercer->GeometryPartExtractor

0684Q00000ArKS8QAN.png

GeometryExtractor -> GeometryReplacer -> AreaBuilder

0684Q00000ArKSDQA3.png

And a Python script.

# PythonCaller Script Example
# Transform a TriangleFan or a TriangleStrip to Polygons.
import fmeobjects
class FeatureProcessor(object):
    def input(self, feature):
        geom = feature.getGeometry()
        if isinstance(geom, fmeobjects.FMETriangleFan) \
            or isinstance(geom, fmeobjects.FMETriangleStrip):
            for i in range(geom.numParts()):
                polygon = geom.getAsFaceAt(i).getAsArea()
                feature.setGeometry(polygon)
                self.pyoutput(feature)
        else:
            self.pyoutput(feature)

Hope this helps.


Thank you, Takashi.

The second method works.

Now I have to solve a new problem at the end of my workspace


Reply