DocGisItemsRte - Maproom/qmapshack GitHub Wiki

Prev (Track filters) | Home | Manual | Index | (Routing in QMapShack) Next


Table of contents


Routes and routing

Introduction

A route is used to plan a trip. It consists of

  • an ordered list of waypoints (routing points) through which the user wants to pass,
  • a strategy how to move from one routing point to the next one.

When selecting a routing strategy, the user has to decide about features like

  • used routing engine (no routing, online or offline routing, routing algorithm),
  • used road network (used map),
  • preferred or avoided road types (motorways, toll roads, unpaved roads, ...),
  • used transportation type (foot, bicycle, car, ...),
  • fastest or shortest route etc.

Having the routing points and having selected the routing strategy (a routing engine) the route can be constructed (calculated) by the routing algorithm. After a change of the routing strategy, the route can be recalculated. The last possibility distinguishes routes from planned tracks in QMS.

The dependence of a route on the routing data and also on the routing engine makes the transfer of a route to a GPS device or to another software that handles GIS data difficult. For instance, when saving a route to a GPX file or a GPS device, only the routing points and not the results of the routing algorithm (route instructions, roads to follow, etc.) are saved or transferred. The GPS device or the other GIS software do have, in general, a different routing algorithm and different routing data taken from some map. Thus, the paths in the GPS device joining the routing points will be different from the ones used when creating the route.

The user of a route must always pay attention to this fact. He must remember that reconstruction of the original route from the list of routing points alone is not possible. He has to decide when to use a route and when to use a track for data transfer to a GPS device. Some more discussion about the relation between routes and tracks can be found here.

Tracks consist of an ordered list of waypoints (trackpoints). In addition to position, elevation and timestamp trackpoints may contain also other information (e.g. various fitness data, if track has been recorded by a fitness device). Thus, a track is a standalone geospatial data object, which does not require additional information like a routing engine when using it.

Typically, a track, especially a recorded one, contains much more points (factor 10 ... 100) than a route. That implies, that it is easier to make changes to a route than to a track when planning a tour. After the final edit step, the route can easily be converted into a track in QMS.

QMS offers tools to create and edit both routes and tracks.

Create route

After the installation and the setup of routers for automatic routing, 2 different approaches are offered for route creation:

  • Create route from a list of routing points (waypoints). This approach is supported by the BRouter, Routino and MapQuest routers.
  • Define routing points one after the other in a map window. This approach is supported by all routing engines.

Select autorouting

Autorouting is the default routing in QMS.

To check if autorouting is active or to activate it proceed as follows:

  1. Right-click in a map view and select Add route from context menu.
  2. If the A icon in the toolbar is pressed, then autorouting is active. If not, press A to activate autorouting.
  3. Press twice Esc to leave the edit mode again.

Use list of routing points

  1. Prepare all routing points required for the route. Ensure that all routing points are located within 1 project in the Workspace docked window.
  2. Ensure that the Routing docked window is open (if necessary, open it with the main menu entry Window - Routing).
  3. Select one of the routers in the listbox on the top of the Routing window.
  4. Select the wanted routing strategy using the offered choices (each router has its own choices!).
  5. Go to the Workspace docked window and select all routing points required for the route.
  6. Right-click on one of the selected waypoints to open the context menu and select Create route.
  7. If necessary, re-order the routing points in the next window.
  8. When closing this window, a new route is constructed. Give the route a name and assign it to a project.
  9. Go to the newly created route object in the workspace, open the context menu with a right-click, and select Calculate route (this step is not necessary if the route has been calculated on the fly!).
  10. To see the new route in a map window double-click on the route name in the workspace window. The map will be zoomed so that the complete route is visible.

Use map window

(see also the section "Create new multi-point objects")

  1. Open a map view and zoom it to the region in which the new route should be located.
  2. Case Autorouting:
    1. Ensure that the Routing window is open (if necessary, open it with the main menu entry Window - Routing).
    2. Select one of the routers in the listbox on the top of the Routing window.
    3. Select the wanted routing strategy using the offered choices (each router has its own choices!).
  3. Move the mouse pointer to the first waypoint of the route in the map view.
  4. Right-click the mouse and select Add route from the context menu that pops-up. A toolbox appears on the top of the map view.
  5. Press A (autorouting), O (off-road routing), or V (vector routing) to select a routing method (described in detail here).
  6. Move the mouse pointer to the next routing point in the map view and left-click the mouse. After a short moment, the path connecting the previous with the current waypoint is shown (maybe in form of a straight line). Remark: The first waypoint is shown with a yellow border, the last one with a green border. Waypoints between the first and the last one are shown as big black rectangles. A change of the routing method during the route creation procedure is allowed. The newly selected method will be applied to all further waypoints.
  7. Repeat the previous step up to the end of the route.
  8. After reaching the last waypoint of the route right-click the mouse. This stops the creation of new routing points.
  9. Select Save as new in the toolbar on the top of the map window, assign a name and a project to the new route.

