Skip to main content
Solved

Turning a mesh into a polygon

  • March 23, 2017
  • 5 replies
  • 440 views

redgeographics
Celebrity
Forum|alt.badge.img+59

Seemingly simple question: I have a KMZ file with mesh objects in its placemark folder, I need to get these written to a shapefile. Any ideas? I tried a GeometryCoercer, no luck.

Best answer by takashi

Hi @redgeographics, the data contains a feature which has a MultiSurface geometry consisting of two Mesh geometries. A possible way is:

  1. Deaggregator: MultiSurface -> individual Meshes
  2. GeometryCoercer (Geometry Type: fme_composite_surface): Meshes -> CompositeSurfaces
  3. GeometryPartExtractor: Extract polygon parts from the CompositeSurfaces, with this setting.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

5 replies

geosander
Forum|alt.badge.img+7
  • 327 replies
  • March 23, 2017

You could try a Triangulator. The Triangles port will give you individual triangle polygons. With a Dissolver (or if that gets too messy and you don't mind multipolygons, an Aggregator) you could glue the whole thing together.


takashi
Celebrity
  • 7843 replies
  • Best Answer
  • March 23, 2017

Hi @redgeographics, the data contains a feature which has a MultiSurface geometry consisting of two Mesh geometries. A possible way is:

  1. Deaggregator: MultiSurface -> individual Meshes
  2. GeometryCoercer (Geometry Type: fme_composite_surface): Meshes -> CompositeSurfaces
  3. GeometryPartExtractor: Extract polygon parts from the CompositeSurfaces, with this setting.


itay
Supporter
Forum|alt.badge.img+18
  • Supporter
  • 1442 replies
  • March 23, 2017

A some what less elegant but working alternative is:

  1. Deaggregator
  2. GeometryFilter (everything but NULL)
  3. Triangulator >Triangles
  4. Second Deaggregator
  5. GeometryCoercer >fme_polygon

     

and voila, you have polygons.


redgeographics
Celebrity
Forum|alt.badge.img+59
  • Author
  • Celebrity
  • 3700 replies
  • March 23, 2017

Thanks @takashi, that did the trick. The data does come out in a local coordinate system but the prj file checks out and my mapping software seems to be able to put it in its right place.


takashi
Celebrity
  • 7843 replies
  • March 23, 2017

Good to hear. Alternatively, a Deaggregator and a PythonCaller with this script could work more efficiently.

import fmeobjects
class MeshToPolygons(object):
    def input(self, feature):
        mesh = feature.getGeometry()
        if isinstance(mesh, fmeobjects.FMEMesh):
            vertices = mesh.getVertices()
            for part in mesh:
                indices = part.getVertexIndices()
                if indices:
                    boundary = fmeobjects.FMELine([vertices[i] for i in indices])
                    feature.setGeometry(fmeobjects.FMEPolygon(boundary))
                    self.pyoutput(feature)