pgRouting Manual (2.3)

pgr_pointsToDMatrix - Deprecated Function

«  pgr_vidsToDMatrix - Deprecated Function   ::   Contents   ::   pgr_textToPoints - Deprecated Function  »

pgr_pointsToDMatrix - Deprecated Function

Warning

This function is deprecated!!!

  • Is no longer supported.
  • May be removed from future versions.
  • There is no replacement.

Name

pgr_pointsToDMatrix - Creates a distance matrix from an array of points.

Synopsis

Create a distance symmetric distance matrix suitable for TSP using Euclidean distances based on the st_distance(). You might want to create a variant of this the uses st_distance_sphere() or st_distance_spheriod() or some other function.

The function returns:

  • record - with two fields as describe here
    • dmatrix:float8[] - the distance matrix suitable to pass to pgrTSP() function.
    • ids:integer[] - an array of ids for the distance matrix.
record pgr_pointsToDMatrix(pnts geometry[], OUT dmatrix double precision[], OUT ids integer[])

Description

Parameters

pnts:geometry[] - An array of point geometries.

Warning

The generated matrix will be symmetric as required for pgr_TSP.

History

  • Proposed in version 2.1.0

Examples

SELECT * FROM pgr_pointstodmatrix(pgr_texttopoints('2,0;2,1;3,1;2,2', 0));
NOTICE:  Deperecated function: pgr_textToPoints
NOTICE:  Deprecated function pgr_pointsToDMatrix
                                              dmatrix                                              |    ids    
---------------------------------------------------------------------------------------------------+-----------
 {{0,1,1.4142135623731,2},{1,0,1,1},{1.4142135623731,1,0,1.4142135623731},{2,1,1.4142135623731,0}} | {1,2,3,4}
(1 row)

This example shows how this can be used in the context of feeding the results into pgr_tsp() function.

SELECT * from pgr_tsp(
    (SELECT dMatrix FROM pgr_pointstodmatrix(pgr_texttopoints('2,0;2,1;3,1;2,2', 0))
    ),
    1
);
NOTICE:  Deperecated function: pgr_textToPoints
NOTICE:  Deprecated function pgr_pointsToDMatrix
 seq | id 
-----+----
   0 |  1
   1 |  3
   2 |  2
   3 |  0
(4 rows)

«  pgr_vidsToDMatrix - Deprecated Function   ::   Contents   ::   pgr_textToPoints - Deprecated Function  »