While creating a route bubble boxes provide additional information about the meaning of an option or possible next steps.

If an online router is used, then the selected routing points are first connected by straight lines. After saving the new route (more precisely: the list of its routing points), left-click on the route in the map window. In the toolbox shown select Calculate route (wheel icon). After a short time interval, the online router returns its result and the final route is shown in the map window. The same procedure should be used if the on-the-fly option for the BRouter (offline) is not selected.

Remark: The router may fail for various reasons to find a route between 2 adjacent routing points. In the case of BRouter an infobox informs about such an event:

BRouter fails to route

Routino informs similarly:

Routino fails to route

Here, the router had to find a bicycle route to a junction where bicycle traffic is not allowed. Thus, routing to this routing point is not possible.

Use track-to-route conversion

Feature available starting with QMS dev version commit 4b9b71f0 (May 28 09:38:23 2021 +0200)!

A route can be created from an existing track as follows:

  1. Click the context menu entry Convert to route of the track or click the route icon route icon in the track actions toolbar if the track is selected in a map window.

  2. A small window pops up where some options can be selected or set:

    • The name of the project for the new route (click the icon in the upper right corner of the window and proceed as described in section "Line edit mode").

    • The name of the new route (use edit field)

    • The handling of track subpoints (subpoints are trackpoints added to the track by a routing engine and not defined by the user). If this option is not selected only trackpoints defined by the user (typically a relatively small number of points) are used as routing points. Otherwise, all trackpoints are used as routing points.

      Track-to-route conversion options

  3. Press the Ok button to close the options window and convert the track to a route.

The following images illustrate these steps:

. .
Track to be converted to a route 4 user-defined trackpoints, many subpoints
Track to route Track to route
blue: new route with 4 routing points new route after routing (matches original track)
Track to route Track to route
new route if all subpoints are routing points .
Track to route .

Remarks:

  • Instead of converting a whole track to a route, it is possible to select a track range and convert this range to a route. To do this use the Convert selected trackpoints to route icon route icon from the track range toolbar.
  • The track-to-route conversion does not include routing itself, i.e. the routing points are connected by straight line segments. If required, the context menu entry Calculate route of the route can be used to start the selected routing algorithm.
  • Track subpoints are shown as small black squares if the track is in the edit mode.
  • Trackpoints defined by the user are shown as big black squares.
  • The conversion of a track to a route is a typical planning step. Avoid converting tracks recorded by a GPS device. These tracks don't have track subpoints. Conversion therefore can result in routes with a large number of routing points exceeding the capacity of a GPS device.
  • Be sure that user-defined trackpoints are precisely on a way segment (a road, path, ...). Otherwise, a later call to the routing engine may fail.

View & edit details

(compare also the section "Line edit mode")

To get a short on-screen-summary and a few toolbar options for handling a route

  • select the route with a left-click on the route name in the workspace or
  • left-click in a map window at a position without a GIS item to remove the selection of any data items and then
  • left-click on the route in a map window.

Short route info

The meaning of the toolbar options is shown in the following table:

Default icon Tooltip
EditDetails.png View details and edit.
Tag.png Set tags and rating.
Copy.png Copy route into another project.
DeleteOne.png Delete route from project.
RteInstr.png Show instructions and details.
Apply.png Calculate route.
Reset.png Reset route calculation.
LineMove.png Move route points.
Reverse.png Reverse Route
Track.png Convert route to track
NoGo.png Toggle Nogo-Line

When clicking the View details ... icon an additional window pops up that informs about some details of the route and that supports editing of some of them:

Route details

The underlined blue fields can be edited (click on the blue text to get an edit window).

Editing of routes is described in this section only for the case of autorouting. Other routing methods are described here.

An existing route in a project selected in the workspace can be modified and edited in various ways:

  • Change of the routing method/recalculation of route:

    1. Change router configuration in routing window.
    2. Right-click on the route in the workspace and select Calculate route from the context menu. The route will be recalculated using the newly selected router configuration.
  • Change location of route waypoints (repeats and extends the description of editing multi-point objects):

    1. Left-click on the route in a map view. This selects the route.

    2. Left-click on the route again to open a toolbox.

      Route toolbox

    3. Choose Move route points from the toolbox. Routing points are shown as big black squares.

    4. Waypoints shown with a big black square (routing points) can be moved with the mouse to a new location. When moving the mouse on such a waypoint, the color of the square is changed to red.

    5. Click on such a waypoint to fix it to the mouse. Move the point with the mouse to a new location.

    6. Left-click at the new location to fix the waypoint.

      Move routing point

    7. Repeat the previous 2 steps as long as necessary.

    8. When finished, click Save to original or Save as new from the toolbox at the top of the map window.

    9. If necessary, recalculate the route.

  • Add routing point:

    1. Open the toolbox and select Move route points as described in the previous point.

    2. Press CTRL-+ or click the Add new points icon in the toolbar to activate adding of new routing points.

      Add routing point

      The infobox below the toolbar gives some information about possible actions.

    3. Click on the route at a location where a new routing point should be added and move the mouse to the location of the new routing point.

      Add routing point

    4. Left-click to fix the new routing point.

    5. Repeat previous steps to add more routing points.

    6. When finished, click Save to original or Save as new from the toolbox at the top of the map window.

    7. If necessary, recalculate the route.

