Question

I have a line and I want to figure out it's endpoints.

  • 20 November 2015
  • 9 replies
  • 160 views

Badge
I have different features that are segments of cable. Each one is different and the shape is always straight. My goal is to find both end points and then label one as start and one as end. My question is how do I get the points from a line.

9 replies

Badge +7
The easiest is probably the CoordinateExtractor - use 0 for the first vertex, and -1 for the last. If you want them as points, add a VertexCreator as well. You may have problems if the direction of digitising isn't standardised!

 

Badge
The easiest is probably the CoordinateExtractor - use 0 for the first vertex, and -1 for the last. If you want them as points, add a VertexCreator as well. You may have problems if the direction of digitising isn't standardised!

 

I see where to choose what X/Y coordinates to use for the point but this doesn't seem to add a attribute as the point with those coordinates. Am i missing something or doing something wrong. The reason I am doing this is I have a line segment and the database I am saving it to only has start and end point locations. So nothing for the actual segment. I did like you said used a extractor to get my start/end point x/y coordinates. Now I need to create a attribute that stores them as a coordinate (X:Y)

Userlevel 2
Badge +17

I see where to choose what X/Y coordinates to use for the point but this doesn't seem to add a attribute as the point with those coordinates. Am i missing something or doing something wrong. The reason I am doing this is I have a line segment and the database I am saving it to only has start and end point locations. So nothing for the actual segment. I did like you said used a extractor to get my start/end point x/y coordinates. Now I need to create a attribute that stores them as a coordinate (X:Y)

If you need to create a string like "(x:y)" from a pair of x and y, just use the AttributeCreator or the StringConcatenator.

Userlevel 4
Badge +13
If you wanted to get point features, the often-overlooked "Snipper" transformer can easily get the First and Last points of a line -- just set it to "Vertex" mode and use 0 for the indexes when you want to get the first point, and -1 when you want to get the last point. See attached workspace.

 

 

However, your comment after @rollo's answer makes me think you don't want geometry for your first and last points, but rather you want attributes. In that case the CoordinateExtractor is the way to go -- use two of them back to back to get the first / last points, be careful what you name them, then use an attribute creator potentially (or a StringConcatenator) to glue the values together if that is what you need done. CHeck out http://docs.safe.com/fme/html/FME_Transformers/FME_Transformers.htm#Transformers/stringconcatenator.htm for descriptions of how to get into the "string editor" to do this type of thing.

 

 

 

snipperfirstlast.fmw
Badge +2
@kouri1986

 

Is it addressed?
If you wanted to get point features, the often-overlooked "Snipper" transformer can easily get the First and Last points of a line -- just set it to "Vertex" mode and use 0 for the indexes when you want to get the first point, and -1 when you want to get the last point. See attached workspace.

 

 

However, your comment after @rollo's answer makes me think you don't want geometry for your first and last points, but rather you want attributes. In that case the CoordinateExtractor is the way to go -- use two of them back to back to get the first / last points, be careful what you name them, then use an attribute creator potentially (or a StringConcatenator) to glue the values together if that is what you need done. CHeck out http://docs.safe.com/fme/html/FME_Transformers/FME_Transformers.htm#Transformers/stringconcatenator.htm for descriptions of how to get into the "string editor" to do this type of thing.

 

 

 

snipperfirstlast.fmw
@DateAtSafe This is a start but how do I reference the endpoints to run a neighborfinder & add related info from the neighbor? I have a Linear_Structure & I need to get info from Point_Structure at each end vertex & then place them in corresponding field (i.e., Start_Pt_Struct_ID & End_Pt_Struct_ID?

 

 

Userlevel 3
Badge +17
@DateAtSafe This is a start but how do I reference the endpoints to run a neighborfinder & add related info from the neighbor? I have a Linear_Structure & I need to get info from Point_Structure at each end vertex & then place them in corresponding field (i.e., Start_Pt_Struct_ID & End_Pt_Struct_ID?

 

 

Hi @danpressler

 

I would recommend creating a new forum Q&A; post for greater visibility. You can link to this post and also provide more context regarding your workflow in the new post. Would you be able to do that?

 

If you wanted to get point features, the often-overlooked "Snipper" transformer can easily get the First and Last points of a line -- just set it to "Vertex" mode and use 0 for the indexes when you want to get the first point, and -1 when you want to get the last point. See attached workspace.

 

 

However, your comment after @rollo's answer makes me think you don't want geometry for your first and last points, but rather you want attributes. In that case the CoordinateExtractor is the way to go -- use two of them back to back to get the first / last points, be careful what you name them, then use an attribute creator potentially (or a StringConcatenator) to glue the values together if that is what you need done. CHeck out http://docs.safe.com/fme/html/FME_Transformers/FME_Transformers.htm#Transformers/stringconcatenator.htm for descriptions of how to get into the "string editor" to do this type of thing.

 

 

 

snipperfirstlast.fmw

I would like to download this WB, however, i don't seem to see attachments, where can i find it?

Badge +2

I would like to download this WB, however, i don't seem to see attachments, where can i find it?

@sabine​ I've attached an example workspace (FME 2020.2). It has three options you can use, depending on what output you need. Since this article was created someone has created a custom transformer on the FME HUB to do this (Extract_End_Points) which is probably what you need.

Reply