Skip to main content
Question

Extract line segments between two points


Forum|alt.badge.img

Hi

I have a spreadsheet (see table below) with a start and end point coordinates for different road sections and I'm trying to extract the road segments between the start and end points from another dataset containing my road geometry. Unfortunately the start and end points do not always lie on the road so I would need to snap it to the closest road. The road directions (road ways) are stored as separate features in the dataset with a common road id.

Section IdStart LatStart LongEnd LatEnd LongA-33.938..., 151.151.-33.935...151.131...B-33.949...151.138..-33.931...151.154...C------------

E.g. For Section B, I want to extract the two segments in green from the underlying blue road. The eastbound (EB) and westbound (WB) road features have a common road id of 1.

I tried using two vertex creators, a point on line over layer, a topology builder and feature merger, but I haven't had too much success.

Any ideas on how this could be achieved?

12 replies

Forum|alt.badge.img
  • Author
  • January 21, 2016

@jeroenstiers I haven't been able to get the point on line overlayer to work correctly. I'm not sure what I'm missing.


takashi
Contributor
Forum|alt.badge.img+19
  • Contributor
  • January 21, 2016

If each line can be spatially related to just 2 points (start point and end point belonging to the same section), this data flow might work.


takashi
Contributor
Forum|alt.badge.img+19
  • Contributor
  • January 21, 2016
mkov wrote:

@jeroenstiers I haven't been able to get the point on line overlayer to work correctly. I'm not sure what I'm missing.

Because the PointOnLineOverlayer doesn't snap the end nodes of split lines to the input points, the output lines and points may not construct a network topology.


Forum|alt.badge.img+7

Hi mkov,

I found a method that works for 2 points and 1 road. So it should work for the road with ID 2 and also for one segment for the road with ID 1.

I tried this using created a sample. Can you try this method on your data to see if it works?

I am not entirely sure the 'select only 1 segment'-part is the most efficient one but it works :)

FME Inspector:

FME Workbench:


Forum|alt.badge.img+7
jeroenstiers wrote:

Hi mkov,

I found a method that works for 2 points and 1 road. So it should work for the road with ID 2 and also for one segment for the road with ID 1.

I tried this using created a sample. Can you try this method on your data to see if it works?

I am not entirely sure the 'select only 1 segment'-part is the most efficient one but it works :)

FME Inspector:

FME Workbench:

The segmentID used in the FeatureMerger is created in the Counter.


Forum|alt.badge.img+7
takashi wrote:

If each line can be spatially related to just 2 points (start point and end point belonging to the same section), this data flow might work.

I implemented this method to find out how it works but I cannot find out what should happen with the MeasureExtractor:2 in combination with the StatisticsCalculator since the attribute '_point_measure' is empty when testing with my testdata.

Could you confirm if the result of the MeasureExtractor:2 should be the following?

 

For every point, the _point_measure should be the location of this point on the line. By calculating the mean of these two values, you make sure the result is a value between those two locations. That is why you can use this information in the Tester. Is this correct?

takashi
Contributor
Forum|alt.badge.img+19
  • Contributor
  • January 21, 2016
takashi wrote:

If each line can be spatially related to just 2 points (start point and end point belonging to the same section), this data flow might work.

Completely different approach flashed. Assuming that each line can be split into three parts by a pair of two points representing a section, the middle part is the required one.

1. Once connect the three parts with the LineJoiner.

  • Group By: <line ID attribute>
  • Preserve Original Orientation: yes
  • List Name: _list
  • Preserve Lines as Path Segments: Yes

2. Split the resulting line (path) into three parts again, with the PathSplitter.

  • Segment Number Attribute: _segment_number
  • List Attribute: _list{}

The segment having 1 as "_segment_number" is the middle segment.


takashi
Contributor
Forum|alt.badge.img+19
  • Contributor
  • January 21, 2016
jeroenstiers wrote:

I implemented this method to find out how it works but I cannot find out what should happen with the MeasureExtractor:2 in combination with the StatisticsCalculator since the attribute '_point_measure' is empty when testing with my testdata.

Could you confirm if the result of the MeasureExtractor:2 should be the following?

 

For every point, the _point_measure should be the location of this point on the line. By calculating the mean of these two values, you make sure the result is a value between those two locations. That is why you can use this information in the Tester. Is this correct?

The ability to set measure to points of the PointOnLineOverlayer is relatively new (maybe FME 2015.1+?). Which version of FME are you using?.


Forum|alt.badge.img+7
takashi wrote:

The ability to set measure to points of the PointOnLineOverlayer is relatively new (maybe FME 2015.1+?). Which version of FME are you using?.

I was working in build 15250 and it didn't work. In build 15482 it does.

Thank you!


Forum|alt.badge.img
  • September 30, 2017
takashi wrote:

Because the PointOnLineOverlayer doesn't snap the end nodes of split lines to the input points, the output lines and points may not construct a network topology.

Many Thanks @takashi this method works for me doing a similar process to the original question. Best regards Steve

 

 


ldreyfuss
Contributor
Forum|alt.badge.img+2
  • Contributor
  • October 3, 2024

I know this is an old post at this point, but does anyone know how to do this when there are points between the two target points?  I have a set of pairs of points, each which has a unique identifier (not road segment, alas). Each pair is a start and end point that I want to overlay on our streets and extract all of the street segments between them.

But as you can see, there are other pairs of points between them. Does anyone know how to modify this workflow for the above?


geomancer
Evangelist
Forum|alt.badge.img+47
  • Evangelist
  • October 4, 2024

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