Skip to content

Commit

Permalink
[doc] adjusting documentation to changes on sampledata.sql
Browse files Browse the repository at this point in the history
  • Loading branch information
cvvergara committed Sep 21, 2023
1 parent d77eb8e commit 6c4915b
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 77 deletions.
27 changes: 1 addition & 26 deletions doc/src/sampledata.rst
Original file line number Diff line number Diff line change
Expand Up @@ -211,38 +211,13 @@ will be stored on a table.
:start-after: -- p1
:end-before: -- p2

Points of interest geometry
Points of interest fillup
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Inserting the data of the points of interest:

.. literalinclude:: sampledata.queries
:start-after: -- p2
:end-before: -- p3

Points of interest fillup
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Using :doc:`pgr_findCloseEdges`
Calculating for visual purposes the points over the graph.

.. literalinclude:: sampledata.queries
:start-after: -- p3
:end-before: -- p4

A special case to arrive from both sides of the edge.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

.. literalinclude:: sampledata.queries
:start-after: -- p4
:end-before: -- p5

Points of interest data
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

.. literalinclude:: sampledata.queries
:start-after: -- p5
:end-before: -- p6

.. pois_end
Support tables
Expand Down
48 changes: 8 additions & 40 deletions docqueries/src/sampledata.result
Original file line number Diff line number Diff line change
Expand Up @@ -156,50 +156,18 @@ CREATE TABLE pointsOfInterest(
edge_id BIGINT,
side CHAR,
fraction FLOAT,
geom geometry,
newPoint geometry);
geom geometry);
CREATE TABLE
/* -- p2 */
INSERT INTO pointsOfInterest (geom) VALUES
(ST_POINT(1.8, 0.4)),
(ST_POINT(4.2, 2.4)),
(ST_POINT(2.6, 3.2)),
(ST_POINT(0.3, 1.8)),
(ST_POINT(2.9, 1.8)),
(ST_POINT(2.2, 1.7));
INSERT INTO pointsOfInterest (edge_id, side, fraction, geom) VALUES
(1, 'l' , 0.4, ST_POINT(1.8, 0.4)),
(15, 'r' , 0.4, ST_POINT(4.2, 2.4)),
(12, 'l' , 0.6, ST_POINT(2.6, 3.2)),
(6, 'r' , 0.3, ST_POINT(0.3, 1.8)),
(5, 'l' , 0.8, ST_POINT(2.9, 1.8)),
(4, 'b' , 0.7, ST_POINT(2.2, 1.7));
INSERT 0 6
/* -- p3 */
UPDATE pointsOfInterest AS p SET
edge_id = q.edge_id,
side = q.side,
fraction = q.fraction,
newPoint = ST_endPoint(q.edge)
FROM (SELECT * FROM pgr_findCloseEdges(
$$SELECT id, geom FROM edges$$,
(SELECT array_agg(geom) FROM pointsOfInterest),
0.5, partial => false)) AS q
WHERE p.geom = q.geom;
UPDATE 6
/* -- p4 */
UPDATE pointsOfInterest SET side = 'b'
WHERE pid = 6;
UPDATE 1
/* -- p5 */
SELECT pid, edge_id, side, fraction,
ST_AsText(geom), ST_AsText(newPoint)
FROM pointsOfInterest
ORDER BY pid;
pid | edge_id | side | fraction | st_astext | st_astext
-----+---------+------+--------------------+----------------+--------------
1 | 1 | l | 0.4 | POINT(1.8 0.4) | POINT(2 0.4)
2 | 15 | r | 0.3999999999999999 | POINT(4.2 2.4) | POINT(4 2.4)
3 | 12 | l | 0.6000000000000001 | POINT(2.6 3.2) | POINT(2.6 3)
4 | 6 | r | 0.3 | POINT(0.3 1.8) | POINT(0.3 2)
5 | 5 | l | 0.8 | POINT(2.9 1.8) | POINT(3 1.8)
6 | 4 | b | 0.7 | POINT(2.2 1.7) | POINT(2 1.7)
(6 rows)

/* -- p6 */
/* --POINTS CREATE end */
/* --COMBINATIONS CREATE start */
/* -- c1 */
Expand Down
22 changes: 11 additions & 11 deletions docqueries/src/withPoints-category.result
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ SET client_min_messages TO NOTICE;
SET
/* --q1 */
SELECT pid, edge_id, fraction, side FROM pointsOfInterest;
pid | edge_id | fraction | side
-----+---------+--------------------+------
1 | 1 | 0.4 | l
4 | 6 | 0.3 | r
3 | 12 | 0.6000000000000001 | l
2 | 15 | 0.3999999999999999 | r
5 | 5 | 0.8 | l
6 | 4 | 0.7 | b
pid | edge_id | fraction | side
-----+---------+----------+------
1 | 1 | 0.4 | l
2 | 15 | 0.4 | r
3 | 12 | 0.6 | l
4 | 6 | 0.3 | r
5 | 5 | 0.8 | l
6 | 4 | 0.7 | b
(6 rows)

/* --q2 */
Expand All @@ -25,9 +25,9 @@ FROM edges WHERE id = 15;
/* --q3 */
SELECT pid, edge_id, fraction, side
FROM pointsOfInterest WHERE pid = 2;
pid | edge_id | fraction | side
-----+---------+--------------------+------
2 | 15 | 0.3999999999999999 | r
pid | edge_id | fraction | side
-----+---------+----------+------
2 | 15 | 0.4 | r
(1 row)

/* --q4 */
Expand Down
1 change: 1 addition & 0 deletions tools/testers/sampledata.sql
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ INSERT INTO pointsOfInterest (edge_id, side, fraction, geom) VALUES
(6, 'r' , 0.3, ST_POINT(0.3, 1.8)),
(5, 'l' , 0.8, ST_POINT(2.9, 1.8)),
(4, 'b' , 0.7, ST_POINT(2.2, 1.7));
/* -- p3 */
/* --POINTS CREATE end */

/* --COMBINATIONS CREATE start */
Expand Down

0 comments on commit 6c4915b

Please sign in to comment.