Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ jobs:
- name: Build
run: |
cd build
make -j 4
make doc

- name: Initialize mandatory git config
run: |
Expand All @@ -95,7 +95,7 @@ jobs:
if [[ "${{ env.BRANCH }}" == "develop" ]]; then
FOLDER_NAME="dev"
elif [[ "${{ env.BRANCH }}" == "main" ]]; then
FOLDER_NAME="3.0"
FOLDER_NAME="3.1"
fi
git checkout -f origin/gh-pages
git checkout -b gh-pages
Expand Down
11 changes: 5 additions & 6 deletions docs/basic/images/pedestrian/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
#---------------------
set(PGR_WORKSHOP_IMG_FILES
pedestrian_combinations.png
pedestrian_route1.png
pedestrian_route2.png
pedestrian_route4.png
pedestrian_route5.png
route.png
)
pedestrian_dijkstracost.png
pedestrian_many_to_many.png
pedestrian_one_to_many.png
pedestrian_one_to_one.png
)


foreach (f ${PGR_WORKSHOP_IMG_FILES})
Expand Down
Binary file modified docs/basic/images/pedestrian/pedestrian_combinations.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/basic/images/pedestrian/pedestrian_route1.png
Binary file not shown.
Binary file removed docs/basic/images/pedestrian/pedestrian_route2.png
Binary file not shown.
Binary file removed docs/basic/images/pedestrian/pedestrian_route4.png
Binary file not shown.
Binary file removed docs/basic/images/pedestrian/pedestrian_route5.png
Binary file not shown.
Binary file removed docs/basic/images/pedestrian/route.png
Binary file not shown.
180 changes: 75 additions & 105 deletions docs/basic/pedestrian.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,18 @@
Pedestrian Routing
===============================================================================

.. image:: images/pedestrian/route.png
.. image:: images/pedestrian/pedestrian_one_to_one.png
:scale: 25%
:align: center

**pgRouting** was first called *pgDijkstra*, because it implemented only shortest
path search with *Dijkstra* algorithm. Later other functions were added and the
library was renamed to pgRouting.

pgRouting functions in this chapter

- `pgr_dijkstra`_
- `pgr_dijkstraCost`_

.. contents:: Chapter Contents

