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.


Badge

icon

Best answer by jdh 28 April 2017, 20:02

View original

10 replies

Userlevel 2
Badge +16

I believe the CoordinateReplacer transformer can do just that.

Userlevel 3
Badge +17

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.
Badge +16

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.

Badge +22

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.

 

 

Badge +22

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.
Badge +22

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.
Userlevel 3
Badge +17

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.

 

 

Badge

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!

Badge

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!

Badge

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.

 

 

Reply