Get route instructions

If the route was constructed with the Routino or the MapQuest router, then route instructions are available. To get them, proceed as follows:

  1. Open some map view that can display the route under consideration.
  2. Double-click the route name in the workspace to see the route on the map.
  3. Right-click on the route name and select the context menu entry Route Instructions or left-click on the route in the map window and select Route instructions from the toolbar.
  4. Points on the route with instructions are shown in light-blue.
  5. Move the mouse pointer to a light-blue point.
  6. See the instructions for the given point in a bubble box.

Route instructions infobox

Save route in GPX file

Routes can be saved in GPX files (and in other formats, too). When checking the information in such a GPX file, it can be seen that only the ordered list of route waypoints is contained in the route part of the file. This fact needs some explanation.

When following a route, the user expects at all junctions (and only there) information about the necessary turn in the selected language (next direction, road number, distance to next junction, ...). No additional information is needed and therefore no additional information is shown between the 2 junctions.

In the following image, the selected waypoints are shown as red dots on the route. Blue dots on the route show junctions with routing information.

Route waypoints and junctions

Having the ordered list of route waypoints and the map data (more precisely the routing data of a map and also the routing engine and its settings) the route can easily be recalculated by the routing algorithm. This is the reason why when saving a route in form of a portable GPX file only the route waypoints are saved. In addition to this, the GPX data format does not support the type of information mentioned above for junctions.

When loading a route from a GPX file into QMS (or into another tool - the file format is portable!), the route has to be recalculated. An implication of this is that a transfer of a route in form of a GPX file from one soft- or hardware tool to another one can lead to a different route due to a different routing algorithm or different map (routing) data.

QMS can transform a route into a track. This track shows exactly the path to follow but doesn't include the above-mentioned routing information for junctions. This track can be stored together with the route (more precisely the route waypoints) in a GPX file. In this file, the route and the track are 2 independent objects!

Remark: Some software applications saving a route together with this track in a proprietary non-portable format that links route and track data.

Other actions

Remarks on other toolbar actions:

  • When selecting Reset route ... from the context menu of a route or the action toolbar in a map window, then all paths between routing points are replaced by straight line segments (this means no routing at all or offline routing).
  • When selecting Calculate route from the context menu of a route or the action toolbar in a map window, then the selected routing engine for autorouting is restarted with the current configuration. Routing points are joined by road segments.
  • When selecting Convert to track from the context menu of a route or the action toolbar in a map window, then a track is created from the route. The route itself remains unchanged. This is quite a comfortable way to create a new track from a few given routing points.
  • For details about the Set tags and rating icon see here.
  • For details about the Toggle no-go area icon see here.

Optimize route

One of the most important applications of optimization is the so-called traveling salesman problem (TSP), in which a series of waypoints has to be visited starting from a given waypoint and ending at a given waypoint (in the original formulation of the problem start and end are the same points). The goal is to find an optimal, i.e. shortest route passing through all of the given waypoints.

QMS offers an approximation algorithm for solving this problem. To use this algorithm carry out the following steps:

  • Create a route from the start to the endpoint passing through all the other given waypoints. To do this
    • select all waypoints in the workspace,
    • right-click on a selected waypoint and click the menu entry Create route from the context menu,
    • press Ok in the next window and assign the new route to a project and give it a name.
  • Open the line edit mode for the route.
  • Press the Optimize button to run the optimization algorithm.
  • At the end of the optimization run you get an optimized version of the route. Keep in mind that the algorithm uses some stop criterion to avoid an extreme duration of the run. Thus, the new route is, in general, only suboptimal.
  • Save the optimized route.

Hints:

  • Keep in mind the mathematical difficulty of this optimization problem. If a large number of waypoints is given, computation time can be considerable!
  • A progress bar is shown for longer optimization runs which allows cancelling the run.

Here is an example of route optimization:

  • Given are randomly located waypoints on the Berlin A10 motorway ring road, the red ones are the start and the endpoints of the route:

    A10 waypoints

  • Initial route through all waypoints in the given order without using a routing engine demonstrates the random order of the waypoints:

    A10 straight line route

  • Initial route through all waypoints in the given order using the Routino router with profile Goods and mode Quickest results in a route with a length of 686 km, converting the route into a track and looking at the track profile or in the project roadbook one can see that different sections of the route are used repeatedly:

    A10 initial route

    Route profile:

    A10 initial route profile

  • Route with optimized order of waypoints found by the optimization algorithm results in a route with a length of 259 km:

    A10 optimized route


Prev (Track filters) | Home | Manual | Index | Top | (Routing in QMapShack) Next