Skip to main content
Solved

Matching two datasets and keeping the highest point?

  • September 1, 2023
  • 3 replies
  • 36 views

alfons
Contributor
Forum|alt.badge.img+7

Hello

 

I have several point data sets (different Excel files) that I would like to clean up. I would like to delete points with the same position (X,Y) and only keep the point with the highest height (Z).

I am currently deleting points with the same position with the Matcher Transformer. This works wonderfully. Now I have not yet found a way to say that the highest point at the location cannot be deleted. Is there a way in FME to influence the selection of the points to be deleted when cleaning different data sets? The height of the objects is available both as attributes and as 3D coordinates.

Thanks a lot

Best answer by nielsgerrits

One way to do this is to use the CoordinateExtractor to get the _x, _y and _z from each point. Then use a Sorter to sort on _z numeric descending. Then use a Sampler set to 1st N features, group by _x and _y. This will let only one of the points through, which will be the one with the highest _z value as the were sorted this way.

 

This will only work if the coordinates matches exactly. With the Matcher this can be fixed using the Vector Tolerance parameter. As an alternative, you can use the Matched outputport from the Matcher, sort on _z numeric descending. Then use a Sampler set to 1st N features, group by _match_id.

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.

3 replies

nielsgerrits
VIP
Forum|alt.badge.img+60
  • 2938 replies
  • Best Answer
  • September 1, 2023

One way to do this is to use the CoordinateExtractor to get the _x, _y and _z from each point. Then use a Sorter to sort on _z numeric descending. Then use a Sampler set to 1st N features, group by _x and _y. This will let only one of the points through, which will be the one with the highest _z value as the were sorted this way.

 

This will only work if the coordinates matches exactly. With the Matcher this can be fixed using the Vector Tolerance parameter. As an alternative, you can use the Matched outputport from the Matcher, sort on _z numeric descending. Then use a Sampler set to 1st N features, group by _match_id.


alfons
Contributor
Forum|alt.badge.img+7
  • Author
  • Contributor
  • 22 replies
  • September 1, 2023

Thanks a lot @nielsgerrits​ 

 

Both suggestions work perfectly. Especially the second suggestion was important in my case, because the coordinates differ slightly in parts. I can compensate for this with the tolerance function in the Matcher. Thanks a lot for the superfast help.


nielsgerrits
VIP
Forum|alt.badge.img+60
  • 2938 replies
  • September 1, 2023

Thanks a lot @nielsgerrits​ 

 

Both suggestions work perfectly. Especially the second suggestion was important in my case, because the coordinates differ slightly in parts. I can compensate for this with the tolerance function in the Matcher. Thanks a lot for the superfast help.

Cheers :)