Skip to main content
Solved

Turning a mesh into a polygon


redgeographics
Celebrity
Forum|alt.badge.img+58

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.

View original
Did this help you find an answer to your question?
This post is closed to further activity.
It may be a question with a best answer, an implemented idea, or just a post needing no comment.
If you have a follow-up or related question, 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
  • 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
  • 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
  • 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+58

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
  • 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)

Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings