Skip to main content
Question

How can multipoints read from FME in the writer plugin


pehrs
Contributor
Forum|alt.badge.img+2
  • Contributor

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

david_r
Celebrity
  • February 3, 2023

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.


pehrs
Contributor
Forum|alt.badge.img+2
  • Author
  • Contributor
  • February 3, 2023

Thank you very much.

It worked.


Reply


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