Question

How can multipoints read from FME in the writer plugin

  • 3 February 2023
  • 2 replies
  • 4 views

We have an IFMEFeature from type FME_GEOM_AGGREGATE.

The window "Feature Information" in FME Desktop displays the IFMEMultipoint property with 299 parts of IFMEPoint.

How can we get these multipoints in the writer plugin?

 

If we call feature->numCoordinates() we got 598 but if we call numParts () or numVertices() we got the correct number of 299.

And if we call feature->getAllCoordinates() we got a list of 598 coordinates, but only 299 of these are correct and the other ones consists of a point with coordinates (1, 1, 0). Where does this point (1,1,0) come from?

The list of coordinates starts with

1,1,0

valid point

1,1,0

valid Point

1,1,0

....


2 replies

Userlevel 4

You can iterate over the aggregate programmatically. For example, using Python:

parts = feature.splitAggregate(recurse=True)
for part in parts:
    coord = part.getCoordinate(0)  # First coordinate of the part geometry
    x, y = coord[:2]  # Get first two elements
    print('Coordinate at x = {}, y = {}'.format(x, y))

Documentation: https://docs.safe.com/fme/html/fmepython/api/fmeobjects/_feature/fmeobjects.FMEFeature.splitAggregate.html

Refer to the relevant documentation if you're not using Python.

Thank you very much.

It worked.

Reply