Skip to main content

Hello FME community!

I am working on a project to identify traffic congestion within our mining operations. My data source includes GPS points of all vehicles and I have done the work to 'connect the dots' of all GPS points to create speed segments. As you can see in the image below, I now have traffic routes for each individual vehicle.

What I am trying to do now is create a "Median Line" for each side of the road, by determining the median value for the segments within a certain distance (i.e. 100m), just like the Traffic layer in Google Maps. My thoughts are to use a "Line Splitter" to split each segment into 100m parts, and then "Nearest Neighbor Aggregator", followed by a "List Exploder", then an aggregator to calculate the median.

Input:

 

Desired output:

Any suggestions here would be awesome!

Thank you!

Looks like an interesting project!

One alternative approach I can suggest is buffering all the lines, with such an amount that both directions on the same road result in overlapping buffers. Dissolve the buffers and generate centerlines for them and that should get you a reasonably accurate median line.

Looks like an interesting project!

One alternative approach I can suggest is buffering all the lines, with such an amount that both directions on the same road result in overlapping buffers. Dissolve the buffers and generate centerlines for them and that should get you a reasonably accurate median line.

Hello @redgeographics! Thank you for your response. I think that approach will definitely work for geometry; however, that leaves out the aggregation of speed. What I am seeking here is a median line of both the geometry and speed attribute. Cheers!


Hello @redgeographics! Thank you for your response. I think that approach will definitely work for geometry; however, that leaves out the aggregation of speed. What I am seeking here is a median line of both the geometry and speed attribute. Cheers!

The Dissolver does have the option to average attributes, so I think you may still be able to pull it off.


The Dissolver does have the option to average attributes, so I think you may still be able to pull it off.

Very true - I'll give this a shot. Thanks!


I think the biggest issue is going to be creating the median line, looking at your sample data. It looks like the distance between the two different directions in some cases is close to the same distance as between different paths travelling in the same direction so buffering could be problematic.

I suspect google already has a road network and then they assign the user data to the existing network, which makes things a bit simpler.


Success! Thanks to those that provided feedback on this post.

Input:

Output:

 

The process:

Part 1: Building the catchment buffers

  1. Buffer all input lines by X amount to ensure overlap
  2. Dissolve
  3. CentrelineReplacer to create the centreline of all buffers
  4. Generalizer to smooth the line out a bit
  5. Chopper to break the lines into individual segments
  6. LineDivider to split all lines into near equal 25 metre segments
  7. UUID generator to create a unique id for each 25 metre segment
  8. Square bufferer to cover traffic on both sides of road (I combined the entire road rather than worrying about lanes

     

Part 2:

  1. SpatialRelator to build spatial relationship between the catchment area buffers in part 1 to the traffic lines (yellow below)

     

  2. Tester to grab any "overlaps" greater than 0
  3. ListExploder to extract each record within the overlaps. Note: Each of my lines has a speed associated with it
  4. Statistics calculator to calculate the average speed with each catchment UUID
  5. FeatureJoiner to bring in the geometry from Part 1, number 7, and then join to the UUID average from the statistics calculator

 

I've tested the results and pretty happy. Workbench runs in about 20 seconds for 10,000 input speed records.

Workbench attached for anyone interested in reviewing and trying on their own data to help validate.Median_Line_SAFE_POST.fmw


Success! Thanks to those that provided feedback on this post.

Input:

Output:

 

The process:

Part 1: Building the catchment buffers

  1. Buffer all input lines by X amount to ensure overlap
  2. Dissolve
  3. CentrelineReplacer to create the centreline of all buffers
  4. Generalizer to smooth the line out a bit
  5. Chopper to break the lines into individual segments
  6. LineDivider to split all lines into near equal 25 metre segments
  7. UUID generator to create a unique id for each 25 metre segment
  8. Square bufferer to cover traffic on both sides of road (I combined the entire road rather than worrying about lanes

     

Part 2:

  1. SpatialRelator to build spatial relationship between the catchment area buffers in part 1 to the traffic lines (yellow below)

     

  2. Tester to grab any "overlaps" greater than 0
  3. ListExploder to extract each record within the overlaps. Note: Each of my lines has a speed associated with it
  4. Statistics calculator to calculate the average speed with each catchment UUID
  5. FeatureJoiner to bring in the geometry from Part 1, number 7, and then join to the UUID average from the statistics calculator

 

I've tested the results and pretty happy. Workbench runs in about 20 seconds for 10,000 input speed records.

Workbench attached for anyone interested in reviewing and trying on their own data to help validate.Median_Line_SAFE_POST.fmw

Nice work!


Reply