Skip to main content

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.

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.


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.


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.


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.


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)

Reply