Skip to content
Vicky Vergara edited this page Aug 12, 2017 · 35 revisions

General

Supported functions

All pgRouting functions from version pgr-2.0 only support integer on identifiers and float8 on costs. Functions like pgr_dijkstra only work for one source to one target. pgRouting is being rewritten gradually to support ANY-INTEGER & ANY-NUMERICAL and also to support one/many sources to one/many targets.

This 2.2 version of pgRoutingLayer works depending on the pgRouting version as follows:

  • About deprecated functions:
    • If the function has being deprecated on pgr-2.1, then the function will not show on pgr-versions >= 2.1
    • If the function has being deprecated on pgr-2.2, then the function will not show on pgr-versions >= 2.2
    • etc
  • About re-factored functions with support on one/many sources to one/many targets also support ANY-INTEGER & ANY-NUMERICAL:
    • If the function was re-factored on pgr-2.1, then the re-factored version is used on pgr-versions >= 2.1
    • If the function was re-factored on pgr-2.2, then the re-factored version is used on pgr-versions >= 2.2
    • etc

In the following table:

  • an "X" means that the function is not available
  • an "A" means that the function supports ANY-INTEGER & ANY-NUMERICAL
    • ANY-INTEGER: smallint, integer, bigint
    • ANY-NUMERICAL: smallint, integer, bigint, real, float
  • an "M" means that multiple:
    • "S" sources can be used.
    • "T" targets can be used.
  • an "I" means that the function supports only int and float
function pgr 2.0 pgr 2.1 pgr 2.2 pgr 2.3 pgr 2.4 pgr 2.5
pgr_alphaShape I A A A A A
pgr_astar I I I A A, MST A, MST
pgr_bdastar I I I I I A, MST
pgr_bddijkstra I I I I A A, MST
pgr_dijkstra I A, MST A, MST A, MST A, MST A, MST
pgr_dijkstraCost X A, MST A, MST A, MST A, MST A, MST
pgr_drivingdistance I A, MS A, MS A, MS A, MS A, MS
pgr_kDijkstra(Cost) I, MT I, MT X X X X
pgr_kDijkstra(Path) I, MT I, MT X X X X
pgr_ksp I A, MST A, MST A, MST A, MST A, MST
pgr_trsp(Node) I I I I I I
pgr_trsp(Edge) I I I I I I
pgr_trsp(via edges) X I I I I I
pgr_trsp(via vertex) X I I I I I
pgr_tsp(Euclidean distances) I I I I I I

Layer Naming Convention

When using the "Export" or "Export Merge" Buttons a new layer is created with the following structure:

(< M >< U|D >) < function >: < parameter > BBOX(< bbox >)

  • Where:
    • M = when Export Merged button is used
    • < U|D >:
      • U = Undirected
      • D = Directed
    • < bbox > = xMin yMin, xMax yMax

The Buttons

There are 4 buttons for controlling how to render the pgRouting query:

buttons

Preview

Draws in the canvas the resulting path.

Creates a temporary lines on the canvas. No additional information is shown, except for pgr_dijkstraCost and for pgr_kDijkstra(Cost) where an annotation is also created.

Clear Preview

Removes from the canvas objects generated with Preview

When Clear Preview is called the generated temporary lines and annotation are deleted from the canvas. When the QGIS project is saved when there are visible annotations:

  • Those annotations will be saved as part of the project
  • Can be cleared with Clear Preview button, but the project needs to be saved again. On reopening a project that has annotation:
  • The annotations will be shown, but won't be cleared using the Clear Preview button, they are not under the pgRoutingLayer GUI control

Export

Creates a one row per edge line geometry layer

Export Merged

Creates a one row per path multi-line geometry layer.

Only one row is generated. Not all functions results can be merged, when that is the case then the button is dimmed.

pgr_alphaShape

  • Uses BBOX of the QGIS canvas to limit the edges in the query
  • The alpha shape is based on the results of pgr_drivingDistance:
    • pgr-v2.0: Identifiers are converted to int4 type. Costs are converted to float8
    • pgr-v2.1 & pgr-v2.2: pgr_drivingDistance for one starting vertex is used.
  • Buttons:
    • Preview: Draws in the canvas the area of the alpha shape
    • Clear Preview: Removes from the canvas objects generated with Preview
    • Export: Creates a new layer containing the multi polygon geometry named:
      (< U|D >) alphashape: <source_id> dd = <value> BBOX(< bbox >)

