Skip to main content
Question

How to construct lines from one dataset of points and one dataset of pairs

  • March 3, 2019
  • 4 replies
  • 47 views

nicholas
Contributor
Forum|alt.badge.img+14

I have two tables.

One is a dataset of points, each point has a unique ID

The other is a (attribute only) dataset of pairs, each record refers to two points, via their unique ID

How do I construct a feature dataset of lines? Each line consisting of two points.

 

To re-phrase, how do I add line geometry to the dataset of pairs, using the appropriate points from the point dataset, based on the unique ID of the from and to points?

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.

4 replies

danilo_fme
Celebrity
Forum|alt.badge.img+51
  • Celebrity
  • 2077 replies
  • March 3, 2019

Hi @nicholas

I suggest you to use the transformer FeatureMerger - to find the relation between the two datasets by ID.

 

After the use the transformer LineBuilder.

Thanks,

Danilo

 


takashi
Celebrity
  • 7843 replies
  • March 4, 2019

A possibly way I can think of is:

  1. Merge the first point geometry to the features containing pair of IDs, with a FeatureMerger (Join On: ID of the first point, Feature Merge Type: Geometry).
  2. Extract coordinates (x, y) from the original point geometries with the CoordinateExtractor (Mode: Specify Coordinate, Coordinate Index: 0), and merge the (x, y) to the features output from the Merged port of the first FeatureMerger, with another FeatureMerger (Join On: ID of the second point, Feature Merge Type: Attributes Only).
  3. Use the VertexCreator (Mode: Add Point) to add the second point to the features output from the Merged port of the second FeatureMerger.

nicholas
Contributor
Forum|alt.badge.img+14
  • Author
  • Contributor
  • 116 replies
  • March 4, 2019

A possibly way I can think of is:

  1. Merge the first point geometry to the features containing pair of IDs, with a FeatureMerger (Join On: ID of the first point, Feature Merge Type: Geometry).
  2. Extract coordinates (x, y) from the original point geometries with the CoordinateExtractor (Mode: Specify Coordinate, Coordinate Index: 0), and merge the (x, y) to the features output from the Merged port of the first FeatureMerger, with another FeatureMerger (Join On: ID of the second point, Feature Merge Type: Attributes Only).
  3. Use the VertexCreator (Mode: Add Point) to add the second point to the features output from the Merged port of the second FeatureMerger.

I have done exactly that.

It works, but it seems not elegant.

I was hoping that there was a way to merge the geometries directly without converting the points from geometry to coordinate values and back to geometry again.


Forum|alt.badge.img+2
  • 1891 replies
  • March 8, 2019

@nicholas I think I would go with @takashi 's approach - it would be much clearer for others to understand the workflow - even if it does require extracting the coordinates. However, there is an obscure part of the FeatureMerger functionality that can build geometries: Geometry Merge Type: Build Lines From Points. I've never used this before so thought this might be an excuse to try that. Here is the result:

 

Here's the workspace (2018.1): createlinesfromnodes.fmwt