Browse samples per component: Graph and Routing Engine
This sample shows how to integrate network functionality in GDF applications. GDF datasets can be read into the sample. During loading, the sample will convert the GDF data into a road network and preprocess the network. The network toolbar provides all functionality to compute shortest routes and traces on the road network. The info button shows details about all routes/traces which are computed.
First select a GDF file using the 'Open' button in the toolbar. After the data has been loaded, shortest routes can be computed and displayed. To compute a route:
This sample demonstrates how to use the LuciadLightspeed Graph & Routing Engine component. It contains a sample graph, representing a small road network, consisting of a set of nodes (junctions) and edges (roads) connecting the nodes. Some of the roads are directed (indicated by a black arrow), some turns are forbidden (indicated by a red corner). Each road has an associated maximum speed, indicated by its thickness.
The length of a route is defined by an ILcdEdgeValueFunction, which associates a value with each edge in the graph. This value can be based on a simple cartesian distance function, a function combining distance and maximum speed into a time-cost function, or other, user-defined functions.
You can display the complete sequence of edges and the total distance of a route via the 'Show routing information' button.
The sample also illustrates how to associates values with nodes, e.g. to incorporate the time to wait for a traffic light on a junction.
Heuristic distance functions, providing estimate distances between two nodes, can accelerate the routing process. They are not required for the routing algorithm to work, but, if one is used, the calculated distances should always be an underestimate of the real remaining distance, otherwise a correct result is not guaranteed.
The cost function and heuristic distance function to be used can be configured via the 'Network configuration' button.
Besides routing, tracing can also be performed, calculating all nodes that are reachable within a given distance.
Finally, the sample shows how to partition a graph and perform routing in partitioned graphs. A partition is calculated for the sample graph, and is visualized by the colors of the nodes. Partitioning can reduce the processor and memory usage significantly when routing.
Note that the size of this sample graph is too small to show the effect of heuristic distance functions and partitioning on routing performance.
Routes can be calculated by first selecting a start node and an end node, using the start/end node selection controller. Once start node and end node are selected, the route can be computed and visualized by pressing the 'Calculate the shortest route' button. Optionally, a start and/or end edge can also be selected, but they are only relevant when turn restrictions are activated. The start and end edge should always be connected to the start and end node, respectively.
This sample demonstrates how to perform cross country route planning with LuciadLightspeed. The sample shows a map with height data. The "Compute route" controller allows to select two points. After the second point has been selected, a route between the two selected points will be computed and shown.
The right panel allows to experiment with different distance functions, which will result in different solutions.
Heuristic distance functions, providing estimate distances between two nodes, can accelerate the routing process. They are not required for the routing algorithm to work, but, if one is used, the calculated distances should always be an underestimate of the real remaining distance, otherwise a correct result is not guaranteed. The right panel allows to enable or disable a simple distance function.
Note that, since the algorithm uses a raster approximation, the computed solution will be an approximation of the actual shortest route.
To compute a route, first enable the "Compute route" controller by pressing the "Compute route" button. After the controller has been enabled, select a start and end point on the map. After the second point has been selected, a route between the two selected points will be computed and shown.
This sample demonstrates how to analyze very large networks with LuciadLightspeed, using numeric graphs. The sample has an Open button which allows to load a numeric graph that was created with the network preprocessor sample. By default, the sample will load the USA roads dataset included in the release.
After the graph has been loaded, routes can be calculated by first selecting a start and end node via the start/end node selection controller, and then pressing the routing button. Only begin and end points of roads (polylines) can be selected as start/end node. Optionally, a start edge can also be selected to indicate from which direction the beginning of the route will be entered, and an end edge to indicate in which direction the route will be left. The start and end edge should always be connected to the start and end node, respectively. They are only relevant however when the graph contains turn restrictions.
The 'Destroy edge' button allows to mark edges as deleted. The application will take these changes into account during succeeding shortest route computations.
Note the sample has a scale range set on the layers, as the default sample dataset is too large to display at once on the map. Zoom in on the map to make the data visible.
First preprocess a SHP file using the samples.network.numeric.preprocessor sample. The generated Network configuration properties file can be loaded using the 'Open file' button. After the data has been loaded, shortest routes can be computed and displayed. To compute a route:
This is a command-line sample. Click More info for run instructions.
This command-line tool demonstrates how to convert SHP data to a numeric graph.
Run the sample using the shell script in the samples
folder:
network.numeric.preprocessor.bat source_directory destination_file
This sample is a command-line sample.
It requires two arguments: one specifying the data source dir and one specifying the
numeric graph destination file.
A sample dataset is provided in resources/Data/Shp/Usa/roads/
.
See the documentation of Preprocessor.java for more information on how the input data should be organized.
The properties file that is created by the preprocessor can be opened with the numeric network viewer sample.