pgr_astar

  • Uses BBOX of the QGIS canvas to limit the edges in the query
  • pgr-v2.0, pgr-v2.1 & pgr-v2.2 & pgr-v2.3: Identifiers are converted to int4 type. Costs are converted to float8
  • Buttons:
    • Preview: Draws in the canvas the resulting path.
    • Clear Preview: Removes from the canvas objects generated with Preview
    • Export: Creates a one row per edge line geometry layer
    • Export Merged: Creates a one row per path multiline geometry layer. Only one row is generated
  • Layer name:
      (< M >< U|D >) astar: < source_id >  to < target_id>  BBOX(< bbox >)

Example: pgr_astar from 2 to 3 on Undirected graph:

pgRouting versions graph note
v2.0 v2.1 v2.2 pgr_astar has a bug
v2.3 pgr_astar bug is fixed

pgr_bdAstar

  • Uses BBOX of the QGIS canvas to limit the edges in the query
  • pgr-v2.0, pgr-v2.1 & pgr-v2.2: Identifiers are converted to int4 type. Costs are converted to float8
  • Buttons:
    • Preview: Draws in the canvas the resulting path
    • Clear Preview: Removes from the canvas objects generated with Preview
    • Export: Creates a one row per edge line geometry layer
    • Export Merged: Creates a one row per path multiline geometry layer. Only one row is generated
  • Layer name:
      (< M >< U|D >) bdAstar: < source_id >  to < target_id>  BBOX(< bbox >)

pgr_bdDijkstra

  • Uses BBOX of the QGIS canvas to limit the edges in the query
  • pgr-v2.0, pgr-v2.1 & pgr-v2.2: Identifiers are converted to int4 type. Costs are converted to float8
  • Buttons:
    • Preview: Draws in the canvas the resulting path
    • Clear Preview: Removes from the canvas objects generated with Preview
    • Export: Creates a one row per edge line geometry layer
    • Export Merged: Creates a one row per path multiline geometry layer. Only one row is generated
  • Layer name:
      (< M >< U|D >) bdDijkstra: < source_id >  to < target_id>  BBOX(< bbox >)

pgr_dijkstra

  • Uses BBOX of the QGIS canvas to limit the resulting path(s)
  • pgr-v2.0: Identifiers are converted to int4 type. Costs are converted to float8; single source & target. , pgr-v2.1 & pgr-v2.2: Multiple source & target
  • Buttons:
    • Preview: Draws in the canvas the resulting path
    • Clear Preview: Removes from the canvas objects generated with Preview
    • Export: Creates a one row per edge line geometry layer
    • Export Merged: Creates a one row per path multiline geometry layer. As many rows as needed.
  • Layer name:
      (< M >< U|D >) dijkstra: < source_ids > to < target_ids> BBOX(< bbox >)

The export button results

d dijkstra 2 3 to 2 3 11 bbox -0 3 -0 12 4 3 4 12

The export merge results

md dijkstra 2 3 to 2 3 11 bbox -0 3 -0 12 4 3 4 12

pgr_dijkstraCost

pgr_dijkstraCost

pgr_drivingDistance

  • pgr-v2.0: Identifiers are converted to int4 type. Costs are converted to float8; single source , pgr-v2.1 & pgr-v2.2: Multiple source
  • Buttons:
    • Preview: Draws in the canvas points within the driving distance
    • Clear Preview: Removes from the canvas objects generated with Preview
    • Export: Creates a one row per point point geometry layer
    • Export Merged: Creates a one row per edge line geometry layer
  • Layer name:
      (< M >< U|D >) drivingDistance: < source_ids > dd = < value > BBOX(< bbox >)

pgr_kDijkstra(Cost)

  • Uses BBOX of the QGIS canvas to limit the edges in the query
  • pgr-v2.0, pgr-v2.1, pgr-v2.2: Identifiers are converted to int4 type. Costs are converted to float8
  • pgr-v2.2: Function is being deprecated in favour of pgr_dijkstraCost which is not yet implemented in this plugin.
  • Buttons:
    • Preview: Draws in the canvas a straight line from the start_vid and a label with the cost information at the target_vid.
    • Clear Preview: Removes from the canvas the objects generated with Preview

