Skip to main content
Solved

Can I replace the start and end points of a line with other point xy's, from a point data layer? The ID of each start and end point are individual attributes in the line layer, which correspond to the appropriate ID of the point in the points data.


Forum|alt.badge.img

Best answer by jdh

The VertexCreator has a mode Replace Point at Index which should do want you want.

 

The start index is 0, then end index is -1.
View original
Did this help you find an answer to your question?

10 replies

erik_jan
Contributor
Forum|alt.badge.img+18
  • Contributor
  • April 28, 2017

I believe the CoordinateReplacer transformer can do just that.


takashi
Influencer
  • April 28, 2017

Hi @amandab, I don't think there is a transformer to do that at once, but you can use the CoordinateRemover to remove a vertex from a line and the VertexCreator to add a vertex at the end of a line. So, assuming that attributes storing coordinates of new start and end nodes have been merged to the line features already, this procedure may be a possible way.

  1. CoordinateRemover: Remove the last vertex.
  2. VertexCreator (Mode: Add Point): Add the new end node.
  3. Orientor: Reverse the orientation.
  4. CoordinateRemover_2: Remove the last vertex.
  5. VertexCreator_2: Add the new start node.
  6. Orientor_2: Reverse (Restore) the orientation.

itay
Supporter
Forum|alt.badge.img+17
  • Supporter
  • April 28, 2017

Hi @amandab,

In case you are working with a database format and the line ID and new XY are identical, you can create new lines from the points and update the existing geometry in the database with the help of the common ID.


jdh
Contributor
Forum|alt.badge.img+28
  • Contributor
  • April 28, 2017
erik_jan wrote:

I believe the CoordinateReplacer transformer can do just that.

Not quite. The CoordinateReplacer transformer searches for all instances of a coordinate value, and replaces them, axis independent. So if I enter 0 for my x and y values to replace with -1, then all the 0's will be replaced, not just 0,0. ex. 0, 10 -> -1, 10.

 

 


jdh
Contributor
Forum|alt.badge.img+28
  • Contributor
  • Best Answer
  • April 28, 2017

The VertexCreator has a mode Replace Point at Index which should do want you want.

 

The start index is 0, then end index is -1.

jdh
Contributor
Forum|alt.badge.img+28
  • Contributor
  • April 28, 2017
jdh wrote:

The VertexCreator has a mode Replace Point at Index which should do want you want.

 

The start index is 0, then end index is -1.
Note that you will have to extract the coordinates of the points to attributes and merge them onto the line layer using the ID.

takashi
Influencer
  • April 28, 2017
jdh wrote:

The VertexCreator has a mode Replace Point at Index which should do want you want.

 

The start index is 0, then end index is -1.
I forgot the option. It's the best way, I think.

 

 


Forum|alt.badge.img
  • Author
  • April 28, 2017

Thanks everyone, those are quite a few options to try, that's great. This was my first post, I'm pleasantly surprised at the quick response!


Forum|alt.badge.img
  • Author
  • April 28, 2017

Ok, looks like this worked:

Extracted the coordinates for the points (specify coordinate), and the lines (All Coordinates), featuremerged them together (using both merged and unmerged in case some lines were missing a start or end matching point) and created new attributes to make sure the xy for the start points and end points were in individual fields. Then used VertexCreator to create a new start point (replace point at index, for index = 0), and used VertexCreator to create a new end point (replace point at index, for index = -1). That really seems to have done the trick.

Thanks again everyone!


Forum|alt.badge.img
  • Author
  • April 28, 2017
itay wrote:

Hi @amandab,

In case you are working with a database format and the line ID and new XY are identical, you can create new lines from the points and update the existing geometry in the database with the help of the common ID.

No, not directly from a database. Using MapInfo files, actually. Good to know, though, as I sometimes do work with database format.

 

 


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