diff --git a/.gitignore b/.gitignore index 3b0eb5ae1cc..70f98d92739 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,6 @@ src/version/version.h .directory notUsed *.swp + +.vscode +taptest.sh diff --git a/NEWS.md b/NEWS.md index 791267a41cf..1eccbd6ae0d 100644 --- a/NEWS.md +++ b/NEWS.md @@ -114,6 +114,7 @@ In the deprecated functions: ## pgRouting 3.7 +
pgRouting 3.7.3 Release Notes To see all issues & pull requests closed by this release see the [Git closed diff --git a/configuration.conf b/configuration.conf index 9f0e2ff0512..ea4e8bc3f28 100644 --- a/configuration.conf +++ b/configuration.conf @@ -54,4 +54,3 @@ categories | N | N | Y #---------------------- topology | N | Y | Y utilities | N | Y | Y -deprecated | N | Y | N diff --git a/doc/src/release_notes.rst b/doc/src/release_notes.rst index 651ef7a593e..c06965bea52 100644 --- a/doc/src/release_notes.rst +++ b/doc/src/release_notes.rst @@ -146,6 +146,10 @@ In the deprecated functions: pgRouting 3.7 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +.. contents:: Contents + :local: + :depth: 1 + pgRouting 3.7.3 Release Notes ------------------------------------------------------------------------------- diff --git a/docqueries/src/migration.pg b/docqueries/src/migration.pg index aafd5af1ded..7c28a870f73 100644 --- a/docqueries/src/migration.pg +++ b/docqueries/src/migration.pg @@ -34,11 +34,6 @@ SELECT * FROM new_restrictions; /* --rest5 */ /* --verticesv1 */ -SELECT * FROM pgr_trsp( - $$SELECT id::INTEGER, source::INTEGER, target::INTEGER, cost, reverse_cost - FROM edges WHERE id != 16$$, - 15, 16, - true, true); /* --verticesv2 */ SELECT * FROM pgr_dijkstra( $$SELECT id, source, target, cost, reverse_cost @@ -51,13 +46,6 @@ FROM pgr_dijkstra( FROM edges WHERE id != 16$$, 15, 16); /* --verticesv4 */ -SELECT * FROM pgr_trsp( - $$SELECT id::INTEGER, source::INTEGER, target::INTEGER, cost, reverse_cost - FROM edges WHERE id != 16$$, - 15, 16, - true, true, - $$SELECT to_cost, target_id::INTEGER, via_path - FROM old_restrictions$$); /* --verticesv5 */ SELECT * FROM pgr_trsp( $$SELECT id, source, target, cost, reverse_cost @@ -75,11 +63,6 @@ FROM pgr_trsp( SELECT pid, edge_id, fraction, side FROM pointsOfInterest WHERE pid IN (3, 4); /* --edgesv1 */ -SELECT * FROM pgr_trsp( - $$SELECT id::INTEGER, source::INTEGER, target::INTEGER, cost, reverse_cost - FROM edges$$, - 6, 0.3, 12, 0.6, - true, true); /* --edgesv2 */ SELECT * FROM pgr_withPoints( $$SELECT id, source, target, cost, reverse_cost FROM edges$$, @@ -94,10 +77,6 @@ FROM pgr_withPoints( -1, -2, details => false); /* --edgesv4 */ -SELECT * FROM pgr_trsp( - $$SELECT id::INTEGER, source::INTEGER, target::INTEGER, cost, reverse_cost FROM edges$$, - 6, 0.3, 12, 0.6, true, true, - $$SELECT to_cost, target_id::INTEGER, via_path FROM old_restrictions$$); /* --edgesv5 */ SELECT * FROM pgr_trsp_withPoints( $$SELECT id, source, target, cost, reverse_cost FROM edges$$, @@ -115,11 +94,6 @@ FROM pgr_trsp_withPoints( details => false) WHERE edge != -1; /* --edgesv7 */ -/* --viav1 */ -SELECT * FROM pgr_trspViaVertices( - $$SELECT id::INTEGER, source::INTEGER, target::INTEGER, cost, reverse_cost FROM edges$$, - ARRAY[6, 3, 6], - true, true); /* --viav2 */ SELECT * FROM pgr_dijkstraVia( $$SELECT id, source, target, cost, reverse_cost FROM edges$$, @@ -133,11 +107,6 @@ FROM pgr_dijkstraVia( ARRAY[6, 3, 6]) WHERE edge != -1; /* --viav4*/ -SELECT * FROM pgr_trspViaVertices( - $$SELECT id::INTEGER, source::INTEGER, target::INTEGER, cost, reverse_cost FROM edges$$, - ARRAY[6, 3, 6], - true, true, - $$SELECT to_cost, target_id::INTEGER, via_path FROM old_restrictions$$); /* --viav5 */ SELECT * FROM pgr_trspVia( $$SELECT id, source, target, cost, reverse_cost FROM edges$$, @@ -156,10 +125,7 @@ WHERE edge != -1; SELECT pid, edge_id, fraction, side FROM pointsOfInterest WHERE pid IN (3, 4, 6); /* --edgesvia1 */ -SELECT * FROM pgr_trspViaEdges( - $$SELECT id::INTEGER, source::INTEGER, target::INTEGER, cost, reverse_cost FROM edges$$, - ARRAY[6, 12, 4], ARRAY[0.3, 0.6, 0.7], - true, true); +SELECT pid, edge_id, fraction FROM pointsOfInterest WHERE pid IN (3, 4, 6); /* --edgesvia2 */ SELECT * FROM pgr_withPointsVia( $$SELECT id, source, target, cost, reverse_cost FROM edges$$, @@ -172,15 +138,10 @@ path_id::INTEGER AS id1, node::INTEGER AS id2, CASE WHEN edge >= 0 THEN edge::INTEGER ELSE -1 END AS id3, cost::FLOAT FROM pgr_withPointsVia( $$SELECT id, source, target, cost, reverse_cost FROM edges$$, - $$SELECT * FROM (VALUES (1, 6, 0.3),(2, 12, 0.6),(3, 4, 0.7)) AS t(pid, edge_id, fraction)$$, - ARRAY[-1, -2, -3], - details=> false); + $$SELECT pid, edge_id, fraction FROM pointsOfInterest WHERE pid IN (3, 4, 6)$$, + ARRAY[-4, -3, -6], + details => false); /* --edgesvia4 */ -SELECT * FROM pgr_trspViaEdges( - $$SELECT id::INTEGER, source::INTEGER, target::INTEGER, cost, reverse_cost FROM edges$$, - ARRAY[6, 12, 4], ARRAY[0.3, 0.6, 0.7], - true, true, - $$SELECT to_cost, target_id::INTEGER, via_path FROM old_restrictions$$); /* --edgesvia5 */ SELECT * FROM pgr_trspVia_withPoints( $$SELECT id, source, target, cost, reverse_cost FROM edges$$, diff --git a/docqueries/src/migration.result b/docqueries/src/migration.result index 0930fcdeb2f..8a9eecf33e8 100644 --- a/docqueries/src/migration.result +++ b/docqueries/src/migration.result @@ -65,20 +65,6 @@ SELECT * FROM new_restrictions; /* --rest5 */ /* --verticesv1 */ -SELECT * FROM pgr_trsp( - $$SELECT id::INTEGER, source::INTEGER, target::INTEGER, cost, reverse_cost - FROM edges WHERE id != 16$$, - 15, 16, - true, true); -WARNING: pgr_trsp(text,integer,integer,boolean,boolean) deprecated signature on v3.4.0 - seq | id1 | id2 | cost ------+-----+-----+------ - 0 | 15 | 3 | 1 - 1 | 10 | 5 | 1 - 2 | 11 | 9 | 1 - 3 | 16 | -1 | 0 -(4 rows) - /* --verticesv2 */ SELECT * FROM pgr_dijkstra( $$SELECT id, source, target, cost, reverse_cost @@ -107,24 +93,6 @@ FROM pgr_dijkstra( (4 rows) /* --verticesv4 */ -SELECT * FROM pgr_trsp( - $$SELECT id::INTEGER, source::INTEGER, target::INTEGER, cost, reverse_cost - FROM edges WHERE id != 16$$, - 15, 16, - true, true, - $$SELECT to_cost, target_id::INTEGER, via_path - FROM old_restrictions$$); -WARNING: pgr_trsp(text,integer,integer,boolean,boolean) deprecated signature on v3.4.0 - seq | id1 | id2 | cost ------+-----+-----+------ - 0 | 15 | 3 | 1 - 1 | 10 | 5 | 1 - 2 | 11 | 11 | 1 - 3 | 12 | 13 | 1 - 4 | 17 | 15 | 1 - 5 | 16 | -1 | 0 -(6 rows) - /* --verticesv5 */ SELECT * FROM pgr_trsp( $$SELECT id, source, target, cost, reverse_cost @@ -168,21 +136,6 @@ WHERE pid IN (3, 4); (2 rows) /* --edgesv1 */ -SELECT * FROM pgr_trsp( - $$SELECT id::INTEGER, source::INTEGER, target::INTEGER, cost, reverse_cost - FROM edges$$, - 6, 0.3, 12, 0.6, - true, true); -WARNING: pgr_trsp(text,integer,float,integer,float,boolean,boolean) deprecated signature on v3.4.0 - seq | id1 | id2 | cost ------+-----+-----+------ - 0 | -1 | 6 | 0.7 - 1 | 3 | 7 | 1 - 2 | 7 | 10 | 1 - 3 | 8 | 12 | 0.6 - 4 | -2 | -1 | 0 -(5 rows) - /* --edgesv2 */ SELECT * FROM pgr_withPoints( $$SELECT id, source, target, cost, reverse_cost FROM edges$$, @@ -215,25 +168,6 @@ FROM pgr_withPoints( (5 rows) /* --edgesv4 */ -SELECT * FROM pgr_trsp( - $$SELECT id::INTEGER, source::INTEGER, target::INTEGER, cost, reverse_cost FROM edges$$, - 6, 0.3, 12, 0.6, true, true, - $$SELECT to_cost, target_id::INTEGER, via_path FROM old_restrictions$$); -WARNING: pgr_trsp(text,integer,float,integer,float,boolean,boolean) deprecated signature on v3.4.0 - seq | id1 | id2 | cost ------+-----+-----+------ - 0 | -1 | 6 | 0.7 - 1 | 3 | 7 | 1 - 2 | 7 | 8 | 1 - 3 | 11 | 9 | 1 - 4 | 16 | 16 | 1 - 5 | 15 | 3 | 1 - 6 | 10 | 2 | 1 - 7 | 6 | 4 | 1 - 8 | 7 | 10 | 1 - 9 | 8 | 12 | 0.6 -(10 rows) - /* --edgesv5 */ SELECT * FROM pgr_trsp_withPoints( $$SELECT id, source, target, cost, reverse_cost FROM edges$$, @@ -280,21 +214,6 @@ WHERE edge != -1; (10 rows) /* --edgesv7 */ -/* --viav1 */ -SELECT * FROM pgr_trspViaVertices( - $$SELECT id::INTEGER, source::INTEGER, target::INTEGER, cost, reverse_cost FROM edges$$, - ARRAY[6, 3, 6], - true, true); -WARNING: pgr_trspViaVertices(text,anyarray,boolean,boolean,text) deprecated function on v3.4.0 - seq | id1 | id2 | id3 | cost ------+-----+-----+-----+------ - 1 | 1 | 6 | 4 | 1 - 2 | 1 | 7 | 7 | 1 - 3 | 2 | 3 | 7 | 1 - 4 | 2 | 7 | 4 | 1 - 5 | 2 | 6 | -1 | 0 -(5 rows) - /* --viav2 */ SELECT * FROM pgr_dijkstraVia( $$SELECT id, source, target, cost, reverse_cost FROM edges$$, @@ -327,27 +246,6 @@ WHERE edge != -1; (5 rows) /* --viav4*/ -SELECT * FROM pgr_trspViaVertices( - $$SELECT id::INTEGER, source::INTEGER, target::INTEGER, cost, reverse_cost FROM edges$$, - ARRAY[6, 3, 6], - true, true, - $$SELECT to_cost, target_id::INTEGER, via_path FROM old_restrictions$$); -WARNING: pgr_trspViaVertices(text,anyarray,boolean,boolean,text) deprecated function on v3.4.0 - seq | id1 | id2 | id3 | cost ------+-----+-----+-----+------ - 1 | 1 | 6 | 4 | 1 - 2 | 1 | 7 | 8 | 1 - 3 | 1 | 11 | 9 | 1 - 4 | 1 | 16 | 16 | 1 - 5 | 1 | 15 | 3 | 1 - 6 | 1 | 10 | 5 | 1 - 7 | 1 | 11 | 8 | 1 - 8 | 1 | 7 | 7 | 1 - 9 | 2 | 3 | 7 | 1 - 10 | 2 | 7 | 4 | 1 - 11 | 2 | 6 | -1 | 0 -(11 rows) - /* --viav5 */ SELECT * FROM pgr_trspVia( $$SELECT id, source, target, cost, reverse_cost FROM edges$$, @@ -404,26 +302,13 @@ WHERE pid IN (3, 4, 6); (3 rows) /* --edgesvia1 */ -SELECT * FROM pgr_trspViaEdges( - $$SELECT id::INTEGER, source::INTEGER, target::INTEGER, cost, reverse_cost FROM edges$$, - ARRAY[6, 12, 4], ARRAY[0.3, 0.6, 0.7], - true, true); -WARNING: pgr_trspViaEdges(text,integer[],float[],boolean,boolean,text) deprecated function on v3.4.0 - seq | id1 | id2 | id3 | cost ------+-----+-----+-----+------ - 1 | 1 | -1 | 6 | 0.7 - 2 | 1 | 3 | 7 | 1 - 3 | 1 | 7 | 10 | 1 - 4 | 1 | 8 | 12 | 0.6 - 5 | 1 | -2 | -1 | 0 - 6 | 2 | -2 | 12 | 0.4 - 7 | 2 | 12 | 13 | 1 - 8 | 2 | 17 | 15 | 1 - 9 | 2 | 16 | 9 | 1 - 10 | 2 | 11 | 8 | 1 - 11 | 2 | 7 | 4 | 0.7 - 12 | 2 | -3 | -2 | 0 -(12 rows) +SELECT pid, edge_id, fraction FROM pointsOfInterest WHERE pid IN (3, 4, 6); + pid | edge_id | fraction +-----+---------+---------- + 3 | 12 | 0.6 + 4 | 6 | 0.3 + 6 | 4 | 0.7 +(3 rows) /* --edgesvia2 */ SELECT * FROM pgr_withPointsVia( @@ -453,53 +338,26 @@ path_id::INTEGER AS id1, node::INTEGER AS id2, CASE WHEN edge >= 0 THEN edge::INTEGER ELSE -1 END AS id3, cost::FLOAT FROM pgr_withPointsVia( $$SELECT id, source, target, cost, reverse_cost FROM edges$$, - $$SELECT * FROM (VALUES (1, 6, 0.3),(2, 12, 0.6),(3, 4, 0.7)) AS t(pid, edge_id, fraction)$$, - ARRAY[-1, -2, -3], - details=> false); + $$SELECT pid, edge_id, fraction FROM pointsOfInterest WHERE pid IN (3, 4, 6)$$, + ARRAY[-4, -3, -6], + details => false); seq | id1 | id2 | id3 | cost -----+-----+-----+-----+------ - 1 | 1 | -1 | 6 | 0.7 + 1 | 1 | -4 | 6 | 0.7 2 | 1 | 3 | 7 | 1 3 | 1 | 7 | 10 | 1 4 | 1 | 8 | 12 | 0.6 - 5 | 1 | -2 | -1 | 0 - 6 | 2 | -2 | 12 | 0.4 + 5 | 1 | -3 | -1 | 0 + 6 | 2 | -3 | 12 | 0.4 7 | 2 | 12 | 13 | 1 8 | 2 | 17 | 15 | 1 9 | 2 | 16 | 9 | 1 10 | 2 | 11 | 8 | 1 11 | 2 | 7 | 4 | 0.3 - 12 | 2 | -3 | -1 | 0 + 12 | 2 | -6 | -1 | 0 (12 rows) /* --edgesvia4 */ -SELECT * FROM pgr_trspViaEdges( - $$SELECT id::INTEGER, source::INTEGER, target::INTEGER, cost, reverse_cost FROM edges$$, - ARRAY[6, 12, 4], ARRAY[0.3, 0.6, 0.7], - true, true, - $$SELECT to_cost, target_id::INTEGER, via_path FROM old_restrictions$$); -WARNING: pgr_trspViaEdges(text,integer[],float[],boolean,boolean,text) deprecated function on v3.4.0 -WARNING: pgr_trsp(text,integer,float,integer,float,boolean,boolean) deprecated signature on v3.4.0 -WARNING: pgr_trsp(text,integer,float,integer,float,boolean,boolean) deprecated signature on v3.4.0 - seq | id1 | id2 | id3 | cost ------+-----+-----+-----+------ - 1 | 1 | -1 | 6 | 0.7 - 2 | 1 | 3 | 7 | 1 - 3 | 1 | 7 | 8 | 1 - 4 | 1 | 11 | 9 | 1 - 5 | 1 | 16 | 16 | 1 - 6 | 1 | 15 | 3 | 1 - 7 | 1 | 10 | 2 | 1 - 8 | 1 | 6 | 4 | 1 - 9 | 1 | 7 | 10 | 1 - 10 | 1 | 8 | 12 | 1 - 11 | 2 | 12 | 13 | 1 - 12 | 2 | 17 | 15 | 1 - 13 | 2 | 16 | 9 | 1 - 14 | 2 | 11 | 8 | 1 - 15 | 2 | 7 | 4 | 0.3 -(15 rows) - /* --edgesvia5 */ SELECT * FROM pgr_trspVia_withPoints( $$SELECT id, source, target, cost, reverse_cost FROM edges$$, diff --git a/docqueries/src/test.conf b/docqueries/src/test.conf index 2eb35118beb..900fd151308 100644 --- a/docqueries/src/test.conf +++ b/docqueries/src/test.conf @@ -3,10 +3,10 @@ %main::tests = ( 'any' => { 'files' => [qw( + concepts.pg + migration.pg sampledata.pg withPoints-category.pg - migration.pg - concepts.pg )], }, ); diff --git a/pgtap/dominator/lengauerTarjanDominatorTree/edge_cases.pg b/pgtap/dominator/lengauerTarjanDominatorTree/edge_cases.pg index 4ed4dacb11f..bdea6c268a4 100644 --- a/pgtap/dominator/lengauerTarjanDominatorTree/edge_cases.pg +++ b/pgtap/dominator/lengauerTarjanDominatorTree/edge_cases.pg @@ -137,7 +137,7 @@ SELECT set_eq('ltd_test4', $$VALUES (1, 5, 0),(2, 6, 1),(3, 10, 0)$$, 'test3: u PREPARE q5 AS SELECT id, source, target, cost, reverse_cost FROM edges -WHERE id <= 3; +WHERE id <= 3 ORDER BY id; RETURN QUERY SELECT set_eq('q5', @@ -156,7 +156,7 @@ FROM pgr_lengauerTarjanDominatorTree( ); RETURN QUERY -SELECT set_eq('ltd_test5', $$VALUES (1, 10, 0),(2, 15, 0),(3, 5, 0), (4, 6, 3)$$, 'test5: u<->v<-w<-z root 5'); +SELECT set_eq('ltd_test5', $$VALUES (3, 10, 0),(4, 15, 0),(1, 5, 0), (2, 6, 1)$$, 'test5: u<->v<-w<-z root 5'); PREPARE ltd_test6 AS @@ -166,7 +166,7 @@ FROM pgr_lengauerTarjanDominatorTree( ); RETURN QUERY -SELECT set_eq('ltd_test6', $$VALUES (1, 10, 2),(2,15,0),(3, 5, 4),(4, 6, 1)$$, 'test6: u<->v<-w<-z root 15'); +SELECT set_eq('ltd_test6', $$VALUES (3, 10, 4),(4,15,0),(1, 5, 2),(2, 6, 3)$$, 'test6: u<->v<-w<-z root 15'); END; $BODY$ diff --git a/pgtap/metrics/degree/edge_cases.pg b/pgtap/metrics/degree/edge_cases.pg index 0f953881cfe..76a75312a85 100644 --- a/pgtap/metrics/degree/edge_cases.pg +++ b/pgtap/metrics/degree/edge_cases.pg @@ -106,7 +106,6 @@ BEGIN SELECT * FROM pgr_degree('SELECT id FROM edges WHERE id > 20', 'SELECT * FROM vertices') ORDER BY node; IF min_version('3.8.0') THEN - PERFORM todo(1, 'Currently is not empty'); RETURN QUERY SELECT is_empty('empty_graph', 'is empty: Empty edges give 0 count on all vertices so none is in result'); ELSE diff --git a/sql/contraction/contractionHierarchies.sql b/sql/contraction/contractionHierarchies.sql index 0784de777e0..2879eb28ebc 100644 --- a/sql/contraction/contractionHierarchies.sql +++ b/sql/contraction/contractionHierarchies.sql @@ -63,7 +63,7 @@ LANGUAGE SQL VOLATILE STRICT; COMMENT ON FUNCTION pgr_contractionHierarchies(TEXT, BOOLEAN, BIGINT[]) IS 'pgr_contractionHierarchies -EXPERIMENTAL +- EXPERIMENTAL - Parameters: - Edges SQL with columns: id, source, target, cost [,reverse_cost] - Optional Parameters diff --git a/sql/contraction/deadEndContraction.sql b/sql/contraction/deadEndContraction.sql index c6cfa7437f4..80c8cd6a978 100644 --- a/sql/contraction/deadEndContraction.sql +++ b/sql/contraction/deadEndContraction.sql @@ -44,6 +44,7 @@ LANGUAGE SQL VOLATILE STRICT; COMMENT ON FUNCTION pgr_contractionDeadEnd(TEXT, BOOLEAN, BIGINT[]) IS 'pgr_contractionDeadEnd +- PROPOSED - Parameters: - Edges SQL with columns: id, source, target, cost [,reverse_cost] - Optional Parameters diff --git a/sql/contraction/linearContraction.sql b/sql/contraction/linearContraction.sql index 6fe617a119f..2e41f0191ce 100644 --- a/sql/contraction/linearContraction.sql +++ b/sql/contraction/linearContraction.sql @@ -44,6 +44,7 @@ LANGUAGE SQL VOLATILE STRICT; COMMENT ON FUNCTION pgr_contractionLinear(TEXT, BOOLEAN, BIGINT[]) IS 'pgr_contractionLinear +- PROPOSED - Parameters: - Edges SQL with columns: id, source, target, cost [,reverse_cost] - Optional Parameters diff --git a/sql/deprecated/CMakeLists.txt b/sql/deprecated/CMakeLists.txt deleted file mode 100644 index a5be0bfec1b..00000000000 --- a/sql/deprecated/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ - -SET(LOCAL_FILES - ) - -foreach (f ${LOCAL_FILES}) - configure_file(${f} ${f}) - list(APPEND PACKAGE_SQL_FILES ${CMAKE_CURRENT_BINARY_DIR}/${f}) -endforeach() - -set(PROJECT_SQL_FILES ${PROJECT_SQL_FILES} ${PACKAGE_SQL_FILES} PARENT_SCOPE) diff --git a/sql/dijkstra/dijkstra.sql b/sql/dijkstra/dijkstra.sql index d2c4595e786..681f3816f66 100644 --- a/sql/dijkstra/dijkstra.sql +++ b/sql/dijkstra/dijkstra.sql @@ -53,7 +53,7 @@ CREATE FUNCTION pgr_dijkstra( RETURNS SETOF RECORD AS $BODY$ SELECT seq, path_seq, start_vid, end_vid, node, edge, cost, agg_cost - FROM _pgr_dijkstra(_pgr_get_statement($1), ARRAY[$2]::BIGINT[], ARRAY[$3]::BIGINT[], $4, false, true); + FROM _pgr_dijkstra(_pgr_get_statement($1), ARRAY[$2]::BIGINT[], ARRAY[$3]::BIGINT[], $4, false, true, 0, false); $BODY$ LANGUAGE sql VOLATILE STRICT COST 100 @@ -79,7 +79,7 @@ CREATE FUNCTION pgr_dijkstra( RETURNS SETOF RECORD AS $BODY$ SELECT seq, path_seq, start_vid, end_vid, node, edge, cost, agg_cost - FROM _pgr_dijkstra(_pgr_get_statement($1), ARRAY[$2]::BIGINT[], $3::BIGINT[], $4, false, true); + FROM _pgr_dijkstra(_pgr_get_statement($1), ARRAY[$2]::BIGINT[], $3::BIGINT[], $4, false, true, 0, false); $BODY$ LANGUAGE sql VOLATILE STRICT COST 100 @@ -105,7 +105,7 @@ CREATE FUNCTION pgr_dijkstra( RETURNS SETOF RECORD AS $BODY$ SELECT seq, path_seq, start_vid, end_vid, node, edge, cost, agg_cost - FROM _pgr_dijkstra(_pgr_get_statement($1), $2::BIGINT[], ARRAY[$3]::BIGINT[], $4, false, false); + FROM _pgr_dijkstra(_pgr_get_statement($1), $2::BIGINT[], ARRAY[$3]::BIGINT[], $4, false, false, 0, false); $BODY$ LANGUAGE sql VOLATILE STRICT COST 100 @@ -131,7 +131,7 @@ CREATE FUNCTION pgr_dijkstra( RETURNS SETOF RECORD AS $BODY$ SELECT seq, path_seq, start_vid, end_vid, node, edge, cost, agg_cost - FROM _pgr_dijkstra(_pgr_get_statement($1), $2::BIGINT[], $3::BIGINT[], $4, false, true); + FROM _pgr_dijkstra(_pgr_get_statement($1), $2::BIGINT[], $3::BIGINT[], $4, false, true, 0, false); $BODY$ LANGUAGE sql VOLATILE STRICT COST 100 @@ -156,7 +156,7 @@ CREATE FUNCTION pgr_dijkstra( RETURNS SETOF RECORD AS $BODY$ SELECT seq, path_seq, start_vid, end_vid, node, edge, cost, agg_cost - FROM _pgr_dijkstra(_pgr_get_statement($1), _pgr_get_statement($2), $3, false, true); + FROM _pgr_dijkstra(_pgr_get_statement($1), _pgr_get_statement($2), $3, false, 0, false); $BODY$ LANGUAGE sql VOLATILE STRICT COST 100 diff --git a/sql/dijkstra/dijkstraCost.sql b/sql/dijkstra/dijkstraCost.sql index f3f3612d61b..02aa15087ef 100644 --- a/sql/dijkstra/dijkstraCost.sql +++ b/sql/dijkstra/dijkstraCost.sql @@ -43,7 +43,7 @@ CREATE FUNCTION pgr_dijkstraCost( RETURNS SETOF RECORD AS $BODY$ SELECT start_vid, end_vid, agg_cost - FROM _pgr_dijkstra(_pgr_get_statement($1), ARRAY[$2]::BIGINT[], ARRAY[$3]::BIGINT[], $4, true); + FROM _pgr_dijkstra(_pgr_get_statement($1), ARRAY[$2]::BIGINT[], ARRAY[$3]::BIGINT[], $4, true, true, 0, false); $BODY$ LANGUAGE sql VOLATILE STRICT COST 100 @@ -66,7 +66,7 @@ CREATE FUNCTION pgr_dijkstraCost( RETURNS SETOF RECORD AS $BODY$ SELECT start_vid, end_vid, agg_cost - FROM _pgr_dijkstra(_pgr_get_statement($1), ARRAY[$2]::BIGINT[], $3::BIGINT[], $4, true); + FROM _pgr_dijkstra(_pgr_get_statement($1), ARRAY[$2]::BIGINT[], $3::BIGINT[], $4, true, true, 0, false); $BODY$ LANGUAGE sql VOLATILE STRICT COST 100 @@ -90,7 +90,7 @@ CREATE FUNCTION pgr_dijkstraCost( RETURNS SETOF RECORD AS $BODY$ SELECT start_vid, end_vid, agg_cost - FROM _pgr_dijkstra(_pgr_get_statement($1), $2::BIGINT[], ARRAY[$3]::BIGINT[], $4, true); + FROM _pgr_dijkstra(_pgr_get_statement($1), $2::BIGINT[], ARRAY[$3]::BIGINT[], $4, true, true, 0, false); $BODY$ LANGUAGE sql VOLATILE STRICT COST 100 @@ -114,7 +114,7 @@ CREATE FUNCTION pgr_dijkstraCost( RETURNS SETOF RECORD AS $BODY$ SELECT start_vid, end_vid, agg_cost - FROM _pgr_dijkstra(_pgr_get_statement($1), $2::BIGINT[], $3::BIGINT[], $4, true); + FROM _pgr_dijkstra(_pgr_get_statement($1), $2::BIGINT[], $3::BIGINT[], $4, true, true, 0, false); $BODY$ LANGUAGE sql VOLATILE STRICT COST 100 @@ -134,7 +134,7 @@ CREATE FUNCTION pgr_dijkstraCost( RETURNS SETOF RECORD AS $BODY$ SELECT start_vid, end_vid, agg_cost - FROM _pgr_dijkstra(_pgr_get_statement($1), _pgr_get_statement($2), $3, true, true); + FROM _pgr_dijkstra(_pgr_get_statement($1), _pgr_get_statement($2), $3, true, 0, false); $BODY$ LANGUAGE sql VOLATILE STRICT COST 100 diff --git a/sql/dijkstra/dijkstraCostMatrix.sql b/sql/dijkstra/dijkstraCostMatrix.sql index 44629ff9cd3..fc6ec7fd854 100644 --- a/sql/dijkstra/dijkstraCostMatrix.sql +++ b/sql/dijkstra/dijkstraCostMatrix.sql @@ -42,7 +42,7 @@ CREATE FUNCTION pgr_dijkstraCostMatrix( RETURNS SETOF RECORD AS $BODY$ SELECT a.start_vid, a.end_vid, a.agg_cost - FROM _pgr_dijkstra(_pgr_get_statement($1), $2, $2, $3, TRUE) a; + FROM _pgr_dijkstra(_pgr_get_statement($1), $2, $2, $3, true, true, 0, false) a; $BODY$ LANGUAGE SQL VOLATILE STRICT COST 100 diff --git a/sql/dijkstra/dijkstraNear.sql b/sql/dijkstra/dijkstraNear.sql index e0c8256285e..3fd1cd74a67 100644 --- a/sql/dijkstra/dijkstraNear.sql +++ b/sql/dijkstra/dijkstraNear.sql @@ -49,7 +49,7 @@ CREATE FUNCTION pgr_dijkstraNear( RETURNS SETOF RECORD AS $BODY$ SELECT seq, path_seq, start_vid, end_vid, node, edge, cost, agg_cost - FROM _pgr_dijkstra(_pgr_get_statement($1), ARRAY[$2]::BIGINT[], $3::BIGINT[], directed, false, true, cap); + FROM _pgr_dijkstra(_pgr_get_statement($1), ARRAY[$2]::BIGINT[], $3::BIGINT[], directed, false, true, cap, false); $BODY$ LANGUAGE sql VOLATILE STRICT COST 100 @@ -76,7 +76,7 @@ CREATE FUNCTION pgr_dijkstraNear( RETURNS SETOF RECORD AS $BODY$ SELECT seq, path_seq, start_vid, end_vid, node, edge, cost, agg_cost - FROM _pgr_dijkstra(_pgr_get_statement($1), $2::BIGINT[], ARRAY[$3]::BIGINT[], directed, false, false, cap); + FROM _pgr_dijkstra(_pgr_get_statement($1), $2::BIGINT[], ARRAY[$3]::BIGINT[], directed, false, false, cap, false); $BODY$ LANGUAGE sql VOLATILE STRICT COST 100 diff --git a/sql/driving_distance/_drivingDistance.sql b/sql/driving_distance/_drivingDistance.sql index 55513c77736..368d7bad7d7 100644 --- a/sql/driving_distance/_drivingDistance.sql +++ b/sql/driving_distance/_drivingDistance.sql @@ -25,10 +25,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ********************************************************************PGR-GNU*/ ----------------------- --- pgr_drivingDistance ----------------------- - --v3.6 CREATE FUNCTION _pgr_drivingDistancev4( TEXT, -- edges_sql @@ -48,8 +44,6 @@ RETURNS SETOF RECORD AS 'MODULE_PATHNAME' LANGUAGE c VOLATILE STRICT; --- COMMENTS - COMMENT ON FUNCTION _pgr_drivingDistancev4(TEXT, ANYARRAY, FLOAT, BOOLEAN, BOOLEAN) IS 'pgRouting internal function'; diff --git a/sql/legacy/alpha_shape.sql b/sql/legacy/alpha_shape.sql deleted file mode 100644 index 90585414a80..00000000000 --- a/sql/legacy/alpha_shape.sql +++ /dev/null @@ -1,74 +0,0 @@ -/*PGR-GNU***************************************************************** - -Copyright (c) 2019 Celia Virginia Vergara Castillo -Mail: project@pgrouting.org - ------- - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - ********************************************************************PGR-GNU*/ - ------------------------------------------------------------------------ --- legacy --- The sql should return vertex x,y values. - -- Before: id is compulsory - -- Legacy: id is ignored --- Return ordered vertex ids. - -- Before: the sequence was does not represent a closed linestring - -- Legacy: the sequence was represent a closed linestring ------------------------------------------------------------------------ -CREATE OR REPLACE FUNCTION pgr_alphashape( - text, -- SQL with x, y - alpha float8 DEFAULT 0, - OUT x float8, - OUT y float8) -RETURNS SETOF record -AS -$BODY$ -DECLARE - rec record; - old_poly_seq BIGINT = 1; - old_ring BIGINT = 1; -BEGIN - FOR rec IN - WITH - multiPoly AS (SELECT pgr_pointsAsPolygon($1, sqrt(alpha)) AS geom), - singlePoly AS (SELECT (ST_dump(geom)).path[1] AS poly_seq, (ST_dump(geom)).geom FROM multipoly), - polydump AS (SELECT poly_seq, ST_DumpPoints(geom) dp FROM singlePoly) - SELECT poly_seq, (dp).path[1] AS ring, (dp).path[2] AS point_seq, st_asText((dp).geom) AS geom - FROM polydump - ORDER BY poly_seq, ring, point_seq - LOOP - IF (old_poly_seq != rec.poly_seq OR old_ring != rec.ring) THEN - RAISE NOTICE '% %', rec.poly_seq, rec.ring; - x = NULL; - y = NULL; - RETURN NEXT; - old_poly_seq := rec.poly_seq; - old_ring := rec.ring; - END IF; - - x = ST_X(rec.geom); - y = ST_Y(rec.geom); - - RETURN NEXT; - END LOOP; -END -$BODY$ -LANGUAGE plpgsql VOLATILE STRICT; - -COMMENT ON FUNCTION pgr_alphaShape(TEXT, FLOAT) -IS 'Legacy'; diff --git a/sql/legacy/legacy-developers.sql b/sql/legacy/legacy-developers.sql deleted file mode 100644 index 77c7fbb61af..00000000000 --- a/sql/legacy/legacy-developers.sql +++ /dev/null @@ -1,470 +0,0 @@ -/*PGR-GNU***************************************************************** - -FILE: legacy-developers.sql - -Copyright (c) 2015 pgRouting developers -Mail: project@pgrouting.org - ------- - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - ********************************************************************PGR-GNU*/ -------------------------------------------------------------------------------- --- Legacy FUNCTIONs that were meant to be used by --- pgRouting developers --- These FUNCTIONs wer used on the plpgsql FUNCTIONs - - --- FILE intended to be used on 3.0 -------------------------------------------------------------------------------- - ------------------------------------------------------------------------------- --- Deprecated on 2.3 --- --- pgr_getColumnName --- pgr_getTableName --- pgr_isColumnIndexed --- pgr_isColumnInTable --- pgr_quote_ident --- pgr_versionless --- pgr_startPoint --- pgr_endPoint --- pgr_pointToid RENAMED and deprecated and never announced no one has complained ------------------------------------------------------------------------------- - - --- deprecated on 2.1.0 -CREATE OR REPLACE FUNCTION pgr_getColumnName(tab text, col text) -RETURNS text AS -$BODY$ -DECLARE - sname text; - tname text; - table_name text; -BEGIN - IF pgr_isColumnInTable(tab, col) THEN RETURN NULL; - END IF; - SELECT pgr_getTableName($1) into sname, tname; - table_name := sname || '.' || tname; - EXECUTE 'SELECT ' || quote_ident(col) || ' FROM ' || table_name || ' LIMIT 1'; - RETURN col; - EXCEPTION WHEN others THEN - BEGIN - EXECUTE 'SELECT ' || quote_ident(lower(col)) || ' FROM ' || table_name || ' LIMIT 1'; - RETURN lower(col); - EXCEPTION WHEN others THEN - RETURN NULL; - END; - -END; -$BODY$ -LANGUAGE plpgsql VOLATILE STRICT; - - - - --- deprecated on 2.1.0 -CREATE OR REPLACE FUNCTION pgr_getTableName(IN tab text,OUT sname text,OUT tname text) -RETURNS RECORD AS -$BODY$ -DECLARE - table_oid regclass; - table_name text; -BEGIN - table_oid := $1::regclass; - -- $1 := replace($1, '"', ''); - SELECT sname, tname FROM _pgr_getTableName($1, 0, 'pgr_getTableName') into sname,tname; - EXCEPTION WHEN others THEN - BEGIN - table_oid := lower($1)::regclass; - SELECT sname, tname FROM _pgr_getTableName(lower($1), 0, 'pgr_getTableName') into sname,tname; - EXCEPTION WHEN others THEN - sname = 'public'; - tname = NULL; - END; -END; -$BODY$ -LANGUAGE plpgsql VOLATILE STRICT; - - - - - --- deprecated on 2.1.0 -CREATE OR REPLACE FUNCTION pgr_isColumnIndexed(tab text, col text) -RETURNS boolean AS -$BODY$ -DECLARE table_oid regclass; -BEGIN - table_oid := $1::regclass; - $1 := replace(tab, '"', ''); - RETURN _pgr_isColumnIndexed($1, $2); -END; -$BODY$ -LANGUAGE plpgsql VOLATILE STRICT; - - - - --- deprecated on 2.1.0 -CREATE OR REPLACE FUNCTION pgr_isColumnInTable(tab text, col text) -RETURNS boolean AS -$BODY$ -DECLARE - cname text; - sname text; - tname text; - table_name text; -BEGIN - SELECT pgr_getTableName($1) into sname, tname; - table_name := sname || '.' || tname; - EXECUTE 'SELECT ' || quote_ident(col) || ' FROM ' || table_name || ' LIMIT 1'; - RETURN true; - EXCEPTION WHEN others THEN - BEGIN - EXECUTE 'SELECT ' || quote_ident(lower(col)) || ' FROM ' || table_name || ' LIMIT 1'; - RETURN true; - EXCEPTION WHEN others THEN - RETURN false; - END; -END; -$BODY$ - LANGUAGE plpgsql VOLATILE STRICT; - - - - --- deprecated on 2.1.0 -CREATE OR REPLACE FUNCTION pgr_quote_ident(idname text) -RETURNS text as -$BODY$ - SELECT quote_ident($1); -$BODY$ -LANGUAGE sql IMMUTABLE; - - - - - --- deprecated on 2.1.0 -CREATE OR REPLACE FUNCTION pgr_versionless(v1 text, v2 text) -RETURNS boolean AS -$BODY$ - SELECT _pgr_versionless($1, $2); -$BODY$ -LANGUAGE sql VOLATILE STRICT; - - - - --- deprecated on 2.1.0 -CREATE OR REPLACE FUNCTION pgr_startPoint(g geometry) - RETURNS geometry as -$BODY$ - SELECT ST_startPoint($1); -$BODY$ -LANGUAGE sql IMMUTABLE; - - - - --- deprecated on 2.1.0 -CREATE OR REPLACE FUNCTION pgr_endPoint(g geometry) - RETURNS geometry as -$BODY$ - SELECT ST_endPoint($1); -$BODY$ -LANGUAGE sql IMMUTABLE; - - - -/* RENAMED and deprecated and never announced no one has complained --- deprecated on 2.1.0 -CREATE OR REPLACE FUNCTION pgr_pointToId(point geometry, tolerance double precision, vertname text, srid integer) -RETURNS bigint AS -$BODY$ - SELECT _pgr_pointToId($1, $2, $3, $4); -$BODY$ -LANGUAGE sql VOLATILE STRICT; -*/ - ------------------------------------------------------------------------------- --- Deprecated on 2.3 --- --- pgr_flipedges --- pgr_texttopoints --- pgr_vidsToDMatrix --- pgr_vidsToDMatrix --- pgr_pointstodmatrix ------------------------------------------------------------------------------- - --- Added on 2.1.0 --- deprecated on 2.3.0 -CREATE OR REPLACE FUNCTION pgr_flipedges(ga geometry[]) - RETURNS geometry[] as -$BODY$ -DECLARE - nn integer; - i integer; - g geometry; - -BEGIN - nn := array_length(ga, 1); - IF nn = 1 THEN - RETURN ga; - END IF; - - g := ST_StartPoint(ga[1]); - - IF ST_StartPoint(ga[2]) = g or ST_EndPoint(ga[2]) = g THEN - ga[1] := ST_Reverse(ga[1]); - END IF; - - g := ST_EndPoint(ga[1]); - - FOR i in 2 .. nn LOOP - IF g = ST_EndPoint(ga[i]) THEN - ga[i] := ST_Reverse(ga[i]); - END IF; - g := ST_EndPoint(ga[i]); - END LOOP; - - RETURN ga; -end; -$BODY$ -LANGUAGE plpgsql immutable; - - - --- Added on 2.1.0 --- deprecated on 2.3.0 -CREATE OR REPLACE FUNCTION pgr_texttopoints(pnts text, srid integer DEFAULT(4326)) - RETURNS geometry[] as -$BODY$ -DECLARE - a text[]; - t text; - p geometry; - g geometry[]; - -BEGIN - a := string_to_array(replace(pnts, ',', ' '), ';'); - FOR t in SELECT unnest(a) LOOP - p := ST_pointfromtext('POINT(' || t || ')', srid); - g := g || p; - END LOOP; - - RETURN g; -end; -$BODY$ -LANGUAGE plpgsql immutable; - - - --- Added on 2.1.0 --- deprecated on 2.3.0 -CREATE OR REPLACE FUNCTION pgr_vidsToDMatrix(sql TEXT, vids INTEGER[], dir BOOLEAN, has_rcost BOOLEAN, want_symmetric BOOLEAN) -RETURNS float8[] AS -$BODY$ -DECLARE -dmatrix_row float8[]; -dmatrix float8[]; -rr RECORD; -ids INTEGER[]; -total BIGINT; -BEGIN - ids := ARRAY(SELECT DISTINCT UNNEST(vids) ORDER BY 1); - - IF want_symmetric THEN - dir = false; - END IF; - - total := array_length(ids, 1); - - FOR i in 1 .. total LOOP - dmatrix_row := dmatrix_row || '+Infinity'::float8; - END LOOP; - - FOR i in 1 .. total LOOP - dmatrix := dmatrix || ARRAY[dmatrix_row]; - dmatrix[i][i] = 0; - END LOOP; - - FOR rr IN EXECUTE - 'SELECT start_vid, end_vid, agg_cost FROM pgr_dijkstraCostMatrix($1, $2, $3)' - USING - sql, ids, dir - LOOP - dmatrix[(SELECT idx FROM generate_subscripts(ids, 1) AS idx WHERE ids[idx] = rr.start_vid)] - [(SELECT idx FROM generate_subscripts(ids, 1) AS idx WHERE ids[idx] = rr.end_vid)] := rr.agg_cost; - END LOOP; - - RETURN dmatrix; -END -$BODY$ -LANGUAGE plpgsql VOLATILE -COST 100; - - --- Added on 2.1.0 --- deprecated on 2.3.0 -CREATE OR REPLACE FUNCTION pgr_vidstodmatrix( - IN vids integer[], - IN pnts geometry[], - IN edges text, - tol float8 DEFAULT(0.1), - OUT dmatrix double precision[], - OUT ids integer[]) - RETURNS record as -$BODY$ -DECLARE - dmatrix_row float8[]; - nn integer; - rr record; - t float8[]; - -BEGIN - ids := array(SELECT DISTINCT unnest(vids::integer[]) ORDER BY 1); - - nn := array_length(ids, 1); - - FOR i in 1 .. nn LOOP - dmatrix_row := dmatrix_row || '+Infinity'::float8; - END LOOP; - - FOR i in 1 .. nn LOOP - dmatrix := dmatrix || ARRAY[dmatrix_row]; - dmatrix[i][i] = 0; - END LOOP; - - FOR i in 1 .. nn LOOP - dmatrix := dmatrix || ARRAY[t]; - END LOOP; - - FOR rr IN EXECUTE - 'SELECT start_vid, end_vid, agg_cost FROM pgr_dijkstraCostMatrix($1, $2, false)' - USING - 'SELECT id, source, target, cost FROM ' || edges, - ids - LOOP - dmatrix[(SELECT idx FROM generate_subscripts(ids, 1) AS idx WHERE ids[idx] = rr.start_vid)] - [(SELECT idx FROM generate_subscripts(ids, 1) AS idx WHERE ids[idx] = rr.end_vid)] := rr.agg_cost; - END LOOP; - - RETURN; -end; -$BODY$ -LANGUAGE plpgsql STABLE cost 200; - - - --- Added on 2.1.0 --- deprecated on 2.3.0 -CREATE OR REPLACE FUNCTION pgr_pointstodmatrix(pnts geometry[], mode integer default (0), OUT dmatrix double precision[], OUT ids integer[]) - RETURNS record as -$BODY$ -DECLARE - r record; - -BEGIN - dmatrix := array[]::double precision[]; - ids := array[]::integer[]; - - FOR r in with nodes AS (SELECT row_number() over()::integer AS id, p FROM (select unnest(pnts) AS p) AS foo) - SELECT i, array_agg(dist) AS arow FROM ( - SELECT a.id AS i, b.id AS j, - case when mode=0 - THEN ST_distance(a.p, b.p) - ELSE ST_distance_sphere(a.p, b.p) - END AS dist - FROM nodes a, nodes b - ORDER BY a.id, b.id - ) AS foo group by i ORDER BY i LOOP - - dmatrix := array_cat(dmatrix, array[r.arow]); - ids := ids || array[r.i]; - END LOOP; -end; -$BODY$ -LANGUAGE plpgsql STABLE; - ------------------------------------------------------------------------ - --- Added on 2.1.0 --- deprecated on 2.4.0 -CREATE OR REPLACE FUNCTION pgr_pointstovids(pnts geometry[], edges text, tol float8 DEFAULT(0.01)) - RETURNS integer[] as -$BODY$ -DECLARE - v integer[]; - g geometry; -BEGIN - FOR g in SELECT unnest(pnts) LOOP - v := v || pgr_pointtoedgenode(edges, g, tol); - END LOOP; - - RETURN v; -end; -$BODY$ -LANGUAGE plpgsql STABLE; - - - ------------------------------------------------------------------------ - --- Added on 2.1.0 --- deprecated on 2.5.0 -CREATE OR REPLACE FUNCTION pgr_pointtoedgenode(edges text, pnt geometry, tol float8) - RETURNS integer as -$BODY$ -DECLARE - rr record; - pct float; - debuglevel text; - -BEGIN - execute 'SELECT source, target, the_geom FROM ' || quote_ident(edges) || - ' where ST_dwithin(''' || pnt::text || - '''::geometry, the_geom, ' || tol || ') ORDER BY ST_distance(''' || pnt::text || - '''::geometry, the_geom) asc limit 1' into rr; - - IF rr.the_geom IS NOT null THEN - IF geometrytype(rr.the_geom)='MULTILINESTRING' THEN - rr.the_geom := ST_GeometryN(rr.the_geom, 1); - END IF; - - IF _pgr_versionless(postgis_version(), '2.0') THEN - pct := ST_line_locate_point(rr.the_geom, pnt); - ELSE - pct := ST_lineLocatePoint(rr.the_geom, pnt); - END IF; - - IF pct < 0.5 THEN - RETURN rr.source; - ELSE - RETURN rr.target; - END IF; - ELSE - RETURN -1; - END IF; -end; -$BODY$ -LANGUAGE plpgsql VOLATILE -cost 5; - - - ------------------------------------------------------------------------------- diff --git a/sql/legacy/legacy_experimental.sql b/sql/legacy/legacy_experimental.sql deleted file mode 100644 index 2c22c75d678..00000000000 --- a/sql/legacy/legacy_experimental.sql +++ /dev/null @@ -1,496 +0,0 @@ -/*PGR-GNU***************************************************************** - -Copyright (c) 2015 ~ pgRouting developers -Mail: project@pgrouting.org - ------- - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - ********************************************************************PGR-GNU*/ - ----------------------------------------------------------------------------- --- Experimental function: pgr_labelGraph --- Original developer: Zia Mohammed --- --- Availability: --- - from v2.1 --- - up to v2.6 --- - moved to legacy on v3.0 --- --- Use Components family of functions instead ----------------------------------------------------------------------------- - -CREATE OR REPLACE FUNCTION pgr_labelGraph( - edge_table text, - id text default 'id', - source text default 'source', - target text default 'target', - subgraph text default 'subgraph', - rows_where text default 'true' - ) - RETURNS character varying AS -$BODY$ - -DECLARE - naming record; - schema_name text; - table_name text; - garbage text; - incre integer; - table_schema_name text; - query text; - ecnt integer; - sql1 text; - rec1 record; - sql2 text; - rec2 record; - rec_count record; - rec_single record; - graph_id integer; - gids int []; - -BEGIN - raise notice 'Processing:'; - raise notice 'pgr_brokenGraph(''%'',''%'',''%'',''%'',''%'',''%'')', edge_table,id,source,target,subgraph,rows_where; - raise notice 'Performing initial checks, please hold on ...'; - - Raise Notice 'Starting - Checking table ...'; - BEGIN - raise debug 'Checking % table existance', edge_table; - execute 'select * from pgr_getTableName('|| quote_literal(edge_table) ||')' into naming; - schema_name = naming.sname; - table_name = naming.tname; - table_schema_name = schema_name||'.'||table_name; - IF schema_name is null then - raise notice 'no schema'; - return 'FAIL'; - else - if table_name is null then - raise notice 'no table'; - return 'FAIL'; - end if; - end if; - END; - Raise Notice 'Ending - Checking table'; - - Raise Notice 'Starting - Checking columns'; - BEGIN - raise debug 'Checking exitance of necessary columns inside % table', edge_table; - execute 'select * from pgr_isColumnInTable('|| quote_literal(table_schema_name) ||', '|| quote_literal(id) ||')' into naming; - if naming.pgr_iscolumnintable = 'f' then - raise notice 'no id column'; - return 'FAIL'; - end if; - execute 'select * from pgr_isColumnInTable('|| quote_literal(table_schema_name) ||', '|| quote_literal(source) ||')' into naming; - if naming.pgr_iscolumnintable = 'f' then - raise notice 'no source column'; - return 'FAIL'; - end if; - execute 'select * from pgr_isColumnInTable('|| quote_literal(table_schema_name) ||', '|| quote_literal(target) ||')' into naming; - if naming.pgr_iscolumnintable = 'f' then - raise notice 'no target column'; - return 'FAIL'; - end if; - execute 'select * from pgr_isColumnInTable('|| quote_literal(table_schema_name) ||', '|| quote_literal(subgraph) ||')' into naming; - if naming.pgr_iscolumnintable = 't' then - raise notice 'subgraph column already in the table'; - return 'FAIL'; - end if; - END; - Raise Notice 'Ending - Checking columns'; - - Raise Notice 'Starting - Checking rows_where condition'; - BEGIN - raise debug 'Checking rows_where condition'; - query='select count(*) from '|| pgr_quote_ident(table_schema_name) ||' where '|| rows_where; - execute query into ecnt; - raise debug '-->Rows where condition: OK'; - raise debug ' --> OK'; - EXCEPTION WHEN OTHERS THEN - raise notice 'Got %', SQLERRM; - Raise notice 'ERROR: Condition is not correct. Please execute the following query to test your condition'; - Raise notice '%', query; - return 'FAIL'; - END; - Raise Notice 'Ending - Checking rows_where condition'; - - garbage := 'garbage001'; - incre := 1; - Raise Notice 'Starting - Checking temporary column'; - Begin - raise debug 'Checking Checking temporary columns existance'; - - While True - Loop - execute 'select * from pgr_isColumnInTable('|| quote_literal(table_schema_name) ||', '|| quote_literal(garbage) ||')' into naming; - If naming.pgr_iscolumnintable = 't' THEN - incre := incre + 1; - garbage := 'garbage00'||incre||''; - ELSE - EXIT; - END IF; - End Loop; - End; - Raise Notice 'Ending - Checking temporary column'; - - Raise Notice 'Starting - Calculating subgraphs'; - BEGIN - --------- Add necessary columns ---------- - EXECUTE 'ALTER TABLE '|| pgr_quote_ident(table_schema_name) ||' ADD COLUMN ' || pgr_quote_ident(subgraph) || ' INTEGER DEFAULT -1'; - EXECUTE 'ALTER TABLE '|| pgr_quote_ident(table_schema_name) ||' ADD COLUMN ' || pgr_quote_ident(garbage) || ' INTEGER DEFAULT 0'; - graph_id := 1; - - EXECUTE 'select count(*) as count from '|| pgr_quote_ident(table_schema_name) ||' where '|| rows_where ||'' into rec_count; - if rec_count.count = 0 then - RETURN 'rows_where condition generated 0 rows'; - end if; - - WHILE TRUE - LOOP - ---------- Assign the very first -1 row graph_id ---------- - EXECUTE 'SELECT ' || pgr_quote_ident(id) || ' AS gid FROM '|| pgr_quote_ident(table_schema_name) ||' WHERE '|| rows_where ||' AND ' || pgr_quote_ident(subgraph) || ' = -1 LIMIT 1' INTO rec_single; - EXECUTE 'UPDATE '|| pgr_quote_ident(table_schema_name) ||' SET ' || pgr_quote_ident(subgraph) || ' = ' || graph_id || ' WHERE ' || pgr_quote_ident(id) || ' = ' || rec_single.gid || ''; - - --------- Search other rows with that particular graph_id ----------- - WHILE TRUE - LOOP - EXECUTE 'SELECT COUNT(*) FROM '|| pgr_quote_ident(table_schema_name) ||' WHERE ' || pgr_quote_ident(subgraph) || ' = ' || graph_id || ' AND ' || pgr_quote_ident(garbage) || ' = 0' into rec_count; - ----------- The following if else will check those rows which already have entertained ------------ - IF (rec_count.count > 0) THEN - sql1 := 'SELECT ' || pgr_quote_ident(id) || ' AS gid, ' || pgr_quote_ident(source) || ' AS source, ' || pgr_quote_ident(target) || ' AS target FROM '|| pgr_quote_ident(table_schema_name) ||' WHERE ' || pgr_quote_ident(subgraph) || ' = ' || graph_id || ' AND ' || pgr_quote_ident(garbage) || ' = 0'; - FOR rec1 IN EXECUTE sql1 - LOOP - sql2 := 'SELECT ' || pgr_quote_ident(id) || ' AS gid, ' || pgr_quote_ident(source) || ' AS source, ' || pgr_quote_ident(target) || ' AS target FROM '|| pgr_quote_ident(table_schema_name) ||' WHERE '|| pgr_quote_ident(source) ||' = '|| rec1.source ||' OR '|| pgr_quote_ident(target) ||' = '|| rec1.source ||' OR '|| pgr_quote_ident(source) ||' = '|| rec1.target ||' OR '|| pgr_quote_ident(target) ||' = '|| rec1.target ||''; - FOR rec2 IN EXECUTE sql2 - LOOP - EXECUTE 'UPDATE '|| pgr_quote_ident(table_schema_name) ||' SET ' || pgr_quote_ident(subgraph) || ' = ' || graph_id || ' WHERE ' || pgr_quote_ident(id) || ' = ' || rec2.gid || ''; - END LOOP; - EXECUTE 'UPDATE '|| pgr_quote_ident(table_schema_name) ||' SET ' || pgr_quote_ident(garbage) || ' = 1 WHERE ' || pgr_quote_ident(id) || ' = ' || rec1.gid || ''; - END LOOP; - ELSE - EXIT; - END IF; - END LOOP; - - ------ Following is to exit the while loop. 0 means no more -1 id. - EXECUTE 'SELECT COUNT(*) AS count FROM '|| pgr_quote_ident(table_schema_name) ||' WHERE '|| rows_where ||' AND ' || pgr_quote_ident(subgraph) || ' = -1' INTO rec_count; - If (rec_count.count = 0) THEN - EXIT; - ELSE - graph_id := graph_id + 1; - END IF; - END LOOP; - - ----------- Drop garbage column ------------ - EXECUTE 'ALTER TABLE '|| pgr_quote_ident(table_schema_name) ||' DROP COLUMN ' || pgr_quote_ident(garbage) ||''; - Raise Notice 'Successfully complicated calculating subgraphs'; - END; - Raise Notice 'Ending - Calculating subgraphs'; - - RETURN 'OK'; - -END; -$BODY$ -LANGUAGE plpgsql VOLATILE STRICT; - ----------------------------------------------------------------------------- --- Experimental functions: --- pgr_maxFlowPushRelabel --- pgr_maximumcardinalitymatching --- pgr_maxFlowBoykovKolmogorov --- pgr_maxFlowEdmondsKarp --- --- Original developer: Andrea Nardelli --- mail: nrd.nardelli@gmail.com --- --- Availability: --- - from v2.3 --- - renamed on v2.5 --- - moved old names to legacy on v3.0 --- --- Use current names of Flow family of functions instead ----------------------------------------------------------------------------- - ----------------------------------------------------------------------------- --- pgr_maxFlowPushRelabel ----------------------------------------------------------------------------- -CREATE OR REPLACE FUNCTION pgr_maxFlowPushRelabel( - edges_sql TEXT, - source_vertex BIGINT, - sink_vertex BIGINT, - OUT seq INTEGER, - OUT edge_id BIGINT, - OUT source BIGINT, - OUT target BIGINT, - OUT flow BIGINT, - OUT residual_capacity BIGINT - ) - RETURNS SETOF RECORD AS - $BODY$ - BEGIN - RETURN QUERY SELECT seq, edge_id, source, target, flow, residual_capacity - FROM pgr_PushRelabel($1, $2, $3); - END - $BODY$ - LANGUAGE plpgsql VOLATILE; - -CREATE OR REPLACE FUNCTION pgr_maxFlowPushRelabel( - edges_sql TEXT, - source_vertex BIGINT, - sink_vertices ANYARRAY, - OUT seq INTEGER, - OUT edge_id BIGINT, - OUT source BIGINT, - OUT target BIGINT, - OUT flow BIGINT, - OUT residual_capacity BIGINT - ) - RETURNS SETOF RECORD AS - $BODY$ - BEGIN - RETURN QUERY SELECT seq, edge_id, source, target, flow, residual_capacity - FROM pgr_PushRelabel($1, $2, $3); - END - $BODY$ - LANGUAGE plpgsql VOLATILE; - -CREATE OR REPLACE FUNCTION pgr_maxFlowPushRelabel( - edges_sql TEXT, - source_vertices ANYARRAY, - sink_vertex BIGINT, - OUT seq INTEGER, - OUT edge_id BIGINT, - OUT source BIGINT, - OUT target BIGINT, - OUT flow BIGINT, - OUT residual_capacity BIGINT - ) - RETURNS SETOF RECORD AS - $BODY$ - BEGIN - RETURN QUERY SELECT seq, edge_id, source, target, flow, residual_capacity - FROM pgr_PushRelabel($1, $2, $3); - END - $BODY$ - LANGUAGE plpgsql VOLATILE; - -CREATE OR REPLACE FUNCTION pgr_maxFlowPushRelabel( - edges_sql TEXT, - source_vertices ANYARRAY, - sink_vertices ANYARRAY, - OUT seq INTEGER, - OUT edge_id BIGINT, - OUT source BIGINT, - OUT target BIGINT, - OUT flow BIGINT, - OUT residual_capacity BIGINT - ) - RETURNS SETOF RECORD AS - $BODY$ - BEGIN - RETURN QUERY SELECT seq, edge_id, source, target, flow, residual_capacity - FROM pgr_PushRelabel($1, $2, $3); - END - $BODY$ - LANGUAGE plpgsql VOLATILE; - ----------------------------------------------------------------------------- --- pgr_maxFlowBoykovKolmogorov ----------------------------------------------------------------------------- -CREATE OR REPLACE FUNCTION pgr_maxFlowBoykovKolmogorov( - edges_sql TEXT, - source_vertex BIGINT, - sink_vertex BIGINT, - OUT seq INTEGER, - OUT edge_id BIGINT, - OUT source BIGINT, - OUT target BIGINT, - OUT flow BIGINT, - OUT residual_capacity BIGINT - ) - RETURNS SETOF RECORD AS - $BODY$ - BEGIN - RETURN QUERY SELECT seq, edge_id, source, target, flow, residual_capacity - FROM pgr_boykovKolmogorov($1, $2, $3); - END - $BODY$ - LANGUAGE plpgsql VOLATILE; - -CREATE OR REPLACE FUNCTION pgr_maxFlowBoykovKolmogorov( - edges_sql TEXT, - source_vertex BIGINT, - sink_vertices ANYARRAY, - OUT seq INTEGER, - OUT edge_id BIGINT, - OUT source BIGINT, - OUT target BIGINT, - OUT flow BIGINT, - OUT residual_capacity BIGINT - ) - RETURNS SETOF RECORD AS - $BODY$ - BEGIN - RETURN QUERY SELECT seq, edge_id, source, target, flow, residual_capacity - FROM pgr_boykovKolmogorov($1, $2, $3); - END - $BODY$ - LANGUAGE plpgsql VOLATILE; - -CREATE OR REPLACE FUNCTION pgr_maxFlowBoykovKolmogorov( - edges_sql TEXT, - source_vertices ANYARRAY, - sink_vertex BIGINT, - OUT seq INTEGER, - OUT edge_id BIGINT, - OUT source BIGINT, - OUT target BIGINT, - OUT flow BIGINT, - OUT residual_capacity BIGINT - ) - RETURNS SETOF RECORD AS - $BODY$ - BEGIN - RETURN QUERY SELECT seq, edge_id, source, target, flow, residual_capacity - FROM pgr_boykovKolmogorov($1, $2, $3); - END - $BODY$ - LANGUAGE plpgsql VOLATILE; - -CREATE OR REPLACE FUNCTION pgr_maxFlowBoykovKolmogorov( - edges_sql TEXT, - source_vertices ANYARRAY, - sink_vertices ANYARRAY, - OUT seq INTEGER, - OUT edge_id BIGINT, - OUT source BIGINT, - OUT target BIGINT, - OUT flow BIGINT, - OUT residual_capacity BIGINT - ) - RETURNS SETOF RECORD AS - $BODY$ - BEGIN - RETURN QUERY SELECT seq, edge_id, source, target, flow, residual_capacity - FROM pgr_boykovKolmogorov($1, $2, $3); - END - $BODY$ - LANGUAGE plpgsql VOLATILE; - ----------------------------------------------------------------------------- --- pgr_maxFlowEdmondsKarp ----------------------------------------------------------------------------- -CREATE OR REPLACE FUNCTION pgr_maxFlowEdmondsKarp( - edges_sql TEXT, - source_vertex BIGINT, - sink_vertex BIGINT, - OUT seq INTEGER, - OUT edge_id BIGINT, - OUT source BIGINT, - OUT target BIGINT, - OUT flow BIGINT, - OUT residual_capacity BIGINT - ) - RETURNS SETOF RECORD AS - $BODY$ - BEGIN - RETURN QUERY SELECT seq, edge_id, source, target, flow, residual_capacity - FROM pgr_edmondsKarp($1, $2, $3); - END - $BODY$ - LANGUAGE plpgsql VOLATILE; - - -CREATE OR REPLACE FUNCTION pgr_maxFlowEdmondsKarp( - edges_sql TEXT, - source_vertex BIGINT, - sink_vertices ANYARRAY, - OUT seq INTEGER, - OUT edge_id BIGINT, - OUT source BIGINT, - OUT target BIGINT, - OUT flow BIGINT, - OUT residual_capacity BIGINT - ) - RETURNS SETOF RECORD AS - $BODY$ - BEGIN - RETURN QUERY SELECT seq, edge_id, source, target, flow, residual_capacity - FROM pgr_edmondsKarp($1, $2, $3); - END - $BODY$ - LANGUAGE plpgsql VOLATILE; - -CREATE OR REPLACE FUNCTION pgr_maxFlowEdmondsKarp( - edges_sql TEXT, - source_vertices ANYARRAY, - sink_vertex BIGINT, - OUT seq INTEGER, - OUT edge_id BIGINT, - OUT source BIGINT, - OUT target BIGINT, - OUT flow BIGINT, - OUT residual_capacity BIGINT - ) - RETURNS SETOF RECORD AS - $BODY$ - BEGIN - RETURN QUERY SELECT seq, edge_id, source, target, flow, residual_capacity - FROM pgr_edmondsKarp($1, $2, $3); - END - $BODY$ - LANGUAGE plpgsql VOLATILE; - -CREATE OR REPLACE FUNCTION pgr_maxFlowEdmondsKarp( - edges_sql TEXT, - source_vertices ANYARRAY, - sink_vertices ANYARRAY, - OUT seq INTEGER, - OUT edge_id BIGINT, - OUT source BIGINT, - OUT target BIGINT, - OUT flow BIGINT, - OUT residual_capacity BIGINT - ) - RETURNS SETOF RECORD AS - $BODY$ - BEGIN - RETURN QUERY SELECT seq, edge_id, source, target, flow, residual_capacity - FROM pgr_edmondsKarp($1, $2, $3); - END - $BODY$ - LANGUAGE plpgsql VOLATILE; - - ----------------------------------------------------------------------------- --- pgr_maximumcardinalitymatching ----------------------------------------------------------------------------- -CREATE OR REPLACE FUNCTION pgr_maximumcardinalitymatching( - edges_sql TEXT, - directed BOOLEAN DEFAULT TRUE, - OUT seq INTEGER, - OUT edge_id BIGINT, - OUT source BIGINT, - OUT target BIGINT - ) - RETURNS SETOF RECORD AS - $BODY$ - BEGIN - RETURN QUERY SELECT seq, edge_id, source, target, flow, residual_capacity - FROM pgr_maxCardinalityMatch($1, $2); - END - $BODY$ - LANGUAGE plpgsql VOLATILE; diff --git a/sql/legacy/pgrouting_version.sql b/sql/legacy/pgrouting_version.sql deleted file mode 100644 index 263d7fd683a..00000000000 --- a/sql/legacy/pgrouting_version.sql +++ /dev/null @@ -1,56 +0,0 @@ -/*PGR-MIT***************************************************************** - -FILE: pgrouting_version.sql - -Copyright (c) 2013 pgRouting developers -Mail: project@pgrouting.org -Author: Stephen Woodbridge - ------- -MIT/X license - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - -********************************************************************PGR-MIT*/ - ---v3.0 -CREATE FUNCTION pgr_version() -RETURNS TABLE( - "version" varchar, - tag varchar, - hash varchar, - branch varchar, - boost varchar - ) AS -$BODY$ - SELECT '${PROJECT_VERSION}'::varchar AS version, - '${PROJECT_FULL_VERSION}'::varchar AS tag, - '${PROJECT_GIT_HASH}'::varchar AS hash, - '${PROJECT_GIT_BRANCH}'::varchar AS branch, - '${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}'::varchar AS boost; -$BODY$ -LANGUAGE sql IMMUTABLE; - -COMMENT ON FUNCTION pgr_version() IS -'pgr_version -- Documentation - - ${PROJECT_DOC_LINK}/pgr_version.html -'; diff --git a/sql/legacy/pointsAsPolygon.sql b/sql/legacy/pointsAsPolygon.sql deleted file mode 100644 index 0bd3b6c381c..00000000000 --- a/sql/legacy/pointsAsPolygon.sql +++ /dev/null @@ -1,73 +0,0 @@ -/*PGR-GNU***************************************************************** - -Copyright (c) 2015~2019 Celia Virginia Vergara Castillo -Mail: project@pgrouting.org - ------- - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - ********************************************************************PGR-GNU*/ - ----------------------- --- pgr_pointsAsPolygon ----------------------- - - -/* ----------------------------------------------------------- --- Draws an alpha shape around given set of points. --- ** This should be rewritten as an aggregate. ** ----------------------------------------------------------- -*/ -CREATE OR REPLACE FUNCTION pgr_pointsAsPolygon( - VARCHAR, -- query (required) - alpha FLOAT8 DEFAULT 0) - -RETURNS geometry AS -$BODY$ -DECLARE - geoms geometry[]; - vertex_result record; - i BIGINT; - q TEXT; - -BEGIN - q = format($$ - WITH - a AS ( - %1$s - ), - b AS (SELECT ST_makePoint(x, y) AS geom FROM a) - SELECT array_agg(geom) FROM b - $$, $1); - -- RAISE NOTICE '%', q; - EXECUTE q INTO geoms; - - -- RAISE NOTICE 'length = %', array_length(geoms, 1); - RETURN pgr_alphashape1(geoms, sqrt(alpha), false); -END; -$BODY$ -LANGUAGE plpgsql VOLATILE STRICT; - -COMMENT ON FUNCTION pgr_pointsAsPolygon(VARCHAR, FLOAT8) -IS 'pgr_pointsAsPolygon -- Parameters: - - An SQL with columns: id, x, y -- Optional Parameters: - - alpha := 0 -- Documentation: - - ${PROJECT_DOC_LINK}/pgr_pointsAsPolygon.html -'; diff --git a/sql/legacy/routing_legacy.sql b/sql/legacy/routing_legacy.sql deleted file mode 100644 index 65913e154ca..00000000000 --- a/sql/legacy/routing_legacy.sql +++ /dev/null @@ -1,316 +0,0 @@ -/*PGR-GNU***************************************************************** - -Copyright (c) 2015 ~ pgRouting developers -Mail: project@pgrouting.org - -Copyright (c) 2015 Celia Virginia Vergara Castillo -mail: vicky_vergara@hotmail.com - ------- - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - ********************************************************************PGR-GNU*/ - -CREATE TYPE pgr_costResult AS -( - seq integer, - id1 integer, - id2 integer, - cost float8 -); - -CREATE TYPE pgr_costResult3 AS -( - seq integer, - id1 integer, - id2 integer, - id3 integer, - cost float8 -); - -CREATE TYPE pgr_geomResult AS -( - seq integer, - id1 integer, - id2 integer, - geom geometry -); - ----------------------------------------------------------------------------- --- Routing function: pgr_dijkstra --- Developer: Vicky Vergara --- --- --- Availability: --- - Created on v2.0.0 --- - Deprecated signature on v2.1.0 --- - Moved to legacy on v3.0 --- --- Use the new signatures of pgr_dijkstra instead ----------------------------------------------------------------------------- - -CREATE OR REPLACE FUNCTION pgr_dijkstra( - edges_sql TEXT, - start_vid INTEGER, - end_vid INTEGER, - directed BOOLEAN, - has_rcost BOOLEAN) -RETURNS SETOF pgr_costresult AS -$BODY$ -DECLARE -has_reverse BOOLEAN; -sql TEXT; -BEGIN - RETURN query SELECT seq-1 AS seq, node::integer AS id1, edge::integer AS id2, cost - FROM _pgr_dijkstra(sql, ARRAY[$2]::BIGINT[], ARRAY[$3]::BIGINT[], directed, false); - END -$BODY$ -LANGUAGE plpgsql VOLATILE -COST 100 -ROWS 1000; - - ------------------------------------------------------------------------------ ---- Routing function: pgr_drivingDistance ---- Developer: Vicky Vergara ---- ---- ---- Availability: ---- - Created on v2.0.0 ---- - Deprecated on v2.1.0 ---- - moved to legacy on v3.0.0 ---- ---- Use the new signatures of pgr_drivingDistance instead ------------------------------------------------------------------------------ -CREATE OR REPLACE FUNCTION pgr_drivingDistance(edges_sql text, source INTEGER, distance FLOAT8, directed BOOLEAN, has_rcost BOOLEAN) -RETURNS SETOF pgr_costresult AS -$BODY$ - SELECT seq - 1, node::INTEGER, edge::INTEGER, agg_cost - FROM pgr_drivingDistance($1, ARRAY[$2]::BIGINT[], $3, $4); -$BODY$ -LANGUAGE sql VOLATILE -COST 100 -ROWS 1000; - ----------------------------------------------------------------------------- --- Routing function: pgr_ksp --- Developer: Vicky Vergara --- --- --- Availability: --- - Created on v2.0.0 --- - Deprecated on v2.1.0 --- - moved to legacy on v3.0 --- --- Use the new signature of pgr_KSP instead ----------------------------------------------------------------------------- -CREATE OR REPLACE FUNCTION pgr_ksp(edges_sql text, start_vid integer, end_vid integer, k integer, has_rcost boolean) -RETURNS SETOF pgr_costresult3 AS -$BODY$ - SELECT ((row_number() over()) -1)::integer, (path_id - 1)::integer, node::integer, edge::integer, cost - FROM pgr_ksp($1::text, $2::BIGINT, $3::BIGINT, $4, TRUE, FALSE) WHERE path_id <= k; -$BODY$ -LANGUAGE sql VOLATILE -COST 100 -ROWS 1000; - ----------------------------------------------------------------------------- --- Routing function: pgr_kdijkstraPath --- Developer: Steve Woodbridge --- --- Availability: --- - Created on v2.0.0 --- - Deprecated signature on v2.2.0 --- - Moved to legacy on v3.0 --- --- Use the new signatures of pgr_dijkstra instead ----------------------------------------------------------------------------- -CREATE OR REPLACE FUNCTION pgr_kdijkstraPath( - sql text, - source INTEGER, - targets INTEGER ARRAY, - directed BOOLEAN, - has_rcost BOOLEAN) -RETURNS SETOF pgr_costResult3 AS -$BODY$ -SELECT (row_number() over () -1)::integer, end_vid::INTEGER, node::INTEGER, edge::INTEGER, cost -FROM pgr_dijkstra($1, $2, $3, $4); -$BODY$ -LANGUAGE sql VOLATILE -COST 100 -ROWS 1000; - - ----------------------------------------------------------------------------- --- Routing function: pgr_kdijkstraCost --- Developer: Steve Woodbridge --- --- Availability: --- - Created on v2.0.0 --- - Deprecated signature on v2.2.0 --- - Moved to legacy on v3.0 --- --- Use the new signatures of pgr_dijkstraCost instead ----------------------------------------------------------------------------- -CREATE OR REPLACE FUNCTION pgr_kdijkstracost( - sql text, - source INTEGER, - targets INTEGER array, - directed BOOLEAN, - has_rcost BOOLEAN) -RETURNS SETOF pgr_costResult AS -$BODY$ - SELECT (row_number() over () -1)::integer, start_vid::integer, end_vid::INTEGER, agg_cost - FROM pgr_dijkstraCost($1, $2, $3, $4); -$BODY$ -LANGUAGE sql VOLATILE -COST 100 -ROWS 1000; - ----------------------------------------------------------------------------- --- Routing function: pgr_apspJohnson --- Developer: Vicky Vergara --- --- --- Availability: --- - Created on v2.0.0 --- - Deprecated on v2.2.0 --- - Moved to legacy on v3.0 --- --- Use the new signatures of pgr_johnson instead ----------------------------------------------------------------------------- - -CREATE OR REPLACE FUNCTION pgr_apspJohnson(edges_sql text) -RETURNS SETOF pgr_costResult AS -$BODY$ - SELECT (row_number() over () - 1)::INTEGER, start_vid::INTEGER, end_vid::INTEGER, agg_cost - FROM pgr_johnson($1, TRUE); -$BODY$ -LANGUAGE sql VOLATILE -COST 100 -ROWS 1000; - - - - ----------------------------------------------------------------------------- --- Routing function: pgr_apspWarshall --- Developer: Vicky Vergara --- --- --- Availability: --- - Created on v2.0.0 --- - Deprecated on v2.2.0 --- - Moved to legacy on v3.0 --- --- Use the new signatures of pgr_floydWarshall instead ----------------------------------------------------------------------------- -CREATE OR REPLACE FUNCTION pgr_apspWarshall(edges_sql text, directed BOOLEAN, has_rcost BOOLEAN) -RETURNS SETOF pgr_costResult AS -$BODY$ - SELECT (row_number() over () -1)::INTEGER, start_vid::INTEGER, end_vid::INTEGER, agg_cost - FROM pgr_floydWarshall($1, $2); -$BODY$ -LANGUAGE sql VOLATILE -COST 100 -ROWS 1000; - ----------------------------------------------------------------------------- --- Routing function: pgr_astar --- Developer: Vicky Vergara --- --- --- Availability: --- - Created on v2.0.0 --- - Deprecated on v2.3.0 --- - Moved to legacy on v3.0 --- --- Use the new signatures of pgr_aStar instead ----------------------------------------------------------------------------- - -CREATE OR REPLACE FUNCTION pgr_astar(edges_sql TEXT, source_id INTEGER, target_id INTEGER, directed BOOLEAN, has_rcost BOOLEAN) -RETURNS SETOF pgr_costresult AS -$BODY$ -DECLARE -has_reverse BOOLEAN; -sql TEXT; -BEGIN - RETURN query SELECT seq - 1 AS seq, node::INTEGER AS id1, edge::INTEGER AS id2, cost - FROM pgr_astar(sql, ARRAY[$2], ARRAY[$3], directed); -END -$BODY$ -LANGUAGE plpgsql VOLATILE -COST 100 -ROWS 1000; - - - ----------------------------------------------------------------------------- --- Routing function: pgr_bdDijkstra --- Developer: Vicky Vergara --- --- --- Availability: --- - Created on v2.0.0 --- - Deprecated on v2.4.0 --- - Moved to legacy on v3.0 --- --- Use the new signatures of pgr_bdDijkstra instead ----------------------------------------------------------------------------- -CREATE OR REPLACE FUNCTION pgr_bdDijkstra(edges_sql TEXT, start_vid INTEGER, end_vid INTEGER, directed BOOLEAN, has_rcost BOOLEAN) -RETURNS SETOF pgr_costresult AS -$BODY$ -DECLARE -has_reverse BOOLEAN; -sql TEXT; -BEGIN - SELECT seq - 1 AS seq, node::integer AS id1, edge::integer AS id2, cost - FROM pgr_bdDijkstra($1, ARRAY[$2]::BIGINT[], ARRAY[$3]::BIGINT[], $4); -END -$BODY$ -LANGUAGE plpgsql VOLATILE -COST 100 -ROWS 1000; - - - - ----------------------------------------------------------------------------- --- Routing function: pgr_bdAstar --- Developer: Vicky Vergara --- --- --- Availability: --- - Created on v2.0.0 --- - Deprecated on v2.5.0 --- - Moved to legacy on v3.0 --- --- Use the new signatures of pgr_bdAstar instead ----------------------------------------------------------------------------- -CREATE OR REPLACE FUNCTION pgr_bdAstar( - edges_sql TEXT, - start_vid INTEGER, - end_vid INTEGER, - directed BOOLEAN, - has_rcost BOOLEAN) -RETURNS SETOF pgr_costresult AS -$BODY$ - SELECT seq - 1 AS seq, node::integer AS id1, edge::integer AS id2, cost - FROM pgr_bdAstar($1, ARRAY[$2]::BIGINT[], ARRAY[$3]::BIGINT[], $4); -$BODY$ -LANGUAGE sql VOLATILE -COST 100 -ROWS 1000; diff --git a/sql/legacy/tsp/TSPeucledian.sql b/sql/legacy/tsp/TSPeucledian.sql deleted file mode 100644 index d3bb611a3fb..00000000000 --- a/sql/legacy/tsp/TSPeucledian.sql +++ /dev/null @@ -1,69 +0,0 @@ -/*PGR-GNU***************************************************************** - -Copyright (c) 2016 pgRouting developers -Mail: project@pgrouting.org - -Copyright (c) 2016 Celia Virginia Vergara Castillo -mail: vicky_vergara@hotmail.com - ------- - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - ********************************************************************PGR-GNU*/ - - --------------------- --- pgr_euclideanTSP --------------------- - -CREATE OR REPLACE FUNCTION pgr_euclideanTSP( - TEXT, -- coordinates_sql (required) - - start_id BIGINT DEFAULT 0, - end_id BIGINT DEFAULT 0, - - max_processing_time FLOAT DEFAULT '+infinity'::FLOAT, - - tries_per_temperature INTEGER DEFAULT 500, - max_changes_per_temperature INTEGER DEFAULT 60, - max_consecutive_non_changes INTEGER DEFAULT 100, - - initial_temperature FLOAT DEFAULT 100, - final_temperature FLOAT DEFAULT 0.1, - cooling_factor FLOAT DEFAULT 0.9, - - randomize BOOLEAN DEFAULT true, - - OUT seq integer, - OUT node BIGINT, - OUT cost FLOAT, - OUT agg_cost FLOAT) -RETURNS SETOF RECORD AS -$BODY$ - SELECT seq, node, cost, agg_cost - FROM pgr_TSPeuclidean(_pgr_get_statement($1), $2,$3, $4, $5,$6,$7, $8,$9,$10, $11); -$BODY$ -LANGUAGE SQL VOLATILE STRICT -COST 100 -ROWS 1000; - - --- COMMENTS - - -COMMENT ON FUNCTION pgr_eucledianTSP(TEXT, BIGINT, BIGINT, FLOAT, INTEGER, INTEGER, INTEGER, FLOAT, FLOAT, FLOAT, BOOLEAN) -IS 'pgRouting deprecated function -Use pgr_TSPeuclidean instead'; diff --git a/sql/legacy/tsp/_makeDistanceMatrix.sql b/sql/legacy/tsp/_makeDistanceMatrix.sql deleted file mode 100644 index 07da120eb9b..00000000000 --- a/sql/legacy/tsp/_makeDistanceMatrix.sql +++ /dev/null @@ -1,77 +0,0 @@ -/*PGR-MIT***************************************************************** - --- --- Copyright (c) 2013 Stephen Woodbridge --- --- This files is released under an MIT-X license. -Copyright (c) 2015 pgRouting developers -Mail: project@pgrouting.org - ------- -MIT/X license - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - -********************************************************************PGR-MIT*/ - - ----------------------------- --- _pgr_makeDistanceMatrix ----------------------------- - - -create or replace function _pgr_makeDistanceMatrix - (sqlin text, - - OUT dmatrix double precision[], - OUT ids integer[]) - as -$body$ -declare - sql text; - r record; - -begin - dmatrix := array[]::double precision[]; - ids := array[]::integer[]; - - sql := 'with nodes as (' || sqlin || ') - select i, array_agg(dist) as arow from ( - select a.id as i, b.id as j, st_distance(st_makepoint(a.x, a.y), st_makepoint(b.x, b.y)) as dist - from nodes a, nodes b - order by a.id, b.id - ) as foo group by i order by i'; - - for r in execute sql loop - dmatrix := array_cat(dmatrix, array[r.arow]); - ids := ids || array[r.i]; - end loop; - -end; -$body$ -language plpgsql stable cost 10; - - --- COMMENTS - - -COMMENT ON FUNCTION _pgr_makeDistanceMatrix(TEXT) -IS 'pgRouting internal function'; diff --git a/sql/legacy/tsp/tsp_v2.0_coordinates.sql b/sql/legacy/tsp/tsp_v2.0_coordinates.sql deleted file mode 100644 index 7e2837746fa..00000000000 --- a/sql/legacy/tsp/tsp_v2.0_coordinates.sql +++ /dev/null @@ -1,108 +0,0 @@ -/*PGR-GNU***************************************************************** - -Copyright (c) 2016 pgRouting developers -Mail: project@pgrouting.org - -Copyright (c) 2016 Celia Virginia Vergara Castillo -mail: vicky_vergara@hotmail.com - ------- - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - ********************************************************************PGR-GNU*/ -/* - Old signature has: - sql: id INTEGER, x FLOAT, y FLOAT -*/ - - ------------------------ --- pgr_tsp ------------------------ - - -CREATE OR REPLACE FUNCTION pgr_tsp( - sql text, - start_id INTEGER, - end_id INTEGER default (-1), - - OUT seq INTEGER, - OUT id1 INTEGER, - OUT id2 INTEGER, - OUT cost FLOAT -) -returns setof record as -$body$ -DECLARE -table_sql TEXT; -rec RECORD; -debuglevel TEXT; -n BIGINT; - -BEGIN - RAISE NOTICE 'Deprecated Signature pgr_tsp(sql, integer, integer)'; - - table_sql := 'CREATE TEMP TABLE ___tmp ON COMMIT DROP AS ' || sql ; - EXECUTE table_sql; - - - BEGIN - EXECUTE 'SELECT id, x, y FROM ___tmp' INTO rec; - EXCEPTION - WHEN OTHERS THEN - RAISE EXCEPTION 'An expected column was not found in the query' - USING ERRCODE = 'XX000', - HINT = 'Please verify the column names: id, x, y'; - END; - - EXECUTE - 'SELECT - pg_typeof(id)::text as id_type, - pg_typeof(x)::text as x_type, - pg_typeof(y)::text as y_type FROM ___tmp' INTO rec; - - - IF NOT((rec.id_type in ('integer'::text)) - AND (rec.x_type = 'double precision'::text) - AND (rec.y_type = 'double precision'::text)) THEN - RAISE EXCEPTION '''id'' must be of type INTEGER, ''x'' ad ''y'' must be of type FLOAT' - USING ERRCODE = 'XX000'; - END IF; - - EXECUTE 'SELECT count(*) AS n FROM (' || sql || ') AS __a__' INTO rec; - n = rec.n; - - RETURN query - SELECT (seq - 1)::INTEGER AS seq, node::INTEGER AS id1, node::INTEGER AS id2, cost - FROM pgr_eucledianTSP(sql, start_id, end_id, - - tries_per_temperature := 500 * n :: INTEGER, - max_changes_per_temperature := 60 * n :: INTEGER, - max_consecutive_non_changes := 500 * n :: INTEGER, - - randomize := false) WHERE seq <= n; - DROP TABLE ___tmp; - -END; -$body$ -language plpgsql volatile STRICT cost 500 ROWS 50; - - --- COMMENTS - - -COMMENT ON FUNCTION pgr_tsp(text, INTEGER, INTEGER) -IS 'DEPRECATED'; diff --git a/sql/legacy/tsp/tsp_v2.0_matrix.sql b/sql/legacy/tsp/tsp_v2.0_matrix.sql deleted file mode 100644 index b24d988a4c5..00000000000 --- a/sql/legacy/tsp/tsp_v2.0_matrix.sql +++ /dev/null @@ -1,133 +0,0 @@ -/*PGR-GNU***************************************************************** - -Copyright (c) 2016 pgRouting developers -Mail: project@pgrouting.org - -Copyright (c) 2016 Celia Virginia Vergara Castillo -mail: vicky_vergara@hotmail.com - ------- - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - ********************************************************************PGR-GNU*/ - - ----------------- ----------------- --- tsp ----------------- ----------------- - - ------------------------ --- _pgr_unnest_matrix ------------------------ - - -CREATE OR REPLACE FUNCTION _pgr_unnest_matrix - (matrix float8[][], - - OUT start_vid integer, - OUT end_vid integer, - out agg_cost float8) -RETURNS SETOF record AS - -$body$ -DECLARE - -m float8[]; - -BEGIN - start_vid = 1; - foreach m slice 1 in ARRAY matrix - LOOP - end_vid = 1; - foreach agg_cost in ARRAY m - LOOP - RETURN next; - end_vid = end_vid + 1; - END LOOP; - start_vid = start_vid + 1; - END LOOP; -END; -$body$ -language plpgsql volatile STRICT cost 500 ROWS 50; - - -CREATE OR REPLACE FUNCTION pgr_tsp - (matrix float8[][], - - startpt INTEGER, - endpt INTEGER DEFAULT -1, - - OUT seq INTEGER, - OUT id INTEGER) -RETURNS SETOF record AS -$body$ -DECLARE -table_sql TEXT; -debuglevel TEXT; -BEGIN - RAISE NOTICE 'Deprecated Signature pgr_tsp(float8[][], integer, integer)'; - - CREATE TEMP TABLE ___tmp2 ON COMMIT DROP AS - SELECT start_vid, end_vid, agg_cost FROM _pgr_unnest_matrix( matrix ); - - - startpt := startpt + 1; - IF endpt = -1 THEN endpt := startpt; - END IF; - - - RETURN QUERY - WITH - result AS ( - SELECT seq, id FROM pgr_TSP( - $$SELECT start_vid, end_vid, agg_cost FROM ___tmp2 $$, - startpt, endpt, - - tries_per_temperature := 500 :: INTEGER, - max_changes_per_temperature := 30 :: INTEGER, - max_consecutive_non_changes := 500 :: INTEGER, - - randomize:=false) - ) - SELECT (row_number() over(ORDER BY result.seq) - 1)::INTEGER AS seq, (result.node - 1)::INTEGER AS id - - FROM result WHERE NOT(result.node = startpt AND result.seq != 1); - - DROP TABLE ___tmp2; -END; -$body$ -language plpgsql volatile STRICT cost 500 ROWS 50; - - --- COMMENTS - - -COMMENT ON FUNCTION _pgr_unnest_matrix(FLOAT[][]) -IS 'DEPRECATED'; - - -COMMENT ON FUNCTION pgr_tsp(FLOAT[][], INTEGER, INTEGER) -IS 'pgr_tsp -- Parameters - - Matrix - - startpt - - endpt -- Documentation: - - ${PGROUTING_DOC_LINK}/pgr_tsp.html -'; diff --git a/sql/legacy/vrppdtw/_gsoc_vrppdtw.sql b/sql/legacy/vrppdtw/_gsoc_vrppdtw.sql deleted file mode 100644 index 9265086f2a0..00000000000 --- a/sql/legacy/vrppdtw/_gsoc_vrppdtw.sql +++ /dev/null @@ -1,105 +0,0 @@ -/*PGR-GNU***************************************************************** -File: _gsoc_vrppdtw.sql - -Generated with Template by: -Copyright (c) 2017 pgRouting developers -Mail: project@pgrouting.org - -Function's developer: -Copyright (c) 2017 Celia Virginia Vergara Castillo -Mail: - ------- - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - ********************************************************************PGR-GNU*/ - - ----------------------------- --- _pgr_gsoc_vrppdtw ----------------------------- - - -CREATE OR REPLACE FUNCTION _pgr_gsoc_vrppdtw( - customers_sql TEXT, - max_vehicles INTEGER, - capacity FLOAT, - speed FLOAT DEFAULT 1, - max_cycles INTEGER DEFAULT 10, - - OUT seq INTEGER, - OUT vehicle_id INTEGER, - OUT vehicle_seq INTEGER, - OUT stop_id BIGINT, - OUT travel_time FLOAT, - OUT arrival_time FLOAT, - OUT wait_time FLOAT, - OUT service_time FLOAT, - OUT departure_time FLOAT -) -RETURNS SETOF RECORD AS -$BODY$ -DECLARE - orders_sql TEXT; - vehicles_sql TEXT; - final_sql TEXT; -BEGIN - orders_sql = $$WITH - customer_data AS ($$ || customers_sql || $$ ), - pickups AS ( - SELECT id, demand, x as p_x, y as p_y, opentime as p_open, closetime as p_close, servicetime as p_service - FROM customer_data WHERE pindex = 0 AND id != 0 - ), - deliveries AS ( - SELECT pindex AS id, x as d_x, y as d_y, opentime as d_open, closetime as d_close, servicetime as d_service - FROM customer_data WHERE dindex = 0 AND id != 0 - ) - SELECT id, demand, p_x, p_y, p_open, p_close, p_service, d_x, d_y, d_open, d_close, d_service - FROM pickups JOIN deliveries USING(id) ORDER BY pickups.id - $$; - - vehicles_sql = $$WITH - customer_data AS ($$ || customers_sql || $$ ) - SELECT id, x AS start_x, y AS start_y, - opentime AS start_open, closetime AS start_close, $$ || - capacity || $$ AS capacity, $$ || max_vehicles || $$ AS number, $$ || speed || $$ AS speed - FROM customer_data WHERE id = 0 LIMIT 1 - $$; --- seq | vehicle_id | vehicle_seq | stop_id | travel_time | arrival_time | wait_time | service_time | departure_time - final_sql = $$ WITH - customer_data AS ($$ || customers_sql || $$ ), - p_deliver AS (SELECT seq, vehicle_seq, vehicle_id, stop_seq, stop_type, order_id, cargo, travel_time, arrival_time, wait_time, service_time, departure_time - FROM _pgr_pickDeliverEuclidean('$$ || orders_sql || $$', '$$ || vehicles_sql || $$', 1, $$ || max_cycles || $$ )), - picks AS (SELECT p_deliver.*, pindex, dindex, id AS the_id FROM p_deliver JOIN customer_data ON (id = order_id AND stop_type = 2)), - delivers AS (SELECT p_deliver.*, pindex, dindex, dindex AS the_id FROM p_deliver JOIN customer_data ON (id = order_id AND stop_type = 3)), - depots AS (SELECT p_deliver.*, 0 as pindex, 0 as dindex, 0 AS the_id FROM p_deliver WHERE (stop_type IN (-1,1,6))), - the_union AS (SELECT * FROM picks UNION SELECT * FROM delivers UNION SELECT * from depots) - - SELECT (row_number() over(ORDER BY a.seq))::INTEGER, vehicle_seq, a.stop_seq, the_id::BIGINT, a.travel_time, a.arrival_time, a.wait_time, a.service_time, a.departure_time - FROM (SELECT * FROM the_union) AS a ORDER BY a.seq - $$; - RETURN QUERY EXECUTE final_sql; -END; -$BODY$ -LANGUAGE plpgsql VOLATILE STRICT; - - --- COMMENTS - - -COMMENT ON FUNCTION _pgr_gsoc_vrppdtw(TEXT, INTEGER, FLOAT, FLOAT, INTEGER) -IS 'pgRouting Deprecated internal function'; - diff --git a/sql/legacy/vrppdtw/gsoc_vrppdtw.sql b/sql/legacy/vrppdtw/gsoc_vrppdtw.sql deleted file mode 100644 index f2c85d26542..00000000000 --- a/sql/legacy/vrppdtw/gsoc_vrppdtw.sql +++ /dev/null @@ -1,66 +0,0 @@ -/*PGR-GNU***************************************************************** -File: reginabook.sql - -Generated with Template by: -Copyright (c) 2017 pgRouting developers -Mail: project@pgrouting.org - -Function's developer: -Copyright (c) 2017 Celia Virginia Vergara Castillo -Mail: - ------- - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - ********************************************************************PGR-GNU*/ - - ----------------------------- --- pgr_gsoc_vrppdtw ----------------------------- - - -CREATE OR REPLACE FUNCTION pgr_gsoc_vrppdtw( - text, -- SQL (required) - INTEGER, -- vehicle_num (required) - INTEGER, -- capacity (required) - - OUT seq INTEGER, - OUT id1 INTEGER, - OUT id2 INTEGER, - OUT cost FLOAT -) -RETURNS SETOF record AS -$BODY$ -DECLARE -has_reverse BOOLEAN; -customers_sql TEXT; -BEGIN - RETURN query - SELECT a.seq, vehicle_id::INTEGER AS id1, stop_id::INTEGER AS id2, departure_time AS cost - FROM _pgr_gsoc_vrppdtw($1, $2, $3, 1, 30) AS a WHERE vehicle_id NOT IN (-2); -END -$BODY$ -LANGUAGE plpgsql VOLATILE STRICT -COST 100 -ROWS 1000; - - --- COMMENTS - - -COMMENT ON FUNCTION pgr_gsoc_vrppdtw(TEXT, INTEGER, INTEGER) -IS 'pgr_gsoc_vrppdtw deprecated experimental function'; diff --git a/sql/lineGraph/lineGraph.sql b/sql/lineGraph/lineGraph.sql index 2d45720cd14..d9ecadac116 100644 --- a/sql/lineGraph/lineGraph.sql +++ b/sql/lineGraph/lineGraph.sql @@ -51,7 +51,7 @@ ROWS 1000; COMMENT ON FUNCTION pgr_lineGraph(TEXT, BOOLEAN) IS 'pgr_lineGraph -- EXPERIMENTAL +- PROPOSED - Parameters: - edges SQL with columns: id, source, target, cost [,reverse_cost] - Optional Parameters: diff --git a/sql/max_flow/maxFlowMinCost.sql b/sql/max_flow/maxFlowMinCost.sql index 1b3256ea634..edec5928307 100644 --- a/sql/max_flow/maxFlowMinCost.sql +++ b/sql/max_flow/maxFlowMinCost.sql @@ -181,7 +181,7 @@ IS 'pgr_maxFlowMinCost(Many to One) '; COMMENT ON FUNCTION pgr_maxFlowMinCost(TEXT, ANYARRAY, ANYARRAY) -IS 'EXPERIMENTAL pgr_maxFlowMinCost(Many to Many) +IS 'pgr_maxFlowMinCost(Many to Many) - EXPERIMENTAL - Parameters: - Edges SQL with columns: id, source, target, cost [,reverse_cost] @@ -192,7 +192,7 @@ IS 'EXPERIMENTAL pgr_maxFlowMinCost(Many to Many) '; COMMENT ON FUNCTION pgr_maxFlowMinCost(TEXT, TEXT) -IS 'EXPERIMENTAL pgr_maxFlowMinCost(Combinations) +IS 'pgr_maxFlowMinCost(Combinations) - EXPERIMENTAL - Parameters: - Edges SQL with columns: id, source, target, cost [,reverse_cost] diff --git a/sql/max_flow/maxFlowMinCost_Cost.sql b/sql/max_flow/maxFlowMinCost_Cost.sql index a58aea7af02..605ab39c829 100644 --- a/sql/max_flow/maxFlowMinCost_Cost.sql +++ b/sql/max_flow/maxFlowMinCost_Cost.sql @@ -141,7 +141,7 @@ IS 'pgr_maxFlowMinCost_Cost (Many to One) '; COMMENT ON FUNCTION pgr_maxFlowMinCost_Cost(TEXT, ANYARRAY, ANYARRAY) -IS 'EXPERIMENTAL pgr_maxFlowMinCost_Cost (Many to Many) +IS 'pgr_maxFlowMinCost_Cost (Many to Many) - EXPERIMENTAL - Parameters: - Edges SQL with columns: id, source, target, cost [,reverse_cost] @@ -152,7 +152,7 @@ IS 'EXPERIMENTAL pgr_maxFlowMinCost_Cost (Many to Many) '; COMMENT ON FUNCTION pgr_maxFlowMinCost_Cost(TEXT, TEXT) -IS 'EXPERIMENTAL pgr_maxFlowMinCost_Cost (Combinations) +IS 'pgr_maxFlowMinCost_Cost (Combinations) - EXPERIMENTAL - Parameters: - Edges SQL with columns: id, source, target, cost [,reverse_cost] diff --git a/sql/metrics/betweennessCentrality.sql b/sql/metrics/betweennessCentrality.sql index 8da8d6916a4..a1c2e059fcd 100644 --- a/sql/metrics/betweennessCentrality.sql +++ b/sql/metrics/betweennessCentrality.sql @@ -48,6 +48,7 @@ LANGUAGE SQL VOLATILE STRICT; COMMENT ON FUNCTION pgr_betweennessCentrality(TEXT, BOOLEAN) IS 'pgr_betweennessCentrality +- EXPERIMENTAL - Parameters: - edges SQL with columns: source, target, cost [,reverse_cost]) - Optional Parameters: diff --git a/sql/spanningTree/_prim.sql b/sql/spanningTree/_prim.sql index 3401e2812d8..4f2a94dd1a4 100644 --- a/sql/spanningTree/_prim.sql +++ b/sql/spanningTree/_prim.sql @@ -27,18 +27,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ********************************************************************PGR-GNU*/ ----------- ----------- --- mst ----------- ----------- - - ----------------- --- _pgr_prim ----------------- - - --v3.7 CREATE FUNCTION _pgr_primv4( TEXT, -- Edge sql diff --git a/sql/topology/nodeNetwork.sql b/sql/topology/nodeNetwork.sql index e215eaf140b..d918c43d6ab 100644 --- a/sql/topology/nodeNetwork.sql +++ b/sql/topology/nodeNetwork.sql @@ -229,5 +229,5 @@ END; $BODY$ LANGUAGE 'plpgsql' VOLATILE STRICT COST 100; -- COMMENTS -COMMENT ON FUNCTION pgr_createverticestable(TEXT, TEXT, TEXT, TEXT, TEXT) +COMMENT ON FUNCTION pgr_nodeNetwork(TEXT, DOUBLE PRECISION, TEXT, TEXT, TEXT, TEXT, BOOLEAN) IS 'pgr_nodeNetwork deprecated function on v3.8.0'; diff --git a/sql/trsp/_trsp.sql b/sql/trsp/_trsp.sql index 4bafa32838b..b78b8ba1929 100644 --- a/sql/trsp/_trsp.sql +++ b/sql/trsp/_trsp.sql @@ -24,17 +24,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ********************************************************************PGR-GNU*/ --------------- --------------- --- trsp --------------- --------------- - - --------------- --- _trsp --------------- - --v3.6 CREATE FUNCTION _pgr_trspv4( TEXT, -- edges SQL diff --git a/sql/trsp/trsp_withPoints.sql b/sql/trsp/trsp_withPoints.sql index 45621006752..2ee6e993635 100644 --- a/sql/trsp/trsp_withPoints.sql +++ b/sql/trsp/trsp_withPoints.sql @@ -268,6 +268,7 @@ IS 'pgr_trsp_withPoints(Many to Many) COMMENT ON FUNCTION pgr_trsp_withPoints(TEXT, TEXT, TEXT, TEXT, BOOLEAN, CHAR, BOOLEAN) IS 'pgr_trsp_withPoints(Combinations) +- PROPOSED - Parameters: - Edges SQL with columns: id, source, target, cost [,reverse_cost] - Restrictions SQL with columns: id, path, cost diff --git a/sql/withPoints/withPointsCost.sql b/sql/withPoints/withPointsCost.sql index cb7c0828df9..f4e44dfc1e4 100644 --- a/sql/withPoints/withPointsCost.sql +++ b/sql/withPoints/withPointsCost.sql @@ -205,6 +205,7 @@ IS 'pgr_withPointsCost (Many to One) COMMENT ON FUNCTION pgr_withPointsCost(TEXT, TEXT, ANYARRAY, ANYARRAY, BOOLEAN, CHAR) IS 'pgr_withPointsCost (Many to Many) +- PROPOSED - Parameters: - Edges SQL with columns: id, source, target, cost [,reverse_cost] - Points SQL with columns: [pid], edge_id, fraction[,side] @@ -219,6 +220,7 @@ IS 'pgr_withPointsCost (Many to Many) COMMENT ON FUNCTION pgr_withPointsCost(TEXT, TEXT, TEXT, BOOLEAN, CHAR) IS 'pgr_withPointsCost(Combinations) +- PROPOSED - Parameters: - Edges SQL with columns: id, source, target, cost [,reverse_cost] - Points SQL with columns: [pid], edge_id, fraction [,side] diff --git a/sql/withPoints/withPointsCostMatrix.sql b/sql/withPoints/withPointsCostMatrix.sql index c8b52fec5ee..ed6cd8ebb15 100644 --- a/sql/withPoints/withPointsCostMatrix.sql +++ b/sql/withPoints/withPointsCostMatrix.sql @@ -27,17 +27,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ********************************************************************PGR-GNU*/ ---------------------- ---------------------- --- costMatrix ---------------------- ---------------------- - --------------------------- -- pgr_withPointsCostMatrix --------------------------- - --v2.6 CREATE FUNCTION pgr_withPointsCostMatrix( TEXT, -- edges_sql (required) diff --git a/tools/developer/run.sh b/tools/developer/run.sh index e8635011856..68660d4990c 100755 --- a/tools/developer/run.sh +++ b/tools/developer/run.sh @@ -58,6 +58,9 @@ function set_cmake { # with developers documentation #cmake -DWITH_DOC=ON -DBUILD_DOXY=ON .. + # using a particular PostgreSQL configuration + #cmake -DPOSTGRESQL_PG_CONFIG="/usr/lib/postgresql/${PGVERSION}/bin/pg_config" .. + # Building using clang #CXX=clang++ CC=clang cmake -DPOSTGRESQL_BIN=${PGBIN} -DCMAKE_BUILD_TYPE=Debug -DDOC_USE_BOOTSTRAP=ON -DWITH_DOC=ON -DBUILD_DOXY=OFF .. @@ -82,7 +85,7 @@ function tap_test { dropdb --if-exists -p $PGPORT ___pgr___test___ createdb -p $PGPORT ___pgr___test___ echo $PGPORT - tools/testers/pg_prove_tests.sh vicky $PGPORT + tools/testers/pg_prove_tests.sh "$PGUSER" $PGPORT dropdb -p $PGPORT ___pgr___test___ }