pgr_kDijkstra(Path)

  • Uses BBOX of the QGIS canvas to limit the edges in the query
  • pgr-v2.0, pgr-v2.1 & pgr-v2.2: Identifiers are converted to int4 type. Costs are converted to float8
  • Buttons:
    • Preview: Draws in the canvas the resulting path
    • Clear Preview: Removes from the canvas objects generated with Preview
    • Export: Creates a one row per edge line geometry layer
    • Export Merged: Creates a one row per path multiline geometry layer. As many rows as needed
  • Layer name:
      (< M >< U|D >) kDijkstra: < source_id > to [tarjets_ids]  BBOX(< bbox >)

pgr_ksp

  • pgr-v2.0: Identifiers are converted to int4 type. Costs are converted to float8; single source , pgr-v2.1 & pgr-v2.2: Multiple source
  • Buttons:
    • Preview: Draws in the canvas points within the driving distance
    • Clear Preview: Removes from the canvas objects generated with Preview
    • Export: Creates a one row per point point geometry layer
    • Export Merged: Creates a one row per path multiline geometry layer. As many rows as needed
  • Layer name:
      (< M >< U|D >) drivingDistance: < source_ids > K = < value > BBOX(< bbox >)

pgr_trsp(Node)

  • Uses BBOX of the QGIS canvas to limit the edges in the query
  • pgr-v2.0, pgr-v2.1 & pgr-v2.2: Identifiers are converted to int4 type. Costs are converted to float8
  • Buttons:
    • Preview: Draws in the canvas the resulting path
    • Clear Preview: Removes from the canvas objects generated with Preview
    • Export: Creates a one row per edge line geometry layer
    • Export Merged: Creates a one row per path multiline geometry layer. One row is generated.
  • Layer name:
      (< M >< U|D >) trsp(Node): < source_id > to < tarjets_id >  BBOX(< bbox >)

pgr_trsp(Edge)

  • Uses BBOX of the QGIS canvas to limit the edges in the query
  • pgr-v2.0, pgr-v2.1 & pgr-v2.2: Identifiers are converted to int4 type. Costs are converted to float8
  • Buttons:
    • Preview: Draws in the canvas the resulting path
    • Clear Preview: Removes from the canvas objects generated with Preview
    • Export: Creates a one row per edge line geometry layer
    • Export Merged: Creates a one row per path multiline geometry layer. One row is generated.
  • Layer name:
      (< M >< U|D >) trsp(Node): < source_id > to < tarjets_id >  BBOX(< bbox >)

pgr_trsp(via edges)

  • Uses BBOX of the QGIS canvas to limit the edges in the query
  • pgr-v2.0, pgr-v2.1 & pgr-v2.2: Identifiers are converted to int4 type. Costs are converted to float8
  • Buttons:
    • Preview: Draws in the canvas the resulting path
    • Clear Preview: Removes from the canvas objects generated with Preview
    • Export: Creates a one row per edge line geometry layer.
    • Export Merged: Creates a one row line geometry layer. One row is generated.

LIMITATIONS

  • Export and Export Merged:
    • Does not work on points that are on the same edge.

pgr_trsp(via vertex)

  • Uses BBOX of the QGIS canvas to limit the edges in the query
  • pgr-v2.0, pgr-v2.1 & pgr-v2.2: Identifiers are converted to int4 type. Costs are converted to float8
  • Buttons:
    • Preview: Draws in the canvas the resulting path
    • Clear Preview: Removes from the canvas objects generated with Preview
    • Export: Creates a one row per edge line geometry layer.
    • Export Merged: Creates a one row line geometry layer. One row is generated.
  • Layer name:
      (< M >< U|D >) trsp(via vertex): < source_id > to < tarjets_id >  BBOX(< bbox >)

pgr_tsp(Euclidean distances)

  • does not use BBOX
  • pgr-v2.0, pgr-v2.1 & pgr-v2.2: Identifiers are converted to int4 type.
  • Buttons:
    • Preview: Draws in the canvas the resulting path, and a label
    • Clear Preview: Removes from the canvas objects generated with Preview