Expand Down Expand Up @@ -62,7 +66,7 @@ Description of the function can be found in `pgr_dijkstra
The assignment of the vertices identifiers on the source and target columns may
be different, the following exercises will use the results of this query.
For the workshop, some locations near of the FOSS4G event are going to be used.
These locations are within this area https://www.openstreetmap.org/#map=14/-1.44228/-48.46069
These locations are within this area https://www.openstreetmap.org/#map=16/-36.8520950/174.7631803

* |osmid_1| |place_1|
* |osmid_2| |place_2|
Expand All @@ -81,12 +85,12 @@ Get the vertex identifiers

.. literalinclude:: ../scripts/basic/pedestrian/pedestrian.sql
:language: sql
:start-after: exercise_5_0.txt
:end-before: exercise_5_1.txt
:start-after: get_id.txt
:end-before: one_to_one.txt

|

.. literalinclude:: ../scripts/basic/pedestrian/exercise_5_0.txt
.. literalinclude:: ../scripts/basic/pedestrian/get_id.txt

* |osmid_1| |place_1| (|id_1|)
* |osmid_2| |place_2| (|id_2|)
Expand All @@ -96,9 +100,9 @@ Get the vertex identifiers


The corresponding :code:`id` are shown in the following image, and a sample route from
"|place_3|" to "|place_5|".
"|place_3|" to "|place_1|".

.. image:: images/pedestrian/route.png
.. image:: images/pedestrian/pedestrian_one_to_one.png
:scale: 25%

Exercise 1: Single pedestrian routing
Expand All @@ -111,34 +115,32 @@ Exercise 1: Single pedestrian routing
* from "|place_1|"
* to "|place_3|".

* Calculate routes with costs in *osm2pgRouting* ``length`` default units.
* Calculate routes with costs in ``length`` in meters.

.. image:: images/pedestrian/pedestrian_route1.png
.. image:: images/pedestrian/pedestrian_one_to_one.png
:scale: 25%
:alt: From the |place_1| to the |place_3|

.. rubric:: Solution:

* The pedestrian wants to go from vertex |id_1| to vertex |id_3| (lines **9** and **10**).
* The pedestrian's cost is in terms of length. In this case ``length`` (line **6**), which
was calculated by osm2pgrouting, is in unit ``degrees``.
* From a pedestrian perspective the graph is ``undirected`` (line **11**), that is, the
* The pedestrian wants to go from vertex |id_1| to vertex |id_3| (lines **5** and **6**).
* The pedestrian's cost is in terms of length. In this case ``length`` (line **3**).
* From a pedestrian perspective the graph is ``undirected`` (line **7**), that is, the
pedestrian can move in both directions on all segments.

.. literalinclude:: ../scripts/basic/pedestrian/pedestrian.sql
:language: sql
:start-after: exercise_5_1.txt
:end-before: exercise_5_2.txt
:emphasize-lines: 3-7
:language: sql
:start-after: one_to_one.txt
:end-before: many_to_one.txt
:linenos:

.. collapse:: Query results

.. literalinclude:: ../scripts/basic/pedestrian/exercise_5_1.txt
.. literalinclude:: ../scripts/basic/pedestrian/one_to_one.txt

.. note::
* The returned cost attribute represents the cost specified in the
inner SQL query (``edges_sql::text`` argument). In this example cost is ``length`` in unit
"degrees". Cost may be time, distance or any combination of both or any
* The returned cost attribute represents the cost specified in the inner SQL
query (``edges_sql::text`` argument). In this example cost is ``length`` in
unit "meters". Cost may be time, distance or any combination of both or any
other attributes or a custom formula.
* ``node`` and ``edge`` results may vary depending on the assignment of the
identifiers to the vertices given by osm2pgrouting.
Expand All @@ -153,27 +155,26 @@ Exercise 2: Many Pedestrians going to the same destination
* from "|place_1|" and "|place_2|"
* to the "|place_3|".

* Calculate routes with costs in *osm2pgRouting* ``length_m`` which is in meters.
* Calculate routes with costs in ``length`` in kilometers.

.. image:: images/pedestrian/pedestrian_route2.png
.. image:: images/pedestrian/pedestrian_one_to_many.png
:scale: 25%
:alt: From |place_1| and |place_2| to |place_3|

.. rubric:: Solution:

* The pedestrians are departing at vertices |id_1| and |id_2| (line **9**).
* All pedestrians want to go to vertex |id_3| (line **10**).
* The cost to be in meters using attribute ``length_m`` (line **6**).
* The pedestrians are departing at vertices |id_1| and |id_2| (line **5**).
* All pedestrians want to go to vertex |id_3| (line **6**).
* The cost to be in kilometers using attribute ``length`` (line **3**).

.. literalinclude:: ../scripts/basic/pedestrian/pedestrian.sql
:language: sql
:start-after: exercise_5_2.txt
:end-before: exercise_5_3.txt
:emphasize-lines: 6, 9
:language: sql
:start-after: many_to_one.txt
:end-before: one_to_many.txt
:linenos:

.. collapse:: Query results

.. literalinclude:: ../scripts/basic/pedestrian/exercise_5_2.txt
.. literalinclude:: ../scripts/basic/pedestrian/many_to_one.txt

Exercise 3: Many Pedestrians departing from the same location
...............................................................................
Expand All @@ -185,26 +186,29 @@ Exercise 3: Many Pedestrians departing from the same location
* from "|place_3|"
* to "|place_1|" and "|place_2|"

* Calculate routes with costs in seconds.
* Calculate routes using the ``cost`` which is in seconds for a walking speed of
``2 mts/sec``.

* See :doc:`graphs` for the costs setup.

.. image:: images/pedestrian/pedestrian_route2.png
.. image:: images/pedestrian/pedestrian_one_to_many.png
:scale: 25%

.. rubric:: Solution:

* All pedestrians are departing from vertex |id_3| (line **9**).
* Pedestrians want to go to locations |id_1| and |id_2| (line **10**).
* The cost to be in seconds, with a walking speed ``s = 1.3 m/s`` and ``t = d/s`` (line **6**).
* All pedestrians are departing from vertex |id_3| (line **5**).
* Pedestrians want to go to locations |id_1| and |id_2| (line **6**).
* The ``cost`` column on ``walk_net`` is in seconds. (line **3**)

.. literalinclude:: ../scripts/basic/pedestrian/pedestrian.sql
:language: sql
:start-after: exercise_5_3.txt
:end-before: exercise_5_4.txt
:emphasize-lines: 6, 9, 10
:language: sql
:start-after: one_to_many.txt
:end-before: many_to_many.txt
:linenos:

.. collapse:: Query results

.. literalinclude:: ../scripts/basic/pedestrian/exercise_5_3.txt
.. literalinclude:: ../scripts/basic/pedestrian/one_to_many.txt


Exercise 4: Many Pedestrians going to different destinations
Expand All @@ -217,27 +221,26 @@ Exercise 4: Many Pedestrians going to different destinations
* from "|place_1|" and "|place_2|"
* to "|place_4|" and "|place_5|"

* Calculate routes with costs in minutes.
* Calculate routes with costs in minutes at walking speed ``s = 1.3 m/s``.

.. image:: images/pedestrian/pedestrian_route4.png
.. image:: images/pedestrian/pedestrian_many_to_many.png
:scale: 25%

.. rubric:: Solution:

* The pedestrians depart from |id_1| and |id_2| (line **9**).
* The pedestrians want to go to destinations |id_4| and |id_5| (line **10**).
* The cost to be in minutes, with a walking speed ``s = 1.3 m/s`` and ``t = d/s`` (line **6**).
* Result adds the costs per destination.
* The pedestrians depart from |id_1| and |id_2| (line **5**).
* The pedestrians want to go to destinations |id_4| and |id_5| (line **6**).
* The cost to be in minutes, with a walking speed ``s = 1.3 m/s`` and ``t = d/s``.

.. literalinclude:: ../scripts/basic/pedestrian/pedestrian.sql
:language: sql
:start-after: exercise_5_4.txt
:end-before: exercise_5_5.txt
:emphasize-lines: 6, 9-10
:language: sql
:start-after: many_to_many.txt
:end-before: combinations.txt
:linenos:

.. collapse:: Query results

.. literalinclude:: ../scripts/basic/pedestrian/exercise_5_4.txt
.. literalinclude:: ../scripts/basic/pedestrian/many_to_many.txt

.. note:: .. include:: ../scripts/basic/pedestrian/note_1.txt

Expand All @@ -251,26 +254,26 @@ Exercise 5: Combination of routes
* First pedestrian goes from "|place_1|" to "|place_4|"
* Second pedestrian goes from "|place_2|" to "|place_5|"

* Calculate routes with costs in minutes.
* Calculate routes with costs in minutes at walking speed ``s = 1.3 m/s``.

.. image:: images/pedestrian/pedestrian_combinations.png
:scale: 25%

.. rubric:: Solution:

* First pedestrian departs from |id_1| and the destination is |id_4| (line **11**).
* Second pedestrian departs from |id_2| and the destination is |id_5| (line **12**).
* The cost to be in minutes, with a walking speed ``s = 1.3 m/s`` and ``t = d/s``
* First pedestrian departs from |id_1| and the destination is |id_4| (line **6**).
* Second pedestrian departs from |id_2| and the destination is |id_5| (line **7**).
* The cost to be in minutes, with a walking speed ``s = 1.3 m/s`` and ``t = d/s``.

.. literalinclude:: ../scripts/basic/pedestrian/pedestrian.sql
:language: sql
:start-after: exercise_5_5.txt
:end-before: exercise_5_6.txt
:emphasize-lines: 11-12
:language: sql
:start-after: combinations.txt
:end-before: dijkstracost.txt
:linenos:

.. collapse:: Query results

.. literalinclude:: ../scripts/basic/pedestrian/exercise_5_5.txt
.. literalinclude:: ../scripts/basic/pedestrian/combinations.txt

pgr_dijkstraCost
-------------------------------------------------------------------------------
Expand Down Expand Up @@ -307,57 +310,24 @@ Exercise 6: Time for many Pedestrians going to different destinations

* Get only the cost in minutes.

.. image:: images/pedestrian/pedestrian_route5.png
.. image:: images/pedestrian/pedestrian_dijkstracost.png
:scale: 25%
:alt: From the hotels to the |place_4| and |place_5|

.. rubric:: Solution:

* The pedestrians depart from |id_1| and |id_2| (line **9**).
* The pedestrians want to go to destinations |id_4| and |id_5| (line **10**).
* The cost to be in minutes, with a walking speed ``s = 1.3 m/s`` and ``t = d/s`` (line **6**).
* The pedestrians depart from |id_1| and |id_2| (line **5**).
* The pedestrians want to go to destinations |id_4| and |id_5| (line **6**).
* The cost to be in minutes, with a walking speed ``s = 1.3 m/s`` and ``t = d/s``.
* Result as aggregated costs.

.. literalinclude:: ../scripts/basic/pedestrian/pedestrian.sql
:language: sql
:start-after: exercise_5_6.txt
:end-before: exercise_5_7.txt
:emphasize-lines: 2
:language: sql
:start-after: dijkstracost.txt
:end-before: note_1.txt
:linenos:

.. collapse:: Query results

.. literalinclude:: ../scripts/basic/pedestrian/exercise_5_6.txt
.. literalinclude:: ../scripts/basic/pedestrian/dijkstracost.txt

Compare with `Exercise 4: Many Pedestrians going to different destinations`_ 's note.


Exercise 7: Many Pedestrians going to different destinations summarizing the total costs per departure
...........................................................................................................

.. rubric:: Problem:

* Walking

* from "|place_1|" or "|place_2|"
* to "|place_4|" or "|place_5|"

* Summarize cost in minutes.

.. rubric:: Solution:

* The pedestrians depart from |id_1| and |id_2| (line **9**).
* The pedestrians want to go to destinations |id_4| and |id_5| (line **10**).
* The cost to be in minutes, with a walking speed s = 1.3 m/s and t = d/s (line **6**).
* Result adds the costs per destination.

.. literalinclude:: ../scripts/basic/pedestrian/pedestrian.sql
:language: sql
:start-after: exercise_5_7.txt
:end-before: note_1.txt
:emphasize-lines: 13-14

.. collapse:: Query results

.. literalinclude:: ../scripts/basic/pedestrian/exercise_5_7.txt

.. note:: .. include:: ../scripts/basic/pedestrian/note_2.txt
2 changes: 1 addition & 1 deletion docs/basic/plpgsql_function.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
pl/pgsql function
###############################################################################

.. image:: images/pedestrian/route.png
.. image:: images/pedestrian/pedestrian_one_to_one.png
:width: 250pt
:align: center

Expand Down
2 changes: 1 addition & 1 deletion docs/basic/sql_function.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
SQL function
###############################################################################

.. image:: images/pedestrian/route.png
.. image:: images/pedestrian/pedestrian_one_to_one.png
:scale: 25%
:align: center

Expand Down
2 changes: 1 addition & 1 deletion docs/interactions/chapter-9.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
Using Qgis
###############################################################################

.. image:: ../basic/images/pedestrian/route.png
.. image:: ../basic/images/pedestrian/pedestrian_one_to_one.png
:width: 250pt
:align: center

Expand Down
Loading