ShortestPathFinder

From fmepedia

ShortestPathFinder is a Workbench Transformer.


Table of contents



Description

The ShortestPathFinder finds the shortest path from a source node to a destination node - including the ability to apply a weighting by length or by attribute (PR#19448)


The start/end point can either match a coordinate on the network, or be snapped to the nearest network node using a tolerance parameter.



Example

The attached workspace shows an example use of the ShortestPathFinder transformer.


Scenario

Here is a road network for the city of Interopolis. We have a defined start and end point and wish to find the shortest path from one to the other.

The source data is the RoadLine.mif/mid dataset found in the FME Sample Dataset (http://www.safe.com/support/onlinelearning/fmesampledata.php).


Workspace Screenshots


Above The source data is added and the start/end points defined using Creator transformers.


Output


Above The output is to the Visualizer - the road network as a base, plus the route defined by the transformer


Enhancements

This example could be enhanced fairly easily with any of the following:

  • If the road dataset contains info on speed limits then you could use some parameters like below to take speed into account when defining routes.
  • The user could define their own coordinates....
    • It would be fairly straightforward to have the user enter the coordinates with a parameter, rather than defining them with Creators.
    • It would be a little more complex to have the user enter addresses, geocode them with a web service, and use those coordinates.
    • It would be harder (though not impossible) to allow the user to select the start and end point on a graphic map display.


Above Weighting the route by road speed limits. Since this screenshot extra settings have been added for snapping the start and end points.

Attached Files
filesizedate
ShortestPathFinderExample.zip8.3 kB10/13/09
spf1.png26.9 kB10/13/09
spf2.png53.0 kB10/13/09
spf3.png26.6 kB10/13/09
User Comments Add a new comment