diff --git a/docs/basic/images/CMakeLists.txt b/docs/basic/images/CMakeLists.txt index 65e7d2604..0d3defb9a 100644 --- a/docs/basic/images/CMakeLists.txt +++ b/docs/basic/images/CMakeLists.txt @@ -9,18 +9,14 @@ set(PGR_WORKSHOP_IMG_SUBDIRS graphs sql_function plpgsql_function - ) - -#--------------------------------------------- -# Adding the documentation subdirectories & files -#--------------------------------------------- +) foreach (dir ${PGR_WORKSHOP_IMG_SUBDIRS}) if (PGR_WORKSHOP_DEBUG) - message(STATUS " -> basic/images/${dir}") + message(STATUS " -> ${CMAKE_CURRENT_SOURCE_DIR}/${dir}") endif() add_subdirectory("${dir}") if (PGR_WORKSHOP_DEBUG) - message(STATUS " <- basic/images/${dir}") + message(STATUS " <- ${CMAKE_CURRENT_SOURCE_DIR}/${dir}") endif() endforeach() diff --git a/docs/basic/images/data/CMakeLists.txt b/docs/basic/images/data/CMakeLists.txt index 4ab9488bf..b44a5147e 100644 --- a/docs/basic/images/data/CMakeLists.txt +++ b/docs/basic/images/data/CMakeLists.txt @@ -9,8 +9,7 @@ set(PGR_WORKSHOP_IMG_FILES foreach (f ${PGR_WORKSHOP_IMG_FILES}) if (PGR_WORKSHOP_VERBOSE_DEBUG) - message(STATUS " Adding file ${f}") + message(STATUS " -> ${f}") endif() - FILE(COPY ${f} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") + configure_file(${f} ${f} COPYONLY) endforeach() - diff --git a/docs/basic/images/pedestrian/CMakeLists.txt b/docs/basic/images/pedestrian/CMakeLists.txt index 6871f1f7e..5d839aa85 100644 --- a/docs/basic/images/pedestrian/CMakeLists.txt +++ b/docs/basic/images/pedestrian/CMakeLists.txt @@ -13,8 +13,7 @@ set(PGR_WORKSHOP_IMG_FILES foreach (f ${PGR_WORKSHOP_IMG_FILES}) if (PGR_WORKSHOP_VERBOSE_DEBUG) - message(STATUS " Adding file ${f}") + message(STATUS " -> ${f}") endif() - FILE(COPY ${f} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") + configure_file(${f} ${f} COPYONLY) endforeach() - diff --git a/docs/basic/images/plpgsql_function/CMakeLists.txt b/docs/basic/images/plpgsql_function/CMakeLists.txt index b1156634f..273701a0f 100644 --- a/docs/basic/images/plpgsql_function/CMakeLists.txt +++ b/docs/basic/images/plpgsql_function/CMakeLists.txt @@ -13,8 +13,7 @@ set(PGR_WORKSHOP_IMG_FILES foreach (f ${PGR_WORKSHOP_IMG_FILES}) if (PGR_WORKSHOP_VERBOSE_DEBUG) - message(STATUS " Adding file ${f}") + message(STATUS " -> ${f}") endif() - FILE(COPY ${f} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") + configure_file(${f} ${f} COPYONLY) endforeach() - diff --git a/docs/basic/images/sql_function/CMakeLists.txt b/docs/basic/images/sql_function/CMakeLists.txt index 6baa04cde..7e154f925 100644 --- a/docs/basic/images/sql_function/CMakeLists.txt +++ b/docs/basic/images/sql_function/CMakeLists.txt @@ -14,8 +14,7 @@ set(PGR_WORKSHOP_IMG_FILES foreach (f ${PGR_WORKSHOP_IMG_FILES}) if (PGR_WORKSHOP_VERBOSE_DEBUG) - message(STATUS " Adding file ${f}") + message(STATUS " -> ${f}") endif() - FILE(COPY ${f} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") + configure_file(${f} ${f} COPYONLY) endforeach() - diff --git a/docs/basic/images/vehicle/CMakeLists.txt b/docs/basic/images/vehicle/CMakeLists.txt index 9660f6705..3206f614b 100644 --- a/docs/basic/images/vehicle/CMakeLists.txt +++ b/docs/basic/images/vehicle/CMakeLists.txt @@ -1,20 +1,17 @@ - #--------------------- # Files #--------------------- set(PGR_WORKSHOP_IMG_FILES - ad11.png - ad7.png - ad8.png - route_using_pedestrian.png - pedestrian_only_roads.png - ) + vehicle_route_coming.png + vehicle_route_going.png + vehicle_time_is_money.png + vehicle_use_penalty.png +) foreach (f ${PGR_WORKSHOP_IMG_FILES}) if (PGR_WORKSHOP_VERBOSE_DEBUG) - message(STATUS " Adding file ${f}") + message(STATUS " -> ${f}") endif() - FILE(COPY ${f} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") + configure_file(${f} ${f} COPYONLY) endforeach() - diff --git a/docs/basic/images/vehicle/ad11.png b/docs/basic/images/vehicle/ad11.png deleted file mode 100644 index 292491f22..000000000 Binary files a/docs/basic/images/vehicle/ad11.png and /dev/null differ diff --git a/docs/basic/images/vehicle/ad7.png b/docs/basic/images/vehicle/ad7.png deleted file mode 100644 index eef046f83..000000000 Binary files a/docs/basic/images/vehicle/ad7.png and /dev/null differ diff --git a/docs/basic/images/vehicle/ad8.png b/docs/basic/images/vehicle/ad8.png deleted file mode 100644 index 45074ea09..000000000 Binary files a/docs/basic/images/vehicle/ad8.png and /dev/null differ diff --git a/docs/basic/images/vehicle/pedestrian_only_roads.png b/docs/basic/images/vehicle/pedestrian_only_roads.png deleted file mode 100644 index 76d060cb9..000000000 Binary files a/docs/basic/images/vehicle/pedestrian_only_roads.png and /dev/null differ diff --git a/docs/basic/images/vehicle/route_using_pedestrian.png b/docs/basic/images/vehicle/route_using_pedestrian.png deleted file mode 100644 index 425157183..000000000 Binary files a/docs/basic/images/vehicle/route_using_pedestrian.png and /dev/null differ diff --git a/docs/basic/images/vehicle/vehicle_route_coming.png b/docs/basic/images/vehicle/vehicle_route_coming.png new file mode 100644 index 000000000..689614f90 Binary files /dev/null and b/docs/basic/images/vehicle/vehicle_route_coming.png differ diff --git a/docs/basic/images/vehicle/vehicle_route_going.png b/docs/basic/images/vehicle/vehicle_route_going.png new file mode 100644 index 000000000..027eadaa9 Binary files /dev/null and b/docs/basic/images/vehicle/vehicle_route_going.png differ diff --git a/docs/basic/images/vehicle/vehicle_time_is_money.png b/docs/basic/images/vehicle/vehicle_time_is_money.png new file mode 100644 index 000000000..09fd60ea9 Binary files /dev/null and b/docs/basic/images/vehicle/vehicle_time_is_money.png differ diff --git a/docs/basic/images/vehicle/vehicle_use_penalty.png b/docs/basic/images/vehicle/vehicle_use_penalty.png new file mode 100644 index 000000000..e074e9d49 Binary files /dev/null and b/docs/basic/images/vehicle/vehicle_use_penalty.png differ diff --git a/docs/basic/vehicle.rst b/docs/basic/vehicle.rst index 9e9196f6b..27902bfd5 100644 --- a/docs/basic/vehicle.rst +++ b/docs/basic/vehicle.rst @@ -11,7 +11,7 @@ Vehicle Routing =============================================================================== -.. image:: images/vehicle/ad7.png +.. image:: images/vehicle/vehicle_route_coming.png :scale: 25% :align: center @@ -62,22 +62,21 @@ be a combination of multiple parameters. #. Number of (``source, target``) segments with ``cost < 0`` (line **3**). .. literalinclude:: ../scripts/basic/vehicles/vehicles.sql - :start-after: section-6.1-1 - :end-before: section-6.1-2 + :start-after: oneway_cost.txt + :end-before: oneway_revc.txt :language: sql - :emphasize-lines: 3 - .. literalinclude:: ../scripts/basic/vehicles/section-6.1-1.txt + .. literalinclude:: ../scripts/basic/vehicles/oneway_cost.txt #. Number of (``target, source``) segments with ``reverse_cost < 0`` (line **3**). .. literalinclude:: ../scripts/basic/vehicles/vehicles.sql - :start-after: section-6.1-2 - :end-before: section-6.1.1 + :start-after: oneway_revc.txt + :end-before: route_going.txt :language: sql :emphasize-lines: 3 - .. literalinclude:: ../scripts/basic/vehicles/section-6.1-2.txt + .. literalinclude:: ../scripts/basic/vehicles/oneway_revc.txt Exercise 1: Vehicle routing - going @@ -87,25 +86,23 @@ Exercise 1: Vehicle routing - going * From the "|place_1|" to the "|place_3|" by car. -.. image:: images/vehicle/ad7.png +.. image:: images/vehicle/vehicle_route_going.png :scale: 25% :alt: From |place_1| to the |place_3| by car. .. rubric:: Solution: -* Use ``cost`` (line **6**) and ``reverse_cost`` (line **7**) columns, which are in unit ``degrees``. -* The vehicle is going from vertex |id_1| (line **10**) to |id_3| (line **11**). +* ``cost`` and ``reverse_cost`` columns, are in seconds. +* The vehicle is going from vertex |id_1| to |id_3|. .. literalinclude:: ../scripts/basic/vehicles/vehicles.sql - :start-after: section-6.1.1 - :end-before: section-6.1.2 + :start-after: route_going.txt + :end-before: route_coming.txt :language: sql - :emphasize-lines: 6,7,10,11 - .. collapse:: Query results - .. literalinclude:: ../scripts/basic/vehicles/section-6.1.1.txt + .. literalinclude:: ../scripts/basic/vehicles/route_going.txt Exercise 2: Vehicle routing - returning @@ -115,25 +112,22 @@ Exercise 2: Vehicle routing - returning * From "|place_3|" to the "|place_1|" by car. -.. image:: images/vehicle/ad8.png +.. image:: images/vehicle/vehicle_route_coming.png :scale: 25% :alt: From |place_3| to the |place_1| by car. .. rubric:: Solution: -* Use ``cost_s`` (line **6**) and ``reverse_cost_s`` (line **7**) columns, in - units seconds. -* The vehicle is going from vertex |id_3| (line **10**) to |id_1| (line **11**). +* The vehicle is going from vertex |id_3| to |id_1|. .. literalinclude:: ../scripts/basic/vehicles/vehicles.sql - :start-after: section-6.1.2 - :end-before: section-6.1.3 + :start-after: route_coming.txt + :end-before: time_is_money.txt :language: sql - :emphasize-lines: 6,7,10,11 .. collapse:: Query results - .. literalinclude:: ../scripts/basic/vehicles/section-6.1.2.txt + .. literalinclude:: ../scripts/basic/vehicles/route_coming.txt .. note:: On a directed graph, going and coming back routes, most of the time are different. @@ -145,30 +139,30 @@ Exercise 3: Vehicle routing when time is money * From "|place_3|" to the "|place_1|" by taxi. -.. image:: images/vehicle/ad8.png +.. image:: images/vehicle/vehicle_time_is_money.png :width: 300pt :alt: From |place_3| to |place_1| by taxi. .. rubric:: Solution: +* Use the ``taxi_net``. * The cost is ``$100 per hour``. - * Using ``cost_s`` (line **6**) and ``reverse_cost_s`` (line **7**) columns, which are in unit ``seconds``. + * Using ``cost`` and ``reverse_cost`` columns, which are in seconds. - * The duration in hours is ``cost_s / 3600``. - * The cost in ``dollars`` is ``cost_s / 3600 * 100``. + * The duration in hours is ``cost / 3600``. + * The cost in ``dollars`` is ``cost / 3600 * 100``. -* The vehicle is going from vertex |id_3| (line **10**) to |id_1| (line **11**). +* The vehicle is going from vertex |id_3| to |id_1|. .. literalinclude:: ../scripts/basic/vehicles/vehicles.sql - :start-after: section-6.1.3 - :end-before: section-6.2-1 + :start-after: time_is_money.txt + :end-before: add_penalty.txt :language: sql - :emphasize-lines: 6-7,10-11 .. collapse:: Query results - .. literalinclude:: ../scripts/basic/vehicles/section-6.1.3.txt + .. literalinclude:: ../scripts/basic/vehicles/time_is_money.txt .. note:: Comparing with `Exercise 2: Vehicle routing - returning`_: @@ -182,63 +176,8 @@ Exercise 3: Vehicle routing when time is money Cost manipulations ------------------------------------------------------------------------------- -When dealing with data, being aware of what kind of data is being used can improve results. - -* Vehicles can not circulate on pedestrian ways - -.. image:: images/vehicle/pedestrian_only_roads.png - :scale: 25% - :alt: - -| - -Penalizing or removal of pedestrian ways will make the results closer to reality. - -When converting data from OSM format using the `osm2pgrouting` tool, there is an -additional table: ``configuration``. - -.. rubric:: The ``configuration`` table structure can be obtained with the following command. - -.. literalinclude:: ../scripts/basic/vehicles/vehicles.sql - :start-after: section-6.2-1 - :end-before: section-6.2-2 - - -.. literalinclude:: ../scripts/basic/vehicles/section-6.2-1.txt - - -.. image:: images/vehicle/route_using_pedestrian.png - :scale: 25% - :alt: tag_id values - -| - -In the image above there is a detail of the ``tag_id`` of the roads. - -.. rubric:: The ``OSM way`` types: - -.. literalinclude:: ../scripts/basic/vehicles/vehicles.sql - :start-after: section-6.2-2 - :end-before: section-6.2-3 - :language: sql - -.. literalinclude:: ../scripts/basic/vehicles/section-6.2-2.txt - -Also, on the ``ways`` table there is a column that can be used to ``JOIN`` with the ``configuration`` table. - -.. rubric:: The ``ways`` types: - -.. literalinclude:: ../scripts/basic/vehicles/vehicles.sql - :start-after: section-6.2-3 - :end-before: section-6.2.1 - :language: sql - -.. literalinclude:: ../scripts/basic/vehicles/section-6.2-3.txt - - In this workshop, costs are going to be manipulated using the ``configuration`` table. - Exercise 4: Vehicle routing without penalization ............................................................................... @@ -246,36 +185,39 @@ Exercise 4: Vehicle routing without penalization * From the "|place_3|" to "|place_1|" -.. image:: images/vehicle/ad7.png +.. image:: images/vehicle/vehicle_route_coming.png :scale: 25% :alt: From |place_3| to |place_1| .. rubric:: Solution: -.. rubric:: Add a penalty column +* Add a penalty column -* All roads have a ``penalty`` of ``1`` (line **3**). + * All roads have a ``penalty`` of ``1``. -.. rubric:: Query + .. literalinclude:: ../scripts/basic/vehicles/vehicles.sql + :start-after: add_penalty.txt + :end-before: use_penalty.txt * The vehicle's cost in this case will be in penalized seconds. - * Costs (in seconds) are to be multiplied by :code:`penalty` (lines **12** and **13**). - * Costs wont change (times 1 leaves the value unchanged). + * Costs are to be multiplied by :code:`penalty` (lines **5** and **6**). + * Costs won't change (:math:`cost * 1 = cost`). * The :code:`configuration` table is linked with the :code:`ways` table by the - :code:`tag_id` field using a ``JOIN`` (lines **14** and **15**). -* The vehicle is going from vertex |id_3| (line **17**) to vertex |id_1| (line **18**). + :code:`tag_id` field using a ``JOIN`` +* The vehicle is going from vertex |id_3| to vertex |id_1|. .. literalinclude:: ../scripts/basic/vehicles/vehicles.sql - :start-after: section-6.2.1 - :end-before: section-6.2.2-1 - :language: sql - :emphasize-lines: 14,15 + :start-after: use_penalty.txt + :end-before: update_penalty.txt + :language: sql + :linenos: + :force: .. collapse:: Query results - .. literalinclude:: ../scripts/basic/vehicles/section-6.2.1.txt + .. literalinclude:: ../scripts/basic/vehicles/use_penalty.txt Exercise 5: Vehicle routing with penalization @@ -285,7 +227,7 @@ Exercise 5: Vehicle routing with penalization Change the cost values for the :code:`configuration` table, in such a way, that the -* Pedestrian roads are not used. +* Bicycle roads are not used. * ``penalty < 0`` makes the road not to be included in the graph. @@ -297,41 +239,41 @@ Change the cost values for the :code:`configuration` table, in such a way, that * ``penalty < 1`` makes the road faster for the calculations. +* All other roads are not penalized. + + * ``penalty = 1`` does not modify the road times. + The ``penalty`` values can be changed with ``UPDATE`` queries. .. note:: These values are an exaggeration. .. literalinclude:: ../scripts/basic/vehicles/vehicles.sql - :start-after: section-6.2.2-1 - :end-before: section-6.2.2-2 - :language: sql + :start-after: update_penalty.txt + :end-before: get_penalized_route.txt + :language: sql + :force: .. rubric:: Problem: * From the "|place_3|" to "|place_1|" with penalization. -.. image:: images/vehicle/ad11.png +.. image:: images/vehicle/vehicle_use_penalty.png :scale: 25% :alt: From |place_3| to |place_1| .. rubric:: Solution: -* Using ``cost_s`` (line **6**) and ``reverse_cost_s`` (line **7**) columns, which are in unit ``seconds``. - - * Costs are to be multiplied by :code:`penalty` (lines **6** and **7**). - -* The :code:`configuration` table is linked with the :code:`ways` table by the - :code:`tag_id` field using a ``JOIN`` (lines **8** and **9**). -* The vehicle is going from vertex |id_3| (line **11**) to vertex |id_1| (line **12**). +* Using the same query from `Exercise 4: Vehicle routing without penalization`_ .. literalinclude:: ../scripts/basic/vehicles/vehicles.sql - :start-after: 6.2.2-2 - :end-before: 6.6 - :language: sql + :start-after: get_penalized_route.txt + :end-before: time_in_secs.txt + :linenos: + :language: sql .. collapse:: Query results - .. literalinclude:: ../scripts/basic/vehicles/section-6.2.2-2.txt + .. literalinclude:: ../scripts/basic/vehicles/get_penalized_route.txt .. note:: Comparing with `Exercise 3: Vehicle routing when time is money`_: @@ -341,38 +283,37 @@ The ``penalty`` values can be changed with ``UPDATE`` queries. * The node sequence changed. * The edge sequence changed. - * The route is avoiding the residential roads that have ``tag_id = 110``. * The costs do not change proportionally. -Exercise 6: Time in seconds of penalized route +Exercise 6: Time in seconds of penalized route using a view ............................................................................... - .. rubric:: Problem: Get the times in seconds of a penalized route .. rubric:: Solution: -* Use as inner query the penalized query joined with the ways table +* Create a penalized view by joining the ``vehicle_net`` joined with the + ``configuration`` table + + * Use the inner query from `Exercise 5: Vehicle routing with penalization`_ - * Keep the ``edge`` as ``gid`` (line **6**) - * Join using ``gid`` (line **18**) + .. literalinclude:: ../scripts/basic/vehicles/vehicles.sql + :start-after: penalized_view.txt + :end-before: using_view.txt + :language: sql + :force: +* Get the route + ``configuration`` table .. literalinclude:: ../scripts/basic/vehicles/vehicles.sql - :start-after: 6.6 - :language: sql - :force: + :start-after: using_view.txt + :end-before: vehicles_end.txt + :language: sql + :force: .. collapse:: Query results - .. literalinclude:: ../scripts/basic/vehicles/section-6.6.txt - -.. note:: - Comparing with `Exercise 5: Vehicle routing with penalization`_: - - * The total number of records is the same. - * The route is the same - * The ``cost`` column have the original vales from the ways table. - + .. literalinclude:: ../scripts/basic/vehicles/using_view.txt diff --git a/docs/images/CMakeLists.txt b/docs/images/CMakeLists.txt index 0fee77486..d3841ccbe 100644 --- a/docs/images/CMakeLists.txt +++ b/docs/images/CMakeLists.txt @@ -7,15 +7,13 @@ set(PGR_WORKSHOP_IMG_SUBDIRS osgeolive ) - -#--------------------------------------------- -# Adding the documentation subdirectories & files -#--------------------------------------------- - foreach (dir ${PGR_WORKSHOP_IMG_SUBDIRS}) - add_subdirectory(${dir}) if (PGR_WORKSHOP_DEBUG) - message(STATUS " Adding images directory ${dir}") + message(STATUS " -> ${CMAKE_CURRENT_SOURCE_DIR}/${dir}") + endif() + add_subdirectory("${dir}") + if (PGR_WORKSHOP_DEBUG) + message(STATUS " <- ${CMAKE_CURRENT_SOURCE_DIR}/${dir}") endif() endforeach() @@ -29,8 +27,7 @@ set(PGR_WORKSHOP_IMG_FILES foreach (f ${PGR_WORKSHOP_IMG_FILES}) if (PGR_WORKSHOP_VERBOSE_DEBUG) - message(STATUS " Adding file ${f}") + message(STATUS " -> ${f}") endif() - FILE(COPY ${f} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") + configure_file(${f} ${f} COPYONLY) endforeach() - diff --git a/docs/images/introduction/CMakeLists.txt b/docs/images/introduction/CMakeLists.txt index ab1e7429d..291add1ff 100644 --- a/docs/images/introduction/CMakeLists.txt +++ b/docs/images/introduction/CMakeLists.txt @@ -9,8 +9,7 @@ set(PGR_WORKSHOP_IMG_FILES foreach (f ${PGR_WORKSHOP_IMG_FILES}) if (PGR_WORKSHOP_VERBOSE_DEBUG) - message(STATUS " Adding file ${f}") + message(STATUS " -> ${f}") endif() - FILE(COPY ${f} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") + configure_file(${f} ${f} COPYONLY) endforeach() - diff --git a/docs/images/logos/CMakeLists.txt b/docs/images/logos/CMakeLists.txt index 223cf1fd0..3ecb882f3 100644 --- a/docs/images/logos/CMakeLists.txt +++ b/docs/images/logos/CMakeLists.txt @@ -16,9 +16,8 @@ set(PGR_WORKSHOP_IMG_FILES foreach (f ${PGR_WORKSHOP_IMG_FILES}) - if (PGR_WORKSHOP_VERBOSE_DEBUG) - message(STATUS " Adding image ${f}") - endif() - FILE(COPY ${f} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") + if (PGR_WORKSHOP_VERBOSE_DEBUG) + message(STATUS " -> ${f}") + endif() + configure_file(${f} ${f} COPYONLY) endforeach() - diff --git a/docs/images/osgeolive/CMakeLists.txt b/docs/images/osgeolive/CMakeLists.txt index a2c880df6..9aa3f8acd 100644 --- a/docs/images/osgeolive/CMakeLists.txt +++ b/docs/images/osgeolive/CMakeLists.txt @@ -21,9 +21,8 @@ set(PGR_WORKSHOP_IMG_FILES foreach (f ${PGR_WORKSHOP_IMG_FILES}) - if (PGR_WORKSHOP_VERBOSE_DEBUG) - message(STATUS " Adding file ${f}") - endif() - FILE(COPY ${f} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") + if (PGR_WORKSHOP_VERBOSE_DEBUG) + message(STATUS " -> ${f}") + endif() + configure_file(${f} ${f} COPYONLY) endforeach() - diff --git a/docs/interactions/images/CMakeLists.txt b/docs/interactions/images/CMakeLists.txt index db24c56b4..5fc94c58a 100644 --- a/docs/interactions/images/CMakeLists.txt +++ b/docs/interactions/images/CMakeLists.txt @@ -4,18 +4,18 @@ #--------------------- set(PGR_WORKSHOP_IMG_SUBDIRS chap_QGIS - chapter9 - ) - - +) #--------------------------------------------- # Adding the documentation subdirectories & files #--------------------------------------------- foreach (dir ${PGR_WORKSHOP_IMG_SUBDIRS}) - file(COPY "${dir}" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") if (PGR_WORKSHOP_DEBUG) - message(STATUS " Adding images directory ${dir}") + message(STATUS " -> ${CMAKE_CURRENT_SOURCE_DIR}/${dir}") + endif() + add_subdirectory("${dir}") + if (PGR_WORKSHOP_DEBUG) + message(STATUS " <- ${CMAKE_CURRENT_SOURCE_DIR}/${dir}") endif() endforeach() diff --git a/docs/interactions/images/chap_QGIS/CMakeLists.txt b/docs/interactions/images/chap_QGIS/CMakeLists.txt index bc25efc0f..61cdd4bd4 100644 --- a/docs/interactions/images/chap_QGIS/CMakeLists.txt +++ b/docs/interactions/images/chap_QGIS/CMakeLists.txt @@ -21,29 +21,9 @@ set(PGR_WORKSHOP_IMG_FILES qgis9.png ) -#--------------------- -# Directories -#--------------------- -set(PGR_WORKSHOP_IMG_SUBDIRS - ) - - - -#--------------------------------------------- -# Adding the documentation subdirectories & files -#--------------------------------------------- - -foreach (dir ${PGR_WORKSHOP_IMG_SUBDIRS}) - file(COPY "${dir}" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") - if (PGR_WORKSHOP_DEBUG) - message(STATUS " Adding images directory ${dir}") - endif() -endforeach() - foreach (f ${PGR_WORKSHOP_IMG_FILES}) if (PGR_WORKSHOP_VERBOSE_DEBUG) - message(STATUS " Adding file ${f}") + message(STATUS " -> ${f}") endif() - FILE(COPY ${f} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") + configure_file(${f} ${f} COPYONLY) endforeach() - diff --git a/docs/scripts/basic/graphs/graphs.sql b/docs/scripts/basic/graphs/graphs.sql index a7f20a030..44009784e 100644 --- a/docs/scripts/basic/graphs/graphs.sql +++ b/docs/scripts/basic/graphs/graphs.sql @@ -79,7 +79,7 @@ SELECT component FROM all_components WHERE count = (SELECT max FROM max_componen \o create_vehicle_net1.txt -- DROP VIEW vehicle_net CASCADE; -CREATE VIEW vehicle_net AS +CREATE OR REPLACE VIEW vehicle_net AS WITH all_components AS (SELECT component, count(*) FROM ways GROUP BY component), -- line 6 @@ -105,7 +105,7 @@ SELECT count(*) FROM vehicle_net; -- DROP VIEW taxi_net; -CREATE VIEW taxi_net AS +CREATE OR REPLACE VIEW taxi_net AS SELECT id, source, target, diff --git a/docs/scripts/basic/pedestrian/images.sql b/docs/scripts/basic/pedestrian/images.sql index 20d7ca7e9..7d13565f0 100644 --- a/docs/scripts/basic/pedestrian/images.sql +++ b/docs/scripts/basic/pedestrian/images.sql @@ -1,4 +1,4 @@ -CREATE VIEW stars AS +CREATE OR REPLACE VIEW stars AS SELECT osm_id, id, geom, CASE WHEN osm_id = @OSMID_1@ THEN '@PLACE_1@' @@ -11,7 +11,7 @@ FROM vertices WHERE osm_id IN (@OSMID_1@, @OSMID_2@, @OSMID_3@, @OSMID_4@, @OSMID_5@) ORDER BY osm_id; -CREATE VIEW pedestrian_one_to_one AS +CREATE OR REPLACE VIEW pedestrian_one_to_one AS WITH dijkstra AS ( SELECT * FROM pgr_dijkstra( 'SELECT id, source, target, @@ -23,7 +23,7 @@ SELECT * FROM pgr_dijkstra( ) SELECT seq, start_vid, end_vid, geom AS geom FROM dijkstra JOIN walk_net ON(edge = id); -CREATE VIEW pedestrian_many_to_one AS +CREATE OR REPLACE VIEW pedestrian_many_to_one AS WITH dijkstra AS ( SELECT * FROM pgr_dijkstra( 'SELECT id, source, target, @@ -35,7 +35,7 @@ SELECT * FROM pgr_dijkstra( ) SELECT seq, start_vid, end_vid, geom AS geom FROM dijkstra JOIN walk_net ON(edge = id); -CREATE VIEW pedestrian_one_to_many AS +CREATE OR REPLACE VIEW pedestrian_one_to_many AS WITH dijkstra AS ( SELECT * FROM pgr_dijkstra( 'SELECT id, source, target, @@ -47,7 +47,7 @@ SELECT * FROM pgr_dijkstra( ) SELECT seq, start_vid, end_vid, geom AS geom FROM dijkstra JOIN walk_net ON(edge = id); -CREATE VIEW pedestrian_many_to_many AS +CREATE OR REPLACE VIEW pedestrian_many_to_many AS WITH dijkstra AS ( SELECT * FROM pgr_dijkstra( 'SELECT id, source, target, @@ -59,7 +59,7 @@ SELECT * FROM pgr_dijkstra( ) SELECT seq, start_vid, end_vid, geom AS geom FROM dijkstra JOIN walk_net ON(edge = id); -CREATE VIEW pedestrian_combinations AS +CREATE OR REPLACE VIEW pedestrian_combinations AS WITH dijkstra AS ( SELECT * FROM pgr_dijkstra( 'SELECT id, source, target, @@ -73,7 +73,7 @@ WITH dijkstra AS ( ) SELECT seq, start_vid, end_vid, geom AS geom FROM dijkstra JOIN walk_net ON(edge = id); -CREATE VIEW pedestrian_dijkstraCost AS +CREATE OR REPLACE VIEW pedestrian_dijkstraCost AS WITH dijkstra AS ( SELECT start_vid, end_vid, round(agg_cost::numeric,2) AS agg_cost FROM pgr_dijkstraCost( diff --git a/docs/scripts/basic/plpgsql_function/plpgsql_function.sql b/docs/scripts/basic/plpgsql_function/plpgsql_function.sql index db67b00e9..4776ada9e 100644 --- a/docs/scripts/basic/plpgsql_function/plpgsql_function.sql +++ b/docs/scripts/basic/plpgsql_function/plpgsql_function.sql @@ -187,19 +187,19 @@ SELECT 1 AS id, ST_MakePoint(@POINT2_LON@, @POINT2_LAT@) SELECT * INTO points_on_the_fly FROM the_points; -CREATE VIEW ch8_using_vehicle AS +CREATE OR REPLACE VIEW ch8_using_vehicle AS SELECT * FROM wrk_fromAtoB( 'vehicle_net', @POINT1_LAT@, @POINT1_LON@, @POINT2_LAT@, @POINT2_LON@); -CREATE VIEW ch8_using_taxi AS +CREATE OR REPLACE VIEW ch8_using_taxi AS SELECT * FROM wrk_fromAtoB( 'taxi_net', @POINT1_LAT@, @POINT1_LON@, @POINT2_LAT@, @POINT2_LON@); -CREATE VIEW ch8_using_walk AS +CREATE OR REPLACE VIEW ch8_using_walk AS SELECT * FROM wrk_fromAtoB( 'walk_net', diff --git a/docs/scripts/basic/sql_function/images.sql b/docs/scripts/basic/sql_function/images.sql index 49841fc75..c9ee90a58 100644 --- a/docs/scripts/basic/sql_function/images.sql +++ b/docs/scripts/basic/sql_function/images.sql @@ -56,14 +56,14 @@ ORDER BY seq; $BODY$ LANGUAGE 'sql'; -CREATE VIEW using_vehicle AS +CREATE OR REPLACE VIEW using_vehicle AS SELECT * FROM wrk_image('vehicle_net', @CH7_OSMID_1@, @CH7_OSMID_2@); -CREATE VIEW using_taxi AS +CREATE OR REPLACE VIEW using_taxi AS SELECT * FROM wrk_image('taxi_net', @CH7_OSMID_1@, @CH7_OSMID_2@); -CREATE VIEW using_walk AS +CREATE OR REPLACE VIEW using_walk AS SELECT * FROM wrk_image('walk_net', @CH7_OSMID_1@, @CH7_OSMID_2@); diff --git a/docs/scripts/basic/vehicles/CMakeLists.txt b/docs/scripts/basic/vehicles/CMakeLists.txt index cb3c98cc1..d2de8e7f9 100644 --- a/docs/scripts/basic/vehicles/CMakeLists.txt +++ b/docs/scripts/basic/vehicles/CMakeLists.txt @@ -14,20 +14,21 @@ add_custom_command( TARGET basic_vehicles_scripts PRE_BUILD BYPRODUCTS - section-6.1-1.txt - section-6.1-2.txt - section-6.1.1.txt - section-6.1.2.txt - section-6.1.3.txt - section-6.2-1.txt - section-6.2-2.txt - section-6.2-3.txt - section-6.2.1.txt - section-6.2.2-1.txt - section-6.2.2-2.txt - section-6.6.txt + oneway_cost.txt + oneway_revc.txt + route_going.txt + route_coming.txt + time_is_money.txt + add_penalty.txt + use_penalty.txt + update_penalty.txt + get_penalized_route.txt + time_in_secs.txt + penalized_view.txt + using_view.txt + vehicles_end.txt COMMAND psql -d city_routing -f vehicles.sql COMMAND psql -d city_routing -f images.sql COMMENT "running vehicles scripts" -) + DEPENDS vehicles.sql images.sql) diff --git a/docs/scripts/basic/vehicles/images.sql b/docs/scripts/basic/vehicles/images.sql index 140840da1..a5dd573b2 100644 --- a/docs/scripts/basic/vehicles/images.sql +++ b/docs/scripts/basic/vehicles/images.sql @@ -1,57 +1,79 @@ -CREATE VIEW ad7_png AS +CREATE OR REPLACE VIEW vehicle_route_going_png AS WITH dijkstra AS ( SELECT * FROM pgr_dijkstra( - ' SELECT gid AS id, source, target, cost, reverse_cost FROM ways ', -@ID_1@, -@ID_3@, -directed := true) + 'SELECT id, source, target, cost, reverse_cost + FROM vehicle_net', + @ID_1@, @ID_3@, + directed := true) ) -SELECT seq, the_geom AS geom FROM dijkstra JOIN ways ON(edge = gid); +SELECT seq, start_vid, end_vid, geom FROM dijkstra JOIN vehicle_net ON(edge = id); -CREATE VIEW ad8_png AS +CREATE OR REPLACE VIEW vehicle_route_coming_png AS WITH dijkstra AS ( SELECT * FROM pgr_dijkstra( - ' SELECT gid AS id, source, target, cost, reverse_cost FROM ways ', -@ID_3@, @ID_1@, -directed := true) + 'SELECT id, source, target, cost, reverse_cost + FROM vehicle_net', + @ID_3@, @ID_1@, + directed := true) ) -SELECT seq, the_geom AS geom FROM dijkstra JOIN ways ON(edge = gid); +SELECT seq, start_vid, end_vid, geom FROM dijkstra JOIN vehicle_net ON(edge = id); +CREATE OR REPLACE VIEW vehicle_time_is_money_png AS +WITH dijkstra AS ( +SELECT * FROM pgr_dijkstra( + 'SELECT id, source, target, + cost / 3600 * 100 AS cost, + reverse_cost / 3600 * 100 AS reverse_cost + FROM taxi_net', + @ID_3@, @ID_1@) +) +SELECT seq, start_vid, end_vid, geom FROM dijkstra JOIN taxi_net ON(edge = id); -ALTER TABLE configuration ADD COLUMN penalty FLOAT; --- No penalty UPDATE configuration SET penalty=1; +CREATE OR REPLACE VIEW vehicle_use_penalty_png AS +WITH dijkstra AS ( +SELECT * FROM pgr_dijkstra( + 'SELECT v.id, source, target, + CASE WHEN cost <= 0 THEN -1 ELSE cost * penalty END AS cost, + CASE WHEN reverse_cost <= 0 THEN -1 ELSE reverse_cost * penalty END AS reverse_cost + FROM vehicle_net AS v JOIN configuration + USING (tag_id)', + @ID_3@, @ID_1@) +) +SELECT seq, start_vid, end_vid, geom FROM dijkstra JOIN vehicle_net ON(edge = id); --- Not including pedestrian ways -UPDATE configuration SET penalty=-1.0 WHERE tag_value IN ('steps','footway','pedestrian','cycleway'); +-- Not including cycleways +UPDATE configuration SET penalty=-1.0 +WHERE tag_key IN ('cycleway') OR tag_value IN ('cycleway'); --- Penalizing with 5 times the costs +-- Penalizing with 5 times the costs the unknown UPDATE configuration SET penalty=5 WHERE tag_value IN ('unclassified'); -- Encuraging the use of "fast" roads UPDATE configuration SET penalty=0.5 WHERE tag_value IN ('tertiary'); -UPDATE configuration SET penalty=0.3 WHERE tag_value IN ( +UPDATE configuration SET penalty=0.3 +WHERE tag_value IN ( 'primary','primary_link', 'trunk','trunk_link', 'motorway','motorway_junction','motorway_link', 'secondary'); - - -CREATE VIEW ad11_png AS +CREATE OR REPLACE VIEW vehicle_get_penalized_route_png AS WITH dijkstra AS ( SELECT * FROM pgr_dijkstra( - ' SELECT gid AS id, source, target, cost_s * penalty AS cost, reverse_cost_s * penalty AS reverse_cost - FROM ways JOIN configuration - USING (tag_id) ', + 'SELECT v.id, source, target, + CASE WHEN cost <= 0 THEN -1 ELSE cost * penalty END AS cost, + CASE WHEN reverse_cost <= 0 THEN -1 ELSE reverse_cost * penalty END AS reverse_cost + FROM vehicle_net AS v JOIN configuration + USING (tag_id)', @ID_3@, @ID_1@) ) -SELECT seq, start_vid, end_vid, the_geom AS geom FROM dijkstra JOIN ways ON(edge = gid); +SELECT seq, geom AS geom FROM dijkstra JOIN vehicle_net ON(edge = id); -CREATE VIEW penalty_routes AS +CREATE OR REPLACE VIEW vehicle_penalty_routes AS WITH dijkstra AS ( SELECT * FROM pgr_dijkstra( ' SELECT gid AS id, source, target, cost_s * penalty AS cost, reverse_cost_s * penalty AS reverse_cost @@ -72,7 +94,7 @@ SELECT seq, start_vid, end_vid, the_geom AS geom FROM dijkstra JOIN ways ON(edge = gid); -CREATE VIEW no_penalty_routes AS +CREATE OR REPLACE VIEW vehicle_no_penalty_routes AS WITH dijkstra AS ( SELECT * FROM pgr_dijkstra( ' SELECT gid AS id, source, target, cost_s AS cost, reverse_cost_s AS reverse_cost FROM ways ', @@ -91,5 +113,5 @@ SELECT seq, start_vid, end_vid, the_geom AS geom FROM dijkstra JOIN ways ON(edge = gid); -CREATE VIEW pedestrian_only_roads AS +CREATE OR REPLACE VIEW pedestrian_only_roads AS SELECT * FROM ways where tag_id in (119, 122, 114, 118); diff --git a/docs/scripts/basic/vehicles/vehicles.sql b/docs/scripts/basic/vehicles/vehicles.sql index 793a6e927..ddd11c0e0 100644 --- a/docs/scripts/basic/vehicles/vehicles.sql +++ b/docs/scripts/basic/vehicles/vehicles.sql @@ -1,101 +1,60 @@ -\o section-6.1-1.txt +\o oneway_cost.txt -SELECT count(*) -FROM ways -WHERE cost < 0; -- line 3 +SELECT count(*) FROM vehicle_net +WHERE cost < 0; -\o section-6.1-2.txt +\o oneway_revc.txt -SELECT count(*) -FROM ways -WHERE reverse_cost < 0; -- line 3 +SELECT count(*) FROM vehicle_net +WHERE reverse_cost < 0; -\o section-6.1.1.txt +\o route_going.txt SELECT * FROM pgr_dijkstra( - ' - SELECT gid AS id, - source, - target, - cost, -- line 6 - reverse_cost -- line 7 - FROM ways - ', - @ID_1@, -- line 10 - @ID_3@, -- line 11 + 'SELECT id, source, target, cost, reverse_cost + FROM vehicle_net', + @ID_1@, @ID_3@, directed := true); -\o section-6.1.2.txt +\o route_coming.txt SELECT * FROM pgr_dijkstra( - ' - SELECT gid AS id, - source, - target, - cost_s AS cost, -- line 6 - reverse_cost_s AS reverse_cost -- line 7 - FROM ways - ', - @ID_3@, -- line 10 - @ID_1@, -- line 11 + 'SELECT id, source, target, cost, reverse_cost + FROM vehicle_net', + @ID_3@, @ID_1@, directed := true); -\o section-6.1.3.txt +\o time_is_money.txt SELECT * FROM pgr_dijkstra( - ' - SELECT gid AS id, - source, - target, - cost_s / 3600 * 100 AS cost, -- line 6 - reverse_cost_s / 3600 * 100 AS reverse_cost -- line 7 - FROM ways - ', - @ID_3@, -- line 10 - @ID_1@); -- line 11 - -\o section-6.2-1.txt -\dS+ configuration -\o section-6.2-2.txt - -SELECT tag_id, tag_key, tag_value -FROM configuration -ORDER BY tag_id; - -\o section-6.2-3.txt - -SELECT distinct tag_id, tag_key, tag_value -FROM ways JOIN configuration USING (tag_id) -ORDER BY tag_id; - -\o section-6.2.1.txt - -ALTER TABLE configuration ADD COLUMN penalty FLOAT; --- No penalty -UPDATE configuration SET penalty=1; -- line 3 - - -SELECT * -FROM pgr_dijkstra( - ' - SELECT gid AS id, - source, - target, - cost_s * penalty AS cost, -- line 12 - reverse_cost_s * penalty AS reverse_cost -- line 13 - FROM ways JOIN configuration -- line 14 - USING (tag_id) -- line 15 - ', - @ID_3@, -- line 17 - @ID_1@); -- line 18 - -\o section-6.2.2-1.txt - --- Not including pedestrian ways + 'SELECT id, source, target, + cost / 3600 * 100 AS cost, + reverse_cost / 3600 * 100 AS reverse_cost + FROM taxi_net', + @ID_3@, @ID_1@); + +\o add_penalty.txt + +ALTER TABLE configuration + ADD COLUMN IF NOT EXISTS penalty FLOAT DEFAULT 1.0; + +\o use_penalty.txt + +SELECT * FROM pgr_dijkstra( + 'SELECT v.id, source, target, + CASE WHEN cost <= 0 THEN -1 ELSE cost * penalty END AS cost, + CASE WHEN reverse_cost <= 0 THEN -1 ELSE reverse_cost * penalty END AS reverse_cost + FROM vehicle_net AS v JOIN configuration + USING (tag_id)', + @ID_3@, @ID_1@); + +\o update_penalty.txt + +-- Not including cycleways UPDATE configuration SET penalty=-1.0 -WHERE tag_value IN ('steps','footway','pedestrian','cycleway'); +WHERE tag_key IN ('cycleway') OR tag_value IN ('cycleway'); -- Penalizing with 5 times the costs the unknown UPDATE configuration SET penalty=5 WHERE tag_value IN ('unclassified'); @@ -109,40 +68,58 @@ WHERE tag_value IN ( 'motorway','motorway_junction','motorway_link', 'secondary'); -\o section-6.2.2-2.txt +\o get_penalized_route.txt SELECT * FROM pgr_dijkstra( - ' - SELECT gid AS id, - source, - target, - cost_s * penalty AS cost, -- line 6 - reverse_cost_s * penalty AS reverse_cost -- line 7 - FROM ways JOIN configuration -- line 8 - USING (tag_id) -- line 9 - ', - @ID_3@, -- line 11 - @ID_1@); -- line 12 - -\o section-6.6.txt + 'SELECT v.id, source, target, + CASE WHEN cost <= 0 THEN -1 ELSE cost * penalty END AS cost, + CASE WHEN reverse_cost <= 0 THEN -1 ELSE reverse_cost * penalty END AS reverse_cost + FROM vehicle_net AS v JOIN configuration + USING (tag_id)', + @ID_3@, @ID_1@); + +\o time_in_secs.txt SELECT * FROM pgr_dijkstra( $$ - SELECT gid AS id, source, target, cost_s AS cost, reverse_cost_s AS reverse_cost + SELECT id, source, target, cost, reverse_cost FROM ( - -- penalized query - SELECT edge AS gid FROM pgr_dijkstra( -- line 6 - ' - SELECT gid AS id, - source, - target, - cost_s * penalty AS cost, - reverse_cost_s * penalty AS reverse_cost - FROM ways JOIN configuration - USING (tag_id) - ', - @ID_3@, - @ID_1@) ) AS edges_in_route - JOIN ways USING (gid) -- line 18 + -- Nested call + SELECT edge AS id FROM pgr_dijkstra( + 'SELECT v.id, source, target, + CASE WHEN cost <= 0 THEN -1 ELSE cost * penalty END AS cost, + CASE WHEN reverse_cost <= 0 THEN -1 ELSE reverse_cost * penalty END AS reverse_cost + FROM vehicle_net AS v JOIN configuration + USING (tag_id)', + @ID_3@, @ID_1@) ) AS edges_in_route + JOIN vehicle_net USING (id) $$, @ID_3@, @ID_1@); + +\o penalized_view.txt + +CREATE OR REPLACE VIEW penalized AS +SELECT + v.id, source, target, + CASE WHEN cost <= 0 THEN -1 ELSE cost * penalty END AS cost, + CASE WHEN reverse_cost <= 0 THEN -1 ELSE reverse_cost * penalty END AS reverse_cost +FROM vehicle_net AS v JOIN configuration +USING (tag_id); + +\o using_view.txt + +SELECT * FROM pgr_dijkstra( + $$ + SELECT id, source, target, cost, reverse_cost + FROM ( + -- Nested call + SELECT edge AS id FROM pgr_dijkstra( + 'SELECT id, source, target, cost, reverse_cost + FROM penalized', + @ID_3@, @ID_1@) ) AS edges_in_route + JOIN vehicle_net USING (id) + $$, + @ID_3@, @ID_1@); + +\o vehicles_end.txt +\o diff --git a/docs/un_sdg/images/CMakeLists.txt b/docs/un_sdg/images/CMakeLists.txt index d00e3e707..2eda896c3 100644 --- a/docs/un_sdg/images/CMakeLists.txt +++ b/docs/un_sdg/images/CMakeLists.txt @@ -7,17 +7,15 @@ set(PGR_WORKSHOP_IMG_SUBDIRS sdg3 sdg11 sdg7 - ) +) - -#--------------------------------------------- -# Adding the documentation subdirectories & files -#--------------------------------------------- - foreach (dir ${PGR_WORKSHOP_IMG_SUBDIRS}) - file(COPY "${dir}" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") if (PGR_WORKSHOP_DEBUG) - message(STATUS " Adding images directory ${dir}") + message(STATUS " -> ${CMAKE_CURRENT_SOURCE_DIR}/${dir}") + endif() + add_subdirectory("${dir}") + if (PGR_WORKSHOP_DEBUG) + message(STATUS " <- ${CMAKE_CURRENT_SOURCE_DIR}/${dir}") endif() endforeach() diff --git a/docs/un_sdg/images/introduction/CMakeLists.txt b/docs/un_sdg/images/introduction/CMakeLists.txt index 916e8dd13..5b233483f 100644 --- a/docs/un_sdg/images/introduction/CMakeLists.txt +++ b/docs/un_sdg/images/introduction/CMakeLists.txt @@ -1,17 +1,15 @@ - #--------------------- # Files #--------------------- set(PGR_WORKSHOP_IMG_FILES un_17_sdgs.png un_logo.jpg - ) +) foreach (f ${PGR_WORKSHOP_IMG_FILES}) if (PGR_WORKSHOP_VERBOSE_DEBUG) - message(STATUS " Adding file ${f}") + message(STATUS " -> ${f}") endif() - FILE(COPY ${f} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") + configure_file(${f} ${f} COPYONLY) endforeach() - diff --git a/docs/un_sdg/images/sdg11/CMakeLists.txt b/docs/un_sdg/images/sdg11/CMakeLists.txt index 2bb9377e9..884c30da5 100644 --- a/docs/un_sdg/images/sdg11/CMakeLists.txt +++ b/docs/un_sdg/images/sdg11/CMakeLists.txt @@ -6,13 +6,12 @@ set(PGR_WORKSHOP_IMG_FILES un_sdg11.png sdg11_output.png remove_waterways.png - ) +) foreach (f ${PGR_WORKSHOP_IMG_FILES}) if (PGR_WORKSHOP_VERBOSE_DEBUG) - message(STATUS " Adding file ${f}") + message(STATUS " -> ${f}") endif() - FILE(COPY ${f} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") + configure_file(${f} ${f} COPYONLY) endforeach() - diff --git a/docs/un_sdg/images/sdg3/CMakeLists.txt b/docs/un_sdg/images/sdg3/CMakeLists.txt index 4eab8c1e5..6e5259b26 100644 --- a/docs/un_sdg/images/sdg3/CMakeLists.txt +++ b/docs/un_sdg/images/sdg3/CMakeLists.txt @@ -10,13 +10,12 @@ set(PGR_WORKSHOP_IMG_FILES service_area.png generalised_service_area.png road_population.png - ) +) foreach (f ${PGR_WORKSHOP_IMG_FILES}) if (PGR_WORKSHOP_VERBOSE_DEBUG) - message(STATUS " Adding file ${f}") + message(STATUS " -> ${f}") endif() - FILE(COPY ${f} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") + configure_file(${f} ${f} COPYONLY) endforeach() - diff --git a/docs/un_sdg/images/sdg7/CMakeLists.txt b/docs/un_sdg/images/sdg7/CMakeLists.txt index 4457f943a..3f84424bb 100644 --- a/docs/un_sdg/images/sdg7/CMakeLists.txt +++ b/docs/un_sdg/images/sdg7/CMakeLists.txt @@ -5,13 +5,12 @@ set(PGR_WORKSHOP_IMG_FILES un_sdg7.png sdg7_output.png - ) +) foreach (f ${PGR_WORKSHOP_IMG_FILES}) if (PGR_WORKSHOP_VERBOSE_DEBUG) - message(STATUS " Adding file ${f}") + message(STATUS " -> ${f}") endif() - FILE(COPY ${f} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") + configure_file(${f} ${f} COPYONLY) endforeach() - diff --git a/locale/en/LC_MESSAGES/basic/vehicle.po b/locale/en/LC_MESSAGES/basic/vehicle.po index 6051e022e..ff775b16f 100644 --- a/locale/en/LC_MESSAGES/basic/vehicle.po +++ b/locale/en/LC_MESSAGES/basic/vehicle.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Workshop FOSS4G Belém 3.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-12-16 17:44+0000\n" +"POT-Creation-Date: 2025-10-04 19:44+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language: en\n" @@ -18,7 +18,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" -"Generated-By: Babel 2.16.0\n" +"Generated-By: Babel 2.17.0\n" #: ../../build/docs/basic/vehicle.rst:12 msgid "Vehicle Routing" @@ -40,8 +40,7 @@ msgstr "" #: ../../build/docs/basic/vehicle.rst:26 msgid "" -"A query for vehicle routing generally differs from routing for " -"pedestrians:" +"A query for vehicle routing generally differs from routing for pedestrians:" msgstr "" #: ../../build/docs/basic/vehicle.rst:28 @@ -82,8 +81,7 @@ msgstr "" #: ../../build/docs/basic/vehicle.rst:39 msgid "" -"The ``reverse_cost`` attribute must be taken into account on two way " -"streets." +"The ``reverse_cost`` attribute must be taken into account on two way streets." msgstr "" #: ../../build/docs/basic/vehicle.rst:41 @@ -112,391 +110,301 @@ msgstr "" #: ../../build/docs/basic/vehicle.rst:51 msgid "" -"A **wrong way** is indicated with a **negative value** and is not " -"inserted in the graph for processing." +"A **wrong way** is indicated with a **negative value** and is not inserted " +"in the graph for processing." msgstr "" #: ../../build/docs/basic/vehicle.rst:54 msgid "" -"**Two way** roads - ``IF cost >= 0 AND reverse_cost >= 0`` and their " -"values can be different. For example, it is faster going down hill on a " -"sloped road. In general, ``cost`` and ``reverse_cost`` do not need to be " -"length; they can be almost anything, for example - time, slope, surface, " -"road type, etc., or they can be a combination of multiple parameters." +"**Two way** roads - ``IF cost >= 0 AND reverse_cost >= 0`` and their values " +"can be different. For example, it is faster going down hill on a sloped " +"road. In general, ``cost`` and ``reverse_cost`` do not need to be length; " +"they can be almost anything, for example - time, slope, surface, road type, " +"etc., or they can be a combination of multiple parameters." msgstr "" #: ../../build/docs/basic/vehicle.rst:61 msgid "" -"The following queries indicate the number of road segments, where a \"one" -" way\" rule applies:" +"The following queries indicate the number of road segments, where a \"one " +"way\" rule applies:" msgstr "" #: ../../build/docs/basic/vehicle.rst:62 msgid "Number of (``source, target``) segments with ``cost < 0`` (line **3**)." msgstr "" -#: ../../build/docs/basic/vehicle.rst:72 +#: ../../build/docs/basic/vehicle.rst:71 msgid "" "Number of (``target, source``) segments with ``reverse_cost < 0`` (line " "**3**)." msgstr "" -#: ../../build/docs/basic/vehicle.rst:84 +#: ../../build/docs/basic/vehicle.rst:83 msgid "Exercise 1: Vehicle routing - going" msgstr "" -#: ../../build/docs/basic/vehicle.rst:87 ../../build/docs/basic/vehicle.rst:115 -#: ../../build/docs/basic/vehicle.rst:145 -#: ../../build/docs/basic/vehicle.rst:246 -#: ../../build/docs/basic/vehicle.rst:310 -#: ../../build/docs/basic/vehicle.rst:352 +#: ../../build/docs/basic/vehicle.rst:86 ../../build/docs/basic/vehicle.rst:112 +#: ../../build/docs/basic/vehicle.rst:139 +#: ../../build/docs/basic/vehicle.rst:185 +#: ../../build/docs/basic/vehicle.rst:257 +#: ../../build/docs/basic/vehicle.rst:292 msgid "Problem:" msgstr "" -#: ../../build/docs/basic/vehicle.rst:88 +#: ../../build/docs/basic/vehicle.rst:87 msgid "From the \"|place_1|\" to the \"|place_3|\" by car." msgstr "" -#: ../../build/docs/basic/vehicle.rst:90 +#: ../../build/docs/basic/vehicle.rst:89 msgid "From |place_1| to the |place_3| by car." msgstr "" -#: ../../build/docs/basic/vehicle.rst:95 ../../build/docs/basic/vehicle.rst:123 -#: ../../build/docs/basic/vehicle.rst:153 -#: ../../build/docs/basic/vehicle.rst:254 -#: ../../build/docs/basic/vehicle.rst:318 -#: ../../build/docs/basic/vehicle.rst:356 +#: ../../build/docs/basic/vehicle.rst:94 ../../build/docs/basic/vehicle.rst:120 +#: ../../build/docs/basic/vehicle.rst:147 +#: ../../build/docs/basic/vehicle.rst:193 +#: ../../build/docs/basic/vehicle.rst:265 +#: ../../build/docs/basic/vehicle.rst:296 msgid "Solution:" msgstr "" -#: ../../build/docs/basic/vehicle.rst:96 -msgid "" -"Use ``cost`` (line **6**) and ``reverse_cost`` (line **7**) columns, " -"which are in unit ``degrees``." +#: ../../build/docs/basic/vehicle.rst:95 +msgid "``cost`` and ``reverse_cost`` columns, are in seconds." msgstr "" -#: ../../build/docs/basic/vehicle.rst:97 -msgid "" -"The vehicle is going from vertex |id_1| (line **10**) to |id_3| (line " -"**11**)." +#: ../../build/docs/basic/vehicle.rst:96 +msgid "The vehicle is going from vertex |id_1| to |id_3|." msgstr "" -#: ../../build/docs/basic/vehicle.rst:112 +#: ../../build/docs/basic/vehicle.rst:109 msgid "Exercise 2: Vehicle routing - returning" msgstr "" -#: ../../build/docs/basic/vehicle.rst:116 +#: ../../build/docs/basic/vehicle.rst:113 msgid "From \"|place_3|\" to the \"|place_1|\" by car." msgstr "" -#: ../../build/docs/basic/vehicle.rst:118 +#: ../../build/docs/basic/vehicle.rst:115 msgid "From |place_3| to the |place_1| by car." msgstr "" -#: ../../build/docs/basic/vehicle.rst:124 -msgid "" -"Use ``cost_s`` (line **6**) and ``reverse_cost_s`` (line **7**) columns, " -"in units seconds." -msgstr "" - -#: ../../build/docs/basic/vehicle.rst:126 -#: ../../build/docs/basic/vehicle.rst:161 -msgid "" -"The vehicle is going from vertex |id_3| (line **10**) to |id_1| (line " -"**11**)." +#: ../../build/docs/basic/vehicle.rst:121 +#: ../../build/docs/basic/vehicle.rst:156 +msgid "The vehicle is going from vertex |id_3| to |id_1|." msgstr "" -#: ../../build/docs/basic/vehicle.rst:138 +#: ../../build/docs/basic/vehicle.rst:132 msgid "" "On a directed graph, going and coming back routes, most of the time are " "different." msgstr "" -#: ../../build/docs/basic/vehicle.rst:142 +#: ../../build/docs/basic/vehicle.rst:136 msgid "Exercise 3: Vehicle routing when time is money" msgstr "" -#: ../../build/docs/basic/vehicle.rst:146 +#: ../../build/docs/basic/vehicle.rst:140 msgid "From \"|place_3|\" to the \"|place_1|\" by taxi." msgstr "" -#: ../../build/docs/basic/vehicle.rst:148 +#: ../../build/docs/basic/vehicle.rst:142 msgid "From |place_3| to |place_1| by taxi." msgstr "" -#: ../../build/docs/basic/vehicle.rst:154 +#: ../../build/docs/basic/vehicle.rst:148 +msgid "Use the ``taxi_net``." +msgstr "" + +#: ../../build/docs/basic/vehicle.rst:149 msgid "The cost is ``$100 per hour``." msgstr "" -#: ../../build/docs/basic/vehicle.rst:156 -#: ../../build/docs/basic/vehicle.rst:319 -msgid "" -"Using ``cost_s`` (line **6**) and ``reverse_cost_s`` (line **7**) " -"columns, which are in unit ``seconds``." +#: ../../build/docs/basic/vehicle.rst:151 +msgid "Using ``cost`` and ``reverse_cost`` columns, which are in seconds." msgstr "" -#: ../../build/docs/basic/vehicle.rst:158 -msgid "The duration in hours is ``cost_s / 3600``." +#: ../../build/docs/basic/vehicle.rst:153 +msgid "The duration in hours is ``cost / 3600``." msgstr "" -#: ../../build/docs/basic/vehicle.rst:159 -msgid "The cost in ``dollars`` is ``cost_s / 3600 * 100``." +#: ../../build/docs/basic/vehicle.rst:154 +msgid "The cost in ``dollars`` is ``cost / 3600 * 100``." msgstr "" -#: ../../build/docs/basic/vehicle.rst:174 +#: ../../build/docs/basic/vehicle.rst:168 msgid "Comparing with `Exercise 2: Vehicle routing - returning`_:" msgstr "" -#: ../../build/docs/basic/vehicle.rst:176 +#: ../../build/docs/basic/vehicle.rst:170 msgid "The total number of records are identical." msgstr "" -#: ../../build/docs/basic/vehicle.rst:177 +#: ../../build/docs/basic/vehicle.rst:171 msgid "The node sequence is identical." msgstr "" -#: ../../build/docs/basic/vehicle.rst:178 +#: ../../build/docs/basic/vehicle.rst:172 msgid "The edge sequence is identical." msgstr "" -#: ../../build/docs/basic/vehicle.rst:179 +#: ../../build/docs/basic/vehicle.rst:173 msgid "The cost and agg_cost results are directly proportional." msgstr "" -#: ../../build/docs/basic/vehicle.rst:183 +#: ../../build/docs/basic/vehicle.rst:177 msgid "Cost manipulations" msgstr "" -#: ../../build/docs/basic/vehicle.rst:185 -msgid "" -"When dealing with data, being aware of what kind of data is being used " -"can improve results." -msgstr "" - -#: ../../build/docs/basic/vehicle.rst:187 -msgid "Vehicles can not circulate on pedestrian ways" -msgstr "" - -#: ../../build/docs/basic/vehicle.rst:195 -msgid "" -"Penalizing or removal of pedestrian ways will make the results closer to " -"reality." -msgstr "" - -#: ../../build/docs/basic/vehicle.rst:197 -msgid "" -"When converting data from OSM format using the `osm2pgrouting` tool, " -"there is an additional table: ``configuration``." -msgstr "" - -#: ../../build/docs/basic/vehicle.rst:201 -msgid "" -"The ``configuration`` table structure can be obtained with the following " -"command." -msgstr "" - -#: ../../build/docs/basic/vehicle.rst:210 -msgid "tag_id values" -msgstr "" - -#: ../../build/docs/basic/vehicle.rst:216 -msgid "In the image above there is a detail of the ``tag_id`` of the roads." -msgstr "" - -#: ../../build/docs/basic/vehicle.rst:219 -msgid "The ``OSM way`` types:" -msgstr "" - -#: ../../build/docs/basic/vehicle.rst:227 -msgid "" -"Also, on the ``ways`` table there is a column that can be used to " -"``JOIN`` with the ``configuration`` table." -msgstr "" - -#: ../../build/docs/basic/vehicle.rst:230 -msgid "The ``ways`` types:" -msgstr "" - -#: ../../build/docs/basic/vehicle.rst:239 +#: ../../build/docs/basic/vehicle.rst:179 msgid "" "In this workshop, costs are going to be manipulated using the " "``configuration`` table." msgstr "" -#: ../../build/docs/basic/vehicle.rst:243 +#: ../../build/docs/basic/vehicle.rst:182 msgid "Exercise 4: Vehicle routing without penalization" msgstr "" -#: ../../build/docs/basic/vehicle.rst:247 +#: ../../build/docs/basic/vehicle.rst:186 msgid "From the \"|place_3|\" to \"|place_1|\"" msgstr "" -#: ../../build/docs/basic/vehicle.rst:249 -#: ../../build/docs/basic/vehicle.rst:313 +#: ../../build/docs/basic/vehicle.rst:188 +#: ../../build/docs/basic/vehicle.rst:260 msgid "From |place_3| to |place_1|" msgstr "" -#: ../../build/docs/basic/vehicle.rst:256 +#: ../../build/docs/basic/vehicle.rst:194 msgid "Add a penalty column" msgstr "" -#: ../../build/docs/basic/vehicle.rst:257 -msgid "All roads have a ``penalty`` of ``1`` (line **3**)." -msgstr "" - -#: ../../build/docs/basic/vehicle.rst:260 -msgid "Query" +#: ../../build/docs/basic/vehicle.rst:196 +msgid "All roads have a ``penalty`` of ``1``." msgstr "" -#: ../../build/docs/basic/vehicle.rst:261 +#: ../../build/docs/basic/vehicle.rst:202 msgid "The vehicle's cost in this case will be in penalized seconds." msgstr "" -#: ../../build/docs/basic/vehicle.rst:263 -msgid "" -"Costs (in seconds) are to be multiplied by :code:`penalty` (lines **12** " -"and **13**)." +#: ../../build/docs/basic/vehicle.rst:204 +msgid "Costs are to be multiplied by :code:`penalty` (lines **5** and **6**)." msgstr "" -#: ../../build/docs/basic/vehicle.rst:264 -msgid "Costs wont change (times 1 leaves the value unchanged)." +#: ../../build/docs/basic/vehicle.rst:205 +msgid "Costs won't change (:math:`cost * 1 = cost`)." msgstr "" -#: ../../build/docs/basic/vehicle.rst:266 +#: ../../build/docs/basic/vehicle.rst:207 msgid "" "The :code:`configuration` table is linked with the :code:`ways` table by " -"the :code:`tag_id` field using a ``JOIN`` (lines **14** and **15**)." +"the :code:`tag_id` field using a ``JOIN``" msgstr "" -#: ../../build/docs/basic/vehicle.rst:268 -msgid "" -"The vehicle is going from vertex |id_3| (line **17**) to vertex |id_1| " -"(line **18**)." +#: ../../build/docs/basic/vehicle.rst:209 +msgid "The vehicle is going from vertex |id_3| to vertex |id_1|." msgstr "" -#: ../../build/docs/basic/vehicle.rst:282 +#: ../../build/docs/basic/vehicle.rst:224 msgid "Exercise 5: Vehicle routing with penalization" msgstr "" -#: ../../build/docs/basic/vehicle.rst:285 +#: ../../build/docs/basic/vehicle.rst:227 msgid "Concept:" msgstr "" -#: ../../build/docs/basic/vehicle.rst:286 +#: ../../build/docs/basic/vehicle.rst:228 msgid "" -"Change the cost values for the :code:`configuration` table, in such a " -"way, that the" +"Change the cost values for the :code:`configuration` table, in such a way, " +"that the" msgstr "" -#: ../../build/docs/basic/vehicle.rst:288 -msgid "Pedestrian roads are not used." +#: ../../build/docs/basic/vehicle.rst:230 +msgid "Bicycle roads are not used." msgstr "" -#: ../../build/docs/basic/vehicle.rst:290 +#: ../../build/docs/basic/vehicle.rst:232 msgid "``penalty < 0`` makes the road not to be included in the graph." msgstr "" -#: ../../build/docs/basic/vehicle.rst:292 +#: ../../build/docs/basic/vehicle.rst:234 msgid "Using residential roads is not encouraged." msgstr "" -#: ../../build/docs/basic/vehicle.rst:294 +#: ../../build/docs/basic/vehicle.rst:236 msgid "``penalty > 1`` makes the road slower for the calculations." msgstr "" -#: ../../build/docs/basic/vehicle.rst:296 +#: ../../build/docs/basic/vehicle.rst:238 msgid "Using \"faster\" roads is highly encouraged." msgstr "" -#: ../../build/docs/basic/vehicle.rst:298 +#: ../../build/docs/basic/vehicle.rst:240 msgid "``penalty < 1`` makes the road faster for the calculations." msgstr "" -#: ../../build/docs/basic/vehicle.rst:300 -msgid "The ``penalty`` values can be changed with ``UPDATE`` queries." +#: ../../build/docs/basic/vehicle.rst:242 +msgid "All other roads are not penalized." msgstr "" -#: ../../build/docs/basic/vehicle.rst:302 -msgid "These values are an exaggeration." +#: ../../build/docs/basic/vehicle.rst:244 +msgid "``penalty = 1`` does not modify the road times." msgstr "" -#: ../../build/docs/basic/vehicle.rst:311 -msgid "From the \"|place_3|\" to \"|place_1|\" with penalization." +#: ../../build/docs/basic/vehicle.rst:246 +msgid "The ``penalty`` values can be changed with ``UPDATE`` queries." msgstr "" -#: ../../build/docs/basic/vehicle.rst:321 -msgid "Costs are to be multiplied by :code:`penalty` (lines **6** and **7**)." +#: ../../build/docs/basic/vehicle.rst:248 +msgid "These values are an exaggeration." msgstr "" -#: ../../build/docs/basic/vehicle.rst:323 -msgid "" -"The :code:`configuration` table is linked with the :code:`ways` table by " -"the :code:`tag_id` field using a ``JOIN`` (lines **8** and **9**)." +#: ../../build/docs/basic/vehicle.rst:258 +msgid "From the \"|place_3|\" to \"|place_1|\" with penalization." msgstr "" -#: ../../build/docs/basic/vehicle.rst:325 +#: ../../build/docs/basic/vehicle.rst:266 msgid "" -"The vehicle is going from vertex |id_3| (line **11**) to vertex |id_1| " -"(line **12**)." +"Using the same query from `Exercise 4: Vehicle routing without penalization`_" msgstr "" -#: ../../build/docs/basic/vehicle.rst:337 +#: ../../build/docs/basic/vehicle.rst:279 msgid "Comparing with `Exercise 3: Vehicle routing when time is money`_:" msgstr "" -#: ../../build/docs/basic/vehicle.rst:339 +#: ../../build/docs/basic/vehicle.rst:281 msgid "The total number of records changed." msgstr "" -#: ../../build/docs/basic/vehicle.rst:341 +#: ../../build/docs/basic/vehicle.rst:283 msgid "The node sequence changed." msgstr "" -#: ../../build/docs/basic/vehicle.rst:342 +#: ../../build/docs/basic/vehicle.rst:284 msgid "The edge sequence changed." msgstr "" -#: ../../build/docs/basic/vehicle.rst:344 -msgid "The route is avoiding the residential roads that have ``tag_id = 110``." -msgstr "" - -#: ../../build/docs/basic/vehicle.rst:345 +#: ../../build/docs/basic/vehicle.rst:286 msgid "The costs do not change proportionally." msgstr "" -#: ../../build/docs/basic/vehicle.rst:348 -msgid "Exercise 6: Time in seconds of penalized route" +#: ../../build/docs/basic/vehicle.rst:289 +msgid "Exercise 6: Time in seconds of penalized route using a view" msgstr "" -#: ../../build/docs/basic/vehicle.rst:353 +#: ../../build/docs/basic/vehicle.rst:293 msgid "Get the times in seconds of a penalized route" msgstr "" -#: ../../build/docs/basic/vehicle.rst:357 -msgid "Use as inner query the penalized query joined with the ways table" -msgstr "" - -#: ../../build/docs/basic/vehicle.rst:359 -msgid "Keep the ``edge`` as ``gid`` (line **6**)" -msgstr "" - -#: ../../build/docs/basic/vehicle.rst:360 -msgid "Join using ``gid`` (line **18**)" -msgstr "" - -#: ../../build/docs/basic/vehicle.rst:373 -msgid "Comparing with `Exercise 5: Vehicle routing with penalization`_:" -msgstr "" - -#: ../../build/docs/basic/vehicle.rst:375 -msgid "The total number of records is the same." +#: ../../build/docs/basic/vehicle.rst:297 +msgid "" +"Create a penalized view by joining the ``vehicle_net`` joined with the " +"``configuration`` table" msgstr "" -#: ../../build/docs/basic/vehicle.rst:376 -msgid "The route is the same" +#: ../../build/docs/basic/vehicle.rst:300 +msgid "" +"Use the inner query from `Exercise 5: Vehicle routing with penalization`_" msgstr "" -#: ../../build/docs/basic/vehicle.rst:377 -msgid "The ``cost`` column have the original vales from the ways table." +#: ../../build/docs/basic/vehicle.rst:308 +msgid "Get the route ``configuration`` table" msgstr "" - diff --git a/locale/pot/basic/vehicle.pot b/locale/pot/basic/vehicle.pot index 61c489911..d942f69f9 100644 --- a/locale/pot/basic/vehicle.pot +++ b/locale/pot/basic/vehicle.pot @@ -1,14 +1,14 @@ # SOME DESCRIPTIVE TITLE. -# Copyright (C) 2010-2024 pgRouting Developers -# This file is distributed under the same license as the Workshop FOSS4G Belém package. +# Copyright (C) 2010-2025 pgRouting Developers +# This file is distributed under the same license as the Workshop FOSS4G Auckland package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Workshop FOSS4G Belém 3.0\n" +"Project-Id-Version: Workshop FOSS4G Auckland 3.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-12-16 17:44+0000\n" +"POT-Creation-Date: 2025-10-04 19:44+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -116,331 +116,266 @@ msgstr "" msgid "Number of (``source, target``) segments with ``cost < 0`` (line **3**)." msgstr "" -#: ../../build/docs/basic/vehicle.rst:72 +#: ../../build/docs/basic/vehicle.rst:71 msgid "Number of (``target, source``) segments with ``reverse_cost < 0`` (line **3**)." msgstr "" -#: ../../build/docs/basic/vehicle.rst:84 +#: ../../build/docs/basic/vehicle.rst:83 msgid "Exercise 1: Vehicle routing - going" msgstr "" -#: ../../build/docs/basic/vehicle.rst:87 -#: ../../build/docs/basic/vehicle.rst:115 -#: ../../build/docs/basic/vehicle.rst:145 -#: ../../build/docs/basic/vehicle.rst:246 -#: ../../build/docs/basic/vehicle.rst:310 -#: ../../build/docs/basic/vehicle.rst:352 +#: ../../build/docs/basic/vehicle.rst:86 +#: ../../build/docs/basic/vehicle.rst:112 +#: ../../build/docs/basic/vehicle.rst:139 +#: ../../build/docs/basic/vehicle.rst:185 +#: ../../build/docs/basic/vehicle.rst:257 +#: ../../build/docs/basic/vehicle.rst:292 msgid "Problem:" msgstr "" -#: ../../build/docs/basic/vehicle.rst:88 +#: ../../build/docs/basic/vehicle.rst:87 msgid "From the \"|place_1|\" to the \"|place_3|\" by car." msgstr "" -#: ../../build/docs/basic/vehicle.rst:90 +#: ../../build/docs/basic/vehicle.rst:89 msgid "From |place_1| to the |place_3| by car." msgstr "" -#: ../../build/docs/basic/vehicle.rst:95 -#: ../../build/docs/basic/vehicle.rst:123 -#: ../../build/docs/basic/vehicle.rst:153 -#: ../../build/docs/basic/vehicle.rst:254 -#: ../../build/docs/basic/vehicle.rst:318 -#: ../../build/docs/basic/vehicle.rst:356 +#: ../../build/docs/basic/vehicle.rst:94 +#: ../../build/docs/basic/vehicle.rst:120 +#: ../../build/docs/basic/vehicle.rst:147 +#: ../../build/docs/basic/vehicle.rst:193 +#: ../../build/docs/basic/vehicle.rst:265 +#: ../../build/docs/basic/vehicle.rst:296 msgid "Solution:" msgstr "" -#: ../../build/docs/basic/vehicle.rst:96 -msgid "Use ``cost`` (line **6**) and ``reverse_cost`` (line **7**) columns, which are in unit ``degrees``." +#: ../../build/docs/basic/vehicle.rst:95 +msgid "``cost`` and ``reverse_cost`` columns, are in seconds." msgstr "" -#: ../../build/docs/basic/vehicle.rst:97 -msgid "The vehicle is going from vertex |id_1| (line **10**) to |id_3| (line **11**)." +#: ../../build/docs/basic/vehicle.rst:96 +msgid "The vehicle is going from vertex |id_1| to |id_3|." msgstr "" -#: ../../build/docs/basic/vehicle.rst:112 +#: ../../build/docs/basic/vehicle.rst:109 msgid "Exercise 2: Vehicle routing - returning" msgstr "" -#: ../../build/docs/basic/vehicle.rst:116 +#: ../../build/docs/basic/vehicle.rst:113 msgid "From \"|place_3|\" to the \"|place_1|\" by car." msgstr "" -#: ../../build/docs/basic/vehicle.rst:118 +#: ../../build/docs/basic/vehicle.rst:115 msgid "From |place_3| to the |place_1| by car." msgstr "" -#: ../../build/docs/basic/vehicle.rst:124 -msgid "Use ``cost_s`` (line **6**) and ``reverse_cost_s`` (line **7**) columns, in units seconds." -msgstr "" - -#: ../../build/docs/basic/vehicle.rst:126 -#: ../../build/docs/basic/vehicle.rst:161 -msgid "The vehicle is going from vertex |id_3| (line **10**) to |id_1| (line **11**)." +#: ../../build/docs/basic/vehicle.rst:121 +#: ../../build/docs/basic/vehicle.rst:156 +msgid "The vehicle is going from vertex |id_3| to |id_1|." msgstr "" -#: ../../build/docs/basic/vehicle.rst:138 +#: ../../build/docs/basic/vehicle.rst:132 msgid "On a directed graph, going and coming back routes, most of the time are different." msgstr "" -#: ../../build/docs/basic/vehicle.rst:142 +#: ../../build/docs/basic/vehicle.rst:136 msgid "Exercise 3: Vehicle routing when time is money" msgstr "" -#: ../../build/docs/basic/vehicle.rst:146 +#: ../../build/docs/basic/vehicle.rst:140 msgid "From \"|place_3|\" to the \"|place_1|\" by taxi." msgstr "" -#: ../../build/docs/basic/vehicle.rst:148 +#: ../../build/docs/basic/vehicle.rst:142 msgid "From |place_3| to |place_1| by taxi." msgstr "" -#: ../../build/docs/basic/vehicle.rst:154 +#: ../../build/docs/basic/vehicle.rst:148 +msgid "Use the ``taxi_net``." +msgstr "" + +#: ../../build/docs/basic/vehicle.rst:149 msgid "The cost is ``$100 per hour``." msgstr "" -#: ../../build/docs/basic/vehicle.rst:156 -#: ../../build/docs/basic/vehicle.rst:319 -msgid "Using ``cost_s`` (line **6**) and ``reverse_cost_s`` (line **7**) columns, which are in unit ``seconds``." +#: ../../build/docs/basic/vehicle.rst:151 +msgid "Using ``cost`` and ``reverse_cost`` columns, which are in seconds." msgstr "" -#: ../../build/docs/basic/vehicle.rst:158 -msgid "The duration in hours is ``cost_s / 3600``." +#: ../../build/docs/basic/vehicle.rst:153 +msgid "The duration in hours is ``cost / 3600``." msgstr "" -#: ../../build/docs/basic/vehicle.rst:159 -msgid "The cost in ``dollars`` is ``cost_s / 3600 * 100``." +#: ../../build/docs/basic/vehicle.rst:154 +msgid "The cost in ``dollars`` is ``cost / 3600 * 100``." msgstr "" -#: ../../build/docs/basic/vehicle.rst:174 +#: ../../build/docs/basic/vehicle.rst:168 msgid "Comparing with `Exercise 2: Vehicle routing - returning`_:" msgstr "" -#: ../../build/docs/basic/vehicle.rst:176 +#: ../../build/docs/basic/vehicle.rst:170 msgid "The total number of records are identical." msgstr "" -#: ../../build/docs/basic/vehicle.rst:177 +#: ../../build/docs/basic/vehicle.rst:171 msgid "The node sequence is identical." msgstr "" -#: ../../build/docs/basic/vehicle.rst:178 +#: ../../build/docs/basic/vehicle.rst:172 msgid "The edge sequence is identical." msgstr "" -#: ../../build/docs/basic/vehicle.rst:179 +#: ../../build/docs/basic/vehicle.rst:173 msgid "The cost and agg_cost results are directly proportional." msgstr "" -#: ../../build/docs/basic/vehicle.rst:183 +#: ../../build/docs/basic/vehicle.rst:177 msgid "Cost manipulations" msgstr "" -#: ../../build/docs/basic/vehicle.rst:185 -msgid "When dealing with data, being aware of what kind of data is being used can improve results." -msgstr "" - -#: ../../build/docs/basic/vehicle.rst:187 -msgid "Vehicles can not circulate on pedestrian ways" -msgstr "" - -#: ../../build/docs/basic/vehicle.rst:195 -msgid "Penalizing or removal of pedestrian ways will make the results closer to reality." -msgstr "" - -#: ../../build/docs/basic/vehicle.rst:197 -msgid "When converting data from OSM format using the `osm2pgrouting` tool, there is an additional table: ``configuration``." -msgstr "" - -#: ../../build/docs/basic/vehicle.rst:201 -msgid "The ``configuration`` table structure can be obtained with the following command." -msgstr "" - -#: ../../build/docs/basic/vehicle.rst:210 -msgid "tag_id values" -msgstr "" - -#: ../../build/docs/basic/vehicle.rst:216 -msgid "In the image above there is a detail of the ``tag_id`` of the roads." -msgstr "" - -#: ../../build/docs/basic/vehicle.rst:219 -msgid "The ``OSM way`` types:" -msgstr "" - -#: ../../build/docs/basic/vehicle.rst:227 -msgid "Also, on the ``ways`` table there is a column that can be used to ``JOIN`` with the ``configuration`` table." -msgstr "" - -#: ../../build/docs/basic/vehicle.rst:230 -msgid "The ``ways`` types:" -msgstr "" - -#: ../../build/docs/basic/vehicle.rst:239 +#: ../../build/docs/basic/vehicle.rst:179 msgid "In this workshop, costs are going to be manipulated using the ``configuration`` table." msgstr "" -#: ../../build/docs/basic/vehicle.rst:243 +#: ../../build/docs/basic/vehicle.rst:182 msgid "Exercise 4: Vehicle routing without penalization" msgstr "" -#: ../../build/docs/basic/vehicle.rst:247 +#: ../../build/docs/basic/vehicle.rst:186 msgid "From the \"|place_3|\" to \"|place_1|\"" msgstr "" -#: ../../build/docs/basic/vehicle.rst:249 -#: ../../build/docs/basic/vehicle.rst:313 +#: ../../build/docs/basic/vehicle.rst:188 +#: ../../build/docs/basic/vehicle.rst:260 msgid "From |place_3| to |place_1|" msgstr "" -#: ../../build/docs/basic/vehicle.rst:256 +#: ../../build/docs/basic/vehicle.rst:194 msgid "Add a penalty column" msgstr "" -#: ../../build/docs/basic/vehicle.rst:257 -msgid "All roads have a ``penalty`` of ``1`` (line **3**)." -msgstr "" - -#: ../../build/docs/basic/vehicle.rst:260 -msgid "Query" +#: ../../build/docs/basic/vehicle.rst:196 +msgid "All roads have a ``penalty`` of ``1``." msgstr "" -#: ../../build/docs/basic/vehicle.rst:261 +#: ../../build/docs/basic/vehicle.rst:202 msgid "The vehicle's cost in this case will be in penalized seconds." msgstr "" -#: ../../build/docs/basic/vehicle.rst:263 -msgid "Costs (in seconds) are to be multiplied by :code:`penalty` (lines **12** and **13**)." +#: ../../build/docs/basic/vehicle.rst:204 +msgid "Costs are to be multiplied by :code:`penalty` (lines **5** and **6**)." msgstr "" -#: ../../build/docs/basic/vehicle.rst:264 -msgid "Costs wont change (times 1 leaves the value unchanged)." +#: ../../build/docs/basic/vehicle.rst:205 +msgid "Costs won't change (:math:`cost * 1 = cost`)." msgstr "" -#: ../../build/docs/basic/vehicle.rst:266 -msgid "The :code:`configuration` table is linked with the :code:`ways` table by the :code:`tag_id` field using a ``JOIN`` (lines **14** and **15**)." +#: ../../build/docs/basic/vehicle.rst:207 +msgid "The :code:`configuration` table is linked with the :code:`ways` table by the :code:`tag_id` field using a ``JOIN``" msgstr "" -#: ../../build/docs/basic/vehicle.rst:268 -msgid "The vehicle is going from vertex |id_3| (line **17**) to vertex |id_1| (line **18**)." +#: ../../build/docs/basic/vehicle.rst:209 +msgid "The vehicle is going from vertex |id_3| to vertex |id_1|." msgstr "" -#: ../../build/docs/basic/vehicle.rst:282 +#: ../../build/docs/basic/vehicle.rst:224 msgid "Exercise 5: Vehicle routing with penalization" msgstr "" -#: ../../build/docs/basic/vehicle.rst:285 +#: ../../build/docs/basic/vehicle.rst:227 msgid "Concept:" msgstr "" -#: ../../build/docs/basic/vehicle.rst:286 +#: ../../build/docs/basic/vehicle.rst:228 msgid "Change the cost values for the :code:`configuration` table, in such a way, that the" msgstr "" -#: ../../build/docs/basic/vehicle.rst:288 -msgid "Pedestrian roads are not used." +#: ../../build/docs/basic/vehicle.rst:230 +msgid "Bicycle roads are not used." msgstr "" -#: ../../build/docs/basic/vehicle.rst:290 +#: ../../build/docs/basic/vehicle.rst:232 msgid "``penalty < 0`` makes the road not to be included in the graph." msgstr "" -#: ../../build/docs/basic/vehicle.rst:292 +#: ../../build/docs/basic/vehicle.rst:234 msgid "Using residential roads is not encouraged." msgstr "" -#: ../../build/docs/basic/vehicle.rst:294 +#: ../../build/docs/basic/vehicle.rst:236 msgid "``penalty > 1`` makes the road slower for the calculations." msgstr "" -#: ../../build/docs/basic/vehicle.rst:296 +#: ../../build/docs/basic/vehicle.rst:238 msgid "Using \"faster\" roads is highly encouraged." msgstr "" -#: ../../build/docs/basic/vehicle.rst:298 +#: ../../build/docs/basic/vehicle.rst:240 msgid "``penalty < 1`` makes the road faster for the calculations." msgstr "" -#: ../../build/docs/basic/vehicle.rst:300 -msgid "The ``penalty`` values can be changed with ``UPDATE`` queries." +#: ../../build/docs/basic/vehicle.rst:242 +msgid "All other roads are not penalized." msgstr "" -#: ../../build/docs/basic/vehicle.rst:302 -msgid "These values are an exaggeration." +#: ../../build/docs/basic/vehicle.rst:244 +msgid "``penalty = 1`` does not modify the road times." msgstr "" -#: ../../build/docs/basic/vehicle.rst:311 -msgid "From the \"|place_3|\" to \"|place_1|\" with penalization." +#: ../../build/docs/basic/vehicle.rst:246 +msgid "The ``penalty`` values can be changed with ``UPDATE`` queries." msgstr "" -#: ../../build/docs/basic/vehicle.rst:321 -msgid "Costs are to be multiplied by :code:`penalty` (lines **6** and **7**)." +#: ../../build/docs/basic/vehicle.rst:248 +msgid "These values are an exaggeration." msgstr "" -#: ../../build/docs/basic/vehicle.rst:323 -msgid "The :code:`configuration` table is linked with the :code:`ways` table by the :code:`tag_id` field using a ``JOIN`` (lines **8** and **9**)." +#: ../../build/docs/basic/vehicle.rst:258 +msgid "From the \"|place_3|\" to \"|place_1|\" with penalization." msgstr "" -#: ../../build/docs/basic/vehicle.rst:325 -msgid "The vehicle is going from vertex |id_3| (line **11**) to vertex |id_1| (line **12**)." +#: ../../build/docs/basic/vehicle.rst:266 +msgid "Using the same query from `Exercise 4: Vehicle routing without penalization`_" msgstr "" -#: ../../build/docs/basic/vehicle.rst:337 +#: ../../build/docs/basic/vehicle.rst:279 msgid "Comparing with `Exercise 3: Vehicle routing when time is money`_:" msgstr "" -#: ../../build/docs/basic/vehicle.rst:339 +#: ../../build/docs/basic/vehicle.rst:281 msgid "The total number of records changed." msgstr "" -#: ../../build/docs/basic/vehicle.rst:341 +#: ../../build/docs/basic/vehicle.rst:283 msgid "The node sequence changed." msgstr "" -#: ../../build/docs/basic/vehicle.rst:342 +#: ../../build/docs/basic/vehicle.rst:284 msgid "The edge sequence changed." msgstr "" -#: ../../build/docs/basic/vehicle.rst:344 -msgid "The route is avoiding the residential roads that have ``tag_id = 110``." -msgstr "" - -#: ../../build/docs/basic/vehicle.rst:345 +#: ../../build/docs/basic/vehicle.rst:286 msgid "The costs do not change proportionally." msgstr "" -#: ../../build/docs/basic/vehicle.rst:348 -msgid "Exercise 6: Time in seconds of penalized route" +#: ../../build/docs/basic/vehicle.rst:289 +msgid "Exercise 6: Time in seconds of penalized route using a view" msgstr "" -#: ../../build/docs/basic/vehicle.rst:353 +#: ../../build/docs/basic/vehicle.rst:293 msgid "Get the times in seconds of a penalized route" msgstr "" -#: ../../build/docs/basic/vehicle.rst:357 -msgid "Use as inner query the penalized query joined with the ways table" -msgstr "" - -#: ../../build/docs/basic/vehicle.rst:359 -msgid "Keep the ``edge`` as ``gid`` (line **6**)" -msgstr "" - -#: ../../build/docs/basic/vehicle.rst:360 -msgid "Join using ``gid`` (line **18**)" +#: ../../build/docs/basic/vehicle.rst:297 +msgid "Create a penalized view by joining the ``vehicle_net`` joined with the ``configuration`` table" msgstr "" -#: ../../build/docs/basic/vehicle.rst:373 -msgid "Comparing with `Exercise 5: Vehicle routing with penalization`_:" -msgstr "" - -#: ../../build/docs/basic/vehicle.rst:375 -msgid "The total number of records is the same." -msgstr "" - -#: ../../build/docs/basic/vehicle.rst:376 -msgid "The route is the same" +#: ../../build/docs/basic/vehicle.rst:300 +msgid "Use the inner query from `Exercise 5: Vehicle routing with penalization`_" msgstr "" -#: ../../build/docs/basic/vehicle.rst:377 -msgid "The ``cost`` column have the original vales from the ways table." +#: ../../build/docs/basic/vehicle.rst:308 +msgid "Get the route ``configuration`` table" msgstr ""