diff --git a/CMakeLists.txt b/CMakeLists.txt index 30bd8c65e..cec567afe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -79,14 +79,15 @@ set(PLACE_5 "Emily Place Reserve") # Example reference point (e.g., near Emily Place Reserve) set(CH7_PLACE_1 ${PLACE_5}) set(CH7_OSMID_1 ${OSMID_5}) +set(CH7_PLACE_2 ${PLACE_1}) +set(CH7_OSMID_2 ${OSMID_1}) + set(POINT1_LAT "-36.8471438") set(POINT1_LON "174.7710042") # Example reference point (e.g., near Auckland University of Technology) set(POINT2_LAT "-36.8524328") set(POINT2_LON "174.766749") -set(CH7_PLACE_2 ${PLACE_1}) -set(CH7_OSMID_2 ${OSMID_1}) diff --git a/docs/basic/images/sql_function/CMakeLists.txt b/docs/basic/images/sql_function/CMakeLists.txt index 7e154f925..b03b3052c 100644 --- a/docs/basic/images/sql_function/CMakeLists.txt +++ b/docs/basic/images/sql_function/CMakeLists.txt @@ -3,13 +3,12 @@ # Files #--------------------- set(PGR_WORKSHOP_IMG_FILES - ch7-e4.png - ch7-e5.png - ch7-e6.png - ch7-e7.png - ch7-e8-1.png - ch7-e8.png - ) + sql_azimuth_fixed.png + sql_route_geom.png + sql_route_names.png + sql_route_readable.png + sql_route_geom_detail.png +) foreach (f ${PGR_WORKSHOP_IMG_FILES}) diff --git a/docs/basic/images/sql_function/ch7-e4.png b/docs/basic/images/sql_function/ch7-e4.png deleted file mode 100644 index 355e03825..000000000 Binary files a/docs/basic/images/sql_function/ch7-e4.png and /dev/null differ diff --git a/docs/basic/images/sql_function/ch7-e5.png b/docs/basic/images/sql_function/ch7-e5.png deleted file mode 100644 index e6d39463c..000000000 Binary files a/docs/basic/images/sql_function/ch7-e5.png and /dev/null differ diff --git a/docs/basic/images/sql_function/ch7-e6.png b/docs/basic/images/sql_function/ch7-e6.png deleted file mode 100644 index b51e26fde..000000000 Binary files a/docs/basic/images/sql_function/ch7-e6.png and /dev/null differ diff --git a/docs/basic/images/sql_function/ch7-e7.png b/docs/basic/images/sql_function/ch7-e7.png deleted file mode 100644 index 702ee8a81..000000000 Binary files a/docs/basic/images/sql_function/ch7-e7.png and /dev/null differ diff --git a/docs/basic/images/sql_function/ch7-e8-1.png b/docs/basic/images/sql_function/ch7-e8-1.png deleted file mode 100644 index c73d1a859..000000000 Binary files a/docs/basic/images/sql_function/ch7-e8-1.png and /dev/null differ diff --git a/docs/basic/images/sql_function/ch7-e8.png b/docs/basic/images/sql_function/ch7-e8.png deleted file mode 100644 index c53961fa3..000000000 Binary files a/docs/basic/images/sql_function/ch7-e8.png and /dev/null differ diff --git a/docs/basic/images/sql_function/sql_azimuth_fixed.png b/docs/basic/images/sql_function/sql_azimuth_fixed.png new file mode 100644 index 000000000..983371d40 Binary files /dev/null and b/docs/basic/images/sql_function/sql_azimuth_fixed.png differ diff --git a/docs/basic/images/sql_function/sql_route_geom.png b/docs/basic/images/sql_function/sql_route_geom.png new file mode 100644 index 000000000..38866b71f Binary files /dev/null and b/docs/basic/images/sql_function/sql_route_geom.png differ diff --git a/docs/basic/images/sql_function/sql_route_geom_detail.png b/docs/basic/images/sql_function/sql_route_geom_detail.png new file mode 100644 index 000000000..f11713d49 Binary files /dev/null and b/docs/basic/images/sql_function/sql_route_geom_detail.png differ diff --git a/docs/basic/images/sql_function/sql_route_names.png b/docs/basic/images/sql_function/sql_route_names.png new file mode 100644 index 000000000..532164c9f Binary files /dev/null and b/docs/basic/images/sql_function/sql_route_names.png differ diff --git a/docs/basic/images/sql_function/sql_route_readable.png b/docs/basic/images/sql_function/sql_route_readable.png new file mode 100644 index 000000000..b064852c4 Binary files /dev/null and b/docs/basic/images/sql_function/sql_route_readable.png differ diff --git a/docs/basic/sql_function.rst b/docs/basic/sql_function.rst index 81dbb2c65..e6c0ef517 100644 --- a/docs/basic/sql_function.rst +++ b/docs/basic/sql_function.rst @@ -11,7 +11,7 @@ SQL function ############################################################################### -.. image:: images/pedestrian/pedestrian_one_to_one.png +.. image:: images/sql_function/sql_route_names.png :scale: 25% :align: center @@ -26,18 +26,26 @@ stored procedures or functions. Stored procedures or functions are an effective way to wrap application logic, in this case, related to routing logic and requirements. -The application requirements +The function requirements =============================================================================== -A front end needs the following routing information: - - ``seq`` - A unique identifier of the rows - - ``id`` - The segment's identifier - - ``name`` - The segment's name - - ``length`` - The segment's length - - ``seconds`` - Number of seconds to traverse the segment - - ``azimuth`` - The azimuth of the segment - - ``route_geom`` - The routing geometry - - ``route_readable`` - The geometry in human readable form. +The function will wrap ``pgr_dijkstra``. + +The function needs to work on any of the networks designed: + +- ``vehicle_net`` +- ``taxi_net`` + +The function needs to return the following routing information: + +- ``seq`` - A unique identifier of the rows +- ``id`` - The segment's identifier +- ``name`` - The segment's name +- ``length`` - The segment's length +- ``seconds`` - Number of seconds to traverse the segment +- ``azimuth`` - The azimuth of the segment +- ``route_geom`` - The routing geometry +- ``route_readable`` - The geometry in human readable form. .. rubric:: Design of the function @@ -50,8 +58,8 @@ output columns: Parameter Type Description ================= ========= ================= ``edges_subset`` REGCLASS The table/view that is going to be used for processing -``source_osm`` BIGINT The OSM identifier of the `departure` location. -``target_osm`` BIGINT The OSM identifier of the `destination` location. +``source`` BIGINT The identifier of the `departure` location. +``target`` BIGINT The identifier of the `destination` location. ================= ========= ================= .. rubric:: output columns @@ -63,16 +71,13 @@ Name Type Description ``id`` BIGINT The edge identifier. ``name`` TEXT The name of the segment. ``seconds`` FLOAT The number of seconds it takes to traverse the segment. -``azimuth`` FLOAT The azimuth of the segment. ``length`` FLOAT The leng in meters of the segment. +``azimuth`` FLOAT The azimuth of the segment. ``route_readable`` TEXT The geometry in human readable form. ``route_geom`` geometry The geometry of the segment in the correct direction. ================== ========= ================= -.. note:: For the following exercises only ``vehicle_net`` will be used, but - you can test the queries with the other views. - Additional information handling =============================================================================== @@ -82,13 +87,13 @@ When the application needs additional information, like the name of the street, Exercise 1: Get additional information ------------------------------------------------------------------------------- -.. image:: images/sql_function/ch7-e4.png +.. image:: images/sql_function/sql_route_names.png :width: 300pt :alt: Route showing names .. rubric:: Problem -* From |ch7_place_1| to |ch7_place_2|, using OSM identifiers. +* From |ch7_place_1| to |ch7_place_2| * Get the following information: * ``seq`` @@ -99,23 +104,28 @@ Exercise 1: Get additional information .. rubric:: Solution -* The columns asked (line **2**). -* Rename ``pgr_dijkstra`` results to application requirements names. (line **4**). -* ``LEFT JOIN`` the results with ``vehicle_net`` to get the additional information. (line **9**) +* The function returns the columns asked. (line **4**) +* Rename ``pgr_dijkstra`` results to application requirements names. (line + **12**). +* ``LEFT JOIN`` the results with ``vehicle_net`` to get the additional + information. (line **17**) + + * ``LEFT`` to include the row with ``id = -1`` because it does not exist on + ``vehicle_net`` - * ``LEFT`` to include the row with ``id = -1`` because it does not - exist on ``vehicle_net`` +* Test from |ch7_id_1| to |ch7_id_2| on ``vehicle_net``. (Last line) .. literalinclude:: ../scripts/basic/sql_function/sql_function.sql - :language: sql - :linenos: - :emphasize-lines: 2, 4,9 - :start-after: exercise_7_5.txt - :end-before: exercise_7_6.txt + :language: sql + :linenos: + :force: + :emphasize-lines: 4,12,17 + :start-after: get_more_info.txt + :end-before: get_read_geom.txt .. collapse:: Query results - .. literalinclude:: ../scripts/basic/sql_function/exercise_7_5.txt + .. literalinclude:: ../scripts/basic/sql_function/get_more_info.txt Geometry handling @@ -129,7 +139,7 @@ with PostGIS functions. Exercise 2: Route geometry (human readable) ------------------------------------------------------------------------------- -.. image:: images/sql_function/ch7-e4.png +.. image:: images/sql_function/sql_route_readable.png :width: 300pt :alt: From |ch7_place_1| to |ch7_place_2| @@ -141,48 +151,36 @@ Route from the |ch7_place_1| to |ch7_place_2| * geometry ``geom`` in human readable form named as ``route_readable`` -.. tip:: - - ``WITH`` provides a way to write auxiliary statements in larger queries. - It can be thought of as defining temporary tables that exist just for one query. - .. rubric:: Solution -* The routing query named ``results`` in a WITH clause. (lines **2** to **5**) -* The results from the previous exercise. (lines **8** and **9**) - - .. note:: For result reading purposes, the result columns from the previous - are in a comment. Uncomment to see the complete results for the problem. - +* The function returns ``route_readable``. (line **6**) +* The routing query named ``results`` in a WITH clause. (line **11**) * The ``geom`` processed with ``ST_AsText`` to get the human readable form. - (line **12**) - - * Renaming the result to ``route_readable`` - -* The ``LEFT JOIN`` with ``vehicle_net``. (line **14**) - + (line **19**). +* Test from |ch7_id_1| to |ch7_id_2| on ``vehicle_net``. (Last line) .. literalinclude:: ../scripts/basic/sql_function/sql_function.sql - :language: sql - :linenos: - :emphasize-lines: 2-5,8-9,12,14 - :start-after: exercise_7_6.txt - :end-before: exercise_7_7.txt + :language: sql + :linenos: + :force: + :emphasize-lines: 6,11,19 + :start-after: get_read_geom.txt + :end-before: get_geom.txt .. exercise 2 results .. collapse:: Query results - .. literalinclude:: ../scripts/basic/sql_function/exercise_7_6.txt + .. literalinclude:: ../scripts/basic/sql_function/get_read_geom.txt Exercise 3: Route geometry (binary format) ------------------------------------------------------------------------------- -.. image:: images/sql_function/ch7-e6.png +.. image:: images/sql_function/sql_route_geom.png :width: 300pt - :alt: From |ch7_place_1| to |ch7_place_2| showing arrows. + :alt: From |ch7_place_1| to |ch7_place_2| .. rubric:: Problem @@ -194,28 +192,27 @@ Route from the |ch7_place_1| to |ch7_place_2| .. rubric:: Solution -* The query from the previous exercise is used -* The ``SELECT`` clause also contains: - - * The ``geom`` including the renaming (line **9**) +* The function returns ``route_geom``. (line **7**) +* The geometry ``geom`` of the segments (line **21**) +* Test from |ch7_id_1| to |ch7_id_2| on ``vehicle_net``. (Last line) .. literalinclude:: ../scripts/basic/sql_function/sql_function.sql - :language: sql - :emphasize-lines: 10 - :linenos: - :start-after: exercise_7_7.txt - :end-before: wrong_directionality.txt + :language: sql + :emphasize-lines: 7,21 + :force: + :linenos: + :start-after: get_geom.txt + :end-before: wrong_directionality.txt .. collapse:: Query results - .. literalinclude:: ../scripts/basic/sql_function/exercise_7_7.txt - + .. literalinclude:: ../scripts/basic/sql_function/get_geom.txt Exercise 4: Route geometry directionality ------------------------------------------------------------------------------- -.. image:: images/sql_function/ch7-e8.png +.. image:: images/sql_function/sql_route_geom_detail.png :width: 300pt :alt: From |ch7_place_1| to |ch7_place_2| @@ -228,14 +225,12 @@ starting point of the next geometry * Inspecting the detail of the results of `Exercise 2: Route geometry (human readable)`_ - * Rows **59** to **61** do not match that criteria - .. collapse:: Query: Rows where criteria is not met .. literalinclude:: ../scripts/basic/sql_function/sql_function.sql :language: sql :start-after: wrong_directionality.txt - :end-before: exercise_7_8.txt + :end-before: fix_directionality.txt .. literalinclude:: ../scripts/basic/sql_function/wrong_directionality.txt :language: sql @@ -255,38 +250,38 @@ Route from the |ch7_place_1| to |ch7_place_2| To get the correct direction some geometries need to be reversed: * Reversing a geometry will depend on the ``node`` column of the query to - Dijkstra (line **2**) + Dijkstra. * A conditional ``CASE`` statement that returns the geometry in human readable form: - * Of the geometry when ``node`` is the ``source`` column. (line **11**) - * Of the reversed geometry when ``node`` is not the ``source`` column. (line **12**) + * Of the geometry when ``node`` is the ``source`` column. + * Of the reversed geometry when ``node`` is not the ``source`` column. * A conditional ``CASE`` statement that returns: - * The geometry when ``node`` is the ``source`` column. (line **17**) - * The reversed geometry when ``node`` is not the ``source`` column. (line **16**) + * The geometry when ``node`` is the ``source`` column. + * The reversed geometry when ``node`` is not the ``source`` column. .. literalinclude:: ../scripts/basic/sql_function/sql_function.sql - :language: sql - :linenos: - :emphasize-lines: 3,9,11,12,16,17 - :start-after: exercise_7_8.txt - :end-before: good_directionality.txt + :language: sql + :linenos: + :force: + :start-after: fix_directionality.txt + :end-before: good_directionality.txt .. collapse:: results - .. literalinclude:: ../scripts/basic/sql_function/exercise_7_8.txt + .. literalinclude:: ../scripts/basic/sql_function/fix_directionality.txt -Inspecting some the problematic rows, the directionality has been fixed. +Inspecting the problematic rows, the directionality has been fixed. .. collapse:: Query: Rows where criteria is not met .. literalinclude:: ../scripts/basic/sql_function/sql_function.sql :language: sql :start-after: good_directionality.txt - :end-before: exercise_7_9.txt + :end-before: use_directionality.txt .. literalinclude:: ../scripts/basic/sql_function/good_directionality.txt @@ -294,7 +289,7 @@ Inspecting some the problematic rows, the directionality has been fixed. Exercise 5: Using the geometry ------------------------------------------------------------------------------- -.. image:: images/sql_function/ch7-e7.png +.. image:: images/sql_function/sql_azimuth_fixed.png :width: 300pt :alt: From |ch7_place_1| to the |ch7_place_2| show azimuth @@ -308,106 +303,44 @@ This exercise will make use an additional function ``ST_Azimuth``. Modify the query from the previous exercise -* Additionally obtain the azimuth of the correct geometry. -* Because ``vehicle_net`` and the other 2 views are sub graphs of ``ways``, do - the ``JOIN`` with ``ways``. +* Additionally obtain the azimuth in degrees of the corrected geometry. .. rubric:: Solution -* Move the query that gets the additional information into the ``WITH`` statement. - - * Name it ``additional``. (line **6**) - -* The ``ways`` table geometry name is ``the_geom``. -* Final ``SELECT`` statements gets: - - * Calculates the azimuth of ``route_geom``. (line **27**) +* The function returns ``aximuth``. (line **8**) +* The query from previous exercise is wrapped under additional subquery. (line + **18**) +* The ``azimuth`` is processed in degrees. (line **35**). +* Test from |ch7_id_1| to |ch7_id_2| on ``vehicle_net``. (Last line) .. literalinclude:: ../scripts/basic/sql_function/sql_function.sql - :language: sql - :emphasize-lines: 6,27 - :start-after: exercise_7_9.txt - :end-before: exercise_7_10.txt + :language: sql + :force: + :linenos: + :emphasize-lines: 8,18,35 + :start-after: use_directionality.txt + :end-before: using_fn1.txt .. collapse:: results - .. literalinclude:: ../scripts/basic/sql_function/exercise_7_9.txt - -Creating the Function -=============================================================================== - -The following function simplifies (and sets default values) when it calls the -shortest path Dijkstra function. - -.. warning:: - pgRouting uses heavely function overloading: - - * Avoid creating functions with a name of a pgRouting routing function - * Avoid the name of a function to start with `pgr_`, `_pgr` or `ST_` + .. literalinclude:: ../scripts/basic/sql_function/use_directionality.txt -Exercise 6: Function for an application +Exercise 6: Using the function ------------------------------------------------------------------------------- -.. rubric:: Problem - -Putting all together in a SQL function - -* function name ``wrk_dijkstra`` -* Should work for any given view. - - * Allow a view as a parameter - * A table can be used if the columns have the correct names. - -* ``source`` and ``target`` are in terms of ``osm_id``. -* The result should meet the requirements indicated at the beginning of the chapter - - -.. rubric:: Solution - -* The signature of the function: - - * The input parameters are from line **4** to **6**. - * The output columns are from line **7** to **14** (not highlighted). - * The function returns a set. (line **16**) - -.. literalinclude:: ../scripts/basic/sql_function/sql_function.sql - :emphasize-lines: 4-6,16 - :language: sql - :start-after: exercise_7_10.txt - :end-before: BODY - -* The body of the function: - - * Appending the view name on line **7** in the ``SELECT`` query to ``pgr_dijkstra``. - * Using the data to get the route from ``source`` to ``target``. (line **8**) - * The ``JOIN`` with ``ways`` is necessary, as the views are subset of ``ways`` (line **25**) - - -.. literalinclude:: ../scripts/basic/sql_function/sql_function.sql - :emphasize-lines: 7,8,25 - :language: sql - :force: - :start-after: RETURNS SETOF - :end-before: using_fn1.txt - -.. collapse:: Response of command - - .. literalinclude:: ../scripts/basic/sql_function/exercise_7_10.txt - -.. _exercise-ch7-e10: - -Exercise 7: Using the function -------------------------------------------------------------------------------- - -.. rubric:: Problem +Try the function with a combination of the interesting places: -* Test the function with the three views -* From the |ch7_place_1| to the |ch7_place_2| using the OSM identifier +* |id_1| |place_1| +* |id_2| |place_2| +* |id_3| |place_3| +* |id_4| |place_4| +* |id_5| |place_5| -.. rubric:: Solution +Using different networks: -* Use the function on the ``SELECT`` statement -* The first parameter changes based on the view to be tested +- ``vehicle_net`` +- ``taxi_net`` +- ``walk_net`` Names of the streets in the route @@ -431,7 +364,7 @@ Total seconds spent in each street .. literalinclude:: ../scripts/basic/sql_function/using_fn2.txt -Get all the information of the route +Why it does not fully work with ``walk_net``? .. literalinclude:: ../scripts/basic/sql_function/sql_function.sql :language: sql @@ -440,12 +373,3 @@ Get all the information of the route .. collapse:: Query results .. literalinclude:: ../scripts/basic/sql_function/using_fn3.txt - - -Try the function with a combination of the interesting places: - -* |osmid_1| |place_1| -* |osmid_2| |place_2| -* |osmid_3| |place_3| -* |osmid_4| |place_4| -* |osmid_5| |place_5| diff --git a/docs/conf.py b/docs/conf.py index abf914b26..83dde6625 100755 --- a/docs/conf.py +++ b/docs/conf.py @@ -299,8 +299,8 @@ def setup(app): .. |place_3| replace:: @PLACE_3@ .. |place_4| replace:: @PLACE_4@ .. |place_5| replace:: @PLACE_5@ -.. |ch7_osmid_1| replace:: ``@CH7_OSMID_1@`` -.. |ch7_osmid_2| replace:: ``@CH7_OSMID_2@`` +.. |ch7_id_1| replace:: ``@CH7_ID_1@`` +.. |ch7_id_2| replace:: ``@CH7_ID_2@`` .. |ch7_place_1| replace:: @CH7_PLACE_1@ .. |ch7_place_2| replace:: @CH7_PLACE_2@ """ diff --git a/docs/scripts/basic/sql_function/CMakeLists.txt b/docs/scripts/basic/sql_function/CMakeLists.txt index 825fdb5b8..7b338e8fc 100644 --- a/docs/scripts/basic/sql_function/CMakeLists.txt +++ b/docs/scripts/basic/sql_function/CMakeLists.txt @@ -6,26 +6,23 @@ add_custom_target(basic_sql_function_scripts) configure_file(sql_function.sql sql_function.sql) configure_file(images.sql images.sql) -#---------------------------------------------- -# Generating the results files -#--------------------------------------------- - add_custom_command( TARGET basic_sql_function_scripts PRE_BUILD BYPRODUCTS - exercise_7_1.txt - exercise_7_2.txt - exercise_7_3.txt - exercise_7_4.txt - exercise_7_5.txt - exercise_7_6.txt - exercise_7_7.txt - exercise_7_8.txt - exercise_7_9.txt - exercise_7_10.txt - exercise_7_11.txt + + get_more_info.txt + get_read_geom.txt + get_geom.txt + wrong_directionality.txt + fix_directionality.txt + good_directionality.txt + use_directionality.txt + using_fn1.txt + using_fn2.txt + using_fn3.txt + COMMAND psql -d city_routing -f sql_function.sql COMMAND psql -d city_routing -f images.sql COMMENT "running sql function scripts" - ) +) diff --git a/docs/scripts/basic/sql_function/images.sql b/docs/scripts/basic/sql_function/images.sql index c9ee90a58..7e8a4ada2 100644 --- a/docs/scripts/basic/sql_function/images.sql +++ b/docs/scripts/basic/sql_function/images.sql @@ -1,69 +1,9 @@ -DROP FUNCTION IF EXISTS wrk_image; -DROP VIEW IF EXISTS chap7_view; - -CREATE OR REPLACE FUNCTION wrk_image( - IN edges_subset REGCLASS, - IN source BIGINT, -- in terms of osm_id - IN target BIGINT, -- in terms of osm_id - OUT seq INTEGER, - OUT id BIGINT, - OUT node BIGINT, - OUT source BIGINT, - OUT seconds FLOAT, - OUT name TEXT, - OUT length_m FLOAT, - OUT geom geometry, - OUT geom_readable TEXT, - OUT azimuth_geom FLOAT, - OUT route_readable TEXT, - OUT route_geom geometry, - OUT azimuth FLOAT -) -RETURNS SETOF record AS -$BODY$ -WITH -results AS ( - SELECT seq, edge AS id, cost AS seconds, - node - FROM pgr_dijkstra( - 'SELECT * FROM ' || edges_subset, - source, target) -), -additional AS ( - SELECT - seq, id, node, source_osm, seconds, - name, length_m, - the_geom, - ST_AsText(the_geom), - degrees(ST_azimuth(ST_StartPoint(the_geom), ST_EndPoint(the_geom))) AS azimuth_geom, - CASE - WHEN node = source_osm THEN ST_AsText(the_geom) - ELSE ST_AsText(ST_Reverse(the_geom)) - END AS route_readable, - - CASE - WHEN node = source_osm THEN the_geom - ELSE ST_Reverse(the_geom) - END AS route_geom - - FROM results - LEFT JOIN ways ON (gid = id) -) -SELECT *, -degrees(ST_azimuth(ST_StartPoint(route_geom), ST_EndPoint(route_geom))) AS azimuth -FROM additional -ORDER BY seq; -$BODY$ -LANGUAGE 'sql'; CREATE OR REPLACE VIEW using_vehicle AS SELECT * -FROM wrk_image('vehicle_net', @CH7_OSMID_1@, @CH7_OSMID_2@); +FROM wrk_dijkstra('vehicle_net', @CH7_ID_1@, @CH7_ID_2@); -CREATE OR REPLACE VIEW using_taxi AS -SELECT * -FROM wrk_image('taxi_net', @CH7_OSMID_1@, @CH7_OSMID_2@); - -CREATE OR REPLACE VIEW using_walk AS -SELECT * -FROM wrk_image('walk_net', @CH7_OSMID_1@, @CH7_OSMID_2@); +CREATE OR REPLACE VIEW sql_route_geom AS +SELECT seq, id, geom +FROM wrk_dijkstra('vehicle_net', @CH7_ID_1@, @CH7_ID_2@) +JOIN vehicle_net USING (id); diff --git a/docs/scripts/basic/sql_function/sql_function.sql b/docs/scripts/basic/sql_function/sql_function.sql index 672b94ce0..5831941e6 100644 --- a/docs/scripts/basic/sql_function/sql_function.sql +++ b/docs/scripts/basic/sql_function/sql_function.sql @@ -2,212 +2,212 @@ DROP FUNCTION IF EXISTS wrk_dijkstra(regclass, bigint, bigint); -\o exercise_7_5.txt +\o get_more_info.txt +-- DROP FUNCTION wrk_dijkstra(regclass, bigint, bigint); + +CREATE OR REPLACE FUNCTION wrk_dijkstra( + IN edges_subset REGCLASS, IN source BIGINT, IN target BIGINT, + OUT seq INTEGER, OUT id BIGINT, OUT seconds FLOAT, OUT name TEXT, OUT length FLOAT +) +RETURNS SETOF record AS +$BODY$ SELECT - seq, id, seconds, name, length +seq, id, seconds, name, length FROM ( SELECT seq, edge AS id, node, cost AS seconds FROM pgr_dijkstra( - 'SELECT * FROM vehicle_net', - @CH7_OSMID_1@, @CH7_OSMID_2@) - ) AS results + 'SELECT * FROM ' || $1, + source, target) +) AS results LEFT JOIN vehicle_net USING (id) ORDER BY seq; +$BODY$ +LANGUAGE SQL; + +SELECT * FROM wrk_dijkstra('vehicle_net', @CH7_ID_1@, @CH7_ID_2@); -\o exercise_7_6.txt +\o get_read_geom.txt +DROP FUNCTION wrk_dijkstra(regclass, bigint, bigint); + +CREATE OR REPLACE FUNCTION wrk_dijkstra( + IN edges_subset REGCLASS, IN source BIGINT, IN target BIGINT, + OUT seq INTEGER, OUT id BIGINT, OUT seconds FLOAT, OUT name TEXT, OUT length FLOAT, + OUT route_readable TEXT +) +RETURNS SETOF record AS +$BODY$ WITH -results AS ( -- line 2 +results AS ( SELECT seq, edge AS id, node, cost AS seconds - FROM pgr_dijkstra('SELECT * FROM vehicle_net', @CH7_OSMID_1@, @CH7_OSMID_2@) + FROM pgr_dijkstra( + 'SELECT * FROM ' || $1, + source, target) ) SELECT - -- from previous excercise - seq, -- line 8 - -- id, seconds, name, length, - - -- additionally get - ST_AsText(geom) AS route_readable --line 12 + seq, id, seconds, name, length, + ST_AsText(geom) FROM results -LEFT JOIN vehicle_net USING (id) -- line 14 +LEFT JOIN vehicle_net USING (id) ORDER BY seq; +$BODY$ +LANGUAGE SQL; + +SELECT seq, route_readable FROM wrk_dijkstra('vehicle_net', @CH7_ID_1@, @CH7_ID_2@); + +\o get_geom.txt -\o exercise_7_7.txt +DROP FUNCTION wrk_dijkstra(regclass, bigint, bigint); -WITH results AS ( +CREATE OR REPLACE FUNCTION wrk_dijkstra( + IN edges_subset REGCLASS, IN source BIGINT, IN target BIGINT, + OUT seq INTEGER, OUT id BIGINT, OUT seconds FLOAT, OUT name TEXT, OUT length FLOAT, + OUT route_readable TEXT, + OUT route_geom geometry +) +RETURNS SETOF record AS +$BODY$ +WITH +results AS ( SELECT seq, edge AS id, node, cost AS seconds - FROM pgr_dijkstra('SELECT * FROM vehicle_net', @CH7_OSMID_1@, @CH7_OSMID_2@) - ) + FROM pgr_dijkstra( + 'SELECT * FROM ' || $1, + source, target) +) SELECT - -- from previous excercise - seq, - -- id, seconds, name, length, ST_AsText(geom) AS route_readable, - - -- additionally get - geom AS route_geom + seq, id, seconds, name, length, + ST_AsText(geom), + geom FROM results -LEFT JOIN vehicle_net - USING (id) +LEFT JOIN vehicle_net USING (id) ORDER BY seq; +$BODY$ +LANGUAGE SQL; + +SELECT seq, route_geom FROM wrk_dijkstra('vehicle_net', @CH7_ID_1@, @CH7_ID_2@); \o wrong_directionality.txt WITH results AS ( - SELECT seq, edge AS id, node, cost AS seconds - FROM pgr_dijkstra('SELECT * FROM vehicle_net', @CH7_OSMID_1@, @CH7_OSMID_2@) + SELECT seq, id, route_geom + FROM wrk_dijkstra('vehicle_net', @CH7_ID_1@, @CH7_ID_2@) ), compare AS ( SELECT seq, id, lead(seq) over(ORDER BY seq) AS next_seq, - ST_AsText(ST_endPoint(geom)) AS id_end, - ST_AsText(ST_startPoint(lead(geom) over(ORDER BY seq))) AS next_id_start + ST_AsText(ST_endPoint(route_geom)) AS id_end, + ST_AsText(ST_startPoint(lead(route_geom) over(ORDER BY seq))) AS next_id_start - FROM results LEFT JOIN vehicle_net USING (id) + FROM results ORDER BY seq) SELECT * FROM compare WHERE id_end != next_id_start; -\o exercise_7_8.txt +\o fix_directionality.txt + +DROP FUNCTION wrk_dijkstra(regclass, bigint, bigint); -WITH results AS ( +CREATE OR REPLACE FUNCTION wrk_dijkstra( + IN edges_subset REGCLASS, IN source BIGINT, IN target BIGINT, + OUT seq INTEGER, OUT id BIGINT, OUT seconds FLOAT, OUT name TEXT, OUT length FLOAT, + OUT route_readable TEXT, + OUT route_geom geometry +) +RETURNS SETOF record AS +$BODY$ +WITH +results AS ( SELECT seq, edge AS id, node, cost AS seconds - FROM pgr_dijkstra('SELECT * FROM vehicle_net', @CH7_OSMID_1@, @CH7_OSMID_2@) - ) + FROM pgr_dijkstra( + 'SELECT * FROM ' || $1, + source, target) +) SELECT - -- from previous excercise - seq, - -- id, seconds, name, length, - - -- fixing the directionality + seq, id, seconds, name, length, CASE WHEN node = source THEN ST_AsText(geom) ELSE ST_AsText(ST_Reverse(geom)) - END AS route_readable, + END, CASE WHEN node = source THEN geom ELSE ST_Reverse(geom) - END AS route_geom - + END FROM results LEFT JOIN vehicle_net USING (id) ORDER BY seq; +$BODY$ +LANGUAGE SQL; + +SELECT seq, route_readable FROM wrk_dijkstra('vehicle_net', @CH7_ID_1@, @CH7_ID_2@); \o good_directionality.txt WITH results AS ( - SELECT seq, edge AS id, node, cost AS seconds - FROM pgr_dijkstra('SELECT * FROM vehicle_net', 5661895682, 10982869752) -), -fix AS ( - SELECT seq, id, - CASE - WHEN node = source THEN geom - ELSE ST_Reverse(geom) - END AS geom -FROM results LEFT JOIN vehicle_net USING (id) + SELECT seq, id, seconds, route_geom + FROM wrk_dijkstra('vehicle_net', @CH7_ID_1@, @CH7_ID_2@) ), compare AS ( - SELECT seq, id, lead(geom) over(ORDER BY seq) AS next_id, - ST_AsText(ST_endPoint(geom)) AS id_end, ST_AsText(ST_startPoint(lead(geom) over(ORDER BY seq))) AS next_id_start - -FROM fix + SELECT seq, id, lead(route_geom) over(ORDER BY seq) AS next_id, + ST_AsText(ST_endPoint(route_geom)) AS id_end, + ST_AsText(ST_startPoint(lead(route_geom) over(ORDER BY seq))) AS next_id_start +FROM results ORDER BY seq) SELECT * FROM compare WHERE id_end != next_id_start; -\o exercise_7_9.txt +\o use_directionality.txt + +DROP FUNCTION wrk_dijkstra(regclass, bigint, bigint); +CREATE OR REPLACE FUNCTION wrk_dijkstra( + IN edges_subset REGCLASS, IN source BIGINT, IN target BIGINT, + OUT seq INTEGER, OUT id BIGINT, OUT seconds FLOAT, OUT name TEXT, OUT length FLOAT, + OUT route_readable TEXT, + OUT route_geom geometry, + OUT azimuth FLOAT +) +RETURNS SETOF record AS +$BODY$ WITH results AS ( SELECT seq, edge AS id, node, cost AS seconds - FROM pgr_dijkstra('SELECT * FROM vehicle_net', @CH7_OSMID_1@, @CH7_OSMID_2@) - ), + FROM pgr_dijkstra( + 'SELECT * FROM ' || $1, + source, target)), additional AS ( SELECT - seq, id, seconds, name, length, - CASE - WHEN node = source THEN ST_AsText(the_geom) - ELSE ST_AsText(ST_Reverse(the_geom)) - END AS route_readable, - - CASE - WHEN node = source THEN the_geom - ELSE ST_Reverse(the_geom) - END AS route_geom + seq, id, seconds, name, length, + CASE + WHEN node = source THEN ST_AsText(geom) + ELSE ST_AsText(ST_Reverse(geom)) + END AS readable, + CASE + WHEN node = source THEN geom + ELSE ST_Reverse(geom) + END AS geom FROM results - LEFT JOIN ways ON (gid = id) -) -SELECT - seq, - -- from previous excercise - -- id, seconds, name, length, route_readable, route_geom + LEFT JOIN vehicle_net USING (id) + ORDER BY seq) - degrees(ST_azimuth(ST_StartPoint(route_geom), ST_EndPoint(route_geom))) AS azimuth -FROM additional -ORDER BY seq; +SELECT *, + degrees(ST_azimuth(ST_StartPoint(geom), ST_EndPoint(geom))) AS azimuth +FROM additional ORDER BY seq; +$BODY$ +LANGUAGE SQL; -\o exercise_7_10.txt --- DROP FUNCTION wrk_dijkstra(regclass, bigint, bigint); +SELECT seq, azimuth FROM wrk_dijkstra('vehicle_net', @CH7_ID_1@, @CH7_ID_2@); -CREATE OR REPLACE FUNCTION wrk_dijkstra( - IN edges_subset REGCLASS, - IN source BIGINT, -- in terms of osm_id - IN target BIGINT, -- in terms of osm_id - OUT seq INTEGER, - OUT id BIGINT, - OUT seconds FLOAT, - OUT name TEXT, - OUT length_m FLOAT, - OUT route_readable TEXT, - OUT route_geom geometry, - OUT azimuth FLOAT - ) - RETURNS SETOF record AS -$BODY$ - WITH - results AS ( - SELECT seq, edge AS id, cost AS seconds, - node - FROM pgr_dijkstra( - 'SELECT * FROM ' || edges_subset, - source, target) - ), - additional AS ( - SELECT - seq, id, seconds, - name, length_m, - CASE - WHEN node = source THEN ST_AsText(the_geom) - ELSE ST_AsText(ST_Reverse(the_geom)) - END AS route_readable, - - CASE - WHEN node = source_osm THEN the_geom - ELSE ST_Reverse(the_geom) - END AS route_geom - - FROM results - LEFT JOIN ways ON (gid = id) - ) - SELECT *, - degrees(ST_azimuth(ST_StartPoint(route_geom), ST_EndPoint(route_geom))) AS azimuth - FROM additional - ORDER BY seq; -$BODY$ -LANGUAGE 'sql'; \o using_fn1.txt SELECT DISTINCT name -FROM wrk_dijkstra('vehicle_net', @CH7_OSMID_1@, @CH7_OSMID_2@); +FROM wrk_dijkstra('vehicle_net', @CH7_ID_1@, @CH7_ID_2@); \o using_fn2.txt SELECT name, sum(seconds) -FROM wrk_dijkstra('taxi_net', @CH7_OSMID_1@, @CH7_OSMID_2@) +FROM wrk_dijkstra('taxi_net', @CH7_ID_1@, @CH7_ID_2@) GROUP BY name; \o using_fn3.txt SELECT * -FROM wrk_dijkstra('walk_net', @CH7_OSMID_1@, @CH7_OSMID_2@); - - +FROM wrk_dijkstra('walk_net', @CH7_ID_1@, @CH7_ID_2@); diff --git a/docs/scripts/configuration/osmid_configuration.sql b/docs/scripts/configuration/osmid_configuration.sql index 501575d34..e8c879abb 100644 --- a/docs/scripts/configuration/osmid_configuration.sql +++ b/docs/scripts/configuration/osmid_configuration.sql @@ -19,3 +19,11 @@ SELECT 'ID_' || r, id from a; WITH a AS (SELECT 5 AS r, osm_id, id FROM ways_vertices_pgr WHERE osm_id = @OSMID_5@) SELECT 'ID_' || r, id from a; + +WITH a AS (SELECT 1 AS r, osm_id, id FROM ways_vertices_pgr +WHERE osm_id = @CH7_ID_1@) +SELECT 'CH7_ID_' || r, id from a; + +WITH a AS (SELECT 2 AS r, osm_id, id FROM ways_vertices_pgr +WHERE osm_id = @CH7_ID_2@) +SELECT 'CH7_ID_' || r, id from a; diff --git a/locale/en/LC_MESSAGES/basic/sql_function.po b/locale/en/LC_MESSAGES/basic/sql_function.po index d72b45775..717fe1ad4 100644 --- a/locale/en/LC_MESSAGES/basic/sql_function.po +++ b/locale/en/LC_MESSAGES/basic/sql_function.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 18:21+0000\n" +"POT-Creation-Date: 2025-10-07 14:41+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/sql_function.rst:12 msgid "SQL function" @@ -34,664 +34,520 @@ msgstr "" #: ../../build/docs/basic/sql_function.rst:22 msgid "" -"When developing for a `higher level` application, the requirements need " -"to be represented in the SQL queries. As these SQL queries get more " -"complex, it is desirable to store them in postgreSQL stored procedures or" -" functions. Stored procedures or functions are an effective way to wrap " -"application logic, in this case, related to routing logic and " -"requirements." +"When developing for a `higher level` application, the requirements need to " +"be represented in the SQL queries. As these SQL queries get more complex, it " +"is desirable to store them in postgreSQL stored procedures or functions. " +"Stored procedures or functions are an effective way to wrap application " +"logic, in this case, related to routing logic and requirements." msgstr "" #: ../../build/docs/basic/sql_function.rst:30 -msgid "The application requirements" +msgid "The function requirements" msgstr "" #: ../../build/docs/basic/sql_function.rst:32 -msgid "A front end needs the following routing information:" +msgid "The function will wrap ``pgr_dijkstra``." msgstr "" -#: ../../build/docs/basic/sql_function.rst:33 +#: ../../build/docs/basic/sql_function.rst:34 +msgid "The function needs to work on any of the networks designed:" +msgstr "" + +#: ../../build/docs/basic/sql_function.rst:36 +#: ../../build/docs/basic/sql_function.rst:341 +msgid "``vehicle_net``" +msgstr "" + +#: ../../build/docs/basic/sql_function.rst:37 +#: ../../build/docs/basic/sql_function.rst:342 +msgid "``taxi_net``" +msgstr "" + +#: ../../build/docs/basic/sql_function.rst:39 +msgid "The function needs to return the following routing information:" +msgstr "" + +#: ../../build/docs/basic/sql_function.rst:41 msgid "``seq`` - A unique identifier of the rows" msgstr "" -#: ../../build/docs/basic/sql_function.rst:34 +#: ../../build/docs/basic/sql_function.rst:42 msgid "``id`` - The segment's identifier" msgstr "" -#: ../../build/docs/basic/sql_function.rst:35 +#: ../../build/docs/basic/sql_function.rst:43 msgid "``name`` - The segment's name" msgstr "" -#: ../../build/docs/basic/sql_function.rst:36 +#: ../../build/docs/basic/sql_function.rst:44 msgid "``length`` - The segment's length" msgstr "" -#: ../../build/docs/basic/sql_function.rst:37 +#: ../../build/docs/basic/sql_function.rst:45 msgid "``seconds`` - Number of seconds to traverse the segment" msgstr "" -#: ../../build/docs/basic/sql_function.rst:38 +#: ../../build/docs/basic/sql_function.rst:46 msgid "``azimuth`` - The azimuth of the segment" msgstr "" -#: ../../build/docs/basic/sql_function.rst:39 +#: ../../build/docs/basic/sql_function.rst:47 msgid "``route_geom`` - The routing geometry" msgstr "" -#: ../../build/docs/basic/sql_function.rst:40 +#: ../../build/docs/basic/sql_function.rst:48 msgid "``route_readable`` - The geometry in human readable form." msgstr "" -#: ../../build/docs/basic/sql_function.rst:43 +#: ../../build/docs/basic/sql_function.rst:51 msgid "Design of the function" msgstr "" -#: ../../build/docs/basic/sql_function.rst:44 +#: ../../build/docs/basic/sql_function.rst:52 msgid "" "The function to be created ``wrk_dijkstra`` with the following input " "parameters and output columns:" msgstr "" -#: ../../build/docs/basic/sql_function.rst:48 +#: ../../build/docs/basic/sql_function.rst:56 msgid "Input parameters" msgstr "" -#: ../../build/docs/basic/sql_function.rst:50 +#: ../../build/docs/basic/sql_function.rst:58 msgid "Parameter" msgstr "" -#: ../../build/docs/basic/sql_function.rst:50 -#: ../../build/docs/basic/sql_function.rst:60 +#: ../../build/docs/basic/sql_function.rst:58 +#: ../../build/docs/basic/sql_function.rst:68 msgid "Type" msgstr "" -#: ../../build/docs/basic/sql_function.rst:50 -#: ../../build/docs/basic/sql_function.rst:60 +#: ../../build/docs/basic/sql_function.rst:58 +#: ../../build/docs/basic/sql_function.rst:68 msgid "Description" msgstr "" -#: ../../build/docs/basic/sql_function.rst:52 +#: ../../build/docs/basic/sql_function.rst:60 msgid "``edges_subset``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:52 +#: ../../build/docs/basic/sql_function.rst:60 msgid "REGCLASS" msgstr "" -#: ../../build/docs/basic/sql_function.rst:52 +#: ../../build/docs/basic/sql_function.rst:60 msgid "The table/view that is going to be used for processing" msgstr "" -#: ../../build/docs/basic/sql_function.rst:53 -msgid "``source_osm``" +#: ../../build/docs/basic/sql_function.rst:61 +msgid "``source``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:53 -#: ../../build/docs/basic/sql_function.rst:54 -#: ../../build/docs/basic/sql_function.rst:63 +#: ../../build/docs/basic/sql_function.rst:61 +#: ../../build/docs/basic/sql_function.rst:62 +#: ../../build/docs/basic/sql_function.rst:71 msgid "BIGINT" msgstr "" -#: ../../build/docs/basic/sql_function.rst:53 -msgid "The OSM identifier of the `departure` location." +#: ../../build/docs/basic/sql_function.rst:61 +msgid "The identifier of the `departure` location." msgstr "" -#: ../../build/docs/basic/sql_function.rst:54 -msgid "``target_osm``" +#: ../../build/docs/basic/sql_function.rst:62 +msgid "``target``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:54 -msgid "The OSM identifier of the `destination` location." +#: ../../build/docs/basic/sql_function.rst:62 +msgid "The identifier of the `destination` location." msgstr "" -#: ../../build/docs/basic/sql_function.rst:58 +#: ../../build/docs/basic/sql_function.rst:66 msgid "output columns" msgstr "" -#: ../../build/docs/basic/sql_function.rst:60 +#: ../../build/docs/basic/sql_function.rst:68 msgid "Name" msgstr "" -#: ../../build/docs/basic/sql_function.rst:62 -#: ../../build/docs/basic/sql_function.rst:94 +#: ../../build/docs/basic/sql_function.rst:70 +#: ../../build/docs/basic/sql_function.rst:99 msgid "``seq``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:62 +#: ../../build/docs/basic/sql_function.rst:70 msgid "INTEGER" msgstr "" -#: ../../build/docs/basic/sql_function.rst:62 +#: ../../build/docs/basic/sql_function.rst:70 msgid "A unique number for each result row." msgstr "" -#: ../../build/docs/basic/sql_function.rst:63 -#: ../../build/docs/basic/sql_function.rst:95 +#: ../../build/docs/basic/sql_function.rst:71 +#: ../../build/docs/basic/sql_function.rst:100 msgid "``id``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:63 +#: ../../build/docs/basic/sql_function.rst:71 msgid "The edge identifier." msgstr "" -#: ../../build/docs/basic/sql_function.rst:64 -#: ../../build/docs/basic/sql_function.rst:96 +#: ../../build/docs/basic/sql_function.rst:72 +#: ../../build/docs/basic/sql_function.rst:101 msgid "``name``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:64 -#: ../../build/docs/basic/sql_function.rst:68 +#: ../../build/docs/basic/sql_function.rst:72 +#: ../../build/docs/basic/sql_function.rst:76 msgid "TEXT" msgstr "" -#: ../../build/docs/basic/sql_function.rst:64 +#: ../../build/docs/basic/sql_function.rst:72 msgid "The name of the segment." msgstr "" -#: ../../build/docs/basic/sql_function.rst:65 -#: ../../build/docs/basic/sql_function.rst:97 +#: ../../build/docs/basic/sql_function.rst:73 +#: ../../build/docs/basic/sql_function.rst:102 msgid "``seconds``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:65 -#: ../../build/docs/basic/sql_function.rst:66 -#: ../../build/docs/basic/sql_function.rst:67 +#: ../../build/docs/basic/sql_function.rst:73 +#: ../../build/docs/basic/sql_function.rst:74 +#: ../../build/docs/basic/sql_function.rst:75 msgid "FLOAT" msgstr "" -#: ../../build/docs/basic/sql_function.rst:65 +#: ../../build/docs/basic/sql_function.rst:73 msgid "The number of seconds it takes to traverse the segment." msgstr "" -#: ../../build/docs/basic/sql_function.rst:66 -msgid "``azimuth``" +#: ../../build/docs/basic/sql_function.rst:74 +#: ../../build/docs/basic/sql_function.rst:103 +msgid "``length``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:66 -msgid "The azimuth of the segment." +#: ../../build/docs/basic/sql_function.rst:74 +msgid "The leng in meters of the segment." msgstr "" -#: ../../build/docs/basic/sql_function.rst:67 -#: ../../build/docs/basic/sql_function.rst:98 -msgid "``length``" +#: ../../build/docs/basic/sql_function.rst:75 +msgid "``azimuth``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:67 -msgid "The leng in meters of the segment." +#: ../../build/docs/basic/sql_function.rst:75 +msgid "The azimuth of the segment." msgstr "" -#: ../../build/docs/basic/sql_function.rst:68 +#: ../../build/docs/basic/sql_function.rst:76 msgid "``route_readable``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:68 +#: ../../build/docs/basic/sql_function.rst:76 msgid "The geometry in human readable form." msgstr "" -#: ../../build/docs/basic/sql_function.rst:69 +#: ../../build/docs/basic/sql_function.rst:77 msgid "``route_geom``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:69 +#: ../../build/docs/basic/sql_function.rst:77 msgid "geometry" msgstr "" -#: ../../build/docs/basic/sql_function.rst:69 +#: ../../build/docs/basic/sql_function.rst:77 msgid "The geometry of the segment in the correct direction." msgstr "" -#: ../../build/docs/basic/sql_function.rst:73 -msgid "" -"For the following exercises only ``vehicle_net`` will be used, but you " -"can test the queries with the other views." -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:77 +#: ../../build/docs/basic/sql_function.rst:82 msgid "Additional information handling" msgstr "" -#: ../../build/docs/basic/sql_function.rst:79 +#: ../../build/docs/basic/sql_function.rst:84 msgid "" "When the application needs additional information, like the name of the " "street, ``JOIN`` the results with other tables." msgstr "" -#: ../../build/docs/basic/sql_function.rst:83 +#: ../../build/docs/basic/sql_function.rst:88 msgid "Exercise 1: Get additional information" msgstr "" -#: ../../build/docs/basic/sql_function.rst:85 +#: ../../build/docs/basic/sql_function.rst:90 msgid "Route showing names" msgstr "" -#: ../../build/docs/basic/sql_function.rst:90 -#: ../../build/docs/basic/sql_function.rst:137 -#: ../../build/docs/basic/sql_function.rst:188 -#: ../../build/docs/basic/sql_function.rst:244 -#: ../../build/docs/basic/sql_function.rst:308 -#: ../../build/docs/basic/sql_function.rst:352 -#: ../../build/docs/basic/sql_function.rst:403 +#: ../../build/docs/basic/sql_function.rst:95 +#: ../../build/docs/basic/sql_function.rst:147 +#: ../../build/docs/basic/sql_function.rst:186 +#: ../../build/docs/basic/sql_function.rst:239 +#: ../../build/docs/basic/sql_function.rst:303 msgid "Problem" msgstr "" -#: ../../build/docs/basic/sql_function.rst:91 -msgid "From |ch7_place_1| to |ch7_place_2|, using OSM identifiers." +#: ../../build/docs/basic/sql_function.rst:96 +#: ../../build/docs/basic/sql_function.rst:142 +#: ../../build/docs/basic/sql_function.rst:181 +#: ../../build/docs/basic/sql_function.rst:215 +msgid "From |ch7_place_1| to |ch7_place_2|" msgstr "" -#: ../../build/docs/basic/sql_function.rst:92 +#: ../../build/docs/basic/sql_function.rst:97 msgid "Get the following information:" msgstr "" -#: ../../build/docs/basic/sql_function.rst:101 -#: ../../build/docs/basic/sql_function.rst:150 -#: ../../build/docs/basic/sql_function.rst:196 -#: ../../build/docs/basic/sql_function.rst:254 -#: ../../build/docs/basic/sql_function.rst:316 -#: ../../build/docs/basic/sql_function.rst:366 -#: ../../build/docs/basic/sql_function.rst:408 +#: ../../build/docs/basic/sql_function.rst:106 +#: ../../build/docs/basic/sql_function.rst:155 +#: ../../build/docs/basic/sql_function.rst:194 +#: ../../build/docs/basic/sql_function.rst:249 +#: ../../build/docs/basic/sql_function.rst:309 msgid "Solution" msgstr "" -#: ../../build/docs/basic/sql_function.rst:102 -msgid "The columns asked (line **2**)." +#: ../../build/docs/basic/sql_function.rst:107 +msgid "The function returns the columns asked. (line **4**)" msgstr "" -#: ../../build/docs/basic/sql_function.rst:103 +#: ../../build/docs/basic/sql_function.rst:108 msgid "" "Rename ``pgr_dijkstra`` results to application requirements names. (line " -"**4**)." +"**12**)." msgstr "" -#: ../../build/docs/basic/sql_function.rst:104 +#: ../../build/docs/basic/sql_function.rst:110 msgid "" "``LEFT JOIN`` the results with ``vehicle_net`` to get the additional " -"information. (line **9**)" +"information. (line **17**)" msgstr "" -#: ../../build/docs/basic/sql_function.rst:106 +#: ../../build/docs/basic/sql_function.rst:113 msgid "" -"``LEFT`` to include the row with ``id = -1`` because it does not exist on" -" ``vehicle_net``" +"``LEFT`` to include the row with ``id = -1`` because it does not exist on " +"``vehicle_net``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:122 +#: ../../build/docs/basic/sql_function.rst:116 +#: ../../build/docs/basic/sql_function.rst:160 +#: ../../build/docs/basic/sql_function.rst:197 +#: ../../build/docs/basic/sql_function.rst:314 +msgid "Test from |ch7_id_1| to |ch7_id_2| on ``vehicle_net``. (Last line)" +msgstr "" + +#: ../../build/docs/basic/sql_function.rst:132 msgid "Geometry handling" msgstr "" -#: ../../build/docs/basic/sql_function.rst:124 +#: ../../build/docs/basic/sql_function.rst:134 msgid "" "From pgRouting point of view, the geometry is part of the additional " -"information, needed on the results for an application. Therefore ``JOIN``" -" the results with other tables that contain the geometry and for further " +"information, needed on the results for an application. Therefore ``JOIN`` " +"the results with other tables that contain the geometry and for further " "processing with PostGIS functions." msgstr "" -#: ../../build/docs/basic/sql_function.rst:130 +#: ../../build/docs/basic/sql_function.rst:140 msgid "Exercise 2: Route geometry (human readable)" msgstr "" -#: ../../build/docs/basic/sql_function.rst:132 -#: ../../build/docs/basic/sql_function.rst:218 -msgid "From |ch7_place_1| to |ch7_place_2|" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:138 -#: ../../build/docs/basic/sql_function.rst:189 -#: ../../build/docs/basic/sql_function.rst:245 +#: ../../build/docs/basic/sql_function.rst:148 +#: ../../build/docs/basic/sql_function.rst:187 +#: ../../build/docs/basic/sql_function.rst:240 msgid "Route from the |ch7_place_1| to |ch7_place_2|" msgstr "" -#: ../../build/docs/basic/sql_function.rst:140 -#: ../../build/docs/basic/sql_function.rst:191 +#: ../../build/docs/basic/sql_function.rst:150 +#: ../../build/docs/basic/sql_function.rst:189 msgid "Additionally to the previous exercise, get the" msgstr "" -#: ../../build/docs/basic/sql_function.rst:142 -msgid "geometry ``geom`` in human readable form named as ``route_readable``" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:146 -msgid "" -"``WITH`` provides a way to write auxiliary statements in larger queries. " -"It can be thought of as defining temporary tables that exist just for one" -" query." -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:151 -msgid "" -"The routing query named ``results`` in a WITH clause. (lines **2** to " -"**5**)" -msgstr "" - #: ../../build/docs/basic/sql_function.rst:152 -msgid "The results from the previous exercise. (lines **8** and **9**)" +msgid "geometry ``geom`` in human readable form named as ``route_readable``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:154 -msgid "" -"For result reading purposes, the result columns from the previous are in " -"a comment. Uncomment to see the complete results for the problem." +#: ../../build/docs/basic/sql_function.rst:156 +msgid "The function returns ``route_readable``. (line **6**)" msgstr "" #: ../../build/docs/basic/sql_function.rst:157 -msgid "" -"The ``geom`` processed with ``ST_AsText`` to get the human readable form." -" (line **12**)" +msgid "The routing query named ``results`` in a WITH clause. (line **11**)" msgstr "" -#: ../../build/docs/basic/sql_function.rst:160 -msgid "Renaming the result to ``route_readable``" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:162 -msgid "The ``LEFT JOIN`` with ``vehicle_net``. (line **14**)" +#: ../../build/docs/basic/sql_function.rst:158 +msgid "" +"The ``geom`` processed with ``ST_AsText`` to get the human readable form. " +"(line **19**)." msgstr "" -#: ../../build/docs/basic/sql_function.rst:181 +#: ../../build/docs/basic/sql_function.rst:179 msgid "Exercise 3: Route geometry (binary format)" msgstr "" -#: ../../build/docs/basic/sql_function.rst:183 -msgid "From |ch7_place_1| to |ch7_place_2| showing arrows." -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:193 -#: ../../build/docs/basic/sql_function.rst:250 +#: ../../build/docs/basic/sql_function.rst:191 +#: ../../build/docs/basic/sql_function.rst:245 msgid "``geom`` in binary format with the name ``route_geom``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:197 -msgid "The query from the previous exercise is used" +#: ../../build/docs/basic/sql_function.rst:195 +msgid "The function returns ``route_geom``. (line **7**)" msgstr "" -#: ../../build/docs/basic/sql_function.rst:198 -msgid "The ``SELECT`` clause also contains:" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:200 -msgid "The ``geom`` including the renaming (line **9**)" +#: ../../build/docs/basic/sql_function.rst:196 +msgid "The geometry ``geom`` of the segments (line **21**)" msgstr "" -#: ../../build/docs/basic/sql_function.rst:216 +#: ../../build/docs/basic/sql_function.rst:213 msgid "Exercise 4: Route geometry directionality" msgstr "" -#: ../../build/docs/basic/sql_function.rst:222 +#: ../../build/docs/basic/sql_function.rst:219 msgid "" -"Visually, with the route displayed with arrows, it can be found that " -"there are arrows that do not match the directionality of the route." +"Visually, with the route displayed with arrows, it can be found that there " +"are arrows that do not match the directionality of the route." msgstr "" -#: ../../build/docs/basic/sql_function.rst:225 +#: ../../build/docs/basic/sql_function.rst:222 msgid "" -"To have correct directionality, the ending point of a geometry must match" -" the starting point of the next geometry" +"To have correct directionality, the ending point of a geometry must match " +"the starting point of the next geometry" msgstr "" -#: ../../build/docs/basic/sql_function.rst:228 +#: ../../build/docs/basic/sql_function.rst:225 msgid "" -"Inspecting the detail of the results of `Exercise 2: Route geometry " -"(human readable)`_" +"Inspecting the detail of the results of `Exercise 2: Route geometry (human " +"readable)`_" msgstr "" -#: ../../build/docs/basic/sql_function.rst:231 -msgid "Rows **59** to **61** do not match that criteria" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:247 +#: ../../build/docs/basic/sql_function.rst:242 msgid "Fix the directionality of the geometries of the previous exercise" msgstr "" -#: ../../build/docs/basic/sql_function.rst:249 +#: ../../build/docs/basic/sql_function.rst:244 msgid "``geom`` in human readable form named as ``route_readable``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:251 +#: ../../build/docs/basic/sql_function.rst:246 msgid "Both columns must have the geometry fixed for directionality." msgstr "" -#: ../../build/docs/basic/sql_function.rst:255 +#: ../../build/docs/basic/sql_function.rst:250 msgid "To get the correct direction some geometries need to be reversed:" msgstr "" -#: ../../build/docs/basic/sql_function.rst:257 +#: ../../build/docs/basic/sql_function.rst:252 msgid "" "Reversing a geometry will depend on the ``node`` column of the query to " -"Dijkstra (line **2**)" +"Dijkstra." msgstr "" -#: ../../build/docs/basic/sql_function.rst:260 +#: ../../build/docs/basic/sql_function.rst:255 msgid "" -"A conditional ``CASE`` statement that returns the geometry in human " -"readable form:" +"A conditional ``CASE`` statement that returns the geometry in human readable " +"form:" msgstr "" -#: ../../build/docs/basic/sql_function.rst:263 -msgid "Of the geometry when ``node`` is the ``source`` column. (line **11**)" +#: ../../build/docs/basic/sql_function.rst:258 +msgid "Of the geometry when ``node`` is the ``source`` column." msgstr "" -#: ../../build/docs/basic/sql_function.rst:264 -msgid "" -"Of the reversed geometry when ``node`` is not the ``source`` column. " -"(line **12**)" +#: ../../build/docs/basic/sql_function.rst:259 +msgid "Of the reversed geometry when ``node`` is not the ``source`` column." msgstr "" -#: ../../build/docs/basic/sql_function.rst:266 +#: ../../build/docs/basic/sql_function.rst:261 msgid "A conditional ``CASE`` statement that returns:" msgstr "" -#: ../../build/docs/basic/sql_function.rst:268 -msgid "The geometry when ``node`` is the ``source`` column. (line **17**)" +#: ../../build/docs/basic/sql_function.rst:263 +msgid "The geometry when ``node`` is the ``source`` column." msgstr "" -#: ../../build/docs/basic/sql_function.rst:269 -msgid "" -"The reversed geometry when ``node`` is not the ``source`` column. (line " -"**16**)" +#: ../../build/docs/basic/sql_function.rst:264 +msgid "The reversed geometry when ``node`` is not the ``source`` column." msgstr "" -#: ../../build/docs/basic/sql_function.rst:282 -msgid "Inspecting some the problematic rows, the directionality has been fixed." +#: ../../build/docs/basic/sql_function.rst:277 +msgid "Inspecting the problematic rows, the directionality has been fixed." msgstr "" -#: ../../build/docs/basic/sql_function.rst:295 +#: ../../build/docs/basic/sql_function.rst:290 msgid "Exercise 5: Using the geometry" msgstr "" -#: ../../build/docs/basic/sql_function.rst:297 +#: ../../build/docs/basic/sql_function.rst:292 msgid "From |ch7_place_1| to the |ch7_place_2| show azimuth" msgstr "" -#: ../../build/docs/basic/sql_function.rst:302 +#: ../../build/docs/basic/sql_function.rst:297 msgid "" -"There are many geometry functions in PostGIS, the workshop already " -"covered some of them like ``ST_AsText``, ``ST_Reverse``, ``ST_EndPoint``," -" etc. This exercise will make use an additional function ``ST_Azimuth``." +"There are many geometry functions in PostGIS, the workshop already covered " +"some of them like ``ST_AsText``, ``ST_Reverse``, ``ST_EndPoint``, etc. This " +"exercise will make use an additional function ``ST_Azimuth``." msgstr "" -#: ../../build/docs/basic/sql_function.rst:309 +#: ../../build/docs/basic/sql_function.rst:304 msgid "Modify the query from the previous exercise" msgstr "" -#: ../../build/docs/basic/sql_function.rst:311 -msgid "Additionally obtain the azimuth of the correct geometry." -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:312 -msgid "" -"Because ``vehicle_net`` and the other 2 views are sub graphs of ``ways``," -" do the ``JOIN`` with ``ways``." -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:317 -msgid "" -"Move the query that gets the additional information into the ``WITH`` " -"statement." -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:319 -msgid "Name it ``additional``. (line **6**)" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:321 -msgid "The ``ways`` table geometry name is ``the_geom``." -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:322 -msgid "Final ``SELECT`` statements gets:" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:324 -msgid "Calculates the azimuth of ``route_geom``. (line **27**)" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:337 -msgid "Creating the Function" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:339 -msgid "" -"The following function simplifies (and sets default values) when it calls" -" the shortest path Dijkstra function." -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:343 -msgid "pgRouting uses heavely function overloading:" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:345 -msgid "Avoid creating functions with a name of a pgRouting routing function" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:346 -msgid "Avoid the name of a function to start with `pgr_`, `_pgr` or `ST_`" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:349 -msgid "Exercise 6: Function for an application" +#: ../../build/docs/basic/sql_function.rst:306 +msgid "Additionally obtain the azimuth in degrees of the corrected geometry." msgstr "" -#: ../../build/docs/basic/sql_function.rst:353 -msgid "Putting all together in a SQL function" +#: ../../build/docs/basic/sql_function.rst:310 +msgid "The function returns ``aximuth``. (line **8**)" msgstr "" -#: ../../build/docs/basic/sql_function.rst:355 -msgid "function name ``wrk_dijkstra``" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:356 -msgid "Should work for any given view." -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:358 -msgid "Allow a view as a parameter" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:359 -msgid "A table can be used if the columns have the correct names." -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:361 -msgid "``source`` and ``target`` are in terms of ``osm_id``." -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:362 +#: ../../build/docs/basic/sql_function.rst:311 msgid "" -"The result should meet the requirements indicated at the beginning of the" -" chapter" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:367 -msgid "The signature of the function:" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:369 -msgid "The input parameters are from line **4** to **6**." +"The query from previous exercise is wrapped under additional subquery. (line " +"**18**)" msgstr "" -#: ../../build/docs/basic/sql_function.rst:370 -msgid "The output columns are from line **7** to **14** (not highlighted)." +#: ../../build/docs/basic/sql_function.rst:313 +msgid "The ``azimuth`` is processed in degrees. (line **35**)." msgstr "" -#: ../../build/docs/basic/sql_function.rst:371 -msgid "The function returns a set. (line **16**)" +#: ../../build/docs/basic/sql_function.rst:329 +msgid "Exercise 6: Using the function" msgstr "" -#: ../../build/docs/basic/sql_function.rst:379 -msgid "The body of the function:" +#: ../../build/docs/basic/sql_function.rst:331 +msgid "Try the function with a combination of the interesting places:" msgstr "" -#: ../../build/docs/basic/sql_function.rst:381 -msgid "" -"Appending the view name on line **7** in the ``SELECT`` query to " -"``pgr_dijkstra``." +#: ../../build/docs/basic/sql_function.rst:333 +msgid "|id_1| |place_1|" msgstr "" -#: ../../build/docs/basic/sql_function.rst:382 -msgid "" -"Using the data to get the route from ``source`` to ``target``. (line " -"**8**)" +#: ../../build/docs/basic/sql_function.rst:334 +msgid "|id_2| |place_2|" msgstr "" -#: ../../build/docs/basic/sql_function.rst:383 -msgid "" -"The ``JOIN`` with ``ways`` is necessary, as the views are subset of " -"``ways`` (line **25**)" +#: ../../build/docs/basic/sql_function.rst:335 +msgid "|id_3| |place_3|" msgstr "" -#: ../../build/docs/basic/sql_function.rst:400 -msgid "Exercise 7: Using the function" +#: ../../build/docs/basic/sql_function.rst:336 +msgid "|id_4| |place_4|" msgstr "" -#: ../../build/docs/basic/sql_function.rst:404 -msgid "Test the function with the three views" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:405 -msgid "From the |ch7_place_1| to the |ch7_place_2| using the OSM identifier" +#: ../../build/docs/basic/sql_function.rst:337 +msgid "|id_5| |place_5|" msgstr "" -#: ../../build/docs/basic/sql_function.rst:409 -msgid "Use the function on the ``SELECT`` statement" +#: ../../build/docs/basic/sql_function.rst:339 +msgid "Using different networks:" msgstr "" -#: ../../build/docs/basic/sql_function.rst:410 -msgid "The first parameter changes based on the view to be tested" +#: ../../build/docs/basic/sql_function.rst:343 +msgid "``walk_net``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:412 +#: ../../build/docs/basic/sql_function.rst:345 msgid "Names of the streets in the route" msgstr "" -#: ../../build/docs/basic/sql_function.rst:423 +#: ../../build/docs/basic/sql_function.rst:356 msgid "Total seconds spent in each street" msgstr "" -#: ../../build/docs/basic/sql_function.rst:434 -msgid "Get all the information of the route" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:445 -msgid "Try the function with a combination of the interesting places:" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:447 -msgid "|osmid_1| |place_1|" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:448 -msgid "|osmid_2| |place_2|" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:449 -msgid "|osmid_3| |place_3|" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:450 -msgid "|osmid_4| |place_4|" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:451 -msgid "|osmid_5| |place_5|" +#: ../../build/docs/basic/sql_function.rst:367 +msgid "Why it does not fully work with ``walk_net``?" msgstr "" - diff --git a/locale/pot/basic/sql_function.pot b/locale/pot/basic/sql_function.pot index 234cbb8f9..4810bf209 100644 --- a/locale/pot/basic/sql_function.pot +++ b/locale/pot/basic/sql_function.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 18:21+0000\n" +"POT-Creation-Date: 2025-10-07 14:41+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -33,598 +33,481 @@ msgid "When developing for a `higher level` application, the requirements need t msgstr "" #: ../../build/docs/basic/sql_function.rst:30 -msgid "The application requirements" +msgid "The function requirements" msgstr "" #: ../../build/docs/basic/sql_function.rst:32 -msgid "A front end needs the following routing information:" +msgid "The function will wrap ``pgr_dijkstra``." msgstr "" -#: ../../build/docs/basic/sql_function.rst:33 +#: ../../build/docs/basic/sql_function.rst:34 +msgid "The function needs to work on any of the networks designed:" +msgstr "" + +#: ../../build/docs/basic/sql_function.rst:36 +#: ../../build/docs/basic/sql_function.rst:341 +msgid "``vehicle_net``" +msgstr "" + +#: ../../build/docs/basic/sql_function.rst:37 +#: ../../build/docs/basic/sql_function.rst:342 +msgid "``taxi_net``" +msgstr "" + +#: ../../build/docs/basic/sql_function.rst:39 +msgid "The function needs to return the following routing information:" +msgstr "" + +#: ../../build/docs/basic/sql_function.rst:41 msgid "``seq`` - A unique identifier of the rows" msgstr "" -#: ../../build/docs/basic/sql_function.rst:34 +#: ../../build/docs/basic/sql_function.rst:42 msgid "``id`` - The segment's identifier" msgstr "" -#: ../../build/docs/basic/sql_function.rst:35 +#: ../../build/docs/basic/sql_function.rst:43 msgid "``name`` - The segment's name" msgstr "" -#: ../../build/docs/basic/sql_function.rst:36 +#: ../../build/docs/basic/sql_function.rst:44 msgid "``length`` - The segment's length" msgstr "" -#: ../../build/docs/basic/sql_function.rst:37 +#: ../../build/docs/basic/sql_function.rst:45 msgid "``seconds`` - Number of seconds to traverse the segment" msgstr "" -#: ../../build/docs/basic/sql_function.rst:38 +#: ../../build/docs/basic/sql_function.rst:46 msgid "``azimuth`` - The azimuth of the segment" msgstr "" -#: ../../build/docs/basic/sql_function.rst:39 +#: ../../build/docs/basic/sql_function.rst:47 msgid "``route_geom`` - The routing geometry" msgstr "" -#: ../../build/docs/basic/sql_function.rst:40 +#: ../../build/docs/basic/sql_function.rst:48 msgid "``route_readable`` - The geometry in human readable form." msgstr "" -#: ../../build/docs/basic/sql_function.rst:43 +#: ../../build/docs/basic/sql_function.rst:51 msgid "Design of the function" msgstr "" -#: ../../build/docs/basic/sql_function.rst:44 +#: ../../build/docs/basic/sql_function.rst:52 msgid "The function to be created ``wrk_dijkstra`` with the following input parameters and output columns:" msgstr "" -#: ../../build/docs/basic/sql_function.rst:48 +#: ../../build/docs/basic/sql_function.rst:56 msgid "Input parameters" msgstr "" -#: ../../build/docs/basic/sql_function.rst:50 +#: ../../build/docs/basic/sql_function.rst:58 msgid "Parameter" msgstr "" -#: ../../build/docs/basic/sql_function.rst:50 -#: ../../build/docs/basic/sql_function.rst:60 +#: ../../build/docs/basic/sql_function.rst:58 +#: ../../build/docs/basic/sql_function.rst:68 msgid "Type" msgstr "" -#: ../../build/docs/basic/sql_function.rst:50 -#: ../../build/docs/basic/sql_function.rst:60 +#: ../../build/docs/basic/sql_function.rst:58 +#: ../../build/docs/basic/sql_function.rst:68 msgid "Description" msgstr "" -#: ../../build/docs/basic/sql_function.rst:52 +#: ../../build/docs/basic/sql_function.rst:60 msgid "``edges_subset``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:52 +#: ../../build/docs/basic/sql_function.rst:60 msgid "REGCLASS" msgstr "" -#: ../../build/docs/basic/sql_function.rst:52 +#: ../../build/docs/basic/sql_function.rst:60 msgid "The table/view that is going to be used for processing" msgstr "" -#: ../../build/docs/basic/sql_function.rst:53 -msgid "``source_osm``" +#: ../../build/docs/basic/sql_function.rst:61 +msgid "``source``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:53 -#: ../../build/docs/basic/sql_function.rst:54 -#: ../../build/docs/basic/sql_function.rst:63 +#: ../../build/docs/basic/sql_function.rst:61 +#: ../../build/docs/basic/sql_function.rst:62 +#: ../../build/docs/basic/sql_function.rst:71 msgid "BIGINT" msgstr "" -#: ../../build/docs/basic/sql_function.rst:53 -msgid "The OSM identifier of the `departure` location." +#: ../../build/docs/basic/sql_function.rst:61 +msgid "The identifier of the `departure` location." msgstr "" -#: ../../build/docs/basic/sql_function.rst:54 -msgid "``target_osm``" +#: ../../build/docs/basic/sql_function.rst:62 +msgid "``target``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:54 -msgid "The OSM identifier of the `destination` location." +#: ../../build/docs/basic/sql_function.rst:62 +msgid "The identifier of the `destination` location." msgstr "" -#: ../../build/docs/basic/sql_function.rst:58 +#: ../../build/docs/basic/sql_function.rst:66 msgid "output columns" msgstr "" -#: ../../build/docs/basic/sql_function.rst:60 +#: ../../build/docs/basic/sql_function.rst:68 msgid "Name" msgstr "" -#: ../../build/docs/basic/sql_function.rst:62 -#: ../../build/docs/basic/sql_function.rst:94 +#: ../../build/docs/basic/sql_function.rst:70 +#: ../../build/docs/basic/sql_function.rst:99 msgid "``seq``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:62 +#: ../../build/docs/basic/sql_function.rst:70 msgid "INTEGER" msgstr "" -#: ../../build/docs/basic/sql_function.rst:62 +#: ../../build/docs/basic/sql_function.rst:70 msgid "A unique number for each result row." msgstr "" -#: ../../build/docs/basic/sql_function.rst:63 -#: ../../build/docs/basic/sql_function.rst:95 +#: ../../build/docs/basic/sql_function.rst:71 +#: ../../build/docs/basic/sql_function.rst:100 msgid "``id``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:63 +#: ../../build/docs/basic/sql_function.rst:71 msgid "The edge identifier." msgstr "" -#: ../../build/docs/basic/sql_function.rst:64 -#: ../../build/docs/basic/sql_function.rst:96 +#: ../../build/docs/basic/sql_function.rst:72 +#: ../../build/docs/basic/sql_function.rst:101 msgid "``name``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:64 -#: ../../build/docs/basic/sql_function.rst:68 +#: ../../build/docs/basic/sql_function.rst:72 +#: ../../build/docs/basic/sql_function.rst:76 msgid "TEXT" msgstr "" -#: ../../build/docs/basic/sql_function.rst:64 +#: ../../build/docs/basic/sql_function.rst:72 msgid "The name of the segment." msgstr "" -#: ../../build/docs/basic/sql_function.rst:65 -#: ../../build/docs/basic/sql_function.rst:97 +#: ../../build/docs/basic/sql_function.rst:73 +#: ../../build/docs/basic/sql_function.rst:102 msgid "``seconds``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:65 -#: ../../build/docs/basic/sql_function.rst:66 -#: ../../build/docs/basic/sql_function.rst:67 +#: ../../build/docs/basic/sql_function.rst:73 +#: ../../build/docs/basic/sql_function.rst:74 +#: ../../build/docs/basic/sql_function.rst:75 msgid "FLOAT" msgstr "" -#: ../../build/docs/basic/sql_function.rst:65 +#: ../../build/docs/basic/sql_function.rst:73 msgid "The number of seconds it takes to traverse the segment." msgstr "" -#: ../../build/docs/basic/sql_function.rst:66 -msgid "``azimuth``" +#: ../../build/docs/basic/sql_function.rst:74 +#: ../../build/docs/basic/sql_function.rst:103 +msgid "``length``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:66 -msgid "The azimuth of the segment." +#: ../../build/docs/basic/sql_function.rst:74 +msgid "The leng in meters of the segment." msgstr "" -#: ../../build/docs/basic/sql_function.rst:67 -#: ../../build/docs/basic/sql_function.rst:98 -msgid "``length``" +#: ../../build/docs/basic/sql_function.rst:75 +msgid "``azimuth``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:67 -msgid "The leng in meters of the segment." +#: ../../build/docs/basic/sql_function.rst:75 +msgid "The azimuth of the segment." msgstr "" -#: ../../build/docs/basic/sql_function.rst:68 +#: ../../build/docs/basic/sql_function.rst:76 msgid "``route_readable``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:68 +#: ../../build/docs/basic/sql_function.rst:76 msgid "The geometry in human readable form." msgstr "" -#: ../../build/docs/basic/sql_function.rst:69 +#: ../../build/docs/basic/sql_function.rst:77 msgid "``route_geom``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:69 +#: ../../build/docs/basic/sql_function.rst:77 msgid "geometry" msgstr "" -#: ../../build/docs/basic/sql_function.rst:69 +#: ../../build/docs/basic/sql_function.rst:77 msgid "The geometry of the segment in the correct direction." msgstr "" -#: ../../build/docs/basic/sql_function.rst:73 -msgid "For the following exercises only ``vehicle_net`` will be used, but you can test the queries with the other views." -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:77 +#: ../../build/docs/basic/sql_function.rst:82 msgid "Additional information handling" msgstr "" -#: ../../build/docs/basic/sql_function.rst:79 +#: ../../build/docs/basic/sql_function.rst:84 msgid "When the application needs additional information, like the name of the street, ``JOIN`` the results with other tables." msgstr "" -#: ../../build/docs/basic/sql_function.rst:83 +#: ../../build/docs/basic/sql_function.rst:88 msgid "Exercise 1: Get additional information" msgstr "" -#: ../../build/docs/basic/sql_function.rst:85 +#: ../../build/docs/basic/sql_function.rst:90 msgid "Route showing names" msgstr "" -#: ../../build/docs/basic/sql_function.rst:90 -#: ../../build/docs/basic/sql_function.rst:137 -#: ../../build/docs/basic/sql_function.rst:188 -#: ../../build/docs/basic/sql_function.rst:244 -#: ../../build/docs/basic/sql_function.rst:308 -#: ../../build/docs/basic/sql_function.rst:352 -#: ../../build/docs/basic/sql_function.rst:403 +#: ../../build/docs/basic/sql_function.rst:95 +#: ../../build/docs/basic/sql_function.rst:147 +#: ../../build/docs/basic/sql_function.rst:186 +#: ../../build/docs/basic/sql_function.rst:239 +#: ../../build/docs/basic/sql_function.rst:303 msgid "Problem" msgstr "" -#: ../../build/docs/basic/sql_function.rst:91 -msgid "From |ch7_place_1| to |ch7_place_2|, using OSM identifiers." +#: ../../build/docs/basic/sql_function.rst:96 +#: ../../build/docs/basic/sql_function.rst:142 +#: ../../build/docs/basic/sql_function.rst:181 +#: ../../build/docs/basic/sql_function.rst:215 +msgid "From |ch7_place_1| to |ch7_place_2|" msgstr "" -#: ../../build/docs/basic/sql_function.rst:92 +#: ../../build/docs/basic/sql_function.rst:97 msgid "Get the following information:" msgstr "" -#: ../../build/docs/basic/sql_function.rst:101 -#: ../../build/docs/basic/sql_function.rst:150 -#: ../../build/docs/basic/sql_function.rst:196 -#: ../../build/docs/basic/sql_function.rst:254 -#: ../../build/docs/basic/sql_function.rst:316 -#: ../../build/docs/basic/sql_function.rst:366 -#: ../../build/docs/basic/sql_function.rst:408 +#: ../../build/docs/basic/sql_function.rst:106 +#: ../../build/docs/basic/sql_function.rst:155 +#: ../../build/docs/basic/sql_function.rst:194 +#: ../../build/docs/basic/sql_function.rst:249 +#: ../../build/docs/basic/sql_function.rst:309 msgid "Solution" msgstr "" -#: ../../build/docs/basic/sql_function.rst:102 -msgid "The columns asked (line **2**)." +#: ../../build/docs/basic/sql_function.rst:107 +msgid "The function returns the columns asked. (line **4**)" msgstr "" -#: ../../build/docs/basic/sql_function.rst:103 -msgid "Rename ``pgr_dijkstra`` results to application requirements names. (line **4**)." +#: ../../build/docs/basic/sql_function.rst:108 +msgid "Rename ``pgr_dijkstra`` results to application requirements names. (line **12**)." msgstr "" -#: ../../build/docs/basic/sql_function.rst:104 -msgid "``LEFT JOIN`` the results with ``vehicle_net`` to get the additional information. (line **9**)" +#: ../../build/docs/basic/sql_function.rst:110 +msgid "``LEFT JOIN`` the results with ``vehicle_net`` to get the additional information. (line **17**)" msgstr "" -#: ../../build/docs/basic/sql_function.rst:106 +#: ../../build/docs/basic/sql_function.rst:113 msgid "``LEFT`` to include the row with ``id = -1`` because it does not exist on ``vehicle_net``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:122 +#: ../../build/docs/basic/sql_function.rst:116 +#: ../../build/docs/basic/sql_function.rst:160 +#: ../../build/docs/basic/sql_function.rst:197 +#: ../../build/docs/basic/sql_function.rst:314 +msgid "Test from |ch7_id_1| to |ch7_id_2| on ``vehicle_net``. (Last line)" +msgstr "" + +#: ../../build/docs/basic/sql_function.rst:132 msgid "Geometry handling" msgstr "" -#: ../../build/docs/basic/sql_function.rst:124 +#: ../../build/docs/basic/sql_function.rst:134 msgid "From pgRouting point of view, the geometry is part of the additional information, needed on the results for an application. Therefore ``JOIN`` the results with other tables that contain the geometry and for further processing with PostGIS functions." msgstr "" -#: ../../build/docs/basic/sql_function.rst:130 +#: ../../build/docs/basic/sql_function.rst:140 msgid "Exercise 2: Route geometry (human readable)" msgstr "" -#: ../../build/docs/basic/sql_function.rst:132 -#: ../../build/docs/basic/sql_function.rst:218 -msgid "From |ch7_place_1| to |ch7_place_2|" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:138 -#: ../../build/docs/basic/sql_function.rst:189 -#: ../../build/docs/basic/sql_function.rst:245 +#: ../../build/docs/basic/sql_function.rst:148 +#: ../../build/docs/basic/sql_function.rst:187 +#: ../../build/docs/basic/sql_function.rst:240 msgid "Route from the |ch7_place_1| to |ch7_place_2|" msgstr "" -#: ../../build/docs/basic/sql_function.rst:140 -#: ../../build/docs/basic/sql_function.rst:191 +#: ../../build/docs/basic/sql_function.rst:150 +#: ../../build/docs/basic/sql_function.rst:189 msgid "Additionally to the previous exercise, get the" msgstr "" -#: ../../build/docs/basic/sql_function.rst:142 -msgid "geometry ``geom`` in human readable form named as ``route_readable``" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:146 -msgid "``WITH`` provides a way to write auxiliary statements in larger queries. It can be thought of as defining temporary tables that exist just for one query." -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:151 -msgid "The routing query named ``results`` in a WITH clause. (lines **2** to **5**)" -msgstr "" - #: ../../build/docs/basic/sql_function.rst:152 -msgid "The results from the previous exercise. (lines **8** and **9**)" +msgid "geometry ``geom`` in human readable form named as ``route_readable``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:154 -msgid "For result reading purposes, the result columns from the previous are in a comment. Uncomment to see the complete results for the problem." +#: ../../build/docs/basic/sql_function.rst:156 +msgid "The function returns ``route_readable``. (line **6**)" msgstr "" #: ../../build/docs/basic/sql_function.rst:157 -msgid "The ``geom`` processed with ``ST_AsText`` to get the human readable form. (line **12**)" +msgid "The routing query named ``results`` in a WITH clause. (line **11**)" msgstr "" -#: ../../build/docs/basic/sql_function.rst:160 -msgid "Renaming the result to ``route_readable``" +#: ../../build/docs/basic/sql_function.rst:158 +msgid "The ``geom`` processed with ``ST_AsText`` to get the human readable form. (line **19**)." msgstr "" -#: ../../build/docs/basic/sql_function.rst:162 -msgid "The ``LEFT JOIN`` with ``vehicle_net``. (line **14**)" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:181 +#: ../../build/docs/basic/sql_function.rst:179 msgid "Exercise 3: Route geometry (binary format)" msgstr "" -#: ../../build/docs/basic/sql_function.rst:183 -msgid "From |ch7_place_1| to |ch7_place_2| showing arrows." -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:193 -#: ../../build/docs/basic/sql_function.rst:250 +#: ../../build/docs/basic/sql_function.rst:191 +#: ../../build/docs/basic/sql_function.rst:245 msgid "``geom`` in binary format with the name ``route_geom``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:197 -msgid "The query from the previous exercise is used" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:198 -msgid "The ``SELECT`` clause also contains:" +#: ../../build/docs/basic/sql_function.rst:195 +msgid "The function returns ``route_geom``. (line **7**)" msgstr "" -#: ../../build/docs/basic/sql_function.rst:200 -msgid "The ``geom`` including the renaming (line **9**)" +#: ../../build/docs/basic/sql_function.rst:196 +msgid "The geometry ``geom`` of the segments (line **21**)" msgstr "" -#: ../../build/docs/basic/sql_function.rst:216 +#: ../../build/docs/basic/sql_function.rst:213 msgid "Exercise 4: Route geometry directionality" msgstr "" -#: ../../build/docs/basic/sql_function.rst:222 +#: ../../build/docs/basic/sql_function.rst:219 msgid "Visually, with the route displayed with arrows, it can be found that there are arrows that do not match the directionality of the route." msgstr "" -#: ../../build/docs/basic/sql_function.rst:225 +#: ../../build/docs/basic/sql_function.rst:222 msgid "To have correct directionality, the ending point of a geometry must match the starting point of the next geometry" msgstr "" -#: ../../build/docs/basic/sql_function.rst:228 +#: ../../build/docs/basic/sql_function.rst:225 msgid "Inspecting the detail of the results of `Exercise 2: Route geometry (human readable)`_" msgstr "" -#: ../../build/docs/basic/sql_function.rst:231 -msgid "Rows **59** to **61** do not match that criteria" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:247 +#: ../../build/docs/basic/sql_function.rst:242 msgid "Fix the directionality of the geometries of the previous exercise" msgstr "" -#: ../../build/docs/basic/sql_function.rst:249 +#: ../../build/docs/basic/sql_function.rst:244 msgid "``geom`` in human readable form named as ``route_readable``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:251 +#: ../../build/docs/basic/sql_function.rst:246 msgid "Both columns must have the geometry fixed for directionality." msgstr "" -#: ../../build/docs/basic/sql_function.rst:255 +#: ../../build/docs/basic/sql_function.rst:250 msgid "To get the correct direction some geometries need to be reversed:" msgstr "" -#: ../../build/docs/basic/sql_function.rst:257 -msgid "Reversing a geometry will depend on the ``node`` column of the query to Dijkstra (line **2**)" +#: ../../build/docs/basic/sql_function.rst:252 +msgid "Reversing a geometry will depend on the ``node`` column of the query to Dijkstra." msgstr "" -#: ../../build/docs/basic/sql_function.rst:260 +#: ../../build/docs/basic/sql_function.rst:255 msgid "A conditional ``CASE`` statement that returns the geometry in human readable form:" msgstr "" -#: ../../build/docs/basic/sql_function.rst:263 -msgid "Of the geometry when ``node`` is the ``source`` column. (line **11**)" +#: ../../build/docs/basic/sql_function.rst:258 +msgid "Of the geometry when ``node`` is the ``source`` column." msgstr "" -#: ../../build/docs/basic/sql_function.rst:264 -msgid "Of the reversed geometry when ``node`` is not the ``source`` column. (line **12**)" +#: ../../build/docs/basic/sql_function.rst:259 +msgid "Of the reversed geometry when ``node`` is not the ``source`` column." msgstr "" -#: ../../build/docs/basic/sql_function.rst:266 +#: ../../build/docs/basic/sql_function.rst:261 msgid "A conditional ``CASE`` statement that returns:" msgstr "" -#: ../../build/docs/basic/sql_function.rst:268 -msgid "The geometry when ``node`` is the ``source`` column. (line **17**)" +#: ../../build/docs/basic/sql_function.rst:263 +msgid "The geometry when ``node`` is the ``source`` column." msgstr "" -#: ../../build/docs/basic/sql_function.rst:269 -msgid "The reversed geometry when ``node`` is not the ``source`` column. (line **16**)" +#: ../../build/docs/basic/sql_function.rst:264 +msgid "The reversed geometry when ``node`` is not the ``source`` column." msgstr "" -#: ../../build/docs/basic/sql_function.rst:282 -msgid "Inspecting some the problematic rows, the directionality has been fixed." +#: ../../build/docs/basic/sql_function.rst:277 +msgid "Inspecting the problematic rows, the directionality has been fixed." msgstr "" -#: ../../build/docs/basic/sql_function.rst:295 +#: ../../build/docs/basic/sql_function.rst:290 msgid "Exercise 5: Using the geometry" msgstr "" -#: ../../build/docs/basic/sql_function.rst:297 +#: ../../build/docs/basic/sql_function.rst:292 msgid "From |ch7_place_1| to the |ch7_place_2| show azimuth" msgstr "" -#: ../../build/docs/basic/sql_function.rst:302 +#: ../../build/docs/basic/sql_function.rst:297 msgid "There are many geometry functions in PostGIS, the workshop already covered some of them like ``ST_AsText``, ``ST_Reverse``, ``ST_EndPoint``, etc. This exercise will make use an additional function ``ST_Azimuth``." msgstr "" -#: ../../build/docs/basic/sql_function.rst:309 +#: ../../build/docs/basic/sql_function.rst:304 msgid "Modify the query from the previous exercise" msgstr "" -#: ../../build/docs/basic/sql_function.rst:311 -msgid "Additionally obtain the azimuth of the correct geometry." +#: ../../build/docs/basic/sql_function.rst:306 +msgid "Additionally obtain the azimuth in degrees of the corrected geometry." msgstr "" -#: ../../build/docs/basic/sql_function.rst:312 -msgid "Because ``vehicle_net`` and the other 2 views are sub graphs of ``ways``, do the ``JOIN`` with ``ways``." -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:317 -msgid "Move the query that gets the additional information into the ``WITH`` statement." -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:319 -msgid "Name it ``additional``. (line **6**)" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:321 -msgid "The ``ways`` table geometry name is ``the_geom``." -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:322 -msgid "Final ``SELECT`` statements gets:" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:324 -msgid "Calculates the azimuth of ``route_geom``. (line **27**)" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:337 -msgid "Creating the Function" +#: ../../build/docs/basic/sql_function.rst:310 +msgid "The function returns ``aximuth``. (line **8**)" msgstr "" -#: ../../build/docs/basic/sql_function.rst:339 -msgid "The following function simplifies (and sets default values) when it calls the shortest path Dijkstra function." -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:343 -msgid "pgRouting uses heavely function overloading:" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:345 -msgid "Avoid creating functions with a name of a pgRouting routing function" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:346 -msgid "Avoid the name of a function to start with `pgr_`, `_pgr` or `ST_`" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:349 -msgid "Exercise 6: Function for an application" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:353 -msgid "Putting all together in a SQL function" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:355 -msgid "function name ``wrk_dijkstra``" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:356 -msgid "Should work for any given view." -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:358 -msgid "Allow a view as a parameter" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:359 -msgid "A table can be used if the columns have the correct names." -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:361 -msgid "``source`` and ``target`` are in terms of ``osm_id``." -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:362 -msgid "The result should meet the requirements indicated at the beginning of the chapter" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:367 -msgid "The signature of the function:" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:369 -msgid "The input parameters are from line **4** to **6**." -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:370 -msgid "The output columns are from line **7** to **14** (not highlighted)." +#: ../../build/docs/basic/sql_function.rst:311 +msgid "The query from previous exercise is wrapped under additional subquery. (line **18**)" msgstr "" -#: ../../build/docs/basic/sql_function.rst:371 -msgid "The function returns a set. (line **16**)" +#: ../../build/docs/basic/sql_function.rst:313 +msgid "The ``azimuth`` is processed in degrees. (line **35**)." msgstr "" -#: ../../build/docs/basic/sql_function.rst:379 -msgid "The body of the function:" +#: ../../build/docs/basic/sql_function.rst:329 +msgid "Exercise 6: Using the function" msgstr "" -#: ../../build/docs/basic/sql_function.rst:381 -msgid "Appending the view name on line **7** in the ``SELECT`` query to ``pgr_dijkstra``." +#: ../../build/docs/basic/sql_function.rst:331 +msgid "Try the function with a combination of the interesting places:" msgstr "" -#: ../../build/docs/basic/sql_function.rst:382 -msgid "Using the data to get the route from ``source`` to ``target``. (line **8**)" +#: ../../build/docs/basic/sql_function.rst:333 +msgid "|id_1| |place_1|" msgstr "" -#: ../../build/docs/basic/sql_function.rst:383 -msgid "The ``JOIN`` with ``ways`` is necessary, as the views are subset of ``ways`` (line **25**)" +#: ../../build/docs/basic/sql_function.rst:334 +msgid "|id_2| |place_2|" msgstr "" -#: ../../build/docs/basic/sql_function.rst:400 -msgid "Exercise 7: Using the function" +#: ../../build/docs/basic/sql_function.rst:335 +msgid "|id_3| |place_3|" msgstr "" -#: ../../build/docs/basic/sql_function.rst:404 -msgid "Test the function with the three views" +#: ../../build/docs/basic/sql_function.rst:336 +msgid "|id_4| |place_4|" msgstr "" -#: ../../build/docs/basic/sql_function.rst:405 -msgid "From the |ch7_place_1| to the |ch7_place_2| using the OSM identifier" +#: ../../build/docs/basic/sql_function.rst:337 +msgid "|id_5| |place_5|" msgstr "" -#: ../../build/docs/basic/sql_function.rst:409 -msgid "Use the function on the ``SELECT`` statement" +#: ../../build/docs/basic/sql_function.rst:339 +msgid "Using different networks:" msgstr "" -#: ../../build/docs/basic/sql_function.rst:410 -msgid "The first parameter changes based on the view to be tested" +#: ../../build/docs/basic/sql_function.rst:343 +msgid "``walk_net``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:412 +#: ../../build/docs/basic/sql_function.rst:345 msgid "Names of the streets in the route" msgstr "" -#: ../../build/docs/basic/sql_function.rst:423 +#: ../../build/docs/basic/sql_function.rst:356 msgid "Total seconds spent in each street" msgstr "" -#: ../../build/docs/basic/sql_function.rst:434 -msgid "Get all the information of the route" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:445 -msgid "Try the function with a combination of the interesting places:" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:447 -msgid "|osmid_1| |place_1|" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:448 -msgid "|osmid_2| |place_2|" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:449 -msgid "|osmid_3| |place_3|" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:450 -msgid "|osmid_4| |place_4|" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:451 -msgid "|osmid_5| |place_5|" +#: ../../build/docs/basic/sql_function.rst:367 +msgid "Why it does not fully work with ``walk_net``?" msgstr ""