Question

How can I convert IFMETriangelFans to fme_polygons

  • 14 December 2017
  • 2 replies
  • 9 views

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?


2 replies

Userlevel 2
Badge +17

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