diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 33c5cde3d..6ca0cc777 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -9,6 +9,8 @@ jobs: strategy: fail-fast: false + matrix: + osm2pgrouting: [apt, source] steps: - uses: actions/checkout@v6 @@ -35,17 +37,28 @@ jobs: - name: Install dependencies run: | sudo apt-get update - sudo apt-get install -y build-essential cmake libpq-dev libpqxx-dev libexpat1-dev \ - libboost-program-options-dev \ + sudo apt-get install -y \ postgresql-${PGVER}-postgis-${PGIS} \ postgresql-${PGVER}-postgis-${PGIS}-scripts \ postgresql-${PGVER}-pgrouting + if [ "${{ matrix.osm2pgrouting }}" = "apt" ]; then + sudo apt-get install -y osm2pgrouting + fi + python -m pip install --upgrade pip pip install -r REQUIREMENTS.txt pip list + - name: Install build dependencies + if: matrix.osm2pgrouting == 'source' + run: | + sudo apt-get update + sudo apt-get install -y build-essential cmake libpq-dev libpqxx-dev libexpat1-dev \ + libboost-program-options-dev + - name: Build osm2pgrouting from source + if: matrix.osm2pgrouting == 'source' run: | wget -q https://github.com/pgRouting/osm2pgrouting/archive/refs/tags/v3.0.0.tar.gz tar xzf v3.0.0.tar.gz diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml index ab6e490ea..ba9725415 100644 --- a/.github/workflows/website.yml +++ b/.github/workflows/website.yml @@ -51,8 +51,7 @@ jobs: - name: Install dependencies run: | sudo apt-get update - sudo apt-get install -y build-essential cmake libpq-dev libpqxx-dev libexpat1-dev \ - libboost-program-options-dev \ + sudo apt-get install -y osm2pgrouting \ postgresql-${PGVER}-postgis-${PGIS} \ postgresql-${PGVER}-postgis-${PGIS}-scripts \ postgresql-${PGVER}-pgrouting @@ -61,16 +60,6 @@ jobs: pip install -r REQUIREMENTS.txt pip list - - name: Build osm2pgrouting from source - run: | - wget -q https://github.com/pgRouting/osm2pgrouting/archive/refs/tags/v3.0.0.tar.gz - tar xzf v3.0.0.tar.gz - python3 -c "import re; c=open('osm2pgrouting-3.0.0/CMakeLists.txt').read(); c=c.replace('if (PQXX_VERSION VERSION_GREATER_EQUAL \"7.0.0\")','if (PQXX_VERSION VERSION_GREATER_EQUAL \"8.0.0\")'); c=c.replace(' set(CMAKE_CXX_STANDARD 17)',' set(CMAKE_CXX_STANDARD 20)\nelseif (PQXX_VERSION VERSION_GREATER_EQUAL \"7.0.0\")\n set(CMAKE_CXX_STANDARD 17)',1); open('osm2pgrouting-3.0.0/CMakeLists.txt','w').write(c)" - cmake -S osm2pgrouting-3.0.0 -B osm2pgrouting-3.0.0/build \ - -DCMAKE_BUILD_TYPE=Release - sudo cmake --build osm2pgrouting-3.0.0/build --target install - sudo ldconfig - - name: Configure run: | service postgresql status diff --git a/CMakeLists.txt b/CMakeLists.txt index d6254e053..b1a2b6632 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -83,22 +83,22 @@ set(PLACE_4 "Grand Prince Hotel Hiroshima") set(PLACE_5 "RCC Bunka Center") -set(CH7_PLACE_1 ${PLACE_5}) -set(CH7_ID_1 ${OSMID_5}) +set(CH7_PLACE_1 ${PLACE_2}) +set(CH7_ID_1 ${OSMID_2}) set(CH7_PLACE_2 ${PLACE_1}) set(CH7_ID_2 ${OSMID_1}) -set(POINT1_LAT "-36.850329") -set(POINT1_LON "174.763094") +set(POINT1_LAT "34.399086") +set(POINT1_LON "132.453875") -set(POINT2_LAT "-36.853675") -set(POINT2_LON "174.764448") +set(POINT2_LAT "34.391111") +set(POINT2_LON "132.451490") #--------------------------------------------- # minimum versions #--------------------------------------------- set(SPHINX_MINIMUM_VERSION "4.0.0") -set(Osm2pgrouting_FIND_VERSION "3.0.0") +set(Osm2pgrouting_FIND_VERSION "2.3.1") #--------------------------------------------- diff --git a/cmake/FindOsm2pgrouting.cmake b/cmake/FindOsm2pgrouting.cmake index 6072766a4..4a030164c 100644 --- a/cmake/FindOsm2pgrouting.cmake +++ b/cmake/FindOsm2pgrouting.cmake @@ -41,14 +41,12 @@ execute_process( string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" Osm2pgrouting_V ${Osm2pgrouting_V}) set(Osm2pgrouting_VERSION ${Osm2pgrouting_V} CACHE STRING "Osm2pgrouting VERSION") -if (false) if (Osm2pgrouting_FIND_VERSION) # Check if version found is >= required version if ("${Osm2pgrouting_VERSION}" VERSION_LESS "${Osm2pgrouting_FIND_VERSION}") message(FATAL_ERROR "Found osm2pgrouting version ${Osm2pgrouting_VERSION} which is less than requested version ${Osm2pgrouting_FIND_VERSION}") endif() endif() -endif() if(Osm2pgrouting_FIND_COMPONENTS) foreach(comp ${Osm2pgrouting_FIND_COMPONENTS}) diff --git a/docs/basic/data.rst b/docs/basic/data.rst index 8594fe6a0..c361ed40d 100644 --- a/docs/basic/data.rst +++ b/docs/basic/data.rst @@ -34,7 +34,7 @@ Create a pgRouting compatible database Create ``city_routing`` database that will be used on the workshop. -.. literalinclude:: ../scripts/get_data/process_osgeolive_data.sh +.. literalinclude:: ../scripts/get_data/setup_city_routing.sh :start-after: create city_routing :end-before: connect city_routing :language: bash @@ -48,7 +48,7 @@ Connect to the database Install pgRouting and its requirements. (otpionally check the version that is being used) -.. literalinclude:: ../scripts/get_data/process_osgeolive_data.sh +.. literalinclude:: ../scripts/get_data/setup_city_routing.sh :start-after: << EOF :end-before: EOF :language: bash @@ -115,7 +115,7 @@ From a terminal window :code:`ctrl-alt-t`. Run the osm2pgrouting converter ------------------------------------------------------------------------------- -.. literalinclude:: ../scripts/get_data/process_osgeolive_data.sh +.. literalinclude:: ../scripts/get_data/setup_city_routing.sh :start-after: import city from-here :end-before: import city to-here :language: bash @@ -124,10 +124,32 @@ Run the osm2pgrouting converter .. collapse:: Output: - .. literalinclude:: ../scripts/get_data/process_osgeolive_data.txt + .. literalinclude:: ../scripts/get_data/setup_city_routing.txt :start-after: import city from-here :end-before: import city to-here +Compatibility with older osm2pgrouting versions +------------------------------------------------------------------------------- + +Check the installed version: + +.. code-block:: bash + + osm2pgrouting --version + +If you are using version 2.x, the column names differ from those used in this +workshop: + +- ``gid`` instead of ``id`` +- ``the_geom`` instead of ``geom`` + +Run the following script to rename them: + +.. collapse:: Script + + .. literalinclude:: ../scripts/get_data/osm2pgrouting_compat.sql + :language: postgresql + Tables on the database ------------------------------------------------------------------------------- diff --git a/docs/basic/images/sql_function/CMakeLists.txt b/docs/basic/images/sql_function/CMakeLists.txt index b03b3052c..514af76f8 100644 --- a/docs/basic/images/sql_function/CMakeLists.txt +++ b/docs/basic/images/sql_function/CMakeLists.txt @@ -3,14 +3,14 @@ # Files #--------------------- set(PGR_WORKSHOP_IMG_FILES - sql_azimuth_fixed.png - sql_route_geom.png - sql_route_names.png - sql_route_readable.png - sql_route_geom_detail.png + route_azimuth.png + route_names.png + route_readable.png + route_final.png + good_directionality.png + wrong_directionality.png ) - foreach (f ${PGR_WORKSHOP_IMG_FILES}) if (PGR_WORKSHOP_VERBOSE_DEBUG) message(STATUS " -> ${f}") diff --git a/docs/basic/images/sql_function/good_directionality.png b/docs/basic/images/sql_function/good_directionality.png new file mode 100644 index 000000000..858a61c5e Binary files /dev/null and b/docs/basic/images/sql_function/good_directionality.png differ diff --git a/docs/basic/images/sql_function/route_azimuth.png b/docs/basic/images/sql_function/route_azimuth.png new file mode 100644 index 000000000..9ee386d13 Binary files /dev/null and b/docs/basic/images/sql_function/route_azimuth.png differ diff --git a/docs/basic/images/sql_function/route_final.png b/docs/basic/images/sql_function/route_final.png new file mode 100644 index 000000000..54255900f Binary files /dev/null and b/docs/basic/images/sql_function/route_final.png differ diff --git a/docs/basic/images/sql_function/route_names.png b/docs/basic/images/sql_function/route_names.png new file mode 100644 index 000000000..571fa1ec0 Binary files /dev/null and b/docs/basic/images/sql_function/route_names.png differ diff --git a/docs/basic/images/sql_function/route_readable.png b/docs/basic/images/sql_function/route_readable.png new file mode 100644 index 000000000..2939b4ca5 Binary files /dev/null and b/docs/basic/images/sql_function/route_readable.png differ diff --git a/docs/basic/images/sql_function/sql_azimuth_fixed.png b/docs/basic/images/sql_function/sql_azimuth_fixed.png deleted file mode 100644 index 983371d40..000000000 Binary files a/docs/basic/images/sql_function/sql_azimuth_fixed.png and /dev/null differ diff --git a/docs/basic/images/sql_function/sql_route_geom.png b/docs/basic/images/sql_function/sql_route_geom.png deleted file mode 100644 index 38866b71f..000000000 Binary files a/docs/basic/images/sql_function/sql_route_geom.png and /dev/null 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 deleted file mode 100644 index f11713d49..000000000 Binary files a/docs/basic/images/sql_function/sql_route_geom_detail.png and /dev/null differ diff --git a/docs/basic/images/sql_function/sql_route_names.png b/docs/basic/images/sql_function/sql_route_names.png deleted file mode 100644 index 532164c9f..000000000 Binary files a/docs/basic/images/sql_function/sql_route_names.png and /dev/null differ diff --git a/docs/basic/images/sql_function/sql_route_readable.png b/docs/basic/images/sql_function/sql_route_readable.png deleted file mode 100644 index b064852c4..000000000 Binary files a/docs/basic/images/sql_function/sql_route_readable.png and /dev/null differ diff --git a/docs/basic/images/sql_function/wrong_direccionality.png b/docs/basic/images/sql_function/wrong_direccionality.png new file mode 100644 index 000000000..90577cd28 Binary files /dev/null and b/docs/basic/images/sql_function/wrong_direccionality.png differ diff --git a/docs/basic/images/sql_function/wrong_directionality.png b/docs/basic/images/sql_function/wrong_directionality.png new file mode 100644 index 000000000..c1fc78dc0 Binary files /dev/null and b/docs/basic/images/sql_function/wrong_directionality.png differ diff --git a/docs/basic/images/withPoints/points_on_map.png b/docs/basic/images/withPoints/points_on_map.png index 2bc819557..d58651622 100644 Binary files a/docs/basic/images/withPoints/points_on_map.png and b/docs/basic/images/withPoints/points_on_map.png differ diff --git a/docs/basic/images/withPoints/points_routing.png b/docs/basic/images/withPoints/points_routing.png index 0d0534485..85a89cb12 100644 Binary files a/docs/basic/images/withPoints/points_routing.png and b/docs/basic/images/withPoints/points_routing.png differ diff --git a/docs/basic/sql_function.rst b/docs/basic/sql_function.rst index 270c753ac..1e5c7832c 100644 --- a/docs/basic/sql_function.rst +++ b/docs/basic/sql_function.rst @@ -6,16 +6,16 @@ SQL function ############################################################################### -.. image:: images/sql_function/sql_route_names.png +.. image:: images/sql_function/route_names.png :scale: 25% :align: center .. contents:: Chapter Contents -While pgRouting functions provide a low-level interface, developing for a higher-level -application requires these requirements to be represented directly 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 +While pgRouting functions provide a low-level interface, developing for a higher-level +application requires these requirements to be represented directly 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. @@ -24,21 +24,21 @@ The function requirements The function will wrap ``pgr_dijkstra``. -The function needs to work on any of the networks designed: +The function will use: - ``vehicle_net`` -- ``taxi_net`` +- ``vehicle_penalized_net`` -The function needs to return the following routing information: +The function returns the following routing information: - ``seq`` - A unique identifier of the rows - ``id`` - The segment's identifier +- ``seconds`` - Number of seconds to traverse the segment - ``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. +- ``readable`` - The geometry in human readable form. +- ``geom`` - The routing geometry .. rubric:: Design of the function @@ -50,26 +50,28 @@ output columns: ================= ========= ================= Parameter Type Description ================= ========= ================= -``edges_subset`` REGCLASS The table/view that is going to be used for processing -``source`` BIGINT The identifier of the `departure` location. -``target`` BIGINT The identifier of the `destination` location. +``source`` BIGINT The identifier of the `departure` location. +``target`` BIGINT The identifier of the `destination` location. ================= ========= ================= -.. rubric:: output columns +.. columns_start + +.. rubric:: Output columns ================== ========= ================= Name Type Description ================== ========= ================= ``seq`` INTEGER A unique number for each result row. ``id`` BIGINT The edge identifier. -``name`` TEXT The name of the segment. ``seconds`` FLOAT The number of seconds it takes to traverse the segment. +``name`` TEXT The name of the segment. ``length`` FLOAT The length 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. +``readable`` TEXT The geometry in human readable form. +``geom`` geometry The geometry of the segment in the correct direction. ================== ========= ================= +.. columns_end Additional information handling =============================================================================== @@ -80,134 +82,115 @@ When the application needs additional information, like the name of the street, Exercise 1: Get additional information ------------------------------------------------------------------------------- -.. image:: images/sql_function/sql_route_names.png +.. image:: images/sql_function/route_names.png :width: 300pt - :alt: Route showing names + :alt: Route showing names .. rubric:: Problem -* From |ch7_place_1| to |ch7_place_2| -* Get the following information: - - * ``seq`` - * ``id`` - * ``name`` - * ``seconds`` - * ``length`` +* Create a function that gets all the required information .. rubric:: Solution -* The function returns the columns asked. (line **4**) -* Rename ``pgr_dijkstra`` results to application requirements names. (line - **12**). +* The function returns the columns asked. +* Rename ``pgr_dijkstra`` results to application requirements names. * ``LEFT JOIN`` the results with ``vehicle_net`` to get the additional - information. (line **17**) + information. - * ``LEFT`` to include the row with ``id = -1`` because it does not exist on + * ``LEFT JOIN`` 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: :force: - :emphasize-lines: 4,12,17 :start-after: get_more_info.txt :end-before: get_read_geom.txt -.. collapse:: Query results +Using the function +=============================================================================== + +Exercise 2: Route geometry (binary format) +------------------------------------------------------------------------------- + +.. image:: images/sql_function/route_readable.png + :width: 300pt + :alt: Route showing readable - .. literalinclude:: ../scripts/basic/sql_function/get_more_info.txt +.. rubric:: Problem +Get the geometries of the route from |place_1| to |place_2| -Geometry handling -=============================================================================== +.. rubric:: Solution + +* Select the column ``geom``. + +.. literalinclude:: ../scripts/basic/sql_function/sql_function.sql + :language: sql + :start-after: get_geom.txt + :end-before: get_azimuth.txt -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. +.. collapse:: Query results + + .. literalinclude:: ../scripts/basic/sql_function/get_geom.txt -Exercise 2: Route geometry (human readable) +Exercise 3: Route geometry (human readable) ------------------------------------------------------------------------------- -.. image:: images/sql_function/sql_route_readable.png +.. image:: images/sql_function/route_readable.png :width: 300pt :alt: From |ch7_place_1| to |ch7_place_2| .. rubric:: Problem -Route from the |ch7_place_1| to |ch7_place_2| - -* Additionally to the previous exercise, get the - - * geometry ``geom`` in human readable form named as ``route_readable`` +Get the geometries in readable form of the route from |place_1| to |place_2| .. rubric:: Solution -* 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 **19**). -* Test from |ch7_id_1| to |ch7_id_2| on ``vehicle_net``. (Last line) +* Select the column ``readable``. .. literalinclude:: ../scripts/basic/sql_function/sql_function.sql :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/get_read_geom.txt - - -Exercise 3: Route geometry (binary format) +Exercise 5: Get the azimuth ------------------------------------------------------------------------------- -.. image:: images/sql_function/sql_route_geom.png +.. image:: images/sql_function/route_azimuth.png :width: 300pt - :alt: From |ch7_place_1| to |ch7_place_2| + :alt: Route showing azimuth -.. rubric:: Problem - -Route from the |ch7_place_1| to |ch7_place_2| +There are many geometry functions in PostGIS, the workshop coveres some +of them like ``ST_AsText``, ``ST_Reverse``, ``ST_EndPoint``, ``ST_Azimuth``. -* Additionally to the previous exercise, get the +.. rubric:: Problem - * ``geom`` in binary format with the name ``route_geom`` +Get the azimuth of the geometries of the route from |place_1| to |place_2| .. rubric:: Solution -* 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) - +* The function returns ``azimuth``. .. literalinclude:: ../scripts/basic/sql_function/sql_function.sql :language: sql - :emphasize-lines: 7,21 - :force: - :linenos: - :start-after: get_geom.txt + :start-after: get_azimuth.txt :end-before: wrong_directionality.txt -.. collapse:: Query results +.. collapse:: results + + .. literalinclude:: ../scripts/basic/sql_function/get_azimuth.txt - .. literalinclude:: ../scripts/basic/sql_function/get_geom.txt Exercise 4: Route geometry directionality ------------------------------------------------------------------------------- -.. image:: images/sql_function/sql_route_geom_detail.png +.. image:: images/sql_function/wrong_directionality.png :width: 300pt - :alt: From |ch7_place_1| to |ch7_place_2| + :alt: wrong direccionality Visually, with the route displayed with arrows, it can be found that there are arrows that do not match the directionality of the route. @@ -215,27 +198,24 @@ arrows that do not match the directionality of the route. To have correct directionality, the ending point of a geometry must match the starting point of the next geometry -* Inspecting the detail of the results of `Exercise 2: Route geometry (human readable)`_ +* Inspecting the detail of the results of `Exercise 3: Route geometry (human readable)`_ -.. collapse:: Query: Rows where criteria is not met +.. collapse:: Rows where criteria is not met - .. literalinclude:: ../scripts/basic/sql_function/sql_function.sql - :language: sql - :start-after: wrong_directionality.txt - :end-before: fix_directionality.txt + .. literalinclude:: ../scripts/basic/sql_function/sql_function.sql + :language: sql + :start-after: wrong_directionality.txt + :end-before: fix_directionality.txt .. literalinclude:: ../scripts/basic/sql_function/wrong_directionality.txt - :language: sql .. rubric:: Problem -Route from the |ch7_place_1| to |ch7_place_2| +* Fix the directionality of the geometries and of the columns that depend on it. -* Fix the directionality of the geometries of the previous exercise - - * ``geom`` in human readable form named as ``route_readable`` - * ``geom`` in binary format with the name ``route_geom`` - * Both columns must have the geometry fixed for directionality. + * ``geom`` + * ``readable`` + * ``azimuth`` .. rubric:: Solution @@ -244,12 +224,6 @@ 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. -* A conditional ``CASE`` statement that returns the geometry in human readable - form: - - * 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. @@ -262,61 +236,32 @@ To get the correct direction some geometries need to be reversed: :start-after: fix_directionality.txt :end-before: good_directionality.txt -.. collapse:: results - - .. literalinclude:: ../scripts/basic/sql_function/fix_directionality.txt - 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: use_directionality.txt + .. literalinclude:: ../scripts/basic/sql_function/sql_function.sql + :language: sql + :start-after: good_directionality.txt + :end-before: final_function.txt .. literalinclude:: ../scripts/basic/sql_function/good_directionality.txt - -Exercise 5: Using the geometry -------------------------------------------------------------------------------- - -.. image:: images/sql_function/sql_azimuth_fixed.png +.. image:: images/sql_function/good_directionality.png :width: 300pt - :alt: From |ch7_place_1| to the |ch7_place_2| show 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``. - - -.. rubric:: Problem + :alt: good direccionality -Modify the query from the previous exercise - -* Additionally obtain the azimuth in degrees of the corrected geometry. - -.. rubric:: Solution +Writing the final function +------------------------------------------------------------------------------- -* 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) +The final function using ``vehicle_penalized_net`` .. literalinclude:: ../scripts/basic/sql_function/sql_function.sql :language: sql :force: - :linenos: - :emphasize-lines: 8,18,35 - :start-after: use_directionality.txt + :start-after: final_function.txt :end-before: using_fn1.txt -.. collapse:: results - - .. literalinclude:: ../scripts/basic/sql_function/use_directionality.txt - Exercise 6: Using the function ------------------------------------------------------------------------------- @@ -328,40 +273,17 @@ Try the function with a combination of the interesting places: * |id_4| |place_4| * |id_5| |place_5| -Using different networks: - -- ``vehicle_net`` -- ``taxi_net`` -- ``walk_net`` - Names of the streets in the route .. literalinclude:: ../scripts/basic/sql_function/sql_function.sql :language: sql :start-after: using_fn1.txt - :end-before: using_fn2.txt + :end-before: vw_initial.txt .. collapse:: Query results .. literalinclude:: ../scripts/basic/sql_function/using_fn1.txt -Total seconds spent in each street - -.. literalinclude:: ../scripts/basic/sql_function/sql_function.sql - :language: sql - :start-after: using_fn2.txt - :end-before: using_fn3.txt - -.. collapse:: Query results - - .. literalinclude:: ../scripts/basic/sql_function/using_fn2.txt - -Why it does not fully work with ``walk_net``? - -.. literalinclude:: ../scripts/basic/sql_function/sql_function.sql - :language: sql - :start-after: using_fn3.txt - -.. collapse:: Query results - - .. literalinclude:: ../scripts/basic/sql_function/using_fn3.txt +.. image:: images/sql_function/route_final.png + :width: 300pt + :alt: From |ch7_place_1| to |ch7_place_2| diff --git a/docs/basic/withPoints.rst b/docs/basic/withPoints.rst index 43a8f2335..6c04b1e5d 100644 --- a/docs/basic/withPoints.rst +++ b/docs/basic/withPoints.rst @@ -10,9 +10,10 @@ Routing using points :align: center -For more advanced requirements, you can utilize `PL/pgSQL `_. As application logic grows more complex, using PL/pgSQL -to dynamically construct SQL queries and execute them using internal variables becomes necessary. - +For more advanced requirements, you can utilize +`PL/pgSQL `_. +As application logic grows more complex, using PL/pgSQL to dynamically construct +SQL queries and execute them using internal variables becomes necessary. pgRouting functions in this chapter @@ -30,13 +31,11 @@ Requirements for routing lat,lon points geometries and works for * ``vehicle_net`` - * ``taxi_net`` - * ``walk_net`` * The function takes as input parameters: - The edges table name - - Latitude/longitude of two point + - Latitude/longitude of two points * Returns @@ -51,7 +50,6 @@ The detailed description: ================ ========== ================================================ Parameter type Description ================ ========== ================================================ -``edges_subset`` REGCLASS Edge table name identifier. ``lat1`` NUMERIC The latitude of the `departure` point. ``lon1`` NUMERIC The longitude of the `departure` point. ``lat2`` NUMERIC The latitude of the `destination` point. @@ -61,21 +59,9 @@ Parameter type Description ================ ========== ================================================ -.. rubric:: Output columns - -================== ========= ================= -Name Type Description -================== ========= ================= -``seq`` INTEGER A unique number for each result row. -``id`` BIGINT The edge identifier. -``name`` TEXT The name of the segment. -``seconds`` FLOAT The number of seconds it takes to traverse the segment. -``length`` FLOAT The length 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. -================== ========= ================= - +.. include:: sql_function.rst + :start-after: columns_start + :end-before: columns_end For this chapter, the following points will be used for testing. @@ -115,8 +101,7 @@ Get the nearest edge on the graph of the following points. .. rubric:: Solution -* Build the geometry of the points with the appropiate SRID. (lines **4** and - **10**) +* Build the geometry of the points with the appropiate SRID. * Get the union of the individual queries .. literalinclude:: ../scripts/basic/withPoints/withPoints.sql @@ -216,15 +201,15 @@ The function's signature: :start-after: wrk_withPoints.txt :end-before: signature ends -Getting the closest query: +The points SQL: * The query looks like the one on `Exercise 1: Get the nearest edge`_ * Using PostgreSQL ``format`` to make substitutions. * The first parameter is the string to be replaced * The rest are the data parameters, are the strings use for replacement. - * ``lat1``, ``lon1`` values will replace ``%2$s, %3$s`` respectively. - * ``lat2``, ``lon2`` values will replace ``%4$s, %5$s`` respectively. + * ``lat1``, ``lon1`` values will replace ``%2$s, %1$s`` respectively. + * ``lat2``, ``lon2`` values will replace ``%4$s, %3$s`` respectively. .. literalinclude:: ../scripts/basic/withPoints/withPoints.sql :language: sql @@ -233,13 +218,12 @@ Getting the closest query: :start-after: -- 0 :end-before: -- 1 -Getting the routing results: +The routing results: * The query looks like the one on `Exercise 2: Point routing` * Using PostgreSQL ``format`` to make substitutions. - * The ``edges_subset`` value will replace ``%1$I``. - * The ``closest_query`` value will replace ``%2$s``. + * The ``points_sql`` value will replace ``%1$s``. .. literalinclude:: ../scripts/basic/withPoints/withPoints.sql :language: sql @@ -248,24 +232,6 @@ Getting the routing results: :start-after: -- 1 :end-before: -- 2 -Getting the additional information: - -* The subquery looks like the one in the function created on - :doc:`sql_function`. -* A joined table can not be a variable - - * Using PostgreSQL ``format`` to make substitutions. - * To make it work on the ``walk_net``, the whole query needs to be in - ``TEXT``. - * The ``edges_subset`` value will replace ``%1$I``: - -.. literalinclude:: ../scripts/basic/withPoints/withPoints.sql - :language: sql - :force: - :linenos: - :start-after: -- 2 - :end-before: -- 3 - Building the complete query: * The complete query looks like the one in the function created on @@ -276,8 +242,8 @@ Building the complete query: :language: sql :force: :linenos: - :start-after: -- 3 - :end-before: -- 4 + :start-after: -- 2 + :end-before: -- 3 Exercise 4: Using wrk_withPoints ............................................................................... @@ -292,25 +258,15 @@ Use ``wrk_withPoints`` * Departure point is: (lat,lon) = ``(@POINT1_LAT@, @POINT1_LON@)`` * Destination point is: (lat,lon) = ``(@POINT2_LAT@, @POINT2_LON@)`` -* For ``vehicle_net``: - * Get the names of the streets of the route. +* Get the query that is been generated. +* Get the names of the streets of the route. +* Create a view to be used on QGIS. -* For ``taxi_net``: - - * Get the query that is been generated. - -* For ``walk_net``: - - * Use with default value of ``do_debug``. - * Store results on a table. - * Show the table contents. + * Test the view by listing the names of each segment of the route. .. rubric:: Solution -For ``vehicle_net``: - -* The first parameter is the table name. * The next two parameters are the latitude and longitude of the departure point. * The next two parameters are the latitude and longitude of the destination point. * Use with default value of ``do_debug``. @@ -324,8 +280,6 @@ For ``vehicle_net``: .. literalinclude:: ../scripts/basic/withPoints/use_fn_1.txt -For ``taxi_net``: - * Do a dry run by adding ``true`` to get the query that is executed. .. literalinclude:: ../scripts/basic/withPoints/withPoints.sql @@ -337,7 +291,7 @@ For ``taxi_net``: .. literalinclude:: ../scripts/basic/withPoints/warnings.txt -For ``walk_net``: +* Create the view and test it. .. literalinclude:: ../scripts/basic/withPoints/withPoints.sql :language: sql diff --git a/docs/index.rst b/docs/index.rst index cbe81448a..37a70aac3 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -38,11 +38,11 @@ United Nations Sustainable Development Goals :numbered: :maxdepth: 2 - un_sdg/data un_sdg/introduction un_sdg/sdg3-health un_sdg/sdg7-energy un_sdg/sdg11-cities + un_sdg/data Interaction with other software =============================================================================== diff --git a/docs/interactions/code/QGISfunctions.sql b/docs/interactions/code/QGISfunctions.sql index b546da501..42df36c21 100644 --- a/docs/interactions/code/QGISfunctions.sql +++ b/docs/interactions/code/QGISfunctions.sql @@ -187,7 +187,7 @@ SELECT tag_id, tag_key, tag_value FROM configuration ORDER BY tag_id; DROP VIEW IF EXISTS info_2 ; CREATE VIEW info_2 AS -SELECT distinct tag_id, tag_key, tag_value +SELECT DISTINCT tag_id, tag_key, tag_value FROM ways JOIN configuration USING (tag_id) ORDER BY tag_id; diff --git a/docs/interactions/code/create-test.sh b/docs/interactions/code/create-test.sh index d3c76c884..15e24759a 100755 --- a/docs/interactions/code/create-test.sh +++ b/docs/interactions/code/create-test.sh @@ -1,3 +1,4 @@ +#!/bin/bash cat \ ../solutions/shortest_problems.sql \ diff --git a/docs/interactions/code/functions.sql b/docs/interactions/code/functions.sql index a3f0cb774..9a7194a2f 100644 --- a/docs/interactions/code/functions.sql +++ b/docs/interactions/code/functions.sql @@ -187,7 +187,7 @@ SELECT tag_id, tag_key, tag_value FROM configuration ORDER BY tag_id; -SELECT distinct tag_id, tag_key, tag_value +SELECT DISTINCT tag_id, tag_key, tag_value FROM ways JOIN configuration USING (tag_id) ORDER BY tag_id; diff --git a/docs/scripts/basic/CMakeLists.txt b/docs/scripts/basic/CMakeLists.txt index dc43b9577..766e70879 100644 --- a/docs/scripts/basic/CMakeLists.txt +++ b/docs/scripts/basic/CMakeLists.txt @@ -20,9 +20,10 @@ foreach (d ${PGR_WORKSHOP_DIR}) add_dependencies(basic_scripts basic_${d}_scripts) endforeach() -add_dependencies(basic_graphs_scripts basic_data_scripts) +# data +# graphs → vehicles → sql_function → withPoints +# ↘ pedestrian add_dependencies(basic_pedestrian_scripts basic_graphs_scripts) add_dependencies(basic_vehicles_scripts basic_graphs_scripts) -add_dependencies(basic_sql_function_scripts basic_graphs_scripts) add_dependencies(basic_sql_function_scripts basic_vehicles_scripts) add_dependencies(basic_withPoints_scripts basic_sql_function_scripts) diff --git a/docs/scripts/basic/data/CMakeLists.txt b/docs/scripts/basic/data/CMakeLists.txt index 1bb2c6e18..1b044789c 100644 --- a/docs/scripts/basic/data/CMakeLists.txt +++ b/docs/scripts/basic/data/CMakeLists.txt @@ -1,4 +1,5 @@ -# Script for basic/data chapter +add_custom_target(basic_data_scripts DEPENDS data.txt) + configure_file(data.sh data.sh) add_custom_command( @@ -6,6 +7,3 @@ add_custom_command( COMMAND bash data.sh > data.txt ) -add_custom_target(basic_data_scripts - DEPENDS "data.txt" -) diff --git a/docs/scripts/basic/data/data.sh b/docs/scripts/basic/data/data.sh old mode 100644 new mode 100755 index ad12b5bcb..92b32bbed --- a/docs/scripts/basic/data/data.sh +++ b/docs/scripts/basic/data/data.sh @@ -1,3 +1,4 @@ +#!/bin/bash set -e # city tables from-here diff --git a/docs/scripts/basic/graphs/CMakeLists.txt b/docs/scripts/basic/graphs/CMakeLists.txt index 6a88ecb49..e9f599afb 100644 --- a/docs/scripts/basic/graphs/CMakeLists.txt +++ b/docs/scripts/basic/graphs/CMakeLists.txt @@ -1,14 +1,7 @@ -#--------------------- -# Files -#--------------------- -add_custom_target(basic_graphs_scripts) +add_custom_target(basic_graphs_scripts DEPENDS graphs.sql) configure_file(graphs.sql graphs.sql) -#---------------------------------------------- -# Generating the results files -#--------------------------------------------- - add_custom_command( TARGET basic_graphs_scripts PRE_BUILD @@ -47,5 +40,4 @@ add_custom_command( graphs_end.txt COMMAND psql -d city_routing -f graphs.sql - COMMENT "running chapter graphs scripts" - DEPENDS graphs.sql) + COMMENT "running chapter graphs scripts") diff --git a/docs/scripts/basic/graphs/graphs.sql b/docs/scripts/basic/graphs/graphs.sql index 6e8e70416..51f9db3f1 100644 --- a/docs/scripts/basic/graphs/graphs.sql +++ b/docs/scripts/basic/graphs/graphs.sql @@ -13,7 +13,7 @@ ORDER BY tag_id; \o configuration_used.txt -SELECT distinct tag_id, tag_key, tag_value +SELECT DISTINCT tag_id, tag_key, tag_value FROM ways JOIN configuration USING (tag_id) ORDER BY tag_id; @@ -31,11 +31,15 @@ SELECT * FROM vertices Limit 10; \o fill_columns_1.txt SELECT count(*) FROM vertices WHERE geom IS NULL; \o fill_columns_2.txt -with get_data as (select source, source_osm, ST_startPoint(geom) as pt from ways -union all -select target, target_osm, ST_endPoint(geom) from ways -) update vertices set -(geom, osm_id, x, y) = (ST_startPoint(pt), source_osm, st_x(pt), st_y(pt)) FROM get_data WHERE source = id; +WITH +get_data AS ( + SELECT source, source_osm, ST_startPoint(geom) AS pt FROM ways + UNION ALL + SELECT target, target_osm, ST_endPoint(geom) FROM ways +) +UPDATE vertices SET +(geom, osm_id, x, y) = (ST_startPoint(pt), source_osm, st_x(pt), st_y(pt)) +FROM get_data WHERE source = id; \o fill_columns_3.txt SELECT count(*) FROM vertices WHERE geom IS NULL; @@ -63,7 +67,7 @@ ORDER BY count DESC LIMIT 10; \o see_components4.txt WITH all_components AS (SELECT component, count(*) FROM ways GROUP BY component), -max_component AS (SELECT max(count) from all_components) +max_component AS (SELECT max(count) FROM all_components) SELECT component FROM all_components WHERE count = (SELECT max FROM max_component); \o create_vehicle_net1.txt @@ -73,7 +77,7 @@ CREATE OR REPLACE VIEW vehicle_net AS WITH all_components AS (SELECT component, count(*) FROM ways GROUP BY component), -max_component AS (SELECT max(count) from all_components), +max_component AS (SELECT max(count) FROM all_components), the_component AS ( SELECT component FROM all_components WHERE count = (SELECT max FROM max_component)) @@ -115,7 +119,7 @@ CREATE MATERIALIZED VIEW walk_net AS WITH all_components AS (SELECT component, count(*) FROM ways GROUP BY component), -max_component AS (SELECT max(count) from all_components), +max_component AS (SELECT max(count) FROM all_components), the_component AS ( SELECT component FROM all_components WHERE count = (SELECT max FROM max_component)) @@ -174,7 +178,7 @@ FROM pgr_dijkstraCostMatrix( \o visualize1.txt CREATE OR REPLACE VIEW vehicle_costmatrix AS SELECT -row_number() over() as id, +row_number() over() AS id, ST_makeline(v1.geom, v2.geom) AS geom, '('||start_vid||', '||end_vid||') t= ' || round(agg_cost::NUMERIC, 2) AS name FROM pgr_dijkstraCostMatrix( diff --git a/docs/scripts/basic/pedestrian/CMakeLists.txt b/docs/scripts/basic/pedestrian/CMakeLists.txt index 39dd5670f..de758e7f8 100644 --- a/docs/scripts/basic/pedestrian/CMakeLists.txt +++ b/docs/scripts/basic/pedestrian/CMakeLists.txt @@ -1,14 +1,7 @@ -#--------------------- -# Files -#--------------------- -add_custom_target(basic_pedestrian_scripts) +add_custom_target(basic_pedestrian_scripts DEPENDS pedestrian.sql) configure_file(pedestrian.sql pedestrian.sql) -#---------------------------------------------- -# Generating the results files -#--------------------------------------------- - add_custom_command( TARGET basic_pedestrian_scripts PRE_BUILD @@ -25,5 +18,4 @@ add_custom_command( stars.txt COMMAND psql -d city_routing -f pedestrian.sql - COMMENT "running chapter pedestrian scripts" - DEPENDS pedestrian.sql) + COMMENT "running chapter pedestrian scripts") diff --git a/docs/scripts/basic/sql_function/CMakeLists.txt b/docs/scripts/basic/sql_function/CMakeLists.txt index 7b338e8fc..af5559b43 100644 --- a/docs/scripts/basic/sql_function/CMakeLists.txt +++ b/docs/scripts/basic/sql_function/CMakeLists.txt @@ -1,28 +1,24 @@ -add_custom_target(basic_sql_function_scripts) +add_custom_target(basic_sql_function_scripts DEPENDS sql_function.sql) -#--------------------- -# Files -#--------------------- configure_file(sql_function.sql sql_function.sql) -configure_file(images.sql images.sql) add_custom_command( TARGET basic_sql_function_scripts PRE_BUILD BYPRODUCTS - get_more_info.txt get_read_geom.txt get_geom.txt + get_azimuth.txt wrong_directionality.txt fix_directionality.txt good_directionality.txt - use_directionality.txt + final_function.txt using_fn1.txt - using_fn2.txt - using_fn3.txt + vw_initial.txt + vw_fixed.txt + vw_final.txt + helpers.txt COMMAND psql -d city_routing -f sql_function.sql - COMMAND psql -d city_routing -f images.sql - COMMENT "running sql function scripts" -) + COMMENT "running sql function scripts") diff --git a/docs/scripts/basic/sql_function/images.sql b/docs/scripts/basic/sql_function/images.sql deleted file mode 100644 index 7e8a4ada2..000000000 --- a/docs/scripts/basic/sql_function/images.sql +++ /dev/null @@ -1,9 +0,0 @@ - -CREATE OR REPLACE VIEW using_vehicle AS -SELECT * -FROM wrk_dijkstra('vehicle_net', @CH7_ID_1@, @CH7_ID_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 5831941e6..bc1e6864f 100644 --- a/docs/scripts/basic/sql_function/sql_function.sql +++ b/docs/scripts/basic/sql_function/sql_function.sql @@ -7,34 +7,11 @@ DROP FUNCTION IF EXISTS wrk_dijkstra(regclass, bigint, bigint); -- 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 -FROM ( - SELECT seq, edge AS id, node, cost AS seconds - FROM pgr_dijkstra( - '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 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 + IN source BIGINT, IN target BIGINT, + OUT seq INTEGER, OUT id BIGINT, + OUT seconds FLOAT, OUT name TEXT, OUT length FLOAT, + OUT azimuth FLOAT, OUT readable TEXT, + OUT geom GEOMETRY ) RETURNS SETOF record AS $BODY$ @@ -42,76 +19,49 @@ WITH results AS ( SELECT seq, edge AS id, node, cost AS seconds FROM pgr_dijkstra( - 'SELECT * FROM ' || $1, + -- on purpose to have wrong direccionality + 'SELECT * FROM vehicle_net', source, target) ) SELECT seq, id, seconds, name, length, - ST_AsText(geom) + degrees(ST_azimuth(ST_StartPoint(geom), ST_EndPoint(geom))), + ST_AsText(geom), + geom 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 get_read_geom.txt + +SELECT seq, readable FROM wrk_dijkstra(@CH7_ID_1@, @CH7_ID_2@); \o get_geom.txt -DROP FUNCTION wrk_dijkstra(regclass, bigint, bigint); +SELECT seq, geom FROM wrk_dijkstra(@CH7_ID_1@, @CH7_ID_2@); -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 ' || $1, - source, target) -) -SELECT - seq, id, seconds, name, length, - ST_AsText(geom), - geom -FROM results -LEFT JOIN vehicle_net USING (id) -ORDER BY seq; -$BODY$ -LANGUAGE SQL; +\o get_azimuth.txt -SELECT seq, route_geom FROM wrk_dijkstra('vehicle_net', @CH7_ID_1@, @CH7_ID_2@); +SELECT seq, azimuth FROM wrk_dijkstra(@CH7_ID_1@, @CH7_ID_2@); \o wrong_directionality.txt -WITH -results AS ( - 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(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; +SELECT seq, azimuth, readable FROM wrk_dijkstra(@CH7_ID_1@, @CH7_ID_2@) +ORDER BY seq LIMIT 3; \o fix_directionality.txt -DROP FUNCTION wrk_dijkstra(regclass, bigint, bigint); +DROP FUNCTION IF EXISTS wrk_dijkstra_fixed(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 +CREATE OR REPLACE FUNCTION wrk_dijkstra_fixed( + IN source BIGINT, IN target BIGINT, + OUT seq INTEGER, OUT id BIGINT, + OUT seconds FLOAT, OUT name TEXT, OUT length FLOAT, + OUT azimuth FLOAT, OUT readable TEXT, + OUT geom GEOMETRY ) RETURNS SETOF record AS $BODY$ @@ -119,53 +69,45 @@ WITH results AS ( SELECT seq, edge AS id, node, cost AS seconds FROM pgr_dijkstra( - 'SELECT * FROM ' || $1, + -- on purpose to have wrong direccionality + 'SELECT * FROM vehicle_net', source, target) -) -SELECT +), +additional AS ( + SELECT seq, id, seconds, name, length, CASE - WHEN node = source THEN ST_AsText(geom) - ELSE ST_AsText(ST_Reverse(geom)) - END, + WHEN node = source THEN geom + ELSE ST_Reverse(geom) + END AS geom + FROM results + LEFT JOIN vehicle_net USING (id) + ORDER BY seq) + +SELECT seq, id, seconds, name, length, + degrees(ST_azimuth(ST_StartPoint(geom), ST_EndPoint(geom))) AS azimuth, + ST_AsText(geom), geom +FROM additional ORDER BY seq; - CASE - WHEN node = source THEN geom - ELSE ST_Reverse(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, id, seconds, route_geom - FROM wrk_dijkstra('vehicle_net', @CH7_ID_1@, @CH7_ID_2@) -), -compare AS ( - 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; +SELECT seq, azimuth, readable FROM wrk_dijkstra_fixed(@CH7_ID_1@, @CH7_ID_2@) +ORDER BY seq LIMIT 3; -\o use_directionality.txt +\o final_function.txt -DROP FUNCTION wrk_dijkstra(regclass, bigint, bigint); +DROP FUNCTION IF EXISTS wrk_dijkstra_final(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 +CREATE OR REPLACE FUNCTION wrk_dijkstra_final( + IN source BIGINT, IN target BIGINT, + OUT seq INTEGER, OUT id BIGINT, + OUT seconds FLOAT, OUT name TEXT, OUT length FLOAT, + OUT azimuth FLOAT, OUT readable TEXT, + OUT geom GEOMETRY ) RETURNS SETOF record AS $BODY$ @@ -173,16 +115,12 @@ WITH results AS ( SELECT seq, edge AS id, node, cost AS seconds FROM pgr_dijkstra( - 'SELECT * FROM ' || $1, - source, target)), + 'SELECT * FROM vehicle_penalized_net', + source, target) +), additional AS ( SELECT 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) @@ -191,23 +129,33 @@ additional AS ( LEFT JOIN vehicle_net USING (id) ORDER BY seq) -SELECT *, - degrees(ST_azimuth(ST_StartPoint(geom), ST_EndPoint(geom))) AS azimuth +SELECT seq, id, seconds, name, length, + degrees(ST_azimuth(ST_StartPoint(geom), ST_EndPoint(geom))) AS azimuth, + ST_AsText(geom), geom FROM additional ORDER BY seq; + $BODY$ LANGUAGE SQL; -SELECT seq, azimuth FROM wrk_dijkstra('vehicle_net', @CH7_ID_1@, @CH7_ID_2@); - \o using_fn1.txt -SELECT DISTINCT name -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_ID_1@, @CH7_ID_2@) -GROUP BY name; +SELECT seq, name FROM wrk_dijkstra_final(@CH7_ID_1@, @CH7_ID_2@); + +\o vw_initial.txt + +CREATE OR REPLACE VIEW vw_initial AS +SELECT *, geom::text AS tgeom FROM wrk_dijkstra(@CH7_ID_1@, @CH7_ID_2@); + +\o vw_fixed.txt + +CREATE OR REPLACE VIEW vw_fixed AS +SELECT * FROM wrk_dijkstra_fixed(@CH7_ID_1@, @CH7_ID_2@); + +\o vw_final.txt + +CREATE OR REPLACE VIEW vw_final AS +SELECT * FROM wrk_dijkstra_final(@CH7_ID_1@, @CH7_ID_2@); -\o using_fn3.txt -SELECT * -FROM wrk_dijkstra('walk_net', @CH7_ID_1@, @CH7_ID_2@); +\o helpers.txt +SELECT seq, a.azimuth = b.azimuth FROM wrk_dijkstra_fixed(@ID_1@, @ID_2@) a JOIN wrk_dijkstra(@ID_1@, @ID_2@) b USING (seq, id, seconds, name, length) WHERE a.azimuth != b.azimuth; +SELECT seq, a.azimuth = b.azimuth FROM wrk_dijkstra_fixed(@ID_1@, @ID_3@) a JOIN wrk_dijkstra(@ID_1@, @ID_3@) b USING (seq, id, seconds, name, length) WHERE a.azimuth != b.azimuth; diff --git a/docs/scripts/basic/vehicles/CMakeLists.txt b/docs/scripts/basic/vehicles/CMakeLists.txt index ec57e3777..cafe30f4a 100644 --- a/docs/scripts/basic/vehicles/CMakeLists.txt +++ b/docs/scripts/basic/vehicles/CMakeLists.txt @@ -1,14 +1,7 @@ -add_custom_target(basic_vehicles_scripts) +add_custom_target(basic_vehicles_scripts DEPENDS vehicles.sql) -#--------------------- -# Files -#--------------------- configure_file(vehicles.sql vehicles.sql) -#---------------------------------------------- -# Generating the results files -#--------------------------------------------- - add_custom_command( TARGET basic_vehicles_scripts PRE_BUILD @@ -19,14 +12,14 @@ add_custom_command( route_coming.txt time_is_money.txt add_penalty.txt + create_penalized_view.txt use_penalty.txt + same_result_as_comming.txt update_penalty.txt + show_penalties.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 - COMMENT "running vehicles scripts" - DEPENDS vehicles.sql) + COMMENT "running vehicles scripts") diff --git a/docs/scripts/basic/vehicles/images.sql b/docs/scripts/basic/vehicles/images.sql deleted file mode 100644 index 8a6995345..000000000 --- a/docs/scripts/basic/vehicles/images.sql +++ /dev/null @@ -1,90 +0,0 @@ - - - -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 cycleways -UPDATE configuration SET penalty=-1.0 -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'); - --- Penalizing with 3 times the costs of residential roads -UPDATE configuration SET penalty=5 WHERE tag_value IN ('residential'); - --- 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 ( - 'primary','primary_link', - 'trunk','trunk_link', - 'motorway','motorway_junction','motorway_link', - 'secondary'); - -CREATE OR REPLACE VIEW vehicle_get_penalized_route_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, geom AS geom FROM dijkstra JOIN vehicle_net ON(edge = id); - -CREATE OR REPLACE VIEW vehicle_penalty_routes AS -WITH dijkstra AS ( -SELECT * FROM pgr_dijkstra( - ' SELECT id, source, target, cost_s * penalty AS cost, reverse_cost_s * penalty AS reverse_cost - FROM ways JOIN configuration - USING (tag_id) ', -ARRAY[@ID_1@,@ID_2@,@ID_3@,@ID_4@, @ID_3@], -ARRAY[@ID_1@,@ID_2@,@ID_3@,@ID_4@, @ID_3@]) -) -SELECT seq, - CASE WHEN start_vid = @ID_1@ THEN '@PLACE_1@' WHEN start_vid = @ID_2@ THEN '@PLACE_2@' - WHEN start_vid = @ID_3@ THEN '@PLACE_3@' WHEN start_vid = @ID_4@ THEN '@PLACE_4@' - WHEN start_vid = @ID_3@ THEN '@PLACE_5@' END - ||','|| - CASE WHEN end_vid = @ID_1@ THEN '@PLACE_1@' WHEN end_vid = @ID_2@ THEN '@PLACE_2@' - WHEN end_vid = @ID_3@ THEN '@PLACE_3@' WHEN end_vid = @ID_4@ THEN '@PLACE_4@' - WHEN end_vid = @ID_3@ THEN '@PLACE_5@' END - AS name, - start_vid, end_vid, geom AS geom -FROM dijkstra JOIN ways ON(edge = id); - -CREATE OR REPLACE VIEW vehicle_no_penalty_routes AS -WITH dijkstra AS ( -SELECT * FROM pgr_dijkstra( - ' SELECT id, source, target, cost_s AS cost, reverse_cost_s AS reverse_cost FROM ways ', -ARRAY[@ID_1@,@ID_2@,@ID_3@,@ID_4@, @ID_3@], -ARRAY[@ID_1@,@ID_2@,@ID_3@,@ID_4@, @ID_3@]) -) -SELECT seq, - CASE WHEN start_vid = @ID_1@ THEN '@PLACE_1@' WHEN start_vid = @ID_2@ THEN '@PLACE_2@' - WHEN start_vid = @ID_3@ THEN '@PLACE_3@' WHEN start_vid = @ID_4@ THEN '@PLACE_4@' - WHEN start_vid = @ID_3@ THEN '@PLACE_5@' END - ||','|| - CASE WHEN end_vid = @ID_1@ THEN '@PLACE_1@' WHEN end_vid = @ID_2@ THEN '@PLACE_2@' - WHEN end_vid = @ID_3@ THEN '@PLACE_3@' WHEN end_vid = @ID_4@ THEN '@PLACE_4@' - WHEN end_vid = @ID_3@ THEN '@PLACE_5@' END - AS name, - start_vid, end_vid, geom AS geom -FROM dijkstra JOIN ways ON(edge = id); - -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/withPoints/CMakeLists.txt b/docs/scripts/basic/withPoints/CMakeLists.txt index 3049bb54b..8dbca0b4a 100644 --- a/docs/scripts/basic/withPoints/CMakeLists.txt +++ b/docs/scripts/basic/withPoints/CMakeLists.txt @@ -1,10 +1,11 @@ -#--------------------- -# Files -#--------------------- +add_custom_target(basic_withPoints_scripts DEPENDS withPoints.sql) + configure_file(withPoints.sql withPoints.sql) -configure_file(images.sql images.sql) -set(GENERATED_FILES +add_custom_command( + TARGET basic_withPoints_scripts + PRE_BUILD + BYPRODUCTS closestedges.txt route_withPoints.txt wrk_withPoints.txt @@ -13,17 +14,6 @@ set(GENERATED_FILES use_fn_3.txt file_end.txt warnings.txt -) -add_custom_command( COMMAND psql -d city_routing -f withPoints.sql 2> warnings.txt - COMMAND psql -d city_routing -f images.sql - OUTPUT ${GENERATED_FILES} - - DEPENDS withPoints.sql images.sql - COMMENT "running chapter withPoints scripts" -) - -add_custom_target(basic_withPoints_scripts - DEPENDS ${GENERATED_FILES} -) + COMMENT "running chapter withPoints scripts") diff --git a/docs/scripts/basic/withPoints/images.sql b/docs/scripts/basic/withPoints/images.sql deleted file mode 100644 index 31cfe6202..000000000 --- a/docs/scripts/basic/withPoints/images.sql +++ /dev/null @@ -1,42 +0,0 @@ -DROP TABLE IF EXISTS points_on_map; -WITH the_points AS ( -SELECT 1 AS id, ST_SetSRID(ST_Point(@POINT1_LON@, @POINT1_LAT@), 4326) -UNION -SELECT 2 AS id, ST_SetSRID(ST_Point(@POINT2_LON@, @POINT2_LAT@), 4326) -) -SELECT * INTO points_on_map -FROM the_points; - - -DROP TABLE IF EXISTS closest_walk; -WITH the_closest AS ( -SELECT 1 AS pid, * from pgr_findCloseEdges( - 'SELECT id, geom from walk_net', - ST_SetSRID(ST_Point(@POINT1_LON@, @POINT1_LAT@), 4326) , 0.5) - -UNION - -SELECT 2 AS pid, * from pgr_findCloseEdges( - 'SELECT id, geom from walk_net', - ST_SetSRID(ST_Point(@POINT2_LON@, @POINT2_LAT@), 4326) , 0.5) -) -SELECT * INTO closest_walk FROM the_closest; - -CREATE OR REPLACE VIEW using_vehicle AS -SELECT * FROM wrk_withPoints( - 'vehicle_net', - @POINT1_LAT@, @POINT1_LON@, - @POINT2_LAT@, @POINT2_LON@); - -CREATE OR REPLACE VIEW using_taxi AS -SELECT * FROM wrk_withPoints( - 'taxi_net', - @POINT1_LAT@, @POINT1_LON@, - @POINT2_LAT@, @POINT2_LON@); - -CREATE OR REPLACE VIEW using_walk AS -SELECT * -FROM wrk_withPoints( - 'walk_net', - @POINT1_LAT@, @POINT1_LON@, - @POINT2_LAT@, @POINT2_LON@); diff --git a/docs/scripts/basic/withPoints/withPoints.sql b/docs/scripts/basic/withPoints/withPoints.sql index 1a74dfb53..77aea8352 100644 --- a/docs/scripts/basic/withPoints/withPoints.sql +++ b/docs/scripts/basic/withPoints/withPoints.sql @@ -1,27 +1,27 @@ \o closestedges.txt -SELECT 1 AS pid, * from pgr_findCloseEdges( - 'SELECT id, geom from vehicle_net', +CREATE OR REPLACE VIEW points_on_map AS +SELECT 1 AS pid, * FROM pgr_findCloseEdges( + 'SELECT id, geom FROM vehicle_net', ST_SetSRID(ST_Point(@POINT1_LON@, @POINT1_LAT@), 4326) , 0.5) UNION -SELECT 2 AS pid, * from pgr_findCloseEdges( - 'SELECT id, geom from vehicle_net', +SELECT 2 AS pid, * FROM pgr_findCloseEdges( + 'SELECT id, geom FROM vehicle_net', ST_SetSRID(ST_Point(@POINT2_LON@, @POINT2_LAT@), 4326) , 0.5); +SELECT * FROM points_on_map; \o route_withPoints.txt SELECT * FROM pgr_withPoints( - 'SELECT id, source, target, cost, reverse_cost from vehicle_net', + 'SELECT id, source, target, cost, reverse_cost FROM vehicle_net', $$ - SELECT 2 AS pid, * from pgr_findCloseEdges( - 'SELECT id, geom from vehicle_net', - ST_SetSRID(ST_Point(@POINT1_LON@, @POINT1_LAT@), 4326), 0.5) - UNION - SELECT 1 AS pid, * from pgr_findCloseEdges( - 'SELECT id, geom from vehicle_net', + SELECT 2 AS pid, * FROM pgr_findCloseEdges( + 'SELECT id, geom FROM vehicle_net', + SELECT 1 AS pid, * FROM pgr_findCloseEdges( + 'SELECT id, geom FROM vehicle_net', ST_SetSRID(ST_Point(@POINT2_LON@, @POINT2_LAT@), 4326), 0.5) $$, -1, -2); @@ -29,80 +29,76 @@ SELECT * FROM pgr_withPoints( \o wrk_withPoints.txt -- DROP FUNCTION wrk_withPoints(regclass, bigint, bigint); + CREATE OR REPLACE FUNCTION wrk_withPoints( - IN edges_subset REGCLASS, IN lat1 NUMERIC, IN lon1 NUMERIC, IN lat2 NUMERIC, IN lon2 NUMERIC, IN do_debug BOOLEAN DEFAULT false, - 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 + OUT seq INTEGER, OUT id BIGINT, + OUT seconds FLOAT, OUT name TEXT, OUT length FLOAT, + OUT azimuth FLOAT, OUT readable TEXT, + OUT geom GEOMETRY ) -- signature ends RETURNS SETOF record AS $BODY$ DECLARE - closest_query TEXT; + points_sql TEXT; resuts_query TEXT; - additional_query TEXT; final_query TEXT; BEGIN + -- 0 - closest_query := format( - $cq$SELECT 1 AS pid, * from pgr_findCloseEdges( - $q1$ SELECT id, geom from %1$I $q1$, - ST_SetSRID(ST_Point(%2$s, %3$s), 4326) , 0.5) + points_sql := format( + $cq$ + SELECT 1 AS pid, * FROM pgr_findCloseEdges( + $q1$ SELECT id, geom FROM vehicle_net $q1$, + ST_SetSRID(ST_Point(%1$s, %2$s), 4326) , 0.5) UNION - SELECT 2 AS pid, * from pgr_findCloseEdges( - $q1$ SELECT id, geom from %1$I $q1$, - ST_SetSRID(ST_Point(%4$s, %5$s), 4326) , 0.5) - $cq$, edges_subset, lon1, lat1, lon2, lat2); + SELECT 2 AS pid, * FROM pgr_findCloseEdges( + $q1$ SELECT id, geom FROM vehicle_net $q1$, + ST_SetSRID(ST_Point(%3$s, %4$s), 4326) , 0.5) + $cq$, lon1, lat1, lon2, lat2); -- 1 resuts_query := format( $$SELECT seq, edge AS id, node, cost AS seconds FROM pgr_withPoints( - 'SELECT * FROM %1$I', - '%2$s', + 'SELECT * FROM vehicle_penalized_net', + '%1$s', -1, -2) - $$, edges_subset, closest_query); + $$, points_sql); -- 2 - additional_query := format( - $$SELECT - 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 %1$I USING (id) - ORDER BY seq - $$, edges_subset); + final_query := ' + WITH + results AS (' || resuts_query || ' ), + + additional AS ( + SELECT + seq, id, seconds, name, length, + CASE + WHEN node = source THEN geom + ELSE ST_Reverse(geom) + END AS geom + FROM results + LEFT JOIN vehicle_net USING (id) + ORDER BY seq) + + SELECT seq, id, seconds, name, length, + degrees(ST_azimuth(ST_StartPoint(geom), ST_EndPoint(geom))) AS azimuth, + ST_AsText(geom), geom + FROM additional ORDER BY seq; + '; -- 3 - final_query := - 'WITH - results AS (' || resuts_query || '), - additional AS ( ' || additional_query || ') - SELECT *, degrees(ST_azimuth(ST_StartPoint(geom), ST_EndPoint(geom))) AS azimuth - FROM additional ORDER BY seq'; - - -- 4 - IF do_debug THEN RAISE NOTICE '%', final_query; RETURN; @@ -117,29 +113,19 @@ LANGUAGE plpgsql; \o use_fn_1.txt SELECT DISTINCT name -FROM wrk_withPoints( - 'vehicle_net', - @POINT1_LAT@, @POINT1_LON@, - @POINT2_LAT@, @POINT2_LON@); +FROM wrk_withPoints(@POINT1_LAT@, @POINT1_LON@, @POINT2_LAT@, @POINT2_LON@); \o use_fn_2.txt SELECT * -FROM wrk_withPoints( - 'taxi_net', - @POINT1_LAT@, @POINT1_LON@, - @POINT2_LAT@, @POINT2_LON@, - true); +FROM wrk_withPoints(@POINT1_LAT@, @POINT1_LON@, @POINT2_LAT@, @POINT2_LON@, true); \o use_fn_3.txt +CREATE OR REPLACE VIEW example AS SELECT * -INTO example -FROM wrk_withPoints( - 'walk_net', - @POINT1_LAT@, @POINT1_LON@, - @POINT2_LAT@, @POINT2_LON@); +FROM wrk_withPoints(@POINT1_LAT@, @POINT1_LON@, @POINT2_LAT@, @POINT2_LON@); -SELECT * FROM example; +SELECT seq, name FROM example; \o file_end.txt diff --git a/docs/scripts/configuration/osmid_configuration.sql b/docs/scripts/configuration/osmid_configuration.sql index e8c879abb..9359c0aca 100644 --- a/docs/scripts/configuration/osmid_configuration.sql +++ b/docs/scripts/configuration/osmid_configuration.sql @@ -2,28 +2,28 @@ \o osmid_configuration.conf WITH a AS (SELECT 1 AS r, osm_id, id FROM ways_vertices_pgr WHERE osm_id = @OSMID_1@) -SELECT 'ID_' || r, id from a; +SELECT 'ID_' || r, id FROM a; WITH a AS (SELECT 2 AS r, osm_id, id FROM ways_vertices_pgr WHERE osm_id = @OSMID_2@) -SELECT 'ID_' || r, id from a; +SELECT 'ID_' || r, id FROM a; WITH a AS (SELECT 3 AS r, osm_id, id FROM ways_vertices_pgr WHERE osm_id = @OSMID_3@) -SELECT 'ID_' || r, id from a; +SELECT 'ID_' || r, id FROM a; WITH a AS (SELECT 4 AS r, osm_id, id FROM ways_vertices_pgr WHERE osm_id = @OSMID_4@) -SELECT 'ID_' || r, id from a; +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; +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; +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; +SELECT 'CH7_ID_' || r, id FROM a; diff --git a/docs/scripts/get_data/CMakeLists.txt b/docs/scripts/get_data/CMakeLists.txt index d86fe5fc1..42b479a0a 100644 --- a/docs/scripts/get_data/CMakeLists.txt +++ b/docs/scripts/get_data/CMakeLists.txt @@ -2,8 +2,17 @@ # Files #--------------------- set(PGR_WORKSHOP_FILES + buildings.xml + waterways.xml + + osm2pgrouting_compat.sql + osm2pgrouting_compat_bangladesh.sql + osm2pgrouting_compat_mumbai.sql + get_all_data.sh - process_osgeolive_data.sh + setup_city_routing.sh + setup_bangladesh.sh + setup_mumbai.sh ) @@ -36,23 +45,64 @@ if (NOT EXISTS ${CMAKE_SOURCE_DIR}/downloads/${PGR_WORKSHOP_DOWNLOAD_DIR}/${PGR_ INPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/get_all_data.sh ) endif() + if (NOT EXISTS ${CMAKE_SOURCE_DIR}/downloads/${PGR_WORKSHOP_DOWNLOAD_DIR}/${PGR_WORKSHOP_CITY_FILE}.osm) message(FATAL_ERROR "Data not found: Failed to get ${PGR_WORKSHOP_CITY_FILE} data") endif() + if (NOT EXISTS ${CMAKE_SOURCE_DIR}/downloads/${PGR_WORKSHOP_DOWNLOAD_DIR}/mumbai.osm) message(FATAL_ERROR "Data not found: Failed to get mumbai data") endif() - if ( NOT EXISTS ${CMAKE_SOURCE_DIR}/downloads/${PGR_WORKSHOP_DOWNLOAD_DIR}/bangladesh.osm) + +if (NOT EXISTS ${CMAKE_SOURCE_DIR}/downloads/${PGR_WORKSHOP_DOWNLOAD_DIR}/bangladesh.osm) message(FATAL_ERROR "Data not found: Failed to get bangladesh data") endif() configure_file(${CMAKE_SOURCE_DIR}/downloads/${PGR_WORKSHOP_DOWNLOAD_DIR}/${PGR_WORKSHOP_CITY_FILE}.osm ${PGR_WORKSHOP_CITY_FILE}.osm) -configure_file(${CMAKE_SOURCE_DIR}/downloads/${PGR_WORKSHOP_DOWNLOAD_DIR}/mumbai.osm ${CMAKE_CURRENT_BINARY_DIR}/../un_sdg/sdg3/mumbai.osm) -configure_file(${CMAKE_SOURCE_DIR}/downloads/${PGR_WORKSHOP_DOWNLOAD_DIR}/bangladesh.osm ${CMAKE_CURRENT_BINARY_DIR}/../un_sdg/sdg11/bangladesh.osm) +configure_file(${CMAKE_SOURCE_DIR}/downloads/${PGR_WORKSHOP_DOWNLOAD_DIR}/mumbai.osm mumbai.osm) +configure_file(${CMAKE_SOURCE_DIR}/downloads/${PGR_WORKSHOP_DOWNLOAD_DIR}/bangladesh.osm bangladesh.osm) + +execute_process( + OUTPUT_FILE setup_city_routing.txt + COMMAND bash ${CMAKE_CURRENT_BINARY_DIR}/setup_city_routing.sh > setup_city_routing.txt + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + INPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/setup_city_routing.sh + ) + +if (Osm2pgrouting_VERSION VERSION_LESS "3.0.0") + execute_process( + COMMAND psql -d city_routing + -f ${CMAKE_CURRENT_BINARY_DIR}/osm2pgrouting_compat.sql + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) +endif() execute_process( - OUTPUT_FILE process_osgeolive_data.txt - COMMAND bash ${CMAKE_CURRENT_BINARY_DIR}/process_osgeolive_data.sh > processes_osgeolive_data.txt + OUTPUT_FILE setup_mumbai.txt + COMMAND bash ${CMAKE_CURRENT_BINARY_DIR}/setup_mumbai.sh > setup_mumbai.txt WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - INPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/process_osgeolive_data.sh + INPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/setup_mumbai.sh ) + +if (Osm2pgrouting_VERSION VERSION_LESS "3.0.0") + execute_process( + COMMAND psql -d mumbai + -f ${CMAKE_CURRENT_BINARY_DIR}/osm2pgrouting_compat_mumbai.sql + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) +endif() + +execute_process( + OUTPUT_FILE setup_bangladesh.txt + COMMAND bash ${CMAKE_CURRENT_BINARY_DIR}/setup_bangladesh.sh > setup_bangladesh.txt + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + INPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/setup_bangladesh.sh + ) + +if (Osm2pgrouting_VERSION VERSION_LESS "3.0.0") + execute_process( + COMMAND psql -d bangladesh + -f ${CMAKE_CURRENT_BINARY_DIR}/osm2pgrouting_compat_bangladesh.sql + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) +endif() diff --git a/docs/scripts/un_sdg/buildings.xml b/docs/scripts/get_data/buildings.xml similarity index 100% rename from docs/scripts/un_sdg/buildings.xml rename to docs/scripts/get_data/buildings.xml diff --git a/docs/scripts/get_data/osm2pgrouting_compat.sql b/docs/scripts/get_data/osm2pgrouting_compat.sql new file mode 100644 index 000000000..206c92b96 --- /dev/null +++ b/docs/scripts/get_data/osm2pgrouting_compat.sql @@ -0,0 +1,2 @@ +ALTER TABLE ways RENAME COLUMN gid TO id; +ALTER TABLE ways RENAME COLUMN the_geom TO geom; diff --git a/docs/scripts/get_data/osm2pgrouting_compat_bangladesh.sql b/docs/scripts/get_data/osm2pgrouting_compat_bangladesh.sql new file mode 100644 index 000000000..7f45c6cd3 --- /dev/null +++ b/docs/scripts/get_data/osm2pgrouting_compat_bangladesh.sql @@ -0,0 +1,2 @@ +ALTER TABLE waterways.ways RENAME COLUMN gid TO id; +ALTER TABLE waterways.ways RENAME COLUMN the_geom TO geom; diff --git a/docs/scripts/get_data/osm2pgrouting_compat_mumbai.sql b/docs/scripts/get_data/osm2pgrouting_compat_mumbai.sql new file mode 100644 index 000000000..693a3096a --- /dev/null +++ b/docs/scripts/get_data/osm2pgrouting_compat_mumbai.sql @@ -0,0 +1,4 @@ +ALTER TABLE roads.ways RENAME COLUMN gid TO id; +ALTER TABLE roads.ways RENAME COLUMN the_geom TO geom; +ALTER TABLE buildings.ways RENAME COLUMN gid TO id; +ALTER TABLE buildings.ways RENAME COLUMN the_geom TO geom; diff --git a/docs/scripts/get_data/setup_bangladesh.sh b/docs/scripts/get_data/setup_bangladesh.sh new file mode 100755 index 000000000..d94db957e --- /dev/null +++ b/docs/scripts/get_data/setup_bangladesh.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +set -e +echo "setup_bangladesh" + +dropdb --if-exists bangladesh + +# create_bangladesh from-here +# Create the database +createdb bangladesh + +# login as user "user" +psql bangladesh << EOF + +-- Commands inside the database +-- add pgRouting extension +CREATE EXTENSION pgrouting CASCADE; +CREATE EXTENSION hstore; + +-- creating schemas for data +CREATE SCHEMA waterways; +-- create_bangladesh to-here + +EOF + +echo import_bangladesh_waterways from-here +@Osm2pgrouting_EXECUTABLE@ \ + -f "bangladesh.osm" \ + -c "waterways.xml" \ + --schema "waterways" \ + --tags \ + -d bangladesh \ + -U user \ + -W user \ + --clean +echo import_bangladesh_waterways to-here diff --git a/docs/scripts/get_data/process_osgeolive_data.sh b/docs/scripts/get_data/setup_city_routing.sh similarity index 98% rename from docs/scripts/get_data/process_osgeolive_data.sh rename to docs/scripts/get_data/setup_city_routing.sh index 0841d63b0..2c5c964c3 100755 --- a/docs/scripts/get_data/process_osgeolive_data.sh +++ b/docs/scripts/get_data/setup_city_routing.sh @@ -1,3 +1,5 @@ +#!/bin/bash + set -e dropdb --if-exists city_routing diff --git a/docs/scripts/get_data/setup_mumbai.sh b/docs/scripts/get_data/setup_mumbai.sh new file mode 100755 index 000000000..25622cd62 --- /dev/null +++ b/docs/scripts/get_data/setup_mumbai.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +set -e + +# Create the database +createdb mumbai + +# login as user "user" +psql mumbai << EOF + +-- setup_mumbai from-here +-- add pgRouting extension +CREATE EXTENSION pgrouting CASCADE; + +-- creating schemas for data +CREATE SCHEMA roads; +CREATE SCHEMA buildings; +CREATE EXTENSION hstore; +-- setup_mumbai to-here +EOF + +echo import_roads from-here +@Osm2pgrouting_EXECUTABLE@ \ + -f "mumbai.osm" \ + -c "@Osm2pgrouting_mapconfig@" \ + --schema "roads" \ + -d mumbai \ + -U user \ + -W user \ + --tags \ + --clean +echo import_roads to-here + +echo import_buildings from-here +@Osm2pgrouting_EXECUTABLE@ \ + -f "mumbai.osm" \ + -c "buildings.xml" \ + --schema "buildings" \ + --tags \ + -d mumbai \ + -U user \ + -W user \ + --clean +echo import_buildings to-here diff --git a/docs/scripts/un_sdg/waterways.xml b/docs/scripts/get_data/waterways.xml similarity index 100% rename from docs/scripts/un_sdg/waterways.xml rename to docs/scripts/get_data/waterways.xml diff --git a/docs/scripts/un_sdg/CMakeLists.txt b/docs/scripts/un_sdg/CMakeLists.txt index 394678f24..3fcc1d26f 100644 --- a/docs/scripts/un_sdg/CMakeLists.txt +++ b/docs/scripts/un_sdg/CMakeLists.txt @@ -1,21 +1,3 @@ -#--------------------- -# Files -#--------------------- -set(PGR_WORKSHOP_FILES -buildings.xml -waterways.xml -) -foreach (f ${PGR_WORKSHOP_FILES}) - if (PGR_WORKSHOP_VERBOSE_DEBUG) - message(STATUS " Adding file ${f}") - endif() - configure_file(${f} sdg3/${f}) - configure_file(${f} sdg7/${f}) - configure_file(${f} sdg11/${f}) -endforeach() - - - add_custom_target(un_sdg_scripts ALL) set(PGR_WORKSHOP_SUBDIRS diff --git a/docs/scripts/un_sdg/sdg11/CMakeLists.txt b/docs/scripts/un_sdg/sdg11/CMakeLists.txt index d61c61dbf..b6491aa25 100644 --- a/docs/scripts/un_sdg/sdg11/CMakeLists.txt +++ b/docs/scripts/un_sdg/sdg11/CMakeLists.txt @@ -1,54 +1,31 @@ -add_custom_target(un_sdg11_scripts) +add_custom_target(un_sdg11_scripts DEPENDS sdg11.sql) -#--------------------- -# Files -#--------------------- -set(PGR_WORKSHOP_FILES - get_bangladesh.sh - create_bangladesh.sh - import_bangladesh_waterways.sh - all_exercises_sdg11.sql -) - -#--------------------------------------------- -# Adding the documentation files -#--------------------------------------------- - -foreach (f ${PGR_WORKSHOP_FILES}) - if (PGR_WORKSHOP_VERBOSE_DEBUG) - message(STATUS " Adding file ${f}") - endif() - configure_file(${f} ${f}) -endforeach() - -execute_process( - OUTPUT_FILE created_bangladesh.txt - COMMAND bash ${CMAKE_CURRENT_BINARY_DIR}/create_bangladesh.sh > created_bangladesh.txt - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - INPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/create_bangladesh.sh - ) - -execute_process( - OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/import_bangladesh_waterways.txt - COMMAND bash ${CMAKE_CURRENT_BINARY_DIR}/import_bangladesh_waterways.sh > ${CMAKE_CURRENT_BINARY_DIR}/import_bangladesh_waterways.txt - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - INPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/import_bangladesh_waterways.sh - ) +configure_file(sdg11.sql sdg11.sql) add_custom_command( TARGET un_sdg11_scripts PRE_BUILD BYPRODUCTS - exercise_1.txt - exercise_2.txt - exercise_3.txt - exercise_4.txt - exercise_5.txt + create_city1.txt + create_city2.txt + create_city3.txt + create_city4.txt + set_path.txt + get_extensions.txt + get_tables.txt exercise_6.txt - exercise_7.txt - exercise_8.txt - exercise_9.txt + delete1.txt + delete2.txt + only_connected1.txt + only_connected2.txt + only_connected3.txt + only_connected4.txt + only_connected5.txt exercise_10.txt - COMMAND psql -d bangladesh -f all_exercises_sdg11.sql + exercise_11.txt + get_rain_zone1.txt + get_rain_zone2.txt + exercise_13.txt + COMMAND psql -d bangladesh -f sdg11.sql COMMENT "running sdg11 scripts" ) diff --git a/docs/scripts/un_sdg/sdg11/create_bangladesh.sh b/docs/scripts/un_sdg/sdg11/create_bangladesh.sh deleted file mode 100755 index c09ee05e9..000000000 --- a/docs/scripts/un_sdg/sdg11/create_bangladesh.sh +++ /dev/null @@ -1,28 +0,0 @@ -set -e -echo "Processing create_bangladesh" - -dropdb --if-exists bangladesh - -# create_bangladesh from-here -# Create the database -createdb bangladesh - -# login as user "user" -psql bangladesh << EOF - --- Commands inside the database --- add PostGIS extension -CREATE EXTENSION postgis; - --- add pgRouting extension -CREATE EXTENSION pgrouting; -CREATE EXTENSION hstore; --- creating schemas for data -CREATE SCHEMA waterways; --- create_bangladesh to-here - -EOF - - - -echo "End create_bangladesh" diff --git a/docs/scripts/un_sdg/sdg11/get_bangladesh.sh b/docs/scripts/un_sdg/sdg11/get_bangladesh.sh deleted file mode 100755 index 2dd780c85..000000000 --- a/docs/scripts/un_sdg/sdg11/get_bangladesh.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -set -e - -# get_bangladesh from-here -CITY="bangladesh" -BBOX="88.9515,22.2192,89.3806,22.4310" -wget --progress=dot:mega -O "$CITY.osm" "http://www.overpass-api.de/api/xapi?*[bbox=${BBOX}][@meta]" - -osmconvert --drop-author --drop-version bangladesh.osm -o=bangladesh_pass1.osm -osmfilter bangladesh_pass1.osm -o=bangladesh.osm --drop="highway= building=" -# get_bangladesh to-here diff --git a/docs/scripts/un_sdg/sdg11/import_bangladesh_waterways.sh b/docs/scripts/un_sdg/sdg11/import_bangladesh_waterways.sh deleted file mode 100755 index 464bb4119..000000000 --- a/docs/scripts/un_sdg/sdg11/import_bangladesh_waterways.sh +++ /dev/null @@ -1,14 +0,0 @@ -set -e - -# from-here -osm2pgrouting \ - -f "bangladesh.osm" \ - -c "waterways.xml" \ - --schema "waterways" \ - --prefix "waterways_" \ - --tags \ - -d bangladesh \ - -U user \ - -W user \ - --clean -# to-here diff --git a/docs/scripts/un_sdg/sdg11/all_exercises_sdg11.sql b/docs/scripts/un_sdg/sdg11/sdg11.sql similarity index 76% rename from docs/scripts/un_sdg/sdg11/all_exercises_sdg11.sql rename to docs/scripts/un_sdg/sdg11/sdg11.sql index ff4fd7a2a..bb145db74 100644 --- a/docs/scripts/un_sdg/sdg11/all_exercises_sdg11.sql +++ b/docs/scripts/un_sdg/sdg11/sdg11.sql @@ -29,38 +29,38 @@ SHOW search_path; \dt \o exercise_6.txt -SELECT count(*) FROM waterways_ways; +SELECT count(*) FROM ways; \o delete1.txt -DELETE FROM waterways_ways +DELETE FROM ways WHERE osm_id IN (721133202, 908102930, 749173392, 652172284, 126774195, 720395312); \o delete2.txt -DELETE FROM waterways_ways WHERE osm_id = 815893446; +DELETE FROM ways WHERE osm_id = 815893446; \o only_connected1.txt SELECT * INTO waterways.waterways_vertices FROM pgr_extractVertices( 'SELECT id, source, target - FROM waterways.waterways_ways ORDER BY id'); + FROM waterways.ways ORDER BY id'); \o only_connected2.txt UPDATE waterways_vertices v SET geom = ST_startPoint(w.geom) -FROM waterways_ways w WHERE source = v.id; +FROM ways w WHERE source = v.id; UPDATE waterways_vertices v SET geom = ST_endPoint(w.geom) -FROM waterways_ways w WHERE v.geom IS NULL AND target = v.id; +FROM ways w WHERE v.geom IS NULL AND target = v.id; UPDATE waterways_vertices set (x,y) = (ST_X(geom), ST_Y(geom)); \o only_connected3.txt -ALTER TABLE waterways_ways ADD COLUMN component BIGINT; +ALTER TABLE ways ADD COLUMN component BIGINT; ALTER TABLE waterways_vertices ADD COLUMN component BIGINT; \o only_connected4.txt @@ -68,13 +68,13 @@ ALTER TABLE waterways_vertices ADD COLUMN component BIGINT; UPDATE waterways_vertices SET component = c.component FROM ( SELECT * FROM pgr_connectedComponents( - 'SELECT id, source, target, cost, reverse_cost FROM waterways_ways') + 'SELECT id, source, target, cost, reverse_cost FROM ways') ) AS c WHERE id = node; \o only_connected5.txt -UPDATE waterways_ways SET component = v.component +UPDATE ways SET component = v.component FROM (SELECT id, component FROM waterways_vertices) AS v WHERE source = v.id; @@ -90,22 +90,22 @@ LANGUAGE SQL; \o exercise_11.txt SELECT DISTINCT component -FROM bangladesh JOIN waterways.waterways_ways w +FROM bangladesh JOIN waterways.ways w ON (ST_Intersects(w.geom, get_city_buffer(5))); \o get_rain_zone1.txt -ALTER TABLE waterways_ways +ALTER TABLE ways ADD COLUMN rain_zone geometry; \o get_rain_zone2.txt -UPDATE waterways.waterways_ways +UPDATE waterways.ways SET rain_zone = ST_Buffer((geom),0.005) WHERE ST_Intersects(geom, get_city_buffer(5)); \o exercise_13.txt -- Combining mutliple rain zones SELECT ST_Union(rain_zone) AS Combined_Rain_Zone -FROM waterways_ways; +FROM ways; \o diff --git a/docs/scripts/un_sdg/sdg3/CMakeLists.txt b/docs/scripts/un_sdg/sdg3/CMakeLists.txt index 366d66fbc..884128124 100644 --- a/docs/scripts/un_sdg/sdg3/CMakeLists.txt +++ b/docs/scripts/un_sdg/sdg3/CMakeLists.txt @@ -1,70 +1,39 @@ -add_custom_target(un_sdg3_scripts) +add_custom_target(un_sdg3_scripts DEPENDS sdg3.sql) -#--------------------- -# Files -#--------------------- -set(PGR_WORKSHOP_FILES - create_mumbai.sh - get_mumbai.sh - import_mumbai_roads.sh - import_mumbai_buildings.sh - all_exercises_sdg3.sql -) - - -#--------------------------------------------- -# Adding the documentation files -#--------------------------------------------- - -foreach (f ${PGR_WORKSHOP_FILES}) - if (PGR_WORKSHOP_VERBOSE_DEBUG) - message(STATUS " Adding file ${f}") - endif() - configure_file(${f} ${f}) -endforeach() - - -execute_process( - OUTPUT_FILE created_mumbai.txt - COMMAND bash ${CMAKE_CURRENT_BINARY_DIR}/create_mumbai.sh > created_mumbai.txt - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - INPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/create_mumbai.sh - ) - -execute_process( - OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/import_mumbai_buildings.txt - COMMAND bash ${CMAKE_CURRENT_BINARY_DIR}/import_mumbai_buildings.sh > ${CMAKE_CURRENT_BINARY_DIR}/import_mumbai_buildings.txt - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - INPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/import_mumbai_buildings.sh - ) - -execute_process( - OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/import_mumbai_roads.txt - COMMAND bash ${CMAKE_CURRENT_BINARY_DIR}/import_mumbai_roads.sh > ${CMAKE_CURRENT_BINARY_DIR}/import_mumbai_roads.txt - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - INPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/import_mumbai_roads.sh - ) +configure_file(sdg3.sql sdg3.sql) add_custom_command( TARGET un_sdg3_scripts PRE_BUILD BYPRODUCTS - exercise_5.txt - exercise_6.txt - exercise_7.txt - exercise_8.txt - exercise_9.txt - exercise_10.txt - exercise_11.txt - exercise_12.txt - exercise_13.txt - exercise_14.txt - exercise_15.txt - exercise_16.txt - exercise_17.txt - exercise_18.txt - exercise_19.txt - exercise_20.txt - COMMAND psql -d mumbai -f all_exercises_sdg3.sql + kind_of_buildings.txt + population_function.txt + show_population_100.txt + show_population_300.txt + show_schemas.txt + show_path1.txt + set_path.txt + show_path2.txt + enumerate_tables.txt + count1.txt + count2.txt + skip1.txt + only_connected0.txt + only_connected1.txt + only_connected2.txt + only_connected3.txt + only_connected4.txt + only_connected5.txt + only_connected6.txt + building_road.txt + test_building_road.txt + nearest_vertex.txt + test_nearest_vertex.txt + clean_buildings.txt + roads_population.txt + served_roads.txt + adjacent_roads.txt + population_served.txt + COMMAND psql -d mumbai -f sdg3.sql COMMENT "running chapter sdg3 scripts" ) diff --git a/docs/scripts/un_sdg/sdg3/all_exercises_sdg3.sql b/docs/scripts/un_sdg/sdg3/all_exercises_sdg3.sql deleted file mode 100644 index 6211da0d5..000000000 --- a/docs/scripts/un_sdg/sdg3/all_exercises_sdg3.sql +++ /dev/null @@ -1,264 +0,0 @@ -\o show_schemas.txt -\dn -\o show_path1.txt -SHOW search_path; -\o set_path.txt -SET search_path TO roads,buildings,public,contrib,postgis; -\o show_path2.txt -SHOW search_path; -\o enumerate_tables.txt -\dt -\o count1.txt -SELECT COUNT(*) FROM roads_ways; -\o count2.txt -SELECT COUNT(*) FROM buildings_ways; -\o clean_buildings.txt -ALTER TABLE buildings.buildings_ways -DROP source, DROP target, -DROP source_osm, DROP target_osm, -DROP length, DROP length_m, -DROP cost, DROP reverse_cost, -DROP cost_s, DROP reverse_cost_s, -DROP one_way, DROP oneway, -DROP priority, DROP osm_id, DROP rule, -DROP x1, DROP x2, -DROP y1, DROP y2, -DROP maxspeed_forward, -DROP maxspeed_backward; -\o exercise_6.txt -SELECT AddGeometryColumn('buildings','buildings_ways','poly_geom',4326,'POLYGON',2); -\o buildings_description.txt -\dS+ buildings_ways -\o exercise_7.txt -DELETE FROM buildings_ways -WHERE ST_NumPoints(geom) < 4 -OR ST_IsClosed(geom) = FALSE; -\o exercise_8.txt -UPDATE buildings_ways -SET poly_geom = ST_MakePolygon(geom); -\o add_area_col.txt - -ALTER TABLE buildings_ways ADD COLUMN area INTEGER; - -\o get_area.txt - -UPDATE buildings_ways -SET area = ST_Area(poly_geom::geography)::INTEGER; - -\o kind_of_buildings.txt - -SELECT DISTINCT tag_id, tag_value -FROM buildings_ways JOIN buildings.configuration USING (tag_id) -ORDER BY tag_id; - -\o population_function.txt - -CREATE OR REPLACE FUNCTION population(tag_id INTEGER,area INTEGER) -RETURNS INTEGER AS -$BODY$ -DECLARE -population INTEGER; -BEGIN - IF tag_id <= 100 THEN population = 1; -- Negligible - ELSIF 100 < tag_id AND tag_id <= 200 THEN population = GREATEST(2, area * 0.0002); -- Very Sparse - ELSIF 200 < tag_id AND tag_id <= 300 THEN population = GREATEST(3, area * 0.002); -- Sparse - ELSIF 300 < tag_id AND tag_id <= 400 THEN population = GREATEST(5, area * 0.05); -- Moderate - ELSIF 400 < tag_id AND tag_id <= 500 THEN population = GREATEST(7, area * 0.7); -- Dense - ELSIF tag_id > 500 THEN population = GREATEST(10,area * 1); -- Very Dense - ELSE population = 1; - END IF; - RETURN population; -END; -$BODY$ -LANGUAGE plpgsql; - -\o add_population_col.txt - -ALTER TABLE buildings_ways ADD COLUMN population INTEGER; - -\o get_population.txt - -UPDATE buildings_ways -SET population = population(tag_id,area); - -\o only_connected1.txt - -SELECT * INTO roads.roads_vertices -FROM pgr_extractVertices( - 'SELECT id, source, target - FROM roads.roads_ways ORDER BY id'); - -\o only_connected2.txt - -UPDATE roads_vertices v SET geom = ST_startPoint(w.geom) -FROM roads_ways w WHERE source = v.id; - -UPDATE roads_vertices v SET geom = ST_endPoint(w.geom) -FROM roads_ways w WHERE v.geom IS NULL AND target = v.id; - -UPDATE roads_vertices set (x,y) = (ST_X(geom), ST_Y(geom)); - -\o only_connected3.txt - -ALTER TABLE roads_ways ADD COLUMN component BIGINT; -ALTER TABLE roads_vertices ADD COLUMN component BIGINT; - -\o only_connected4.txt - -UPDATE roads_vertices SET component = c.component -FROM ( - SELECT * FROM pgr_connectedComponents( - 'SELECT id, source, target, cost, reverse_cost FROM roads_ways') -) AS c -WHERE id = node; - -\o only_connected5.txt - -UPDATE roads_ways SET component = v.component -FROM (SELECT id, component FROM roads_vertices) AS v -WHERE source = v.id; - -\o only_connected6.txt - -WITH -all_components AS (SELECT component, count(*) FROM roads_ways GROUP BY component), -max_component AS (SELECT max(count) from all_components) -SELECT component FROM all_components WHERE count = (SELECT max FROM max_component); - -\o only_connected7.txt - -WITH -all_components AS (SELECT component, count(*) FROM roads_ways GROUP BY component), -max_component AS (SELECT max(count) from all_components), -the_component AS (SELECT component FROM all_components WHERE count = (SELECT max FROM max_component)) -DELETE FROM roads_ways WHERE component != (SELECT component FROM the_component); - -\o only_connected8.txt - -WITH -all_components AS (SELECT component, count(*) FROM roads_vertices GROUP BY component), -max_component AS (SELECT max(count) from all_components), -the_component AS (SELECT component FROM all_components WHERE count = (SELECT max FROM max_component)) -DELETE FROM roads_vertices WHERE component != (SELECT component FROM the_component); - -\o nearest_vertex1.txt - -CREATE OR REPLACE FUNCTION closest_vertex(geom GEOMETRY) -RETURNS BIGINT AS -$BODY$ -SELECT id FROM roads_vertices ORDER BY geom <-> $1 LIMIT 1; -$BODY$ -LANGUAGE SQL; - -\o nearest_vertex2.txt - -SELECT closest_vertex(poly_geom) FROM buildings_ways; - -\o prepare_edges.txt - -PREPARE edges AS -SELECT id,source,target, length_m/60 AS cost,length_m/60 AS reverse_cost -FROM roads.roads_ways; - -\o exercise_15.txt - -SELECT id, source, target, agg_cost AS minutes, geom -FROM pgr_drivingDistance( - 'edges', -- the prepared statement - ( - SELECT closest_vertex(poly_geom) - FROM buildings.buildings_ways - WHERE tag_id = '318' - ), -- the starting vertex - 10, -- 10 minutes - false -- graph is undirected -) AS results -JOIN roads.roads_ways AS r ON (edge = id); - -\o exercise_16.txt - -WITH -subquery AS ( - SELECT edge, source, target, agg_cost AS minutes, geom - FROM pgr_drivingDistance( - 'edges', - ( - SELECT closest_vertex(poly_geom) - FROM buildings.buildings_ways - WHERE tag_id = '318' - ), 10, FALSE - ) AS results - JOIN roads.roads_ways AS r ON (edge = id) -), -connected_edges AS ( - SELECT r.id, r.source, r.target, length_m/60, r.geom - FROM subquery AS s JOIN roads.roads_ways AS r - ON ((s.source = r.source OR s.source = r.target)) -) -SELECT * FROM subquery -UNION ALL -SELECT * FROM connected_edges; - -\o closest_edge1.txt - -CREATE OR REPLACE FUNCTION closest_edge(geom GEOMETRY) -RETURNS BIGINT AS -$BODY$ - SELECT id FROM roads_ways ORDER BY geom <-> geom LIMIT 1; -$BODY$ -LANGUAGE SQL; - -\o closest_edge2.txt - -ALTER TABLE buildings_ways -ADD COLUMN edge_id INTEGER; - -\o closest_edge3.txt - -UPDATE buildings_ways SET edge_id = closest_edge(poly_geom); - -\o add_road_population1.txt - -ALTER TABLE roads_ways ADD COLUMN population INTEGER; - -\o add_road_population2.txt - -UPDATE roads_ways SET population = SUM -FROM ( - SELECT edge_id, SUM(population) - FROM buildings_ways GROUP BY edge_id - ) -AS subquery -WHERE id = edge_id; - -\o add_road_population3.txt - -SELECT population FROM roads_ways WHERE id = 441; - -\o exercise_20.txt - -WITH -subquery AS ( - SELECT source, target - FROM pgr_drivingDistance( - 'edges', - ( - SELECT closest_vertex(poly_geom) - FROM buildings.buildings_ways - WHERE tag_id = '318' - ), 10, FALSE - ) - AS results - JOIN roads.roads_ways AS r ON (edge = id) -), -connected_edges AS ( - SELECT DISTINCT id, population - FROM subquery AS s JOIN roads.roads_ways AS r - ON ( - (s.source = r.source OR s.source = r.target) OR - (s.target = r.source OR s.target = r.target) - ) -) -SELECT SUM(population) FROM connected_edges; - -\o diff --git a/docs/scripts/un_sdg/sdg3/create_mumbai.sh b/docs/scripts/un_sdg/sdg3/create_mumbai.sh deleted file mode 100755 index 7b3b8f6ee..000000000 --- a/docs/scripts/un_sdg/sdg3/create_mumbai.sh +++ /dev/null @@ -1,30 +0,0 @@ -set -e -echo "Processing create_mumbai" -dropdb --if-exists mumbai - -# create_mumbai from-here -# Create the database -createdb mumbai - -# login as user "user" -psql mumbai << EOF - --- Commands inside the database --- add PostGIS extension -CREATE EXTENSION postgis; - --- add pgRouting extension -CREATE EXTENSION pgrouting; - --- creating schemas for data -CREATE SCHEMA roads; -CREATE SCHEMA buildings; -CREATE EXTENSION hstore; --- create_mumbai to-here -EOF - - - - - -echo "End create_mumbai" diff --git a/docs/scripts/un_sdg/sdg3/get_mumbai.sh b/docs/scripts/un_sdg/sdg3/get_mumbai.sh deleted file mode 100755 index 1915b3c9d..000000000 --- a/docs/scripts/un_sdg/sdg3/get_mumbai.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -set -e - -# This is for getting the mumbai data directly using the overpass API -# The results of using this download will affect the results on the workshop -# prefer using the download from OSGeo -# get_mumbai from-here -CITY="mumbai" -BBOX="72.8263,19.1021,72.8379,19.1166" -wget --progress=dot:mega -O "$CITY.osm" "http://www.overpass-api.de/api/xapi?*[bbox=${BBOX}][@meta]" -# get_mumbai to-here diff --git a/docs/scripts/un_sdg/sdg3/import_mumbai_buildings.sh b/docs/scripts/un_sdg/sdg3/import_mumbai_buildings.sh deleted file mode 100755 index 9dcfad52a..000000000 --- a/docs/scripts/un_sdg/sdg3/import_mumbai_buildings.sh +++ /dev/null @@ -1,14 +0,0 @@ -set -e - -#from-here -@Osm2pgrouting_EXECUTABLE@ \ - -f "mumbai.osm" \ - -c "buildings.xml" \ - --schema "buildings" \ - --prefix "buildings_" \ - --tags \ - -d mumbai \ - -U user \ - -W user \ - --clean -#to-here diff --git a/docs/scripts/un_sdg/sdg3/import_mumbai_roads.sh b/docs/scripts/un_sdg/sdg3/import_mumbai_roads.sh deleted file mode 100755 index 88d3bc287..000000000 --- a/docs/scripts/un_sdg/sdg3/import_mumbai_roads.sh +++ /dev/null @@ -1,14 +0,0 @@ -set -e - -# from-here -@Osm2pgrouting_EXECUTABLE@ \ - -f "mumbai.osm" \ - -c "@Osm2pgrouting_mapconfig@" \ - --schema "roads" \ - -d mumbai \ - -U user \ - -W user \ - --prefix "roads_" \ - --tags \ - --clean -# to-here diff --git a/docs/scripts/un_sdg/sdg3/sdg3.sql b/docs/scripts/un_sdg/sdg3/sdg3.sql new file mode 100644 index 000000000..a092f6419 --- /dev/null +++ b/docs/scripts/un_sdg/sdg3/sdg3.sql @@ -0,0 +1,231 @@ +DROP TABLE IF EXISTS buildings; +DROP TABLE IF EXISTS roads_net; +\o kind_of_buildings.txt + +SELECT DISTINCT tag_id, tag_value +FROM buildings.ways JOIN buildings.configuration USING (tag_id) +ORDER BY tag_id; + +\o population_function.txt + +CREATE OR REPLACE FUNCTION population(tag_id INTEGER, area INTEGER) +RETURNS INTEGER AS +$BODY$ +DECLARE +population INTEGER; +BEGIN + IF tag_id <= 100 THEN population = 1; -- Negligible + ELSIF 100 < tag_id AND tag_id <= 200 THEN population = GREATEST(2, area * 0.0002); -- Very Sparse + ELSIF 200 < tag_id AND tag_id <= 300 THEN population = GREATEST(3, area * 0.002); -- Sparse + ELSIF 300 < tag_id AND tag_id <= 400 THEN population = GREATEST(5, area * 0.05); -- Moderate + ELSIF 400 < tag_id AND tag_id <= 500 THEN population = GREATEST(7, area * 0.7); -- Dense + ELSIF tag_id > 500 THEN population = GREATEST(10,area * 1); -- Very Dense + ELSE population = 1; + END IF; + RETURN population; +END; +$BODY$ +LANGUAGE plpgsql; + +\o show_population_100.txt +SELECT tag_id, tag_value, population(tag_id, 100) +FROM buildings.configuration +ORDER BY tag_id; +\o show_population_300.txt +SELECT tag_id, tag_value, population(tag_id, 300) +FROM buildings.configuration +ORDER BY tag_id; +\o show_schemas.txt +\dn +\o show_path1.txt +SHOW search_path; +\o set_path.txt +SET search_path TO public,roads,buildings,contrib,postgis; +\o show_path2.txt +SHOW search_path; +\o enumerate_tables.txt +\dt +\o count1.txt +SELECT COUNT(*) FROM roads.ways; +\o count2.txt +SELECT COUNT(*) FROM buildings.ways; +\o skip1.txt + + +\o only_connected0.txt + +ALTER TABLE roads.ways ADD COLUMN component BIGINT; + +\o only_connected1.txt + +SELECT id, in_edges, out_edges, x, y, NULL::BIGINT osm_id, NULL::BIGINT component, geom +INTO vertices +FROM pgr_extractVertices('SELECT id, source, target FROM roads.ways ORDER BY id'); + +\o only_connected2.txt + +WITH +get_data AS ( + SELECT source, source_osm, ST_startPoint(geom) AS pt FROM roads.ways + UNION ALL + SELECT target, target_osm, ST_endPoint(geom) FROM roads.ways +) +UPDATE vertices SET +(geom, osm_id, x, y) = (ST_startPoint(pt), source_osm, st_x(pt), st_y(pt)) +FROM get_data WHERE source = id; + +\o only_connected3.txt + +UPDATE vertices SET component = c.component +FROM ( + SELECT * FROM pgr_connectedComponents( + 'SELECT id, source, target, cost, reverse_cost FROM roads.ways') +) AS c +WHERE id = node; + + +\o only_connected4.txt + +UPDATE roads.ways SET component = v.component +FROM (SELECT id, component FROM vertices) AS v +WHERE source = v.id; + +\o only_connected5.txt + +-- DROP TABLE IF EXISTS roads_net; +CREATE TABLE roads_net AS + +WITH +all_components AS (SELECT component, count(*) FROM roads.ways GROUP BY component), +max_component AS (SELECT max(count) FROM all_components), +the_component AS ( + SELECT component FROM all_components + WHERE count = (SELECT max FROM max_component)) + +SELECT + w.id, source, target, + length_m/60 AS cost, length_m/60 AS reverse_cost, + name, length_m AS length, NULL::BIGINT population, tag_id, component, geom AS geom +FROM roads.ways w JOIN the_component USING (component); + +\o only_connected6.txt + +DELETE FROM vertices WHERE component != (SELECT DISTINCT component FROM roads_net LIMIT 1); + +\o building_road.txt +CREATE OR REPLACE FUNCTION building_road(building GEOMETRY) +RETURNS BIGINT AS +$BODY$ + SELECT id FROM roads_net ORDER BY geom <-> $1 LIMIT 1; +$BODY$ +LANGUAGE SQL; + +\o test_building_road.txt + +SELECT id, building_road(geom) FROM buildings.ways LIMIT 3; + +\o nearest_vertex.txt + +CREATE OR REPLACE FUNCTION get_vertex(geom GEOMETRY) +RETURNS BIGINT AS +$BODY$ +SELECT id FROM vertices ORDER BY geom <-> $1 LIMIT 1; +$BODY$ +LANGUAGE SQL; + +\o test_nearest_vertex.txt + +SELECT get_vertex(geom) FROM buildings.ways LIMIT 3; + +\o clean_buildings.txt +-- DROP TABLE IF EXISTS buildings; +CREATE TABLE buildings AS +WITH +buildings_data AS ( +SELECT id, name, building_road(geom) AS road, get_vertex(geom) AS vid, tag_id, geom, ST_MakePolygon(geom) AS building +FROM buildings.ways +WHERE ST_NumPoints(geom) >= 4 + AND ST_IsClosed(geom) = TRUE) +SELECT id, name, + ST_Area(building::geography)::INTEGER AS area, + population(tag_id, ST_Area(building::geography)::INTEGER) AS population, + road, vid, + tag_id, + geom, building +FROM buildings_data; + +\o roads_population.txt + +UPDATE roads_net SET population = SUM +FROM ( + SELECT road, SUM(population) + FROM buildings GROUP BY road + ) +AS subquery +WHERE id = road; + +\o served_roads.txt + +SELECT id, source, target, agg_cost AS minutes, geom +FROM pgr_drivingDistance( + 'SELECT * FROM roads_net', + ( + -- the starting vertex + SELECT vid + FROM buildings + WHERE tag_id = '318' + ), + 10, -- 10 minutes + false -- graph is undirected +) AS results +JOIN roads_net ON (edge = id); + +\o adjacent_roads.txt + +WITH +subquery AS ( + SELECT edge, source, target, agg_cost AS minutes, geom + FROM pgr_drivingDistance( + 'SELECT * FROM roads_net', + ( + SELECT vid + FROM buildings + WHERE tag_id = '318' + ), 10, FALSE + ) AS results + JOIN roads_net AS r ON (edge = id) +), +connected_edges AS ( + SELECT r.id, r.source, r.target, length, r.geom + FROM subquery AS s JOIN roads_net AS r + ON ((s.source = r.source OR s.source = r.target)) +) +SELECT * FROM subquery +UNION ALL +SELECT * FROM connected_edges; + +\o population_served.txt + +WITH +subquery AS ( + SELECT source, target + FROM pgr_drivingDistance( + 'SELECT * FROM roads_net', + ( + SELECT vid + FROM buildings + WHERE tag_id = '318' + ), 10, FALSE + ) + AS results + JOIN roads_net AS r ON (edge = id) +), +connected_edges AS ( + SELECT DISTINCT id, population + FROM subquery AS s JOIN roads_net AS r + ON ( + (s.source = r.source OR s.source = r.target) OR + (s.target = r.source OR s.target = r.target) + ) +) +SELECT SUM(population) FROM connected_edges; diff --git a/docs/scripts/un_sdg/sdg7/CMakeLists.txt b/docs/scripts/un_sdg/sdg7/CMakeLists.txt index b977dc11a..5fe3415d8 100644 --- a/docs/scripts/un_sdg/sdg7/CMakeLists.txt +++ b/docs/scripts/un_sdg/sdg7/CMakeLists.txt @@ -1,36 +1,26 @@ -add_custom_target(un_sdg7_scripts) +add_custom_target(un_sdg7_scripts DEPENDS sdg7.sql) -#--------------------- -# Files -#--------------------- -set(PGR_WORKSHOP_FILES - all_exercises_sdg7.sql -) - - -#--------------------------------------------- -# Adding the documentation files -#--------------------------------------------- - -foreach (f ${PGR_WORKSHOP_FILES}) - if (PGR_WORKSHOP_VERBOSE_DEBUG) - message(STATUS " Adding file ${f}") - endif() - configure_file(${f} ${f}) -endforeach() +configure_file(sdg7.sql sdg7.sql) add_custom_command( TARGET un_sdg7_scripts PRE_BUILD BYPRODUCTS - exercise_5.txt - exercise_6.txt - exercise_7.txt - exercise_8.txt - exercise_9.txt - exercise_10.txt + set_path.txt + show_path2.txt + revert_changes.txt + only_connected1.txt + only_connected2.txt + only_connected3.txt + only_connected4.txt + only_connected5.txt + only_connected6.txt + only_connected7.txt + only_connected8.txt + exercise_10-1.txt + exercise_10-2.txt exercise_11.txt exercise_12.txt - COMMAND psql -d mumbai -f all_exercises_sdg7.sql + COMMAND psql -d mumbai -f sdg7.sql COMMENT "running chapter sdg7 scripts" ) diff --git a/docs/scripts/un_sdg/sdg7/all_exercises_sdg7.sql b/docs/scripts/un_sdg/sdg7/sdg7.sql similarity index 70% rename from docs/scripts/un_sdg/sdg7/all_exercises_sdg7.sql rename to docs/scripts/un_sdg/sdg7/sdg7.sql index b46285f76..99c830bdc 100644 --- a/docs/scripts/un_sdg/sdg7/all_exercises_sdg7.sql +++ b/docs/scripts/un_sdg/sdg7/sdg7.sql @@ -5,28 +5,28 @@ SHOW search_path; \o revert_changes.txt DROP TABLE IF EXISTS roads.roads_vertices; -ALTER TABLE roads.roads_ways DROP component; +ALTER TABLE roads.ways DROP component; \o only_connected1.txt SELECT * INTO roads.roads_vertices FROM pgr_extractVertices( 'SELECT id, source, target - FROM roads.roads_ways ORDER BY id'); + FROM roads.ways ORDER BY id'); \o only_connected2.txt UPDATE roads_vertices v SET geom = ST_startPoint(w.geom) -FROM roads_ways w WHERE source = v.id; +FROM roads.ways w WHERE source = v.id; UPDATE roads_vertices v SET geom = ST_endPoint(w.geom) -FROM roads_ways w WHERE v.geom IS NULL AND target = v.id; +FROM roads.ways w WHERE v.geom IS NULL AND target = v.id; UPDATE roads_vertices set (x,y) = (ST_X(geom), ST_Y(geom)); \o only_connected3.txt -ALTER TABLE roads_ways ADD COLUMN component BIGINT; +ALTER TABLE roads.ways ADD COLUMN component BIGINT; ALTER TABLE roads_vertices ADD COLUMN component BIGINT; \o only_connected4.txt @@ -34,36 +34,36 @@ ALTER TABLE roads_vertices ADD COLUMN component BIGINT; UPDATE roads_vertices SET component = c.component FROM ( SELECT * FROM pgr_connectedComponents( - 'SELECT id, source, target, cost, reverse_cost FROM roads_ways') + 'SELECT id, source, target, cost, reverse_cost FROM roads.ways') ) AS c WHERE id = node; \o only_connected5.txt -UPDATE roads_ways SET component = v.component +UPDATE roads.ways SET component = v.component FROM (SELECT id, component FROM roads_vertices) AS v WHERE source = v.id; \o only_connected6.txt WITH -all_components AS (SELECT component, count(*) FROM roads_ways GROUP BY component), -max_component AS (SELECT max(count) from all_components) +all_components AS (SELECT component, count(*) FROM roads.ways GROUP BY component), +max_component AS (SELECT max(count) FROM all_components) SELECT component FROM all_components WHERE count = (SELECT max FROM max_component); \o only_connected7.txt WITH -all_components AS (SELECT component, count(*) FROM roads_ways GROUP BY component), -max_component AS (SELECT max(count) from all_components), +all_components AS (SELECT component, count(*) FROM roads.ways GROUP BY component), +max_component AS (SELECT max(count) FROM all_components), the_component AS (SELECT component FROM all_components WHERE count = (SELECT max FROM max_component)) -DELETE FROM roads_ways WHERE component != (SELECT component FROM the_component); +DELETE FROM roads.ways WHERE component != (SELECT component FROM the_component); \o only_connected8.txt WITH all_components AS (SELECT component, count(*) FROM roads_vertices GROUP BY component), -max_component AS (SELECT max(count) from all_components), +max_component AS (SELECT max(count) FROM all_components), the_component AS (SELECT component FROM all_components WHERE count = (SELECT max FROM max_component)) DELETE FROM roads_vertices WHERE component != (SELECT component FROM the_component); @@ -71,7 +71,7 @@ DELETE FROM roads_vertices WHERE component != (SELECT component FROM the_compone PREPARE edges AS SELECT id, source, target, length_m AS cost -FROM roads.roads_ways; +FROM roads.ways; \o exercise_10-2.txt @@ -86,6 +86,6 @@ FROM pgr_kruskalDFS('edges', 91); \o exercise_12.txt SELECT sum(length_m)/1000 AS total_km -FROM roads_ways; +FROM roads.ways; \o diff --git a/docs/un_sdg/data.rst b/docs/un_sdg/data.rst index ba33bdfeb..590999b07 100644 --- a/docs/un_sdg/data.rst +++ b/docs/un_sdg/data.rst @@ -9,23 +9,10 @@ Data for Sustainable Development Goals :align: center To be able to use pgRouting, data has to be imported into a database. This chapter -will use ``osm2pgrouting`` to get that the data from OpenStreetMap (OSM). This data will +will use ``osm2pgrouting`` to get the data from OpenStreetMap (OSM). This data will be used for exercises in further chapters. -.. contents:: Chapter Contents - -Work Directory for pgRouting data manipulation -=============================================================================== - -.. code-block:: bash - - mkdir ~/Desktop/workshop - cd ~/Desktop/workshop - -Mumbai database -=============================================================================== - -pgRouting is pre-installed as an extension which requires: +pgRouting is an extension which requires: * Supported PostgreSQL version * Supported PostGIS version @@ -39,6 +26,29 @@ instructions. Information about installing OSGeoLive can be found in procedure at this `link `__ +The database to install depends on the UN SDG chapter you are working on: + +.. list-table:: + :widths: 50 50 + :header-rows: 1 + + * - Chapter + - Database + * - :doc:`sdg3-health` + - `Mumbai database`_ + * - :doc:`sdg7-energy` + - `Mumbai database`_ + * - :doc:`sdg11-cities` + - `Bangladesh database`_ + +.. contents:: Chapter Contents + :depth: 2 + +Mumbai database +=============================================================================== + +.. contents:: Contents + :local: Create Mumbai database compatible with pgRouting ------------------------------------------------------------------------------- @@ -55,12 +65,12 @@ To connect to the database do the following psql mumbai -After connecting to the database, first step is to create ``EXTENSION`` to enable -pgRouting and PostGIS in the database. Then add the ``SCHEMA`` for each table. +After connecting to the database, the first step is to create ``EXTENSION`` to enable +pgRouting and PostGIS in the database. Then add the ``SCHEMA`` that are needed. -.. literalinclude:: ../scripts/un_sdg/sdg3/create_mumbai.sh - :start-after: -- Commands inside the database - :end-before: -- create_mumbai to-here +.. literalinclude:: ../scripts/get_data/setup_mumbai.sh + :start-after: setup_mumbai from-here + :end-before: setup_mumbai to-here :language: postgresql :linenos: @@ -69,8 +79,7 @@ Get the Mumbai Data The pgRouting workshop will make use of OpenStreetMap data of an area in Mumbai City. The instructions for downloading the data are given below. -Downloading Mumbai data from OSGeo -............................................................................... +.. rubric:: Downloading Mumbai data from OSGeo The following command is used to download the snapshot of the Mumbai area data used in this workshop, using the download service of OSGeo. @@ -84,20 +93,16 @@ used in this workshop, using the download service of OSGeo. :language: bash :linenos: -Downloading Mumbai data from OpenStreetMap (OSM) -............................................................................... -The following command is used to download the OpenStreetMap data of the area in Mumbai, India. - -OpenStreetMap data changes on a day to day basis, therefore if this data is used, -the results might change and some queries might need adjustments. -The command was used to take the snapshot of the data on June 2021. +The following command was used in June 2021 to download the OpenStreetMap data +of the area in Mumbai, India. -.. literalinclude:: ../scripts/un_sdg/sdg3/get_mumbai.sh - :start-after: get_mumbai from-here - :end-before: get_mumbai to-here - :language: bash +.. code-block:: bash :linenos: + CITY="mumbai" + BBOX="72.8263,19.1021,72.8379,19.1166" + wget --progress=dot:mega -O "$CITY.osm" "http://www.overpass-api.de/api/xapi?*[bbox=${BBOX}][@meta]" + Upload Mumbai data to the database ------------------------------------------------------------------------------- @@ -107,58 +112,74 @@ See :doc:`../appendix/appendix-3` for additional information about ``osm2pgrouti For this step the following is used: -* ``mumbai_buildings.xml`` and ``mumbai_roads.xml`` configuration files for osm2pgrouting. -* ``~/Desktop/workshop/mumbai.osm`` - OSM data from the previous step -* ``mumbai`` database. +* Configuration file: ``buildings.xml`` +* Configuration file: the default ``mapconfig.xml`` provided with ``osm2pgrouting`` -Contents of the configuration files are given in the `Appendix`_. Create a XML file -using these contents and save it into the root directory ``~/Desktop/workshop``. +Copy the ``buildings.xml`` configuration file. -Open a terminal window by ``ctrl-alt-t`` and move to the workshop directory by ``cd ~/Desktop/workshop``. -The following ``osm2pgrouting`` command will be used to convert the osm files to -pgRouting friendly format which we will use for further exercises. +.. collapse:: buildings.xml + + .. literalinclude:: ../scripts/get_data/buildings.xml + :language: xml Importing Mumbai Roads -............................................................................... +------------------------------------------------------------------------------- + +The following ``osm2pgrouting`` command will be used to import the +``mumbai.osm`` roads into a pgRouting compatible database. + +.. literalinclude:: ../scripts/get_data/setup_mumbai.sh + :start-after: import_roads from-here + :end-before: import_roads to-here + :language: bash + +.. collapse:: Output of the command + + .. literalinclude:: ../scripts/get_data/setup_mumbai.txt + :start-after: import_roads from-here + :end-before: import_roads to-here -The following ``osm2pgrouting`` command will be used to import the Roads -from OpenStreetMaps file to pgRouting database which we will use for further exercises. +Importing Mumbai Buildings +------------------------------------------------------------------------------- +The following ``osm2pgrouting`` command will be used to import the +``mumbai.osm`` buildings into a pgRouting compatible database. -.. literalinclude:: ../scripts/un_sdg/sdg3/import_mumbai_roads.sh - :start-after: from-here - :end-before: to-here +.. literalinclude:: ../scripts/get_data/setup_mumbai.sh + :start-after: import_buildings from-here + :end-before: import_buildings to-here :language: bash - :linenos: -.. note:: Depending on the osm2pgrouting version `-W password` is needed +.. collapse:: Output of the command -.. rubric:: Output: + .. literalinclude:: ../scripts/get_data/setup_mumbai.txt + :start-after: import_buildings from-here + :end-before: import_buildings to-here -.. literalinclude:: ../scripts/un_sdg/sdg3/import_mumbai_roads.txt - :linenos: +Compatibility with older osm2pgrouting versions (Mumbai) +------------------------------------------------------------------------------- +Check the installed version: -Importing Mumbai Buildings -............................................................................... +.. code-block:: bash -Similar to Roads, ``osm2pgrouting`` command will be used to import the Buildings -from OpenStreetMaps file to pgRouting database which we will use for further exercises. + osm2pgrouting --version +If you are using version 2.x, the column names differ from those used in this +workshop: -.. literalinclude:: ../scripts/un_sdg/sdg3/import_mumbai_buildings.sh - :start-after: from-here - :end-before: to-here - :language: bash - :linenos: +- ``gid`` instead of ``id`` +- ``the_geom`` instead of ``geom`` -.. note:: Depending on the osm2pgrouting version `-W password` is needed +Run the following script to rename them: -.. rubric:: Output: +.. collapse:: Script -.. literalinclude:: ../scripts/un_sdg/sdg3/import_mumbai_buildings.txt - :language: bash - :linenos: + .. literalinclude:: ../scripts/get_data/osm2pgrouting_compat_mumbai.sql + :language: postgresql + +Verify the data (Mumbai) +------------------------------------------------------------------------------- To connect to the database, type the following in the terminal. @@ -166,12 +187,37 @@ To connect to the database, type the following in the terminal. psql mumbai +The importance of counting the information on this workshop is to make sure that +the same data is used and consequently the results are same. + +.. literalinclude:: ../scripts/un_sdg/sdg3/sdg3.sql + :start-after: count1.txt + :end-before: count2.txt + :language: sql + +.. collapse:: Command output + + .. literalinclude:: ../scripts/un_sdg/sdg3/count1.txt + +.. literalinclude:: ../scripts/un_sdg/sdg3/sdg3.sql + :start-after: count2.txt + :end-before: skip1.txt + :language: sql + +.. collapse:: Command output + + .. literalinclude:: ../scripts/un_sdg/sdg3/count2.txt + +Continue with the workshop: + +- :doc:`sdg3-health` +- :doc:`sdg7-energy` Bangladesh database =============================================================================== -Now download the data for an area in Bangladesh by following the same steps like -that of Mumbai. +.. contents:: Contents + :local: Create Bangladesh area database compatible with pgRouting ------------------------------------------------------------------------------- @@ -189,10 +235,10 @@ To connect to the database do the following psql bangladesh -After connecting to the database, first step is to create ``EXTENSION`` to enable +After connecting to the database, the first step is to create ``EXTENSION`` to enable pgRouting and PostGIS in the database. Then add the ``SCHEMA`` for each table. -.. literalinclude:: ../scripts/un_sdg/sdg11/create_bangladesh.sh +.. literalinclude:: ../scripts/get_data/setup_bangladesh.sh :start-after: -- Commands inside the database :end-before: -- create_bangladesh to-here :language: postgresql @@ -201,8 +247,7 @@ pgRouting and PostGIS in the database. Then add the ``SCHEMA`` for each table. Get the Bangladesh Data ------------------------------------------------------------------------------- -Downloading Bangladesh data from OSGeo -............................................................................... +.. rubric:: Downloading Bangladesh data from OSGeo The following command is used to download the snapshot of the Bangladesh area data used in this workshop, using the download service of OSGeo. @@ -216,17 +261,19 @@ used in this workshop, using the download service of OSGeo. :language: bash :linenos: -Downloading Bangladesh data from OpenStreetMap -............................................................................... -The following command is used to download the OSM data of the area in Munshigang, -Bangladesh. +The following command was used in June 2021 to download the OpenStreetMap data +of the area in Munshigang, Bangladesh. -.. literalinclude:: ../scripts/un_sdg/sdg11/get_bangladesh.sh - :start-after: get_bangladesh from-here - :end-before: get_bangladesh to-here - :language: bash +.. code-block:: bash :linenos: + CITY="bangladesh" + BBOX="88.9515,22.2192,89.3806,22.4310" + wget --progress=dot:mega -O "$CITY.osm" "http://www.overpass-api.de/api/xapi?*[bbox=${BBOX}][@meta]" + + osmconvert --drop-author --drop-version bangladesh.osm -o=bangladesh_pass1.osm + osmfilter bangladesh_pass1.osm -o=bangladesh.osm --drop="highway= building=" + Upload Bangladesh data to the database ------------------------------------------------------------------------------- @@ -236,58 +283,65 @@ See :doc:`../appendix/appendix-3` for additional information about ``osm2pgrouti For this step the following is used: -* ``waterways.xml`` configuration file +* Configuration file: ``waterways.xml`` * ``~/Desktop/workshop/bangladesh.osm`` - OSM data from the previous step * ``bangladesh`` database -Contents of the configuration files are given in the `Appendix`_. Create a XML file -using these contents and save it into the root directory ``~/Desktop/workshop``. +Copy the ``waterways.xml`` configuration file. -Open a terminal window by ``ctrl-alt-t`` and move to the workshop directory by ``cd ~/Desktop/workshop``. +.. collapse:: waterways.xml + .. literalinclude:: ../scripts/get_data/waterways.xml + :language: xml Importing Bangladesh Waterways -............................................................................... +------------------------------------------------------------------------------- The following ``osm2pgrouting`` command will be used to import the Waterways -from OpenStreetMaps file to pgRouting database which we will use for further exercises. +from the OpenStreetMap file to the pgRouting database which we will use for further exercises. -.. literalinclude:: ../scripts/un_sdg/sdg11/import_bangladesh_waterways.sh - :start-after: from-here - :end-before: to-here +.. literalinclude:: ../scripts/get_data/setup_bangladesh.sh + :start-after: import_bangladesh_waterways from-here + :end-before: import_bangladesh_waterways to-here :language: bash - :linenos: -.. note:: Depending on the osm2pgrouting version `-W password` is needed +.. collapse:: Output of the command -.. rubric:: Output: + .. literalinclude:: ../scripts/get_data/setup_bangladesh.txt + :start-after: import_bangladesh_waterways from-here + :end-before: import_bangladesh_waterways to-here -.. literalinclude:: ../scripts/un_sdg/sdg11/import_bangladesh_waterways.txt - :language: bash - :linenos: +Compatibility with older osm2pgrouting versions (Bangladesh) +------------------------------------------------------------------------------- -To connect to the database, type the following in the terminal. +Check the installed version: .. code-block:: bash - psql bangladesh + osm2pgrouting --version +If you are using version 2.x, the column names differ from those used in this +workshop: +- ``gid`` instead of ``id`` +- ``the_geom`` instead of ``geom`` -Appendix -=============================================================================== +Run the following script to rename them: -Configuration information for Buildings +.. collapse:: Script + + .. literalinclude:: ../scripts/get_data/osm2pgrouting_compat_bangladesh.sql + :language: postgresql + +Verify the data (Bangladesh) ------------------------------------------------------------------------------- -.. literalinclude:: ../scripts/un_sdg/sdg3/buildings.xml - :language: xml - :linenos: +To connect to the database, type the following in the terminal. +.. code-block:: bash -Configuration information for Waterways -------------------------------------------------------------------------------- + psql bangladesh -.. literalinclude:: ../scripts/un_sdg/sdg3/waterways.xml - :language: xml - :linenos: +Continue with the workshop: + +- :doc:`sdg11-cities` diff --git a/docs/un_sdg/sdg11-cities.rst b/docs/un_sdg/sdg11-cities.rst index c389e6af2..2f304715d 100644 --- a/docs/un_sdg/sdg11-cities.rst +++ b/docs/un_sdg/sdg11-cities.rst @@ -65,7 +65,7 @@ Exercise 1: Create a point for the city .. rubric:: Create a table for the cities -.. literalinclude:: ../scripts/un_sdg/sdg11/all_exercises_sdg11.sql +.. literalinclude:: ../scripts/un_sdg/sdg11/sdg11.sql :start-after: create_city1.txt :end-before: create_city2.txt :language: sql @@ -76,7 +76,7 @@ Exercise 1: Create a point for the city .. rubric:: Insert Munshigang -.. literalinclude:: ../scripts/un_sdg/sdg11/all_exercises_sdg11.sql +.. literalinclude:: ../scripts/un_sdg/sdg11/sdg11.sql :start-after: create_city2.txt :end-before: create_city3.txt :language: sql @@ -87,7 +87,7 @@ Exercise 1: Create a point for the city .. rubric:: Simulate the city region with a buffer -.. literalinclude:: ../scripts/un_sdg/sdg11/all_exercises_sdg11.sql +.. literalinclude:: ../scripts/un_sdg/sdg11/sdg11.sql :start-after: create_city3.txt :end-before: create_city4.txt :language: sql @@ -98,7 +98,7 @@ Exercise 1: Create a point for the city .. rubric:: See description of the table -.. literalinclude:: ../scripts/un_sdg/sdg11/all_exercises_sdg11.sql +.. literalinclude:: ../scripts/un_sdg/sdg11/sdg11.sql :start-after: create_city4.txt :end-before: set_path.txt @@ -126,7 +126,7 @@ First step in pre processing is to set the search path for ``Waterways`` data. Search path is a list of schemas that helps the system determine how a particular table is to be imported. -.. literalinclude:: ../scripts/un_sdg/sdg11/all_exercises_sdg11.sql +.. literalinclude:: ../scripts/un_sdg/sdg11/sdg11.sql :start-after: set_path.txt :end-before: get_extensions.txt :language: sql @@ -143,7 +143,7 @@ As part of the every project tasks: inspect the database structure. .. rubric:: Get the extensions that are installed -.. literalinclude:: ../scripts/un_sdg/sdg11/all_exercises_sdg11.sql +.. literalinclude:: ../scripts/un_sdg/sdg11/sdg11.sql :start-after: get_extensions.txt :end-before: get_tables.txt @@ -153,7 +153,7 @@ As part of the every project tasks: inspect the database structure. .. rubric:: List installed tables -.. literalinclude:: ../scripts/un_sdg/sdg11/all_exercises_sdg11.sql +.. literalinclude:: ../scripts/un_sdg/sdg11/sdg11.sql :start-after: get_tables.txt :end-before: exercise_6.txt @@ -169,7 +169,7 @@ the same data is used and consequently the results are same. Also, some of the rows can be seen to understand the structure of the table and how the data is stored in it. -.. literalinclude:: ../scripts/un_sdg/sdg11/all_exercises_sdg11.sql +.. literalinclude:: ../scripts/un_sdg/sdg11/sdg11.sql :start-after: exercise_6.txt :end-before: delete1.txt :language: sql @@ -195,11 +195,11 @@ Exercise 5: Remove waterways not for the problem This exercise focusses only the areas in the mainland, where if it rains the city is affected. Hence, the rivers which are there in the swamp area wich is in a lower -altitude of the city, are to be removed from the ``waterways_ways`` table. +altitude of the city, are to be removed from the ``waterways.ways`` table. .. rubric:: Remove swamp rivers -.. literalinclude:: ../scripts/un_sdg/sdg11/all_exercises_sdg11.sql +.. literalinclude:: ../scripts/un_sdg/sdg11/sdg11.sql :start-after: delete1.txt :end-before: delete2.txt :language: sql @@ -213,7 +213,7 @@ altitude of the city, are to be removed from the ``waterways_ways`` table. .. rubric:: Also delete a boundary tagged as waterway -.. literalinclude:: ../scripts/un_sdg/sdg11/all_exercises_sdg11.sql +.. literalinclude:: ../scripts/un_sdg/sdg11/sdg11.sql :start-after: delete2.txt :end-before: only_connected1.txt :language: sql @@ -229,7 +229,7 @@ Exercise 6: Get the Connected Components of Waterways As the rivers in the data are not having single edges, i.e, multiple edges make up a river, it is important to find out the connected edges and store the information -in the ``waterways_ways`` table. This will help us to identify which edges belong to +in the ``waterways.ways`` table. This will help us to identify which edges belong to a river. First, the connected components are found and then stored in a new column named ``component``. @@ -238,13 +238,13 @@ and its explaind with more detail in :doc:`../basic/graphs`. A sub-query is created to find out all the connected components. After that, the ``component`` column is updated using the results obtained from the sub-query. -This helps in storing the component id in the ``waterways_ways_vertices_pgr`` table. -Next query uses this output and stores the component id in the waterways_ways +This helps in storing the component id in the ``waterways.waterway_vertices`` table. +Next query uses this output and stores the component id in the waterways.ways (edges) table. Follow the steps given below to complete this task. .. rubric:: Create a vertices table. -.. literalinclude:: ../scripts/un_sdg/sdg11/all_exercises_sdg11.sql +.. literalinclude:: ../scripts/un_sdg/sdg11/sdg11.sql :start-after: only_connected1.txt :end-before: only_connected2.txt :language: sql @@ -255,7 +255,7 @@ Next query uses this output and stores the component id in the waterways_ways .. rubric:: Fill up the ``x``, ``y`` and ``geom`` columns. -.. literalinclude:: ../scripts/un_sdg/sdg11/all_exercises_sdg11.sql +.. literalinclude:: ../scripts/un_sdg/sdg11/sdg11.sql :start-after: only_connected2.txt :end-before: only_connected3.txt :language: sql @@ -266,7 +266,7 @@ Next query uses this output and stores the component id in the waterways_ways .. rubric:: Add a ``component`` column on the edges and vertices tables. -.. literalinclude:: ../scripts/un_sdg/sdg11/all_exercises_sdg11.sql +.. literalinclude:: ../scripts/un_sdg/sdg11/sdg11.sql :start-after: only_connected3.txt :end-before: only_connected4.txt :language: sql @@ -277,7 +277,7 @@ Next query uses this output and stores the component id in the waterways_ways .. rubric:: Fill up the ``component`` column on the vertices table. -.. literalinclude:: ../scripts/un_sdg/sdg11/all_exercises_sdg11.sql +.. literalinclude:: ../scripts/un_sdg/sdg11/sdg11.sql :start-after: only_connected4.txt :end-before: only_connected5.txt :language: sql @@ -288,7 +288,7 @@ Next query uses this output and stores the component id in the waterways_ways .. rubric:: Fill up the ``component`` column on the edges table. -.. literalinclude:: ../scripts/un_sdg/sdg11/all_exercises_sdg11.sql +.. literalinclude:: ../scripts/un_sdg/sdg11/sdg11.sql :start-after: only_connected5.txt :end-before: exercise_10.txt :language: sql @@ -299,7 +299,7 @@ Exercise 7: Creating a function that gets the city buffer A function can be created for the same task. This will be help when the table has more than one city. -.. literalinclude:: ../scripts/un_sdg/sdg11/all_exercises_sdg11.sql +.. literalinclude:: ../scripts/un_sdg/sdg11/sdg11.sql :start-after: exercise_10.txt :end-before: exercise_11.txt :language: sql @@ -318,7 +318,7 @@ the city. These are the waterways which will affect the city when it rains aroun them. This is done using ``ST_Intersects``. Note that ``get_city_buffer`` function is used in the query below. -.. literalinclude:: ../scripts/un_sdg/sdg11/all_exercises_sdg11.sql +.. literalinclude:: ../scripts/un_sdg/sdg11/sdg11.sql :start-after: exercise_11.txt :end-before: get_rain_zone1.txt :language: sql @@ -340,7 +340,7 @@ city would be affected, is calculated. This area is called ``rain zone`` in the Create a Buffer around the river components. -- Add columns named ``rain_zone`` in waterways_ways +- Add columns named ``rain_zone`` in waterways.ways - To store buffer geometry of the rain zones. @@ -349,7 +349,7 @@ Create a Buffer around the river components. .. rubric:: Adding column to store Buffer geometry -.. literalinclude:: ../scripts/un_sdg/sdg11/all_exercises_sdg11.sql +.. literalinclude:: ../scripts/un_sdg/sdg11/sdg11.sql :start-after: get_rain_zone1.txt :end-before: get_rain_zone2.txt :language: sql @@ -360,7 +360,7 @@ Create a Buffer around the river components. .. rubric:: Storing Buffer geometry -.. literalinclude:: ../scripts/un_sdg/sdg11/all_exercises_sdg11.sql +.. literalinclude:: ../scripts/un_sdg/sdg11/sdg11.sql :start-after: get_rain_zone2.txt :end-before: exercise_13.txt :language: sql @@ -382,7 +382,7 @@ will give a single polygon as the output. When it rains in the vicinity, the city will get affected by the rain. -.. literalinclude:: ../scripts/un_sdg/sdg11/all_exercises_sdg11.sql +.. literalinclude:: ../scripts/un_sdg/sdg11/sdg11.sql :start-after: exercise_13.txt :end-before: \o :language: sql diff --git a/docs/un_sdg/sdg3-health.rst b/docs/un_sdg/sdg3-health.rst index 40d5f8ed6..66dc8d1f9 100644 --- a/docs/un_sdg/sdg3-health.rst +++ b/docs/un_sdg/sdg3-health.rst @@ -5,6 +5,12 @@ Good Health and Well Being ############################################################################### +.. image:: images/sdg3/un_sdg3.png + :align: center + :alt: Sustainable Development Goal 3: Good Health and Well Being + +`Image Source `__ + `Good Health and Well Being` is the 3rd Sustainable Development Goal which aspires to ensure health and well-being for all, including a bold commitment to end the epidemics like AIDS, tuberculosis, malaria and other communicable diseases by 2030. @@ -18,12 +24,6 @@ the number of dependant people living near the hospital for better planning whic would ultimately help in achieving universal coverage of health services. This chapter will focus on solving one of such problems. -.. image:: images/sdg3/un_sdg3.png - :align: center - :alt: Sustainable Development Goal 3: Good Health and Well Being - -`Image Source `__ - .. contents:: Chapter Contents Problem: Estimation of Population Served by Hospitals @@ -31,7 +31,7 @@ Problem: Estimation of Population Served by Hospitals **Problem Statement** -To determine the population served by a hospital based on travel time +Determine the population served by a hospital based on walking travel time. **Core Idea** @@ -40,22 +40,37 @@ time is dependant on that hospital. **Approach** -* To prepare a dataset with: +* Get the data of + + - Roads + - Buildings - - Edges: Roads - - Polygons: Buildings with population +* Small analysis of the database. +* Simulate census data. +* Remove disconnected roads from the graph. +* Estimate the population living on the buildings. -* Find the travel-time based the roads served -* Estimate the population of the buildings -* Find the nearest road to the buildings -* Store the sum of population of nearest buildings in roads table -* Find the sum of population on all the roads in the roads served + * Find the nearest road to the buildings. + +* Estimate the population living on the roads. +* Calculate the walking travel time from a road to a hospital. +* Calculate the population within 10 mintues waking to a location. + +First step is to prepare the data obtained from :doc:`data`. + +Follow the instructions in :doc:`data` to create and populate the ``mumbai`` +database. + +Following image shows the roads and buildings. + +.. image:: images/sdg3/roads_and_buildings.png + :align: center + :scale: 50% PostreSQL basics ================================================================================ Preparing work area -------------------------------------------------------------------------------- The ``search_path`` is a variable that determines the order in which database schemas are searched for objects. @@ -64,12 +79,12 @@ By setting the ``search_path`` to appropriate values, prepending the schema name to tables can be avoided. Exercise 1: Inspecting schemas -............................................................................... +------------------------------------------------------------------------------- Inspect the schemas by displaying all the present schemas using the following command -.. literalinclude:: ../scripts/un_sdg/sdg3/all_exercises_sdg3.sql +.. literalinclude:: ../scripts/un_sdg/sdg3/sdg3.sql :start-after: show_schemas.txt :end-before: show_path1.txt @@ -81,11 +96,11 @@ The schema names are ``buildings``, ``roads`` and ``public``. The owner depends on who has the rights to the database. Exercise 2: Inspecting the search path -............................................................................... +------------------------------------------------------------------------------- Display the current search path using the following query. -.. literalinclude:: ../scripts/un_sdg/sdg3/all_exercises_sdg3.sql +.. literalinclude:: ../scripts/un_sdg/sdg3/sdg3.sql :start-after: show_path1.txt :end-before: set_path.txt :language: sql @@ -97,37 +112,39 @@ Display the current search path using the following query. This is the current search path. Tables in other schemas cannot be accessed with this path. -Exercise 3: Fixing the search path -............................................................................... +Exercise 3: Adjusting the search path +------------------------------------------------------------------------------- In this case, the search path needs to include ``roads`` and ``buildings`` schemas. The following query is used to adjust the search path. -.. literalinclude:: ../scripts/un_sdg/sdg3/all_exercises_sdg3.sql +.. literalinclude:: ../scripts/un_sdg/sdg3/sdg3.sql :start-after: set_path.txt :end-before: show_path2.txt + :language: sql .. collapse:: Command output - .. literalinclude:: ../scripts/un_sdg/sdg3/set_path.txt + .. literalinclude:: ../scripts/un_sdg/sdg3/set_path.txt Checking the search path again -.. literalinclude:: ../scripts/un_sdg/sdg3/all_exercises_sdg3.sql - :start-after: show_path2.txt - :end-before: enumerate_tables.txt +.. literalinclude:: ../scripts/un_sdg/sdg3/sdg3.sql + :start-after: show_path2.txt + :end-before: enumerate_tables.txt + :language: sql .. collapse:: Command output - .. literalinclude:: ../scripts/un_sdg/sdg3/show_path2.txt + .. literalinclude:: ../scripts/un_sdg/sdg3/show_path2.txt Exercise 4: Enumerating tables -............................................................................... +------------------------------------------------------------------------------- With ``\dt`` the tables are listed showing the schema and the owner -.. literalinclude:: ../scripts/un_sdg/sdg3/all_exercises_sdg3.sql +.. literalinclude:: ../scripts/un_sdg/sdg3/sdg3.sql :start-after: enumerate_tables.txt :end-before: count1.txt @@ -135,169 +152,15 @@ With ``\dt`` the tables are listed showing the schema and the owner .. literalinclude:: ../scripts/un_sdg/sdg3/enumerate_tables.txt -Preparing roads and buildings data +Simulation of census data ================================================================================ -First step is to prepare the data obtained from :doc:`data`. - -This section will work the graph and data that is going to be used for processing. -While building the graph, the data has to be inspected to determine if there is any -invalid data. -This is a very important step to make sure that the data is of -required quality. -pgRouting can also be used to do some Data Adjustments. - -Exercise 5: Counting the number of roads and buildings --------------------------------------------------------------------------------- - -The importance of counting the information on this workshop is to make sure that -the same data is used and consequently the results are same. -Also, some of the rows can be seen to understand the structure of the table and -how the data is stored in it. - -.. literalinclude:: ../scripts/un_sdg/sdg3/all_exercises_sdg3.sql - :start-after: count1.txt - :end-before: count2.txt - :language: sql - -.. collapse:: Command output - - .. literalinclude:: ../scripts/un_sdg/sdg3/count1.txt - -.. literalinclude:: ../scripts/un_sdg/sdg3/all_exercises_sdg3.sql - :start-after: count2.txt - :end-before: clean_buildings.txt - :language: sql - -.. collapse:: Command output - - .. literalinclude:: ../scripts/un_sdg/sdg3/count2.txt - -Following image shows the roads and buildings visualised. - -.. image:: images/sdg3/roads_and_buildings.png - :align: center - :scale: 50% - -Preprocessing Buildings --------------------------------------------------------------------------------- - -The table ``buildings_ways`` contains the buildings in ``LINGSTING`` type. -They have to be converted into polygons to get the area, as the area is going to -be used to get an estimate of the population living in the building. - -Exercise 6: Removing columns -............................................................................... - -Columns can be deleted from a table. In this case instead of creating a view, -columns that are not related to a **buidling** concept are dropped from -``buildings_ways``. - -.. literalinclude:: ../scripts/un_sdg/sdg3/all_exercises_sdg3.sql - :start-after: clean_buildings.txt - :end-before: exercise_6.txt - :language: sql - -.. collapse:: Command output - - .. literalinclude:: ../scripts/un_sdg/sdg3/clean_buildings.txt - - -Exercise 7: Add a spatial column to the table -............................................................................... - -Add a spatial column named ``poly_geom`` to the table ``buildings_ways`` to store -the Polygon Geometry - -.. literalinclude:: ../scripts/un_sdg/sdg3/all_exercises_sdg3.sql - :start-after: exercise_6.txt - :end-before: buildings_description.txt - :language: sql - -.. collapse:: Query Results - - .. literalinclude:: ../scripts/un_sdg/sdg3/exercise_6.txt - -Inspecting the table: - -.. literalinclude:: ../scripts/un_sdg/sdg3/all_exercises_sdg3.sql - :start-after: buildings_description.txt - :end-before: exercise_7.txt - -.. collapse:: Table structure - - .. literalinclude:: ../scripts/un_sdg/sdg3/buildings_description.txt - -Exercise 8: Removing the polygons with less than 4 points -............................................................................... - -``ST_NumPoints`` is used to find the number of points on a geometry. Also, polygons -with less than 3 points/vertices are not considered valid polygons in PostgreSQL. -Hence, the buildings having less than 3 vertices need to be cleaned up. Follow -the steps given below to complete this task. - -.. literalinclude:: ../scripts/un_sdg/sdg3/all_exercises_sdg3.sql - :start-after: exercise_7.txt - :end-before: exercise_8.txt - :language: sql - -.. collapse:: Query Results - - .. literalinclude:: ../scripts/un_sdg/sdg3/exercise_7.txt - -Exercise 9: Creating the polygons -............................................................................... - -``ST_MakePolygons`` is used to make the polygons. This step stores the geometry of -polygons in the ``poly_geom`` column which was created earlier. - -.. literalinclude:: ../scripts/un_sdg/sdg3/all_exercises_sdg3.sql - :start-after: exercise_8.txt - :end-before: add_area_col.txt - :language: sql - :linenos: - -.. collapse:: Query Results - - .. literalinclude:: ../scripts/un_sdg/sdg3/exercise_8.txt - -Exercise 10: Calculating the area -............................................................................... - -After getting the polygon geometry, next step is to find the area of the polygons. -Follow the steps given below to complete this task. - -1. Adding a column for storing the area - -.. literalinclude:: ../scripts/un_sdg/sdg3/all_exercises_sdg3.sql - :start-after: add_area_col.txt - :end-before: get_area.txt - :language: sql - -2. Storing the area in the new column - -``ST_Area`` is used to calculate area of polygons. Area is stored in the -new column - -.. literalinclude:: ../scripts/un_sdg/sdg3/all_exercises_sdg3.sql - :start-after: get_area.txt - :end-before: kind_of_buildings.txt - :language: sql - -.. collapse:: Query Results - - .. literalinclude:: ../scripts/un_sdg/sdg3/get_area.txt - -Exercise 11: Estimating the population -............................................................................... - -Due to the lack of census data, this exercise will fill up and estimate of the -population living on the buildings, based on the area of the building and the -kind of use the building gets. +Due to the lack of census data, this exercise will estimate the population, +based on the area size of the building and the kind of use the building gets. Buildings of OpenStreetMap data are classified into various categories. -.. literalinclude:: ../scripts/un_sdg/sdg3/all_exercises_sdg3.sql +.. literalinclude:: ../scripts/un_sdg/sdg3/sdg3.sql :start-after: kind_of_buildings.txt :end-before: population_function.txt :language: sql @@ -312,7 +175,7 @@ For this exercise, the population will be set as follows: - Negligible: - People do not live in these places. - - Population: 1 person + - Population: 1 person. - There may be people guarding the place. @@ -348,54 +211,63 @@ For this exercise, the population will be set as follows: - A large sized residential building, like ``apartments``. - Population: At least 10 persons. +Exercise 5: Estimating the population +------------------------------------------------------------------------------- +Each density class has a **class-specific factor** that represents how many +people per square meter are expected (e.g., 0.0002 for Very Sparse, 1.0 for +Very Dense). This factor is multiplied by a building's area to estimate its +population, with a minimum floor per class. -Reference: :ref:`un_sdg/data:Appendix` +For example: -This class-specific factor is multiplied with the area of each building to get -the population. Follow the steps given below to complete this task. +- Very Dense -1. Create a function to find population using class-specific factor and area. + - A large sized residential building, like ``apartments``. + - Population: At least 10 persons. -.. literalinclude:: ../scripts/un_sdg/sdg3/all_exercises_sdg3.sql - :start-after: population_function.txt - :end-before: add_population_col.txt - :language: sql - :force: +Each class has a specific numeric factor (visible in the SQL function below) +that scales the building area to estimate the number of residents. -.. collapse:: Query Results +This class specific factor is multiplied with the area of each building to get +the population. Follow the steps given below to complete this task. - .. literalinclude:: ../scripts/un_sdg/sdg3/population_function.txt +.. rubric:: Create a function to find population using class-specific factor and area. -.. note:: All these are estimations based on this particular area. More complicated - functions can be done that consider height of the apartments but the - design of a function is going to depend on the availability of the data. - For example, using census data can achieve more accurate estimation. +.. literalinclude:: ../scripts/un_sdg/sdg3/sdg3.sql + :start-after: population_function.txt + :end-before: show_population_100.txt + :language: postgresql -2. Add a column for storing the population in the ``buildings_ways`` +.. rubric:: Testing the function with 100 square meters buildings. -.. literalinclude:: ../scripts/un_sdg/sdg3/all_exercises_sdg3.sql - :start-after: add_population_col.txt - :end-before: get_population.txt - :language: sql +.. literalinclude:: ../scripts/un_sdg/sdg3/sdg3.sql + :start-after: show_population_100.txt + :end-before: show_population_300.txt + :language: sql .. collapse:: Query Results - .. literalinclude:: ../scripts/un_sdg/sdg3/add_population_col.txt + .. literalinclude:: ../scripts/un_sdg/sdg3/show_population_100.txt -3. Use the ``population`` function to store the population in the new column created -in the ``building_ways``. +.. rubric:: Testing the function with 300 square meters buildings. -.. literalinclude:: ../scripts/un_sdg/sdg3/all_exercises_sdg3.sql - :start-after: get_population.txt - :end-before: only_connected1.txt - :language: sql +.. literalinclude:: ../scripts/un_sdg/sdg3/sdg3.sql + :start-after: show_population_300.txt + :end-before: show_schemas.txt + :language: sql .. collapse:: Query Results - .. literalinclude:: ../scripts/un_sdg/sdg3/get_population.txt + .. literalinclude:: ../scripts/un_sdg/sdg3/show_population_300.txt + +.. note:: More complicated estimation functions can be done that consider height + of the apartments. + + Using census data can achieve more accurate estimation. + +Preparing roads information +================================================================================ -Preprocessing Roads --------------------------------------------------------------------------------- pgRouting algorithms are only useful when the road network belongs to a single graph (or all the roads are connected to each other). Hence, the disconnected roads have to be removed from their network to get appropriate results. @@ -410,107 +282,235 @@ the network. Hence they will have same connected component number. But the count of this number will be less count of fully connected network. All the edges with the component number with count less than maximum count will be removed -Follow the steps given below to complete this task. +Disconnected road segments are unreachable from the main network. If they are +kept, routing queries like ``pgr_drivingDistance`` or ``pgr_dijkstra`` will +either fail to find paths on those segments or produce misleading +results (e.g., infinite cost, no path found). -Exercise 12: Remove disconnected components -............................................................................... +Removing them ensures that every building in the network is reachable and that +population-serving analysis works correctly. + +Once each road segment has a component identifier, you can isolate the main +network by keeping only the component with the highest edge count. A new table +(or view) can be created that contains just those edges, discarding all +unreachable segments in one step. + +Exercise 6: Calculate the components of the roads +------------------------------------------------------------------------------- To remove the disconnected components on the road network, the following -pgRouting functions, discussed on :doc:`../basic/graphs`, will be used: +pgRouting functions, discussed on :doc:`../basic/graphs` chapter, will be used: * ``pgr_extractVertices`` * ``pgr_connectedComponents`` -.. rubric:: Create a vertices table. +.. rubric:: Add a components column. -.. literalinclude:: ../scripts/un_sdg/sdg3/all_exercises_sdg3.sql - :start-after: only_connected1.txt - :end-before: only_connected2.txt - :language: sql +.. literalinclude:: ../scripts/un_sdg/sdg3/sdg3.sql + :start-after: only_connected0.txt + :end-before: only_connected1.txt + :language: sql -.. collapse:: Query Results +.. rubric:: Create a vertices table. - .. literalinclude:: ../scripts/un_sdg/sdg3/only_connected1.txt +.. literalinclude:: ../scripts/un_sdg/sdg3/sdg3.sql + :start-after: only_connected1.txt + :end-before: only_connected2.txt + :language: sql + :force: .. rubric:: Fill up the ``x``, ``y`` and ``geom`` columns. -.. literalinclude:: ../scripts/un_sdg/sdg3/all_exercises_sdg3.sql +.. literalinclude:: ../scripts/un_sdg/sdg3/sdg3.sql :start-after: only_connected2.txt :end-before: only_connected3.txt :language: sql + :force: -.. collapse:: Query Results - - .. literalinclude:: ../scripts/un_sdg/sdg3/only_connected2.txt - -.. rubric:: Add a ``component`` column on the edges and vertices tables. +.. rubric:: Fill up the ``component`` column on the vertices table. -.. literalinclude:: ../scripts/un_sdg/sdg3/all_exercises_sdg3.sql +.. literalinclude:: ../scripts/un_sdg/sdg3/sdg3.sql :start-after: only_connected3.txt :end-before: only_connected4.txt :language: sql + :force: -.. collapse:: Query Results - - .. literalinclude:: ../scripts/un_sdg/sdg3/only_connected3.txt - -.. rubric:: Fill up the ``component`` column on the vertices table. +.. rubric:: Fill up the ``component`` column on the edges table. -.. literalinclude:: ../scripts/un_sdg/sdg3/all_exercises_sdg3.sql +.. literalinclude:: ../scripts/un_sdg/sdg3/sdg3.sql :start-after: only_connected4.txt :end-before: only_connected5.txt :language: sql + :force: -.. collapse:: Query Results +Exercise 7: Create a roads_net table. +------------------------------------------------------------------------------- - .. literalinclude:: ../scripts/un_sdg/sdg3/only_connected4.txt +The ``roads_net`` table stores road edges with travel costs in **minutes**, +assuming a walking speed of **1 m/s**. -.. rubric:: Fill up the ``component`` column on the edges table. +Since :math:`time = distance / speed`: + +* :math:`time = length\_m / 1\ m/s` + +This gives time in **seconds**. To convert to **minutes**, divide by 60: + +* :math:`time = length\_m / 60` -.. literalinclude:: ../scripts/un_sdg/sdg3/all_exercises_sdg3.sql +.. rubric:: Create roads_net with only the largest component + +This query creates the ``roads_net`` table by keeping only edges belonging to +the most connected component. + +* It calculates travel cost as ``length_m / 60`` (seconds converted to minutes + at 1 m/s) and +* initializes the population column as ``NULL`` for later population of the roads. + +.. literalinclude:: ../scripts/un_sdg/sdg3/sdg3.sql :start-after: only_connected5.txt :end-before: only_connected6.txt :language: sql + :force: -.. collapse:: Query Results +.. rubric:: Delete vertices not belonging to the most connected component. - .. literalinclude:: ../scripts/un_sdg/sdg3/only_connected5.txt +Once ``roads_net`` is filtered to only the largest connected component, the +``vertices`` table still contains vertices from the discarded components. -.. rubric:: Get the component number with the most number of edges. +These orphan vertices have no edges in ``roads_net``, so they are useless for +routing and would pollute nearest-vertex lookups. Deleting them keeps the vertex +table consistent with the trimmed network. -.. literalinclude:: ../scripts/un_sdg/sdg3/all_exercises_sdg3.sql +.. literalinclude:: ../scripts/un_sdg/sdg3/sdg3.sql :start-after: only_connected6.txt - :end-before: only_connected7.txt + :end-before: building_road.txt :language: sql + :force: -.. collapse:: Query Results - .. literalinclude:: ../scripts/un_sdg/sdg3/only_connected6.txt +Preparing buildings population information +================================================================================ -.. rubric:: Delete edges not belonging to the most connected component. +This section links buildings to the road network and estimates their population. -.. literalinclude:: ../scripts/un_sdg/sdg3/all_exercises_sdg3.sql - :start-after: only_connected7.txt - :end-before: only_connected8.txt - :language: sql +* First, functions are created to find the nearest road and vertex for each + building. +* Then building geometries are converted from ``LINESTRING`` to polygons to + calculate area, which feeds the ``population`` function. +* Finally, the estimated population is aggregated onto the road segments. -.. collapse:: Query Results +Exercise 8: Get the nearest road to a building +-------------------------------------------------------------------------------- - .. literalinclude:: ../scripts/un_sdg/sdg3/only_connected7.txt +.. rubric:: Create the building_road function -.. rubric:: Delete vertices not belonging to the most connected component. +This function finds the closest road edge to a building using PostGIS' +spatial distance operator (``<->``). It returns the ``id`` of the nearest +edge from ``roads_net``, which is later used to link each building to the +road network. + +.. literalinclude:: ../scripts/un_sdg/sdg3/sdg3.sql + :start-after: building_road.txt + :end-before: test_building_road.txt + :language: sql + :force: + +.. rubric:: Test the function + +.. literalinclude:: ../scripts/un_sdg/sdg3/sdg3.sql + :start-after: test_building_road.txt + :end-before: clean_buildings.txt + :language: sql + :force: -.. literalinclude:: ../scripts/un_sdg/sdg3/all_exercises_sdg3.sql - :start-after: only_connected8.txt - :end-before: nearest_vertex1.txt +.. collapse:: Query results + + .. literalinclude:: ../scripts/un_sdg/sdg3/test_building_road.txt + +Exercise 9: Find the closest road vertex +-------------------------------------------------------------------------------- + +There are multiple road vertices near the hospital. Create a function to find +the geographically closest road vertex. ``get_vertex`` function takes a geometry +as input and returns the id of the closest vertex by comparing ``geom`` of both +tables. + +.. image:: images/sdg3/finding_closest_vertex.png + :align: center + :scale: 50% + +.. rubric:: Create the get_vertex function + +This function finds the closest road vertex to a building + +* Using PostGIS' spatial distance operator (``<->``). +* Returns the ``id`` of the nearest vertex from the ``vertices`` table, + + - Used as the start point for ``pgr_drivingDistance`` queries. + +.. literalinclude:: ../scripts/un_sdg/sdg3/sdg3.sql + :start-after: nearest_vertex.txt + :end-before: test_nearest_vertex.txt + :language: sql + :force: + +.. rubric:: Test the function + +.. literalinclude:: ../scripts/un_sdg/sdg3/sdg3.sql + :start-after: test_nearest_vertex.txt + :end-before: clean_buildings.txt :language: sql + :force: .. collapse:: Query Results - .. literalinclude:: ../scripts/un_sdg/sdg3/only_connected8.txt + .. literalinclude:: ../scripts/un_sdg/sdg3/test_nearest_vertex.txt + +Exercise 10: Create the buildings table +-------------------------------------------------------------------------------- + +A ``buildings`` table is created for efficient access throughout the remaining +exercises. + +.. rubric:: The query + +* converts ``LINESTRING`` geometries to ``Polygon``, +* calculates the area using ``ST_Area``, +* and estimates population using the ``population`` function. + +.. rubric:: The result + +* Is stored in the ``buildings`` table. + +.. literalinclude:: ../scripts/un_sdg/sdg3/sdg3.sql + :start-after: clean_buildings.txt + :end-before: roads_population.txt + :language: sql + :force: + +Exercise 11: Storing the population in the roads +-------------------------------------------------------------------------------- + +After finding the nearest road, the sum of population of all the nearest +buildings is stored in the population column of the roads table. Following image +shows the visualised output where the blue colour labels shows the population +stored in roads. + +.. image:: images/sdg3/road_population.png + :align: center + :scale: 50% + +.. rubric:: Update the population of the roads. + +.. literalinclude:: ../scripts/un_sdg/sdg3/sdg3.sql + :start-after: roads_population.txt + :end-before: served_roads.txt + :language: sql + :force: Find the roads served by the hospitals ================================================================================ + After pre-processing the data, next step is to find the area served by the hospital. This area can be computed from the entrance of the hospital or from any point on road near the hospital. In this exercise it is computed from closest @@ -539,90 +539,32 @@ conform to the corresponding spanning tree. `pgr_drivingDistance Documentation `__ can be found at this link for more information. -Exercise 13: Find the closest road vertex --------------------------------------------------------------------------------- -There are multiple road vertices near the hospital. Create a function to find -the geographically closest road vertex. ``closest_vertex`` function takes geometry -of other table as input and gives the gid of the closest vertex as output by -comparing ``geom`` of both the tables. - -.. image:: images/sdg3/finding_closest_vertex.png - :align: center - :scale: 50% - -The following query creates a function to find the closest road vertex. - -.. literalinclude:: ../scripts/un_sdg/sdg3/all_exercises_sdg3.sql - :start-after: nearest_vertex1.txt - :end-before: nearest_vertex2.txt - :language: sql - :force: - -.. collapse:: Query Results - - .. literalinclude:: ../scripts/un_sdg/sdg3/nearest_vertex1.txt - -Testing the function - -.. literalinclude:: ../scripts/un_sdg/sdg3/all_exercises_sdg3.sql - :start-after: nearest_vertex2.txt - :end-before: prepare_edges.txt - :language: sql - -.. collapse:: Query Results - - .. literalinclude:: ../scripts/un_sdg/sdg3/nearest_vertex2.txt - - -Exercise 14: Finding the served roads using pgr_drivingDistance +Exercise 12: Finding the served roads using pgr_drivingDistance -------------------------------------------------------------------------------- .. rubric:: Problem -Find the roads within 10 minutes walking distance from the hospitals. Use ``1 -m/s`` as walking speed. +Find the roads within 10 minutes walking distance from the hospitals. .. rubric:: Solution -In this exercise, the roads served are calculated based on a walking time of ``1 -m/s``, by using ``pgrdrivingDistance`` function from pgRouting extension. +Using ``pgrdrivingDistance`` function from pgRouting extension. - Time in minutes is considered as ``cost``. - the graph is undirected. - -Preparing a query - -.. literalinclude:: ../scripts/un_sdg/sdg3/all_exercises_sdg3.sql - :start-after: prepare_edges.txt - :end-before: exercise_16.txt - :language: sql - :force: - -.. collapse:: Query Results - - .. literalinclude:: ../scripts/un_sdg/sdg3/prepare_edges.txt - -For the following query, - -- The prepared statement is used. -- Pedestrian speed is set to be ``1 m/s``. - - - As ``time`` = ``distance/speed``, ``length_m`` / ``1 m/s`` / ``60`` gives - the time in minutes. - - ``tag_id = '318'`` as 318 is the value for hospital in the configuration table of the buildings. - - ``10`` for 10 minutes, which is a threshold for ``agg_cost`` -.. literalinclude:: ../scripts/un_sdg/sdg3/all_exercises_sdg3.sql - :start-after: exercise_15.txt - :end-before: exercise_16.txt +.. literalinclude:: ../scripts/un_sdg/sdg3/sdg3.sql + :start-after: served_roads.txt + :end-before: adjacent_roads.txt :language: sql + :force: .. collapse:: Query Results - .. literalinclude:: ../scripts/un_sdg/sdg3/exercise_15.txt + .. literalinclude:: ../scripts/un_sdg/sdg3/served_roads.txt Following figure shows the visualised output of the above query. The lines highlighted by red colour show the area from where the hospital can be reached @@ -637,7 +579,7 @@ query. :align: center :scale: 50% -Exercise 15: Generalising the served roads +Exercise 13: Adding adjacent roads -------------------------------------------------------------------------------- The edges which are near to to hospital should also be selected in the roads served @@ -646,14 +588,15 @@ from previous section as a ``subquery`` and selects all the edges from ``roads_w that have the same ``source`` and ``target`` to that of ``subquery`` (Line 14). -.. literalinclude:: ../scripts/un_sdg/sdg3/all_exercises_sdg3.sql - :start-after: exercise_16.txt - :end-before: closest_edge1.txt +.. literalinclude:: ../scripts/un_sdg/sdg3/sdg3.sql + :start-after: adjacent_roads.txt + :end-before: population_served.txt :language: sql + :force: .. collapse:: Query Results - .. literalinclude:: ../scripts/un_sdg/sdg3/exercise_16.txt + .. literalinclude:: ../scripts/un_sdg/sdg3/adjacent_roads.txt Following figure shows the visualised output of the above query. Lines highlighted in ``yellow`` show the `generalised the roads served`. This gives a better @@ -673,106 +616,16 @@ This area will be stored in the nearest roads. Following steps explain this process in detail. -Exercise 16: Finding the nearest roads of the buildings --------------------------------------------------------------------------------- - -To store the population of buildings in the roads, nearest road to a building -is to be found. Follow the steps given below to complete this task. - -1. Create Function for finding the closest edge. - -.. literalinclude:: ../scripts/un_sdg/sdg3/all_exercises_sdg3.sql - :start-after: closest_edge1.txt - :end-before: closest_edge2.txt - :linenos: - -.. collapse:: Query Results - - .. literalinclude:: ../scripts/un_sdg/sdg3/closest_edge1.txt - -2. Add a column in ``buildings_ways`` for storing the id of closest edge - -.. literalinclude:: ../scripts/un_sdg/sdg3/all_exercises_sdg3.sql - :start-after: closest_edge2.txt - :end-before: closest_edge3.txt - :language: sql - :linenos: - -.. collapse:: Query Results - - .. literalinclude:: ../scripts/un_sdg/sdg3/closest_edge2.txt - -3. Store the edge id of the closest edge in the new column of ``buildings_ways`` - -.. literalinclude:: ../scripts/un_sdg/sdg3/all_exercises_sdg3.sql - :start-after: closest_edge3.txt - :end-before: add_road_population1.txt - :language: sql - :linenos: - -.. collapse:: Query Results - - .. literalinclude:: ../scripts/un_sdg/sdg3/closest_edge3.txt - -Exercise 17: Storing the population in the roads --------------------------------------------------------------------------------- -After finding the nearest road, the sum of population of all the nearest -buildings is stored in the population column of the roads table. Following image -shows the visualised output where the blue colour labels shows the population -stored in roads. - -.. image:: images/sdg3/road_population.png - :align: center - :scale: 50% - -Follow the steps given below to complete this task. - -1. Add a column in ``roads_ways`` for storing population - -.. literalinclude:: ../scripts/un_sdg/sdg3/all_exercises_sdg3.sql - :start-after: add_road_population1.txt - :end-before: add_road_population2.txt - :language: sql - -.. collapse:: Query Results - - .. literalinclude:: ../scripts/un_sdg/sdg3/add_road_population1.txt - -2. Update the roads with the sum of population of buildings closest to it - -.. literalinclude:: ../scripts/un_sdg/sdg3/all_exercises_sdg3.sql - :start-after: add_road_population2.txt - :end-before: add_road_population3.txt - :language: sql - :linenos: - -.. collapse:: Query Results - - .. literalinclude:: ../scripts/un_sdg/sdg3/add_road_population2.txt - -3. Verify is the population is stored using the following query. - -.. literalinclude:: ../scripts/un_sdg/sdg3/all_exercises_sdg3.sql - :start-after: add_road_population3.txt - :end-before: exercise_20.txt - :language: sql - :linenos: - -.. collapse:: Query Results - - .. literalinclude:: ../scripts/un_sdg/sdg3/add_road_population3.txt - -Exercise 18: Find total population served by the hospital +Exercise 14: Find total population served by the hospital -------------------------------------------------------------------------------- Final step is to find the total population served by the hospital based on travel time. -.. literalinclude:: ../scripts/un_sdg/sdg3/all_exercises_sdg3.sql - :start-after: exercise_20.txt - :end-before: \o +.. literalinclude:: ../scripts/un_sdg/sdg3/sdg3.sql + :start-after: population_served.txt :language: sql .. collapse:: Query Results - .. literalinclude:: ../scripts/un_sdg/sdg3/exercise_20.txt + .. literalinclude:: ../scripts/un_sdg/sdg3/population_served.txt diff --git a/docs/un_sdg/sdg7-energy.rst b/docs/un_sdg/sdg7-energy.rst index 24e73a6d5..73cc8f418 100644 --- a/docs/un_sdg/sdg7-energy.rst +++ b/docs/un_sdg/sdg7-energy.rst @@ -69,7 +69,7 @@ Exercise 1: Set the seach path In this case, search path of roads table is search path to ``roads`` and ``buildings`` schemas. Following query is used to adjust the search path. -.. literalinclude:: ../scripts/un_sdg/sdg7/all_exercises_sdg7.sql +.. literalinclude:: ../scripts/un_sdg/sdg7/sdg7.sql :start-after: set_path.txt :end-before: show_path2.txt @@ -79,7 +79,7 @@ In this case, search path of roads table is search path to ``roads`` and Checking the search path again -.. literalinclude:: ../scripts/un_sdg/sdg7/all_exercises_sdg7.sql +.. literalinclude:: ../scripts/un_sdg/sdg7/sdg7.sql :start-after: show_path2.txt :end-before: revert_changes.txt @@ -99,7 +99,7 @@ pgRouting functions, discussed on :doc:`../basic/graphs`, will be used: .. rubric:: Create a vertices table. -.. literalinclude:: ../scripts/un_sdg/sdg7/all_exercises_sdg7.sql +.. literalinclude:: ../scripts/un_sdg/sdg7/sdg7.sql :start-after: only_connected1.txt :end-before: only_connected2.txt :language: sql @@ -110,7 +110,7 @@ pgRouting functions, discussed on :doc:`../basic/graphs`, will be used: .. rubric:: Fill up the ``x``, ``y`` and ``geom`` columns. -.. literalinclude:: ../scripts/un_sdg/sdg7/all_exercises_sdg7.sql +.. literalinclude:: ../scripts/un_sdg/sdg7/sdg7.sql :start-after: only_connected2.txt :end-before: only_connected3.txt :language: sql @@ -121,7 +121,7 @@ pgRouting functions, discussed on :doc:`../basic/graphs`, will be used: .. rubric:: Add a ``component`` column on the edges and vertices tables. -.. literalinclude:: ../scripts/un_sdg/sdg7/all_exercises_sdg7.sql +.. literalinclude:: ../scripts/un_sdg/sdg7/sdg7.sql :start-after: only_connected3.txt :end-before: only_connected4.txt :language: sql @@ -132,7 +132,7 @@ pgRouting functions, discussed on :doc:`../basic/graphs`, will be used: .. rubric:: Fill up the ``component`` column on the vertices table. -.. literalinclude:: ../scripts/un_sdg/sdg7/all_exercises_sdg7.sql +.. literalinclude:: ../scripts/un_sdg/sdg7/sdg7.sql :start-after: only_connected4.txt :end-before: only_connected5.txt :language: sql @@ -143,7 +143,7 @@ pgRouting functions, discussed on :doc:`../basic/graphs`, will be used: .. rubric:: Fill up the ``component`` column on the edges table. -.. literalinclude:: ../scripts/un_sdg/sdg7/all_exercises_sdg7.sql +.. literalinclude:: ../scripts/un_sdg/sdg7/sdg7.sql :start-after: only_connected5.txt :end-before: only_connected6.txt :language: sql @@ -154,7 +154,7 @@ pgRouting functions, discussed on :doc:`../basic/graphs`, will be used: .. rubric:: Get the component number with the most number of edges. -.. literalinclude:: ../scripts/un_sdg/sdg7/all_exercises_sdg7.sql +.. literalinclude:: ../scripts/un_sdg/sdg7/sdg7.sql :start-after: only_connected6.txt :end-before: only_connected7.txt :language: sql @@ -165,25 +165,25 @@ pgRouting functions, discussed on :doc:`../basic/graphs`, will be used: .. rubric:: Delete edges not belonging to the most connected component. -.. literalinclude:: ../scripts/un_sdg/sdg7/all_exercises_sdg7.sql +.. literalinclude:: ../scripts/un_sdg/sdg7/sdg7.sql :start-after: only_connected7.txt :end-before: only_connected8.txt :language: sql .. collapse:: Query Results - .. literalinclude:: ../scripts/un_sdg/sdg3/only_connected7.txt + .. literalinclude:: ../scripts/un_sdg/sdg7/only_connected7.txt .. rubric:: Delete vertices not belonging to the most connected component. -.. literalinclude:: ../scripts/un_sdg/sdg7/all_exercises_sdg7.sql +.. literalinclude:: ../scripts/un_sdg/sdg7/sdg7.sql :start-after: only_connected8.txt :end-before: exercise_10-1.txt :language: sql .. collapse:: Query Results - .. literalinclude:: ../scripts/un_sdg/sdg3/only_connected8.txt + .. literalinclude:: ../scripts/un_sdg/sdg7/only_connected8.txt pgr_kruskalDFS @@ -216,7 +216,7 @@ optimal network of electricity distribution components. To complete this task, execute the query below. -.. literalinclude:: ../scripts/un_sdg/sdg7/all_exercises_sdg7.sql +.. literalinclude:: ../scripts/un_sdg/sdg7/sdg7.sql :start-after: exercise_10-1.txt :end-before: exercise_10-2.txt :language: sql @@ -228,7 +228,7 @@ To complete this task, execute the query below. The following query will give the results with the source vertex, target vertex, edge id, aggregate cost. -.. literalinclude:: ../scripts/un_sdg/sdg7/all_exercises_sdg7.sql +.. literalinclude:: ../scripts/un_sdg/sdg7/sdg7.sql :start-after: exercise_10-2.txt :end-before: exercise_11.txt :language: sql @@ -249,7 +249,7 @@ Exercise 4: Compute total length of material required in km Compute the total length of the minimum spanning tree which is an estimate of the total length of material required. -.. literalinclude:: ../scripts/un_sdg/sdg7/all_exercises_sdg7.sql +.. literalinclude:: ../scripts/un_sdg/sdg7/sdg7.sql :start-after: exercise_11.txt :end-before: exercise_12.txt :language: sql @@ -264,7 +264,7 @@ Exercise 5: Compute total length of roads Compute the total length of the road network of the given area.. -.. literalinclude:: ../scripts/un_sdg/sdg7/all_exercises_sdg7.sql +.. literalinclude:: ../scripts/un_sdg/sdg7/sdg7.sql :start-after: exercise_12.txt :end-before: \o :language: sql diff --git a/locale/en/LC_MESSAGES/basic/data.po b/locale/en/LC_MESSAGES/basic/data.po index 29d7343c5..aa716d55b 100644 --- a/locale/en/LC_MESSAGES/basic/data.po +++ b/locale/en/LC_MESSAGES/basic/data.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: 2026-06-25 21:50+0000\n" +"POT-Creation-Date: 2026-07-01 17:09+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language: en\n" @@ -169,9 +169,35 @@ msgid "Depending on the osm2pgrouting version `-W password` is needed" msgstr "" #: ../../build/docs/basic/data.rst:132 -msgid "Tables on the database" +msgid "Compatibility with older osm2pgrouting versions" msgstr "" #: ../../build/docs/basic/data.rst:134 +msgid "Check the installed version:" +msgstr "" + +#: ../../build/docs/basic/data.rst:140 +msgid "" +"If you are using version 2.x, the column names differ from those used in " +"this workshop:" +msgstr "" + +#: ../../build/docs/basic/data.rst:143 +msgid "``gid`` instead of ``id``" +msgstr "" + +#: ../../build/docs/basic/data.rst:144 +msgid "``the_geom`` instead of ``geom``" +msgstr "" + +#: ../../build/docs/basic/data.rst:146 +msgid "Run the following script to rename them:" +msgstr "" + +#: ../../build/docs/basic/data.rst:154 +msgid "Tables on the database" +msgstr "" + +#: ../../build/docs/basic/data.rst:156 msgid "To inspect the tables that were created during this process:" msgstr "" diff --git a/locale/en/LC_MESSAGES/basic/sql_function.po b/locale/en/LC_MESSAGES/basic/sql_function.po index 068eac44c..53dbe9e2a 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: 2026-06-14 15:20+0000\n" +"POT-Creation-Date: 2026-07-01 17:09+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language: en\n" @@ -20,15 +20,15 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 2.18.0\n" -#: ../../build/docs/basic/sql_function.rst:12 +#: ../../build/docs/basic/sql_function.rst:7 msgid "SQL function" msgstr "" -#: ../../build/docs/basic/sql_function.rst:18 +#: ../../build/docs/basic/sql_function.rst:13 msgid "Chapter Contents" msgstr "" -#: ../../build/docs/basic/sql_function.rst:20 +#: ../../build/docs/basic/sql_function.rst:15 msgid "" "While pgRouting functions provide a low-level interface, developing for a " "higher-level application requires these requirements to be represented " @@ -38,513 +38,423 @@ msgid "" "this case, related to routing logic and requirements." msgstr "" -#: ../../build/docs/basic/sql_function.rst:28 +#: ../../build/docs/basic/sql_function.rst:23 msgid "The function requirements" msgstr "" -#: ../../build/docs/basic/sql_function.rst:30 +#: ../../build/docs/basic/sql_function.rst:25 msgid "The function will wrap ``pgr_dijkstra``." msgstr "" -#: ../../build/docs/basic/sql_function.rst:32 -msgid "The function needs to work on any of the networks designed:" +#: ../../build/docs/basic/sql_function.rst:27 +msgid "The function will use:" msgstr "" -#: ../../build/docs/basic/sql_function.rst:34 -#: ../../build/docs/basic/sql_function.rst:339 +#: ../../build/docs/basic/sql_function.rst:29 msgid "``vehicle_net``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:35 -#: ../../build/docs/basic/sql_function.rst:340 -msgid "``taxi_net``" +#: ../../build/docs/basic/sql_function.rst:30 +msgid "``vehicle_penalized_net``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:37 -msgid "The function needs to return the following routing information:" +#: ../../build/docs/basic/sql_function.rst:32 +msgid "The function returns the following routing information:" msgstr "" -#: ../../build/docs/basic/sql_function.rst:39 +#: ../../build/docs/basic/sql_function.rst:34 msgid "``seq`` - A unique identifier of the rows" msgstr "" -#: ../../build/docs/basic/sql_function.rst:40 +#: ../../build/docs/basic/sql_function.rst:35 msgid "``id`` - The segment's identifier" msgstr "" -#: ../../build/docs/basic/sql_function.rst:41 -msgid "``name`` - The segment's name" +#: ../../build/docs/basic/sql_function.rst:36 +msgid "``seconds`` - Number of seconds to traverse the segment" msgstr "" -#: ../../build/docs/basic/sql_function.rst:42 -msgid "``length`` - The segment's length" +#: ../../build/docs/basic/sql_function.rst:37 +msgid "``name`` - The segment's name" msgstr "" -#: ../../build/docs/basic/sql_function.rst:43 -msgid "``seconds`` - Number of seconds to traverse the segment" +#: ../../build/docs/basic/sql_function.rst:38 +msgid "``length`` - The segment's length" msgstr "" -#: ../../build/docs/basic/sql_function.rst:44 +#: ../../build/docs/basic/sql_function.rst:39 msgid "``azimuth`` - The azimuth of the segment" msgstr "" -#: ../../build/docs/basic/sql_function.rst:45 -msgid "``route_geom`` - The routing geometry" +#: ../../build/docs/basic/sql_function.rst:40 +msgid "``readable`` - The geometry in human readable form." msgstr "" -#: ../../build/docs/basic/sql_function.rst:46 -msgid "``route_readable`` - The geometry in human readable form." +#: ../../build/docs/basic/sql_function.rst:41 +msgid "``geom`` - The routing geometry" msgstr "" -#: ../../build/docs/basic/sql_function.rst:49 +#: ../../build/docs/basic/sql_function.rst:44 msgid "Design of the function" msgstr "" -#: ../../build/docs/basic/sql_function.rst:50 +#: ../../build/docs/basic/sql_function.rst:45 msgid "" "The function to be created ``wrk_dijkstra`` with the following input " "parameters and output columns:" msgstr "" -#: ../../build/docs/basic/sql_function.rst:54 +#: ../../build/docs/basic/sql_function.rst:49 msgid "Input parameters" msgstr "" -#: ../../build/docs/basic/sql_function.rst:56 +#: ../../build/docs/basic/sql_function.rst:51 msgid "Parameter" msgstr "" -#: ../../build/docs/basic/sql_function.rst:56 -#: ../../build/docs/basic/sql_function.rst:66 +#: ../../build/docs/basic/sql_function.rst:51 +#: ../../build/docs/basic/sql_function.rst:62 msgid "Type" msgstr "" -#: ../../build/docs/basic/sql_function.rst:56 -#: ../../build/docs/basic/sql_function.rst:66 +#: ../../build/docs/basic/sql_function.rst:51 +#: ../../build/docs/basic/sql_function.rst:62 msgid "Description" msgstr "" -#: ../../build/docs/basic/sql_function.rst:58 -msgid "``edges_subset``" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:58 -msgid "REGCLASS" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:58 -msgid "The table/view that is going to be used for processing" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:59 +#: ../../build/docs/basic/sql_function.rst:53 msgid "``source``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:59 -#: ../../build/docs/basic/sql_function.rst:60 -#: ../../build/docs/basic/sql_function.rst:69 +#: ../../build/docs/basic/sql_function.rst:53 +#: ../../build/docs/basic/sql_function.rst:54 +#: ../../build/docs/basic/sql_function.rst:65 msgid "BIGINT" msgstr "" -#: ../../build/docs/basic/sql_function.rst:59 -msgid "The identifier of the `departure` location." +#: ../../build/docs/basic/sql_function.rst:53 +msgid "The identifier of the `departure` location." msgstr "" -#: ../../build/docs/basic/sql_function.rst:60 +#: ../../build/docs/basic/sql_function.rst:54 msgid "``target``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:60 -msgid "The identifier of the `destination` location." +#: ../../build/docs/basic/sql_function.rst:54 +msgid "The identifier of the `destination` location." msgstr "" -#: ../../build/docs/basic/sql_function.rst:64 -msgid "output columns" +#: ../../build/docs/basic/sql_function.rst:60 +msgid "Output columns" msgstr "" -#: ../../build/docs/basic/sql_function.rst:66 +#: ../../build/docs/basic/sql_function.rst:62 msgid "Name" msgstr "" -#: ../../build/docs/basic/sql_function.rst:68 -#: ../../build/docs/basic/sql_function.rst:97 +#: ../../build/docs/basic/sql_function.rst:64 msgid "``seq``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:68 +#: ../../build/docs/basic/sql_function.rst:64 msgid "INTEGER" msgstr "" -#: ../../build/docs/basic/sql_function.rst:68 +#: ../../build/docs/basic/sql_function.rst:64 msgid "A unique number for each result row." msgstr "" -#: ../../build/docs/basic/sql_function.rst:69 -#: ../../build/docs/basic/sql_function.rst:98 +#: ../../build/docs/basic/sql_function.rst:65 msgid "``id``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:69 +#: ../../build/docs/basic/sql_function.rst:65 msgid "The edge identifier." msgstr "" -#: ../../build/docs/basic/sql_function.rst:70 -#: ../../build/docs/basic/sql_function.rst:99 -msgid "``name``" +#: ../../build/docs/basic/sql_function.rst:66 +msgid "``seconds``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:70 -#: ../../build/docs/basic/sql_function.rst:74 -msgid "TEXT" +#: ../../build/docs/basic/sql_function.rst:66 +#: ../../build/docs/basic/sql_function.rst:68 +#: ../../build/docs/basic/sql_function.rst:69 +msgid "FLOAT" msgstr "" -#: ../../build/docs/basic/sql_function.rst:70 -msgid "The name of the segment." +#: ../../build/docs/basic/sql_function.rst:66 +msgid "The number of seconds it takes to traverse the segment." msgstr "" -#: ../../build/docs/basic/sql_function.rst:71 -#: ../../build/docs/basic/sql_function.rst:100 -msgid "``seconds``" +#: ../../build/docs/basic/sql_function.rst:67 +msgid "``name``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:71 -#: ../../build/docs/basic/sql_function.rst:72 -#: ../../build/docs/basic/sql_function.rst:73 -msgid "FLOAT" +#: ../../build/docs/basic/sql_function.rst:67 +#: ../../build/docs/basic/sql_function.rst:70 +msgid "TEXT" msgstr "" -#: ../../build/docs/basic/sql_function.rst:71 -msgid "The number of seconds it takes to traverse the segment." +#: ../../build/docs/basic/sql_function.rst:67 +msgid "The name of the segment." msgstr "" -#: ../../build/docs/basic/sql_function.rst:72 -#: ../../build/docs/basic/sql_function.rst:101 +#: ../../build/docs/basic/sql_function.rst:68 msgid "``length``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:72 +#: ../../build/docs/basic/sql_function.rst:68 msgid "The length in meters of the segment." msgstr "" -#: ../../build/docs/basic/sql_function.rst:73 +#: ../../build/docs/basic/sql_function.rst:69 +#: ../../build/docs/basic/sql_function.rst:218 msgid "``azimuth``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:73 +#: ../../build/docs/basic/sql_function.rst:69 msgid "The azimuth of the segment." msgstr "" -#: ../../build/docs/basic/sql_function.rst:74 -msgid "``route_readable``" +#: ../../build/docs/basic/sql_function.rst:70 +#: ../../build/docs/basic/sql_function.rst:217 +msgid "``readable``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:74 +#: ../../build/docs/basic/sql_function.rst:70 msgid "The geometry in human readable form." msgstr "" -#: ../../build/docs/basic/sql_function.rst:75 -msgid "``route_geom``" +#: ../../build/docs/basic/sql_function.rst:71 +#: ../../build/docs/basic/sql_function.rst:216 +msgid "``geom``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:75 +#: ../../build/docs/basic/sql_function.rst:71 msgid "geometry" msgstr "" -#: ../../build/docs/basic/sql_function.rst:75 +#: ../../build/docs/basic/sql_function.rst:71 msgid "The geometry of the segment in the correct direction." msgstr "" -#: ../../build/docs/basic/sql_function.rst:80 +#: ../../build/docs/basic/sql_function.rst:77 msgid "Additional information handling" msgstr "" -#: ../../build/docs/basic/sql_function.rst:82 +#: ../../build/docs/basic/sql_function.rst:79 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:86 +#: ../../build/docs/basic/sql_function.rst:83 msgid "Exercise 1: Get additional information" msgstr "" -#: ../../build/docs/basic/sql_function.rst:88 +#: ../../build/docs/basic/sql_function.rst:85 msgid "Route showing names" msgstr "" -#: ../../build/docs/basic/sql_function.rst:93 -#: ../../build/docs/basic/sql_function.rst:145 -#: ../../build/docs/basic/sql_function.rst:184 -#: ../../build/docs/basic/sql_function.rst:237 -#: ../../build/docs/basic/sql_function.rst:301 +#: ../../build/docs/basic/sql_function.rst:90 +#: ../../build/docs/basic/sql_function.rst:120 +#: ../../build/docs/basic/sql_function.rst:144 +#: ../../build/docs/basic/sql_function.rst:171 +#: ../../build/docs/basic/sql_function.rst:213 msgid "Problem" msgstr "" -#: ../../build/docs/basic/sql_function.rst:94 -#: ../../build/docs/basic/sql_function.rst:140 -#: ../../build/docs/basic/sql_function.rst:179 -#: ../../build/docs/basic/sql_function.rst:213 -msgid "From |ch7_place_1| to |ch7_place_2|" +#: ../../build/docs/basic/sql_function.rst:91 +msgid "Create a function that gets all the required information" msgstr "" -#: ../../build/docs/basic/sql_function.rst:95 -msgid "Get the following information:" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:104 -#: ../../build/docs/basic/sql_function.rst:153 -#: ../../build/docs/basic/sql_function.rst:192 -#: ../../build/docs/basic/sql_function.rst:247 -#: ../../build/docs/basic/sql_function.rst:307 +#: ../../build/docs/basic/sql_function.rst:94 +#: ../../build/docs/basic/sql_function.rst:124 +#: ../../build/docs/basic/sql_function.rst:148 +#: ../../build/docs/basic/sql_function.rst:175 +#: ../../build/docs/basic/sql_function.rst:221 msgid "Solution" msgstr "" -#: ../../build/docs/basic/sql_function.rst:105 -msgid "The function returns the columns asked. (line **4**)" +#: ../../build/docs/basic/sql_function.rst:95 +msgid "The function returns the columns asked." msgstr "" -#: ../../build/docs/basic/sql_function.rst:106 -msgid "" -"Rename ``pgr_dijkstra`` results to application requirements names. (line " -"**12**)." +#: ../../build/docs/basic/sql_function.rst:96 +msgid "Rename ``pgr_dijkstra`` results to application requirements names." msgstr "" -#: ../../build/docs/basic/sql_function.rst:108 +#: ../../build/docs/basic/sql_function.rst:97 msgid "" "``LEFT JOIN`` the results with ``vehicle_net`` to get the additional " -"information. (line **17**)" +"information." msgstr "" -#: ../../build/docs/basic/sql_function.rst:111 +#: ../../build/docs/basic/sql_function.rst:100 msgid "" -"``LEFT`` to include the row with ``id = -1`` because it does not exist on " -"``vehicle_net``" +"``LEFT JOIN`` to include the row with ``id = -1`` because it does not exist " +"on ``vehicle_net``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:114 -#: ../../build/docs/basic/sql_function.rst:158 -#: ../../build/docs/basic/sql_function.rst:195 -#: ../../build/docs/basic/sql_function.rst:312 -msgid "Test from |ch7_id_1| to |ch7_id_2| on ``vehicle_net``. (Last line)" +#: ../../build/docs/basic/sql_function.rst:110 +msgid "Using the function" msgstr "" -#: ../../build/docs/basic/sql_function.rst:130 -msgid "Geometry handling" +#: ../../build/docs/basic/sql_function.rst:113 +msgid "Exercise 2: Route geometry (binary format)" msgstr "" -#: ../../build/docs/basic/sql_function.rst:132 -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." +#: ../../build/docs/basic/sql_function.rst:115 +msgid "Route showing readable" msgstr "" -#: ../../build/docs/basic/sql_function.rst:138 -msgid "Exercise 2: Route geometry (human readable)" +#: ../../build/docs/basic/sql_function.rst:121 +msgid "Get the geometries of the route from |place_1| to |place_2|" msgstr "" -#: ../../build/docs/basic/sql_function.rst:146 -#: ../../build/docs/basic/sql_function.rst:185 -#: ../../build/docs/basic/sql_function.rst:238 -msgid "Route from the |ch7_place_1| to |ch7_place_2|" +#: ../../build/docs/basic/sql_function.rst:125 +msgid "Select the column ``geom``." msgstr "" -#: ../../build/docs/basic/sql_function.rst:148 -#: ../../build/docs/basic/sql_function.rst:187 -msgid "Additionally to the previous exercise, get the" +#: ../../build/docs/basic/sql_function.rst:137 +msgid "Exercise 3: Route geometry (human readable)" msgstr "" -#: ../../build/docs/basic/sql_function.rst:150 -msgid "geometry ``geom`` in human readable form named as ``route_readable``" +#: ../../build/docs/basic/sql_function.rst:139 +#: ../../build/docs/basic/sql_function.rst:287 +msgid "From |ch7_place_1| to |ch7_place_2|" msgstr "" -#: ../../build/docs/basic/sql_function.rst:154 -msgid "The function returns ``route_readable``. (line **6**)" +#: ../../build/docs/basic/sql_function.rst:145 +msgid "" +"Get the geometries in readable form of the route from |place_1| to |place_2|" msgstr "" -#: ../../build/docs/basic/sql_function.rst:155 -msgid "The routing query named ``results`` in a WITH clause. (line **11**)" +#: ../../build/docs/basic/sql_function.rst:149 +msgid "Select the column ``readable``." msgstr "" -#: ../../build/docs/basic/sql_function.rst:156 -msgid "" -"The ``geom`` processed with ``ST_AsText`` to get the human readable form. " -"(line **19**)." +#: ../../build/docs/basic/sql_function.rst:161 +msgid "Exercise 5: Get the azimuth" msgstr "" -#: ../../build/docs/basic/sql_function.rst:177 -msgid "Exercise 3: Route geometry (binary format)" +#: ../../build/docs/basic/sql_function.rst:163 +msgid "Route showing azimuth" msgstr "" -#: ../../build/docs/basic/sql_function.rst:189 -#: ../../build/docs/basic/sql_function.rst:243 -msgid "``geom`` in binary format with the name ``route_geom``" +#: ../../build/docs/basic/sql_function.rst:167 +msgid "" +"There are many geometry functions in PostGIS, the workshop coveres some of " +"them like ``ST_AsText``, ``ST_Reverse``, ``ST_EndPoint``, ``ST_Azimuth``." msgstr "" -#: ../../build/docs/basic/sql_function.rst:193 -msgid "The function returns ``route_geom``. (line **7**)" +#: ../../build/docs/basic/sql_function.rst:172 +msgid "" +"Get the azimuth of the geometries of the route from |place_1| to |place_2|" msgstr "" -#: ../../build/docs/basic/sql_function.rst:194 -msgid "The geometry ``geom`` of the segments (line **21**)" +#: ../../build/docs/basic/sql_function.rst:176 +msgid "The function returns ``azimuth``." msgstr "" -#: ../../build/docs/basic/sql_function.rst:211 +#: ../../build/docs/basic/sql_function.rst:189 msgid "Exercise 4: Route geometry directionality" msgstr "" -#: ../../build/docs/basic/sql_function.rst:217 +#: ../../build/docs/basic/sql_function.rst:191 +msgid "wrong direccionality" +msgstr "" + +#: ../../build/docs/basic/sql_function.rst:195 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:220 +#: ../../build/docs/basic/sql_function.rst:198 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:223 +#: ../../build/docs/basic/sql_function.rst:201 msgid "" -"Inspecting the detail of the results of `Exercise 2: Route geometry (human " +"Inspecting the detail of the results of `Exercise 3: Route geometry (human " "readable)`_" msgstr "" -#: ../../build/docs/basic/sql_function.rst:240 -msgid "Fix the directionality of the geometries of the previous exercise" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:242 -msgid "``geom`` in human readable form named as ``route_readable``" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:244 -msgid "Both columns must have the geometry fixed for directionality." +#: ../../build/docs/basic/sql_function.rst:214 +msgid "" +"Fix the directionality of the geometries and of the columns that depend on " +"it." msgstr "" -#: ../../build/docs/basic/sql_function.rst:248 +#: ../../build/docs/basic/sql_function.rst:222 msgid "To get the correct direction some geometries need to be reversed:" msgstr "" -#: ../../build/docs/basic/sql_function.rst:250 +#: ../../build/docs/basic/sql_function.rst:224 msgid "" "Reversing a geometry will depend on the ``node`` column of the query to " "Dijkstra." msgstr "" -#: ../../build/docs/basic/sql_function.rst:253 -msgid "" -"A conditional ``CASE`` statement that returns the geometry in human readable " -"form:" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:256 -msgid "Of the geometry when ``node`` is the ``source`` column." -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:257 -msgid "Of the reversed geometry when ``node`` is not the ``source`` column." -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:259 +#: ../../build/docs/basic/sql_function.rst:227 msgid "A conditional ``CASE`` statement that returns:" msgstr "" -#: ../../build/docs/basic/sql_function.rst:261 +#: ../../build/docs/basic/sql_function.rst:229 msgid "The geometry when ``node`` is the ``source`` column." msgstr "" -#: ../../build/docs/basic/sql_function.rst:262 +#: ../../build/docs/basic/sql_function.rst:230 msgid "The reversed geometry when ``node`` is not the ``source`` column." msgstr "" -#: ../../build/docs/basic/sql_function.rst:275 +#: ../../build/docs/basic/sql_function.rst:239 msgid "Inspecting the problematic rows, the directionality has been fixed." msgstr "" -#: ../../build/docs/basic/sql_function.rst:288 -msgid "Exercise 5: Using the geometry" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:290 -msgid "From |ch7_place_1| to the |ch7_place_2| show azimuth" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:295 -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:302 -msgid "Modify the query from the previous exercise" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:304 -msgid "Additionally obtain the azimuth in degrees of the corrected geometry." -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:308 -msgid "The function returns ``aximuth``. (line **8**)" +#: ../../build/docs/basic/sql_function.rst:250 +msgid "good direccionality" msgstr "" -#: ../../build/docs/basic/sql_function.rst:309 -msgid "" -"The query from previous exercise is wrapped under additional subquery. (line " -"**18**)" +#: ../../build/docs/basic/sql_function.rst:255 +msgid "Writing the final function" msgstr "" -#: ../../build/docs/basic/sql_function.rst:311 -msgid "The ``azimuth`` is processed in degrees. (line **35**)." +#: ../../build/docs/basic/sql_function.rst:257 +msgid "The final function using ``vehicle_penalized_net``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:327 +#: ../../build/docs/basic/sql_function.rst:266 msgid "Exercise 6: Using the function" msgstr "" -#: ../../build/docs/basic/sql_function.rst:329 +#: ../../build/docs/basic/sql_function.rst:268 msgid "Try the function with a combination of the interesting places:" msgstr "" -#: ../../build/docs/basic/sql_function.rst:331 +#: ../../build/docs/basic/sql_function.rst:270 msgid "|id_1| |place_1|" msgstr "" -#: ../../build/docs/basic/sql_function.rst:332 +#: ../../build/docs/basic/sql_function.rst:271 msgid "|id_2| |place_2|" msgstr "" -#: ../../build/docs/basic/sql_function.rst:333 +#: ../../build/docs/basic/sql_function.rst:272 msgid "|id_3| |place_3|" msgstr "" -#: ../../build/docs/basic/sql_function.rst:334 +#: ../../build/docs/basic/sql_function.rst:273 msgid "|id_4| |place_4|" msgstr "" -#: ../../build/docs/basic/sql_function.rst:335 +#: ../../build/docs/basic/sql_function.rst:274 msgid "|id_5| |place_5|" msgstr "" -#: ../../build/docs/basic/sql_function.rst:337 -msgid "Using different networks:" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:341 -msgid "``walk_net``" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:343 +#: ../../build/docs/basic/sql_function.rst:276 msgid "Names of the streets in the route" msgstr "" - -#: ../../build/docs/basic/sql_function.rst:354 -msgid "Total seconds spent in each street" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:365 -msgid "Why it does not fully work with ``walk_net``?" -msgstr "" diff --git a/locale/en/LC_MESSAGES/basic/withPoints.po b/locale/en/LC_MESSAGES/basic/withPoints.po index d08733460..92ba11583 100644 --- a/locale/en/LC_MESSAGES/basic/withPoints.po +++ b/locale/en/LC_MESSAGES/basic/withPoints.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: 2026-06-14 15:20+0000\n" +"POT-Creation-Date: 2026-07-01 17:09+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language: en\n" @@ -20,11 +20,11 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 2.18.0\n" -#: ../../build/docs/basic/withPoints.rst:11 +#: ../../build/docs/basic/withPoints.rst:6 msgid "Routing using points" msgstr "" -#: ../../build/docs/basic/withPoints.rst:18 +#: ../../build/docs/basic/withPoints.rst:13 msgid "" "For more advanced requirements, you can utilize `PL/pgSQL `_. As application logic grows more " @@ -32,549 +32,483 @@ msgid "" "them using internal variables becomes necessary." msgstr "" -#: ../../build/docs/basic/withPoints.rst:22 +#: ../../build/docs/basic/withPoints.rst:18 msgid "pgRouting functions in this chapter" msgstr "" -#: ../../build/docs/basic/withPoints.rst:24 +#: ../../build/docs/basic/withPoints.rst:20 msgid "`pgr_findCloseEdges`_" msgstr "" -#: ../../build/docs/basic/withPoints.rst:25 +#: ../../build/docs/basic/withPoints.rst:21 msgid "`pgr_withPoints`_" msgstr "" -#: ../../build/docs/basic/withPoints.rst:27 +#: ../../build/docs/basic/withPoints.rst:23 msgid "Chapter contents" msgstr "" -#: ../../build/docs/basic/withPoints.rst:30 +#: ../../build/docs/basic/withPoints.rst:26 msgid "Requirements for routing lat,lon points" msgstr "" -#: ../../build/docs/basic/withPoints.rst:33 +#: ../../build/docs/basic/withPoints.rst:29 msgid "Chapter problem:" msgstr "" -#: ../../build/docs/basic/withPoints.rst:34 +#: ../../build/docs/basic/withPoints.rst:30 msgid "" "Create a function ``wrk_withPoints`` that allows routing from two point " "geometries and works for" msgstr "" -#: ../../build/docs/basic/withPoints.rst:37 +#: ../../build/docs/basic/withPoints.rst:33 msgid "``vehicle_net``" msgstr "" -#: ../../build/docs/basic/withPoints.rst:38 -msgid "``taxi_net``" -msgstr "" - -#: ../../build/docs/basic/withPoints.rst:39 -msgid "``walk_net``" -msgstr "" - -#: ../../build/docs/basic/withPoints.rst:41 +#: ../../build/docs/basic/withPoints.rst:35 msgid "The function takes as input parameters:" msgstr "" -#: ../../build/docs/basic/withPoints.rst:43 +#: ../../build/docs/basic/withPoints.rst:37 msgid "The edges table name" msgstr "" -#: ../../build/docs/basic/withPoints.rst:44 -msgid "Latitude/longitude of two point" +#: ../../build/docs/basic/withPoints.rst:38 +msgid "Latitude/longitude of two points" msgstr "" -#: ../../build/docs/basic/withPoints.rst:46 +#: ../../build/docs/basic/withPoints.rst:40 msgid "Returns" msgstr "" -#: ../../build/docs/basic/withPoints.rst:48 +#: ../../build/docs/basic/withPoints.rst:42 msgid "the same information as in :doc:`sql_function` chapter problem." msgstr "" -#: ../../build/docs/basic/withPoints.rst:49 +#: ../../build/docs/basic/withPoints.rst:43 msgid "or the query that it builds" msgstr "" -#: ../../build/docs/basic/withPoints.rst:52 +#: ../../build/docs/basic/withPoints.rst:46 msgid "The detailed description:" msgstr "" -#: ../../build/docs/basic/withPoints.rst:55 +#: ../../build/docs/basic/withPoints.rst:49 msgid "Input parameters" msgstr "" -#: ../../build/docs/basic/withPoints.rst:57 +#: ../../build/docs/basic/withPoints.rst:51 msgid "Parameter" msgstr "" -#: ../../build/docs/basic/withPoints.rst:57 +#: ../../build/docs/basic/withPoints.rst:51 msgid "type" msgstr "" -#: ../../build/docs/basic/withPoints.rst:57 -#: ../../build/docs/basic/withPoints.rst:72 +#: ../../build/docs/basic/sql_function.rst:6 +#: ../../build/docs/basic/withPoints.rst:51 msgid "Description" msgstr "" -#: ../../build/docs/basic/withPoints.rst:59 -msgid "``edges_subset``" -msgstr "" - -#: ../../build/docs/basic/withPoints.rst:59 -msgid "REGCLASS" -msgstr "" - -#: ../../build/docs/basic/withPoints.rst:59 -msgid "Edge table name identifier." -msgstr "" - -#: ../../build/docs/basic/withPoints.rst:60 +#: ../../build/docs/basic/withPoints.rst:53 msgid "``lat1``" msgstr "" -#: ../../build/docs/basic/withPoints.rst:60 -#: ../../build/docs/basic/withPoints.rst:61 -#: ../../build/docs/basic/withPoints.rst:62 -#: ../../build/docs/basic/withPoints.rst:63 +#: ../../build/docs/basic/withPoints.rst:53 +#: ../../build/docs/basic/withPoints.rst:54 +#: ../../build/docs/basic/withPoints.rst:55 +#: ../../build/docs/basic/withPoints.rst:56 msgid "NUMERIC" msgstr "" -#: ../../build/docs/basic/withPoints.rst:60 +#: ../../build/docs/basic/withPoints.rst:53 msgid "The latitude of the `departure` point." msgstr "" -#: ../../build/docs/basic/withPoints.rst:61 +#: ../../build/docs/basic/withPoints.rst:54 msgid "``lon1``" msgstr "" -#: ../../build/docs/basic/withPoints.rst:61 +#: ../../build/docs/basic/withPoints.rst:54 msgid "The longitude of the `departure` point." msgstr "" -#: ../../build/docs/basic/withPoints.rst:62 +#: ../../build/docs/basic/withPoints.rst:55 msgid "``lat2``" msgstr "" -#: ../../build/docs/basic/withPoints.rst:62 +#: ../../build/docs/basic/withPoints.rst:55 msgid "The latitude of the `destination` point." msgstr "" -#: ../../build/docs/basic/withPoints.rst:63 +#: ../../build/docs/basic/withPoints.rst:56 msgid "``lon2``" msgstr "" -#: ../../build/docs/basic/withPoints.rst:63 +#: ../../build/docs/basic/withPoints.rst:56 msgid "The longitude of the `destination` point." msgstr "" -#: ../../build/docs/basic/withPoints.rst:64 +#: ../../build/docs/basic/withPoints.rst:57 msgid "``do_debug``" msgstr "" -#: ../../build/docs/basic/withPoints.rst:64 +#: ../../build/docs/basic/withPoints.rst:57 msgid "BOOLEAN" msgstr "" -#: ../../build/docs/basic/withPoints.rst:64 +#: ../../build/docs/basic/withPoints.rst:57 msgid "Flag to create a ``NOTICE`` with the query that is been executed" msgstr "" -#: ../../build/docs/basic/withPoints.rst:70 +#: ../../build/docs/basic/sql_function.rst:4 msgid "Output columns" msgstr "" -#: ../../build/docs/basic/withPoints.rst:72 +#: ../../build/docs/basic/sql_function.rst:6 msgid "Name" msgstr "" -#: ../../build/docs/basic/withPoints.rst:72 +#: ../../build/docs/basic/sql_function.rst:6 msgid "Type" msgstr "" -#: ../../build/docs/basic/withPoints.rst:74 +#: ../../build/docs/basic/sql_function.rst:8 msgid "``seq``" msgstr "" -#: ../../build/docs/basic/withPoints.rst:74 +#: ../../build/docs/basic/sql_function.rst:8 msgid "INTEGER" msgstr "" -#: ../../build/docs/basic/withPoints.rst:74 +#: ../../build/docs/basic/sql_function.rst:8 msgid "A unique number for each result row." msgstr "" -#: ../../build/docs/basic/withPoints.rst:75 +#: ../../build/docs/basic/sql_function.rst:9 msgid "``id``" msgstr "" -#: ../../build/docs/basic/withPoints.rst:75 +#: ../../build/docs/basic/sql_function.rst:9 msgid "BIGINT" msgstr "" -#: ../../build/docs/basic/withPoints.rst:75 +#: ../../build/docs/basic/sql_function.rst:9 msgid "The edge identifier." msgstr "" -#: ../../build/docs/basic/withPoints.rst:76 -msgid "``name``" +#: ../../build/docs/basic/sql_function.rst:10 +msgid "``seconds``" msgstr "" -#: ../../build/docs/basic/withPoints.rst:76 -#: ../../build/docs/basic/withPoints.rst:80 -msgid "TEXT" +#: ../../build/docs/basic/sql_function.rst:10 +#: ../../build/docs/basic/sql_function.rst:12 +#: ../../build/docs/basic/sql_function.rst:13 +msgid "FLOAT" msgstr "" -#: ../../build/docs/basic/withPoints.rst:76 -msgid "The name of the segment." +#: ../../build/docs/basic/sql_function.rst:10 +msgid "The number of seconds it takes to traverse the segment." msgstr "" -#: ../../build/docs/basic/withPoints.rst:77 -msgid "``seconds``" +#: ../../build/docs/basic/sql_function.rst:11 +msgid "``name``" msgstr "" -#: ../../build/docs/basic/withPoints.rst:77 -#: ../../build/docs/basic/withPoints.rst:78 -#: ../../build/docs/basic/withPoints.rst:79 -msgid "FLOAT" +#: ../../build/docs/basic/sql_function.rst:11 +#: ../../build/docs/basic/sql_function.rst:14 +msgid "TEXT" msgstr "" -#: ../../build/docs/basic/withPoints.rst:77 -msgid "The number of seconds it takes to traverse the segment." +#: ../../build/docs/basic/sql_function.rst:11 +msgid "The name of the segment." msgstr "" -#: ../../build/docs/basic/withPoints.rst:78 +#: ../../build/docs/basic/sql_function.rst:12 msgid "``length``" msgstr "" -#: ../../build/docs/basic/withPoints.rst:78 +#: ../../build/docs/basic/sql_function.rst:12 msgid "The length in meters of the segment." msgstr "" -#: ../../build/docs/basic/withPoints.rst:79 +#: ../../build/docs/basic/sql_function.rst:13 msgid "``azimuth``" msgstr "" -#: ../../build/docs/basic/withPoints.rst:79 +#: ../../build/docs/basic/sql_function.rst:13 msgid "The azimuth of the segment." msgstr "" -#: ../../build/docs/basic/withPoints.rst:80 -msgid "``route_readable``" +#: ../../build/docs/basic/sql_function.rst:14 +msgid "``readable``" msgstr "" -#: ../../build/docs/basic/withPoints.rst:80 +#: ../../build/docs/basic/sql_function.rst:14 msgid "The geometry in human readable form." msgstr "" -#: ../../build/docs/basic/withPoints.rst:81 -msgid "``route_geom``" +#: ../../build/docs/basic/sql_function.rst:15 +msgid "``geom``" msgstr "" -#: ../../build/docs/basic/withPoints.rst:81 +#: ../../build/docs/basic/sql_function.rst:15 msgid "geometry" msgstr "" -#: ../../build/docs/basic/withPoints.rst:81 +#: ../../build/docs/basic/sql_function.rst:15 msgid "The geometry of the segment in the correct direction." msgstr "" -#: ../../build/docs/basic/withPoints.rst:85 +#: ../../build/docs/basic/withPoints.rst:66 msgid "For this chapter, the following points will be used for testing." msgstr "" -#: ../../build/docs/basic/withPoints.rst:87 -msgid "(lat,lon) = (-36.850329, 174.763094)" +#: ../../build/docs/basic/withPoints.rst:68 +msgid "(lat,lon) = (34.399086, 132.453875)" msgstr "" -#: ../../build/docs/basic/withPoints.rst:88 -msgid "(lat,lon) = (-36.853675, 174.764448)" +#: ../../build/docs/basic/withPoints.rst:69 +msgid "(lat,lon) = (34.391111, 132.451490)" msgstr "" -#: ../../build/docs/basic/withPoints.rst:91 +#: ../../build/docs/basic/withPoints.rst:72 msgid "pgr_findCloseEdges" msgstr "" -#: ../../build/docs/basic/withPoints.rst:93 +#: ../../build/docs/basic/withPoints.rst:74 msgid "Finds the close edges to a point geometry." msgstr "" -#: ../../build/docs/basic/withPoints.rst:96 -#: ../../build/docs/basic/withPoints.rst:143 +#: ../../build/docs/basic/withPoints.rst:77 +#: ../../build/docs/basic/withPoints.rst:123 msgid "Signature Summary" msgstr "" -#: ../../build/docs/basic/withPoints.rst:108 +#: ../../build/docs/basic/withPoints.rst:89 msgid "Exercise 1: Get the nearest edge" msgstr "" -#: ../../build/docs/basic/withPoints.rst:115 -#: ../../build/docs/basic/withPoints.rst:165 -#: ../../build/docs/basic/withPoints.rst:193 -#: ../../build/docs/basic/withPoints.rst:295 +#: ../../build/docs/basic/withPoints.rst:96 +#: ../../build/docs/basic/withPoints.rst:145 +#: ../../build/docs/basic/withPoints.rst:173 +#: ../../build/docs/basic/withPoints.rst:256 msgid "Problem" msgstr "" -#: ../../build/docs/basic/withPoints.rst:116 +#: ../../build/docs/basic/withPoints.rst:97 msgid "Get the nearest edge on the graph of the following points." msgstr "" -#: ../../build/docs/basic/withPoints.rst:118 -msgid "(pid, lat, lon) = (1, -36.850329, 174.763094)" +#: ../../build/docs/basic/withPoints.rst:99 +msgid "(pid, lat, lon) = (1, 34.399086, 132.453875)" msgstr "" -#: ../../build/docs/basic/withPoints.rst:119 -msgid "(pid, lat, lon) = (2, -36.853675, 174.764448)" +#: ../../build/docs/basic/withPoints.rst:100 +msgid "(pid, lat, lon) = (2, 34.391111, 132.451490)" msgstr "" -#: ../../build/docs/basic/withPoints.rst:122 -#: ../../build/docs/basic/withPoints.rst:172 -#: ../../build/docs/basic/withPoints.rst:200 -#: ../../build/docs/basic/withPoints.rst:315 +#: ../../build/docs/basic/withPoints.rst:103 +#: ../../build/docs/basic/withPoints.rst:152 +#: ../../build/docs/basic/withPoints.rst:180 +#: ../../build/docs/basic/withPoints.rst:269 msgid "Solution" msgstr "" -#: ../../build/docs/basic/withPoints.rst:123 -msgid "" -"Build the geometry of the points with the appropiate SRID. (lines **4** and " -"**10**)" +#: ../../build/docs/basic/withPoints.rst:104 +msgid "Build the geometry of the points with the appropiate SRID." msgstr "" -#: ../../build/docs/basic/withPoints.rst:125 +#: ../../build/docs/basic/withPoints.rst:105 msgid "Get the union of the individual queries" msgstr "" -#: ../../build/docs/basic/withPoints.rst:138 +#: ../../build/docs/basic/withPoints.rst:118 msgid "pgr_withPoints" msgstr "" -#: ../../build/docs/basic/withPoints.rst:140 +#: ../../build/docs/basic/withPoints.rst:120 msgid "" "Returns the shortest path in a graph with additional temporary vertices." msgstr "" -#: ../../build/docs/basic/withPoints.rst:158 +#: ../../build/docs/basic/withPoints.rst:138 msgid "Exercise 2: Point routing" msgstr "" -#: ../../build/docs/basic/withPoints.rst:166 +#: ../../build/docs/basic/withPoints.rst:146 msgid "Route from point **1** to point **2** on the ``vehicle_net`` where:" msgstr "" -#: ../../build/docs/basic/withPoints.rst:168 -msgid "point **1**: (lat, lon) = (1, -36.850329, 174.763094)" +#: ../../build/docs/basic/withPoints.rst:148 +msgid "point **1**: (lat, lon) = (1, 34.399086, 132.453875)" msgstr "" -#: ../../build/docs/basic/withPoints.rst:169 -msgid "point **2**: (lat, lon) = (2, -36.853675, 174.764448)" +#: ../../build/docs/basic/withPoints.rst:149 +msgid "point **2**: (lat, lon) = (2, 34.391111, 132.451490)" msgstr "" -#: ../../build/docs/basic/withPoints.rst:173 +#: ../../build/docs/basic/withPoints.rst:153 msgid "" "The query from `Exercise 1: Get the nearest edge`_ is used as the inner " "query for points." msgstr "" -#: ../../build/docs/basic/withPoints.rst:175 +#: ../../build/docs/basic/withPoints.rst:155 msgid "" "Using negative values to avoid conficts with vertices with the same value:" msgstr "" -#: ../../build/docs/basic/withPoints.rst:177 +#: ../../build/docs/basic/withPoints.rst:157 msgid "Routing from point **-1** to point **-2**" msgstr "" -#: ../../build/docs/basic/withPoints.rst:190 +#: ../../build/docs/basic/withPoints.rst:170 msgid "Exercise 3: Creating the point routing function" msgstr "" -#: ../../build/docs/basic/withPoints.rst:194 +#: ../../build/docs/basic/withPoints.rst:174 msgid "" "Create the function ``wrk_withPoints`` to route from locations using " "latitude and longitude values." msgstr "" -#: ../../build/docs/basic/withPoints.rst:197 +#: ../../build/docs/basic/withPoints.rst:177 msgid "Analyze the function." msgstr "" -#: ../../build/docs/basic/withPoints.rst:201 +#: ../../build/docs/basic/withPoints.rst:181 msgid "Creating a ``plpgsql`` function." msgstr "" -#: ../../build/docs/basic/withPoints.rst:210 +#: ../../build/docs/basic/withPoints.rst:190 msgid "Analysis" msgstr "" -#: ../../build/docs/basic/withPoints.rst:211 +#: ../../build/docs/basic/withPoints.rst:191 msgid "The function's signature:" msgstr "" -#: ../../build/docs/basic/withPoints.rst:213 +#: ../../build/docs/basic/withPoints.rst:193 msgid "" "The input parameters instead of vertex identifiers, now it has the latitude " "and longitude of a couple of points." msgstr "" -#: ../../build/docs/basic/withPoints.rst:215 +#: ../../build/docs/basic/withPoints.rst:195 msgid "" "The function returns the same set of values calculated on the :doc:" "`sql_function`." msgstr "" -#: ../../build/docs/basic/withPoints.rst:224 -msgid "Getting the closest query:" +#: ../../build/docs/basic/withPoints.rst:204 +msgid "The points SQL:" msgstr "" -#: ../../build/docs/basic/withPoints.rst:226 +#: ../../build/docs/basic/withPoints.rst:206 msgid "The query looks like the one on `Exercise 1: Get the nearest edge`_" msgstr "" -#: ../../build/docs/basic/withPoints.rst:227 -#: ../../build/docs/basic/withPoints.rst:244 -#: ../../build/docs/basic/withPoints.rst:262 +#: ../../build/docs/basic/withPoints.rst:207 +#: ../../build/docs/basic/withPoints.rst:224 msgid "Using PostgreSQL ``format`` to make substitutions." msgstr "" -#: ../../build/docs/basic/withPoints.rst:229 +#: ../../build/docs/basic/withPoints.rst:209 msgid "The first parameter is the string to be replaced" msgstr "" -#: ../../build/docs/basic/withPoints.rst:230 +#: ../../build/docs/basic/withPoints.rst:210 msgid "The rest are the data parameters, are the strings use for replacement." msgstr "" -#: ../../build/docs/basic/withPoints.rst:231 -msgid "``lat1``, ``lon1`` values will replace ``%2$s, %3$s`` respectively." +#: ../../build/docs/basic/withPoints.rst:211 +msgid "``lat1``, ``lon1`` values will replace ``%2$s, %1$s`` respectively." msgstr "" -#: ../../build/docs/basic/withPoints.rst:232 -msgid "``lat2``, ``lon2`` values will replace ``%4$s, %5$s`` respectively." +#: ../../build/docs/basic/withPoints.rst:212 +msgid "``lat2``, ``lon2`` values will replace ``%4$s, %3$s`` respectively." msgstr "" -#: ../../build/docs/basic/withPoints.rst:241 -msgid "Getting the routing results:" +#: ../../build/docs/basic/withPoints.rst:221 +msgid "The routing results:" msgstr "" -#: ../../build/docs/basic/withPoints.rst:243 +#: ../../build/docs/basic/withPoints.rst:223 msgid "The query looks like the one on `Exercise 2: Point routing`" msgstr "" -#: ../../build/docs/basic/withPoints.rst:246 -msgid "The ``edges_subset`` value will replace ``%1$I``." -msgstr "" - -#: ../../build/docs/basic/withPoints.rst:247 -msgid "The ``closest_query`` value will replace ``%2$s``." -msgstr "" - -#: ../../build/docs/basic/withPoints.rst:256 -msgid "Getting the additional information:" -msgstr "" - -#: ../../build/docs/basic/withPoints.rst:258 -msgid "" -"The subquery looks like the one in the function created on :doc:" -"`sql_function`." -msgstr "" - -#: ../../build/docs/basic/withPoints.rst:260 -msgid "A joined table can not be a variable" -msgstr "" - -#: ../../build/docs/basic/withPoints.rst:263 -msgid "" -"To make it work on the ``walk_net``, the whole query needs to be in ``TEXT``." -msgstr "" - -#: ../../build/docs/basic/withPoints.rst:265 -msgid "The ``edges_subset`` value will replace ``%1$I``:" +#: ../../build/docs/basic/withPoints.rst:226 +msgid "The ``points_sql`` value will replace ``%1$s``." msgstr "" -#: ../../build/docs/basic/withPoints.rst:274 +#: ../../build/docs/basic/withPoints.rst:235 msgid "Building the complete query:" msgstr "" -#: ../../build/docs/basic/withPoints.rst:276 +#: ../../build/docs/basic/withPoints.rst:237 msgid "" "The complete query looks like the one in the function created on :doc:" "`sql_function`." msgstr "" -#: ../../build/docs/basic/withPoints.rst:278 +#: ../../build/docs/basic/withPoints.rst:239 msgid "Concatenation of strings is used." msgstr "" -#: ../../build/docs/basic/withPoints.rst:288 +#: ../../build/docs/basic/withPoints.rst:249 msgid "Exercise 4: Using wrk_withPoints" msgstr "" -#: ../../build/docs/basic/withPoints.rst:296 +#: ../../build/docs/basic/withPoints.rst:257 msgid "Use ``wrk_withPoints``" msgstr "" -#: ../../build/docs/basic/withPoints.rst:298 -msgid "Departure point is: (lat,lon) = ``(-36.850329, 174.763094)``" -msgstr "" - -#: ../../build/docs/basic/withPoints.rst:299 -msgid "Destination point is: (lat,lon) = ``(-36.853675, 174.764448)``" +#: ../../build/docs/basic/withPoints.rst:259 +msgid "Departure point is: (lat,lon) = ``(34.399086, 132.453875)``" msgstr "" -#: ../../build/docs/basic/withPoints.rst:300 -#: ../../build/docs/basic/withPoints.rst:316 -msgid "For ``vehicle_net``:" -msgstr "" - -#: ../../build/docs/basic/withPoints.rst:302 -msgid "Get the names of the streets of the route." -msgstr "" - -#: ../../build/docs/basic/withPoints.rst:304 -#: ../../build/docs/basic/withPoints.rst:332 -msgid "For ``taxi_net``:" +#: ../../build/docs/basic/withPoints.rst:260 +msgid "Destination point is: (lat,lon) = ``(34.391111, 132.451490)``" msgstr "" -#: ../../build/docs/basic/withPoints.rst:306 +#: ../../build/docs/basic/withPoints.rst:262 msgid "Get the query that is been generated." msgstr "" -#: ../../build/docs/basic/withPoints.rst:308 -#: ../../build/docs/basic/withPoints.rst:345 -msgid "For ``walk_net``:" -msgstr "" - -#: ../../build/docs/basic/withPoints.rst:310 -#: ../../build/docs/basic/withPoints.rst:321 -msgid "Use with default value of ``do_debug``." -msgstr "" - -#: ../../build/docs/basic/withPoints.rst:311 -msgid "Store results on a table." +#: ../../build/docs/basic/withPoints.rst:263 +msgid "Get the names of the streets of the route." msgstr "" -#: ../../build/docs/basic/withPoints.rst:312 -msgid "Show the table contents." +#: ../../build/docs/basic/withPoints.rst:264 +msgid "Create a view to be used on QGIS." msgstr "" -#: ../../build/docs/basic/withPoints.rst:318 -msgid "The first parameter is the table name." +#: ../../build/docs/basic/withPoints.rst:266 +msgid "Test the view by listing the names of each segment of the route." msgstr "" -#: ../../build/docs/basic/withPoints.rst:319 +#: ../../build/docs/basic/withPoints.rst:270 msgid "" "The next two parameters are the latitude and longitude of the departure " "point." msgstr "" -#: ../../build/docs/basic/withPoints.rst:320 +#: ../../build/docs/basic/withPoints.rst:271 msgid "" "The next two parameters are the latitude and longitude of the destination " "point." msgstr "" -#: ../../build/docs/basic/withPoints.rst:334 +#: ../../build/docs/basic/withPoints.rst:272 +msgid "Use with default value of ``do_debug``." +msgstr "" + +#: ../../build/docs/basic/withPoints.rst:283 msgid "Do a dry run by adding ``true`` to get the query that is executed." msgstr "" + +#: ../../build/docs/basic/withPoints.rst:294 +msgid "Create the view and test it." +msgstr "" diff --git a/locale/en/LC_MESSAGES/un_sdg/data.po b/locale/en/LC_MESSAGES/un_sdg/data.po index 91750cb2f..b8736142d 100644 --- a/locale/en/LC_MESSAGES/un_sdg/data.po +++ b/locale/en/LC_MESSAGES/un_sdg/data.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: 2026-06-25 21:50+0000\n" +"POT-Creation-Date: 2026-07-01 17:09+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language: en\n" @@ -27,35 +27,23 @@ msgstr "" #: ../../build/docs/un_sdg/data.rst:11 msgid "" "To be able to use pgRouting, data has to be imported into a database. This " -"chapter will use ``osm2pgrouting`` to get that the data from OpenStreetMap " -"(OSM). This data will be used for exercises in further chapters." +"chapter will use ``osm2pgrouting`` to get the data from OpenStreetMap (OSM). " +"This data will be used for exercises in further chapters." msgstr "" #: ../../build/docs/un_sdg/data.rst:15 -msgid "Chapter Contents" -msgstr "" - -#: ../../build/docs/un_sdg/data.rst:18 -msgid "Work Directory for pgRouting data manipulation" +msgid "pgRouting is an extension which requires:" msgstr "" -#: ../../build/docs/un_sdg/data.rst:26 -msgid "Mumbai database" -msgstr "" - -#: ../../build/docs/un_sdg/data.rst:28 -msgid "pgRouting is pre-installed as an extension which requires:" -msgstr "" - -#: ../../build/docs/un_sdg/data.rst:30 +#: ../../build/docs/un_sdg/data.rst:17 msgid "Supported PostgreSQL version" msgstr "" -#: ../../build/docs/un_sdg/data.rst:31 +#: ../../build/docs/un_sdg/data.rst:18 msgid "Supported PostGIS version" msgstr "" -#: ../../build/docs/un_sdg/data.rst:33 +#: ../../build/docs/un_sdg/data.rst:20 msgid "" "These requirements are met on OSGeoLive. When the required software is " "installed, open a terminal window by pressing ``ctrl-alt-t`` and follow the " @@ -63,80 +51,114 @@ msgid "" "`../appendix/osgeolive` of this workshop." msgstr "" -#: ../../build/docs/un_sdg/data.rst:38 +#: ../../build/docs/un_sdg/data.rst:25 msgid "" "If you don't have pgRouting installed. You can find the installation " "procedure at this `link `__" msgstr "" -#: ../../build/docs/un_sdg/data.rst:44 +#: ../../build/docs/un_sdg/data.rst:29 +msgid "" +"The database to install depends on the UN SDG chapter you are working on:" +msgstr "" + +#: ../../build/docs/un_sdg/data.rst:35 +msgid "Chapter" +msgstr "" + +#: ../../build/docs/un_sdg/data.rst:36 +msgid "Database" +msgstr "" + +#: ../../build/docs/un_sdg/data.rst:37 ../../build/docs/un_sdg/data.rst:213 +msgid ":doc:`sdg3-health`" +msgstr "" + +#: ../../build/docs/un_sdg/data.rst:38 ../../build/docs/un_sdg/data.rst:40 +msgid "`Mumbai database`_" +msgstr "" + +#: ../../build/docs/un_sdg/data.rst:39 ../../build/docs/un_sdg/data.rst:214 +msgid ":doc:`sdg7-energy`" +msgstr "" + +#: ../../build/docs/un_sdg/data.rst:41 ../../build/docs/un_sdg/data.rst:347 +msgid ":doc:`sdg11-cities`" +msgstr "" + +#: ../../build/docs/un_sdg/data.rst:42 +msgid "`Bangladesh database`_" +msgstr "" + +#: ../../build/docs/un_sdg/data.rst:45 +msgid "Chapter Contents" +msgstr "" + +#: ../../build/docs/un_sdg/data.rst:48 +msgid "Mumbai database" +msgstr "" + +#: ../../build/docs/un_sdg/data.rst:51 ../../build/docs/un_sdg/data.rst:220 +msgid "Contents" +msgstr "" + +#: ../../build/docs/un_sdg/data.rst:54 msgid "Create Mumbai database compatible with pgRouting" msgstr "" -#: ../../build/docs/un_sdg/data.rst:46 +#: ../../build/docs/un_sdg/data.rst:56 msgid "Use the following command to create ``mumbai`` database" msgstr "" -#: ../../build/docs/un_sdg/data.rst:52 ../../build/docs/un_sdg/data.rst:185 +#: ../../build/docs/un_sdg/data.rst:62 ../../build/docs/un_sdg/data.rst:231 msgid "To connect to the database do the following" msgstr "" -#: ../../build/docs/un_sdg/data.rst:58 ../../build/docs/un_sdg/data.rst:192 +#: ../../build/docs/un_sdg/data.rst:68 msgid "" -"After connecting to the database, first step is to create ``EXTENSION`` to " -"enable pgRouting and PostGIS in the database. Then add the ``SCHEMA`` for " -"each table." +"After connecting to the database, the first step is to create ``EXTENSION`` " +"to enable pgRouting and PostGIS in the database. Then add the ``SCHEMA`` " +"that are needed." msgstr "" -#: ../../build/docs/un_sdg/data.rst:68 +#: ../../build/docs/un_sdg/data.rst:78 msgid "Get the Mumbai Data" msgstr "" -#: ../../build/docs/un_sdg/data.rst:69 +#: ../../build/docs/un_sdg/data.rst:79 msgid "" "The pgRouting workshop will make use of OpenStreetMap data of an area in " "Mumbai City. The instructions for downloading the data are given below." msgstr "" -#: ../../build/docs/un_sdg/data.rst:73 +#: ../../build/docs/un_sdg/data.rst:83 msgid "Downloading Mumbai data from OSGeo" msgstr "" -#: ../../build/docs/un_sdg/data.rst:75 +#: ../../build/docs/un_sdg/data.rst:84 msgid "" "The following command is used to download the snapshot of the Mumbai area " "data used in this workshop, using the download service of OSGeo." msgstr "" -#: ../../build/docs/un_sdg/data.rst:78 +#: ../../build/docs/un_sdg/data.rst:87 msgid "" "The Mumbai data for this workshop depends on this `snapshot `__." msgstr "" -#: ../../build/docs/un_sdg/data.rst:88 -msgid "Downloading Mumbai data from OpenStreetMap (OSM)" -msgstr "" - -#: ../../build/docs/un_sdg/data.rst:89 +#: ../../build/docs/un_sdg/data.rst:96 msgid "" -"The following command is used to download the OpenStreetMap data of the area " -"in Mumbai, India." +"The following command was used in June 2021 to download the OpenStreetMap " +"data of the area in Mumbai, India." msgstr "" -#: ../../build/docs/un_sdg/data.rst:91 -msgid "" -"OpenStreetMap data changes on a day to day basis, therefore if this data is " -"used, the results might change and some queries might need adjustments. The " -"command was used to take the snapshot of the data on June 2021." -msgstr "" - -#: ../../build/docs/un_sdg/data.rst:102 +#: ../../build/docs/un_sdg/data.rst:107 msgid "Upload Mumbai data to the database" msgstr "" -#: ../../build/docs/un_sdg/data.rst:104 ../../build/docs/un_sdg/data.rst:233 +#: ../../build/docs/un_sdg/data.rst:109 ../../build/docs/un_sdg/data.rst:280 msgid "" "The next step is to run ``osm2pgrouting`` converter, which is a command line " "tool that inserts the data in the database, \"ready\" to be used with " @@ -144,164 +166,168 @@ msgid "" "about ``osm2pgrouting``." msgstr "" -#: ../../build/docs/un_sdg/data.rst:108 ../../build/docs/un_sdg/data.rst:237 +#: ../../build/docs/un_sdg/data.rst:113 ../../build/docs/un_sdg/data.rst:284 msgid "For this step the following is used:" msgstr "" -#: ../../build/docs/un_sdg/data.rst:110 +#: ../../build/docs/un_sdg/data.rst:115 +msgid "Configuration file: ``buildings.xml``" +msgstr "" + +#: ../../build/docs/un_sdg/data.rst:116 msgid "" -"``mumbai_buildings.xml`` and ``mumbai_roads.xml`` configuration files for " -"osm2pgrouting." +"Configuration file: the default ``mapconfig.xml`` provided with " +"``osm2pgrouting``" msgstr "" -#: ../../build/docs/un_sdg/data.rst:111 -msgid "``~/Desktop/workshop/mumbai.osm`` - OSM data from the previous step" +#: ../../build/docs/un_sdg/data.rst:118 +msgid "Copy the ``buildings.xml`` configuration file." msgstr "" -#: ../../build/docs/un_sdg/data.rst:112 -msgid "``mumbai`` database." +#: ../../build/docs/un_sdg/data.rst:126 +msgid "Importing Mumbai Roads" msgstr "" -#: ../../build/docs/un_sdg/data.rst:114 ../../build/docs/un_sdg/data.rst:243 +#: ../../build/docs/un_sdg/data.rst:128 msgid "" -"Contents of the configuration files are given in the `Appendix`_. Create a " -"XML file using these contents and save it into the root directory ``~/" -"Desktop/workshop``." +"The following ``osm2pgrouting`` command will be used to import the ``mumbai." +"osm`` roads into a pgRouting compatible database." +msgstr "" + +#: ../../build/docs/un_sdg/data.rst:143 +msgid "Importing Mumbai Buildings" msgstr "" -#: ../../build/docs/un_sdg/data.rst:117 +#: ../../build/docs/un_sdg/data.rst:145 msgid "" -"Open a terminal window by ``ctrl-alt-t`` and move to the workshop directory " -"by ``cd ~/Desktop/workshop``. The following ``osm2pgrouting`` command will " -"be used to convert the osm files to pgRouting friendly format which we will " -"use for further exercises." +"The following ``osm2pgrouting`` command will be used to import the ``mumbai." +"osm`` buildings into a pgRouting compatible database." msgstr "" -#: ../../build/docs/un_sdg/data.rst:122 -msgid "Importing Mumbai Roads" +#: ../../build/docs/un_sdg/data.rst:160 +msgid "Compatibility with older osm2pgrouting versions (Mumbai)" +msgstr "" + +#: ../../build/docs/un_sdg/data.rst:162 ../../build/docs/un_sdg/data.rst:317 +msgid "Check the installed version:" msgstr "" -#: ../../build/docs/un_sdg/data.rst:124 +#: ../../build/docs/un_sdg/data.rst:168 ../../build/docs/un_sdg/data.rst:323 msgid "" -"The following ``osm2pgrouting`` command will be used to import the Roads " -"from OpenStreetMaps file to pgRouting database which we will use for further " -"exercises." +"If you are using version 2.x, the column names differ from those used in " +"this workshop:" msgstr "" -#: ../../build/docs/un_sdg/data.rst:134 ../../build/docs/un_sdg/data.rst:155 -#: ../../build/docs/un_sdg/data.rst:261 -msgid "Depending on the osm2pgrouting version `-W password` is needed" +#: ../../build/docs/un_sdg/data.rst:171 ../../build/docs/un_sdg/data.rst:326 +msgid "``gid`` instead of ``id``" msgstr "" -#: ../../build/docs/un_sdg/data.rst:137 ../../build/docs/un_sdg/data.rst:158 -#: ../../build/docs/un_sdg/data.rst:264 -msgid "Output:" +#: ../../build/docs/un_sdg/data.rst:172 ../../build/docs/un_sdg/data.rst:327 +msgid "``the_geom`` instead of ``geom``" msgstr "" -#: ../../build/docs/un_sdg/data.rst:143 -msgid "Importing Mumbai Buildings" +#: ../../build/docs/un_sdg/data.rst:174 ../../build/docs/un_sdg/data.rst:329 +msgid "Run the following script to rename them:" msgstr "" -#: ../../build/docs/un_sdg/data.rst:145 -msgid "" -"Similar to Roads, ``osm2pgrouting`` command will be used to import the " -"Buildings from OpenStreetMaps file to pgRouting database which we will use " -"for further exercises." +#: ../../build/docs/un_sdg/data.rst:182 +msgid "Verify the data (Mumbai)" msgstr "" -#: ../../build/docs/un_sdg/data.rst:163 ../../build/docs/un_sdg/data.rst:269 +#: ../../build/docs/un_sdg/data.rst:184 ../../build/docs/un_sdg/data.rst:339 msgid "To connect to the database, type the following in the terminal." msgstr "" -#: ../../build/docs/un_sdg/data.rst:171 -msgid "Bangladesh database" +#: ../../build/docs/un_sdg/data.rst:190 +msgid "" +"The importance of counting the information on this workshop is to make sure " +"that the same data is used and consequently the results are same." msgstr "" -#: ../../build/docs/un_sdg/data.rst:173 -msgid "" -"Now download the data for an area in Bangladesh by following the same steps " -"like that of Mumbai." +#: ../../build/docs/un_sdg/data.rst:211 ../../build/docs/un_sdg/data.rst:345 +msgid "Continue with the workshop:" +msgstr "" + +#: ../../build/docs/un_sdg/data.rst:217 +msgid "Bangladesh database" msgstr "" -#: ../../build/docs/un_sdg/data.rst:177 +#: ../../build/docs/un_sdg/data.rst:223 msgid "Create Bangladesh area database compatible with pgRouting" msgstr "" -#: ../../build/docs/un_sdg/data.rst:179 +#: ../../build/docs/un_sdg/data.rst:225 msgid "Use the following command to create ``bangladesh`` database" msgstr "" -#: ../../build/docs/un_sdg/data.rst:202 +#: ../../build/docs/un_sdg/data.rst:238 +msgid "" +"After connecting to the database, the first step is to create ``EXTENSION`` " +"to enable pgRouting and PostGIS in the database. Then add the ``SCHEMA`` for " +"each table." +msgstr "" + +#: ../../build/docs/un_sdg/data.rst:248 msgid "Get the Bangladesh Data" msgstr "" -#: ../../build/docs/un_sdg/data.rst:205 +#: ../../build/docs/un_sdg/data.rst:251 msgid "Downloading Bangladesh data from OSGeo" msgstr "" -#: ../../build/docs/un_sdg/data.rst:207 +#: ../../build/docs/un_sdg/data.rst:252 msgid "" "The following command is used to download the snapshot of the Bangladesh " "area data used in this workshop, using the download service of OSGeo." msgstr "" -#: ../../build/docs/un_sdg/data.rst:210 +#: ../../build/docs/un_sdg/data.rst:255 msgid "" "The Bangladesh data for this workshop depends on this `snapshot `__." msgstr "" -#: ../../build/docs/un_sdg/data.rst:220 -msgid "Downloading Bangladesh data from OpenStreetMap" -msgstr "" - -#: ../../build/docs/un_sdg/data.rst:221 +#: ../../build/docs/un_sdg/data.rst:264 msgid "" -"The following command is used to download the OSM data of the area in " -"Munshigang, Bangladesh." +"The following command was used in June 2021 to download the OpenStreetMap " +"data of the area in Munshigang, Bangladesh." msgstr "" -#: ../../build/docs/un_sdg/data.rst:231 +#: ../../build/docs/un_sdg/data.rst:278 msgid "Upload Bangladesh data to the database" msgstr "" -#: ../../build/docs/un_sdg/data.rst:239 -msgid "``waterways.xml`` configuration file" +#: ../../build/docs/un_sdg/data.rst:286 +msgid "Configuration file: ``waterways.xml``" msgstr "" -#: ../../build/docs/un_sdg/data.rst:240 +#: ../../build/docs/un_sdg/data.rst:287 msgid "``~/Desktop/workshop/bangladesh.osm`` - OSM data from the previous step" msgstr "" -#: ../../build/docs/un_sdg/data.rst:241 +#: ../../build/docs/un_sdg/data.rst:288 msgid "``bangladesh`` database" msgstr "" -#: ../../build/docs/un_sdg/data.rst:246 -msgid "" -"Open a terminal window by ``ctrl-alt-t`` and move to the workshop directory " -"by ``cd ~/Desktop/workshop``." +#: ../../build/docs/un_sdg/data.rst:290 +msgid "Copy the ``waterways.xml`` configuration file." msgstr "" -#: ../../build/docs/un_sdg/data.rst:250 +#: ../../build/docs/un_sdg/data.rst:298 msgid "Importing Bangladesh Waterways" msgstr "" -#: ../../build/docs/un_sdg/data.rst:252 +#: ../../build/docs/un_sdg/data.rst:300 msgid "" "The following ``osm2pgrouting`` command will be used to import the Waterways " -"from OpenStreetMaps file to pgRouting database which we will use for further " -"exercises." -msgstr "" - -#: ../../build/docs/un_sdg/data.rst:278 -msgid "Appendix" +"from the OpenStreetMap file to the pgRouting database which we will use for " +"further exercises." msgstr "" -#: ../../build/docs/un_sdg/data.rst:281 -msgid "Configuration information for Buildings" +#: ../../build/docs/un_sdg/data.rst:315 +msgid "Compatibility with older osm2pgrouting versions (Bangladesh)" msgstr "" -#: ../../build/docs/un_sdg/data.rst:289 -msgid "Configuration information for Waterways" +#: ../../build/docs/un_sdg/data.rst:337 +msgid "Verify the data (Bangladesh)" msgstr "" diff --git a/locale/en/LC_MESSAGES/un_sdg/sdg11-cities.po b/locale/en/LC_MESSAGES/un_sdg/sdg11-cities.po index 9ad920dc3..e73cea834 100644 --- a/locale/en/LC_MESSAGES/un_sdg/sdg11-cities.po +++ b/locale/en/LC_MESSAGES/un_sdg/sdg11-cities.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: 2026-06-14 15:17+0000\n" +"POT-Creation-Date: 2026-07-01 17:09+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language: en\n" @@ -20,11 +20,11 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 2.18.0\n" -#: ../../build/docs/un_sdg/sdg11-cities.rst:11 +#: ../../build/docs/un_sdg/sdg11-cities.rst:6 msgid "Sustainable Cities and Communities" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:13 +#: ../../build/docs/un_sdg/sdg11-cities.rst:8 msgid "" "`Sustainable Cities and Communities` is the 11th Sustainable Development " "Goal which aspires to make cities `inclusive, safe, resilient` and " @@ -37,70 +37,70 @@ msgid "" "of such problems." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:22 +#: ../../build/docs/un_sdg/sdg11-cities.rst:17 msgid "Sustainable Development Goal 11: Sustainable Cities and Communities" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:26 +#: ../../build/docs/un_sdg/sdg11-cities.rst:21 msgid "`Image Source `__" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:28 +#: ../../build/docs/un_sdg/sdg11-cities.rst:23 msgid "Chapter Contents" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:31 +#: ../../build/docs/un_sdg/sdg11-cities.rst:26 msgid "Problem: City getting affected by rain or not" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:33 +#: ../../build/docs/un_sdg/sdg11-cities.rst:28 msgid "**Problem Statement**" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:35 +#: ../../build/docs/un_sdg/sdg11-cities.rst:30 msgid "To determine the areas where if it rains will affect a city/town" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:41 +#: ../../build/docs/un_sdg/sdg11-cities.rst:36 msgid "**Core Idea**" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:43 +#: ../../build/docs/un_sdg/sdg11-cities.rst:38 msgid "" "If it rains in vicinity of a river connecting the city, the city will get " "affected by the rains." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:46 +#: ../../build/docs/un_sdg/sdg11-cities.rst:41 msgid "**Approach**" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:48 -#: ../../build/docs/un_sdg/sdg11-cities.rst:59 +#: ../../build/docs/un_sdg/sdg11-cities.rst:43 +#: ../../build/docs/un_sdg/sdg11-cities.rst:54 msgid "Choose a city" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:49 +#: ../../build/docs/un_sdg/sdg11-cities.rst:44 msgid "Get the Rivers (Edges)" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:50 +#: ../../build/docs/un_sdg/sdg11-cities.rst:45 msgid "Create river components" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:51 +#: ../../build/docs/un_sdg/sdg11-cities.rst:46 msgid "Create a Buffer around the city" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:52 +#: ../../build/docs/un_sdg/sdg11-cities.rst:47 msgid "Finding the components intersecting the buffer" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:53 +#: ../../build/docs/un_sdg/sdg11-cities.rst:48 msgid "Finding the rain zones" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:61 +#: ../../build/docs/un_sdg/sdg11-cities.rst:56 msgid "" "For this exercise, Munshigang city from Bangladesh is chosen. This city has " "multiple rivers in its proximity which makes it an apt location to " @@ -111,27 +111,27 @@ msgid "" "point." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:69 +#: ../../build/docs/un_sdg/sdg11-cities.rst:64 msgid "Exercise 1: Create a point for the city" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:72 +#: ../../build/docs/un_sdg/sdg11-cities.rst:67 msgid "Create a table for the cities" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:83 +#: ../../build/docs/un_sdg/sdg11-cities.rst:78 msgid "Insert Munshigang" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:94 +#: ../../build/docs/un_sdg/sdg11-cities.rst:89 msgid "Simulate the city region with a buffer" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:105 +#: ../../build/docs/un_sdg/sdg11-cities.rst:100 msgid "See description of the table" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:114 +#: ../../build/docs/un_sdg/sdg11-cities.rst:109 msgid "" "Latitude and longitude values are converted into ``geometry`` form using " "``ST_Point`` which returns a point with the given X and Y coordinate values. " @@ -139,52 +139,52 @@ msgid "" "point geometry to ``4326``." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:120 +#: ../../build/docs/un_sdg/sdg11-cities.rst:115 msgid "Prepare the database" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:122 +#: ../../build/docs/un_sdg/sdg11-cities.rst:117 msgid "Data obtained in :doc:`data`." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:124 +#: ../../build/docs/un_sdg/sdg11-cities.rst:119 msgid "" "This section will cover the status of the database in order to get the same " "results when processing the queries." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:128 +#: ../../build/docs/un_sdg/sdg11-cities.rst:123 msgid "Exercise 2: Set the search path" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:130 +#: ../../build/docs/un_sdg/sdg11-cities.rst:125 msgid "" "First step in pre processing is to set the search path for ``Waterways`` " "data. Search path is a list of schemas that helps the system determine how a " "particular table is to be imported." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:145 +#: ../../build/docs/un_sdg/sdg11-cities.rst:140 msgid "Exercise 3: Verify database configuration" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:147 +#: ../../build/docs/un_sdg/sdg11-cities.rst:142 msgid "As part of the every project tasks: inspect the database structure." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:150 +#: ../../build/docs/un_sdg/sdg11-cities.rst:145 msgid "Get the extensions that are installed" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:160 +#: ../../build/docs/un_sdg/sdg11-cities.rst:155 msgid "List installed tables" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:170 +#: ../../build/docs/un_sdg/sdg11-cities.rst:165 msgid "Exercise 4: Count the number of Waterways" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:172 +#: ../../build/docs/un_sdg/sdg11-cities.rst:167 msgid "" "The importance of counting the information on this workshop is to make sure " "that the same data is used and consequently the results are same. Also, some " @@ -192,11 +192,11 @@ msgid "" "data is stored in it." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:187 +#: ../../build/docs/un_sdg/sdg11-cities.rst:182 msgid "Processing waterways data" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:189 +#: ../../build/docs/un_sdg/sdg11-cities.rst:184 msgid "" "This section will work the graph that is going to be used for processing. " "While building the graph, the data has to be inspected to determine if there " @@ -205,103 +205,103 @@ msgid "" "Adjustments." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:195 +#: ../../build/docs/un_sdg/sdg11-cities.rst:190 msgid "Exercise 5: Remove waterways not for the problem" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:197 +#: ../../build/docs/un_sdg/sdg11-cities.rst:192 msgid "Waterways to be removed" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:201 +#: ../../build/docs/un_sdg/sdg11-cities.rst:196 msgid "" "This exercise focusses only the areas in the mainland, where if it rains the " "city is affected. Hence, the rivers which are there in the swamp area wich " -"is in a lower altitude of the city, are to be removed from the " -"``waterways_ways`` table." +"is in a lower altitude of the city, are to be removed from the ``waterways." +"ways`` table." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:206 +#: ../../build/docs/un_sdg/sdg11-cities.rst:201 msgid "Remove swamp rivers" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:216 +#: ../../build/docs/un_sdg/sdg11-cities.rst:211 msgid "" "When working for many cities, a better approach might be to create views." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:220 +#: ../../build/docs/un_sdg/sdg11-cities.rst:215 msgid "Also delete a boundary tagged as waterway" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:230 +#: ../../build/docs/un_sdg/sdg11-cities.rst:225 msgid "A better approach might be to fix the original data in OSM website." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:233 +#: ../../build/docs/un_sdg/sdg11-cities.rst:228 msgid "Exercise 6: Get the Connected Components of Waterways" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:235 +#: ../../build/docs/un_sdg/sdg11-cities.rst:230 msgid "" "As the rivers in the data are not having single edges, i.e, multiple edges " "make up a river, it is important to find out the connected edges and store " -"the information in the ``waterways_ways`` table. This will help us to " +"the information in the ``waterways.ways`` table. This will help us to " "identify which edges belong to a river. First, the connected components are " "found and then stored in a new column named ``component``." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:241 +#: ../../build/docs/un_sdg/sdg11-cities.rst:236 msgid "" "The pgRouting function ``pgr_connectedComponents`` is used to complete this " "task and its explaind with more detail in :doc:`../basic/graphs`." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:244 +#: ../../build/docs/un_sdg/sdg11-cities.rst:239 msgid "" "A sub-query is created to find out all the connected components. After that, " "the ``component`` column is updated using the results obtained from the sub-" -"query. This helps in storing the component id in the " -"``waterways_ways_vertices_pgr`` table. Next query uses this output and " -"stores the component id in the waterways_ways (edges) table. Follow the " -"steps given below to complete this task." +"query. This helps in storing the component id in the ``waterways." +"waterway_vertices`` table. Next query uses this output and stores the " +"component id in the waterways.ways (edges) table. Follow the steps given " +"below to complete this task." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:251 +#: ../../build/docs/un_sdg/sdg11-cities.rst:246 msgid "Create a vertices table." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:262 +#: ../../build/docs/un_sdg/sdg11-cities.rst:257 msgid "Fill up the ``x``, ``y`` and ``geom`` columns." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:273 +#: ../../build/docs/un_sdg/sdg11-cities.rst:268 msgid "Add a ``component`` column on the edges and vertices tables." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:284 +#: ../../build/docs/un_sdg/sdg11-cities.rst:279 msgid "Fill up the ``component`` column on the vertices table." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:295 +#: ../../build/docs/un_sdg/sdg11-cities.rst:290 msgid "Fill up the ``component`` column on the edges table." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:302 +#: ../../build/docs/un_sdg/sdg11-cities.rst:297 msgid "Exercise 7: Creating a function that gets the city buffer" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:304 +#: ../../build/docs/un_sdg/sdg11-cities.rst:299 msgid "" "A function can be created for the same task. This will be help when the " "table has more than one city." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:319 +#: ../../build/docs/un_sdg/sdg11-cities.rst:314 msgid "Exercise 8: Finding the components intersecting the buffer" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:321 +#: ../../build/docs/un_sdg/sdg11-cities.rst:316 msgid "" "Next step is to find the components of waterways which lie in the buffer " "zone of the city. These are the waterways which will affect the city when it " @@ -309,68 +309,68 @@ msgid "" "``get_city_buffer`` function is used in the query below." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:336 +#: ../../build/docs/un_sdg/sdg11-cities.rst:331 msgid "" "Output shows the distinct component numbers which lie in the buffer zone of " "the city. That is, the rivers that lie within the city." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:341 +#: ../../build/docs/un_sdg/sdg11-cities.rst:336 msgid "Exercise 9: Get the rain zones" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:343 +#: ../../build/docs/un_sdg/sdg11-cities.rst:338 msgid "" "In this excercise the area , where if it rains, the city would be affected, " "is calculated. This area is called ``rain zone`` in the excercise" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:346 +#: ../../build/docs/un_sdg/sdg11-cities.rst:341 msgid "Create a Buffer around the river components." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:348 -msgid "Add columns named ``rain_zone`` in waterways_ways" +#: ../../build/docs/un_sdg/sdg11-cities.rst:343 +msgid "Add columns named ``rain_zone`` in waterways.ways" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:350 +#: ../../build/docs/un_sdg/sdg11-cities.rst:345 msgid "To store buffer geometry of the rain zones." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:352 +#: ../../build/docs/un_sdg/sdg11-cities.rst:347 msgid "" "Find the buffer for every edge that intersects the city buffer area using " "``ST_Buffer``" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:353 +#: ../../build/docs/un_sdg/sdg11-cities.rst:348 msgid "and update the ``rain_zone`` column." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:356 +#: ../../build/docs/un_sdg/sdg11-cities.rst:351 msgid "Adding column to store Buffer geometry" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:367 +#: ../../build/docs/un_sdg/sdg11-cities.rst:362 msgid "Storing Buffer geometry" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:377 +#: ../../build/docs/un_sdg/sdg11-cities.rst:372 msgid "" "This will give us the requires area, where if it rains, the city will be " "affected." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:380 +#: ../../build/docs/un_sdg/sdg11-cities.rst:375 msgid "Exercise 10: Create a union of rain zones" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:381 +#: ../../build/docs/un_sdg/sdg11-cities.rst:376 msgid "" "Multiple polygons that are obtained can also be merged using ``ST_Union``. " "This will give a single polygon as the output." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:388 +#: ../../build/docs/un_sdg/sdg11-cities.rst:383 msgid "When it rains in the vicinity, the city will get affected by the rain." msgstr "" diff --git a/locale/en/LC_MESSAGES/un_sdg/sdg3-health.po b/locale/en/LC_MESSAGES/un_sdg/sdg3-health.po index 55e53dd81..ac26fc9a0 100644 --- a/locale/en/LC_MESSAGES/un_sdg/sdg3-health.po +++ b/locale/en/LC_MESSAGES/un_sdg/sdg3-health.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: 2026-06-14 15:17+0000\n" +"POT-Creation-Date: 2026-07-01 17:09+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language: en\n" @@ -20,11 +20,19 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 2.18.0\n" -#: ../../build/docs/un_sdg/sdg3-health.rst:11 +#: ../../build/docs/un_sdg/sdg3-health.rst:6 msgid "Good Health and Well Being" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:13 +#: ../../build/docs/un_sdg/sdg3-health.rst:8 +msgid "Sustainable Development Goal 3: Good Health and Well Being" +msgstr "" + +#: ../../build/docs/un_sdg/sdg3-health.rst:12 +msgid "`Image Source `__" +msgstr "" + +#: ../../build/docs/un_sdg/sdg3-health.rst:14 msgid "" "`Good Health and Well Being` is the 3rd Sustainable Development Goal which " "aspires to ensure health and well-being for all, including a bold commitment " @@ -41,484 +49,612 @@ msgid "" "services. This chapter will focus on solving one of such problems." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:26 -msgid "Sustainable Development Goal 3: Good Health and Well Being" +#: ../../build/docs/un_sdg/sdg3-health.rst:27 +msgid "Chapter Contents" msgstr "" #: ../../build/docs/un_sdg/sdg3-health.rst:30 -msgid "`Image Source `__" +msgid "Problem: Estimation of Population Served by Hospitals" msgstr "" #: ../../build/docs/un_sdg/sdg3-health.rst:32 -msgid "Chapter Contents" +msgid "**Problem Statement**" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:35 -msgid "Problem: Estimation of Population Served by Hospitals" +#: ../../build/docs/un_sdg/sdg3-health.rst:34 +msgid "" +"Determine the population served by a hospital based on walking travel time." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:37 -msgid "**Problem Statement**" +#: ../../build/docs/un_sdg/sdg3-health.rst:36 +msgid "**Core Idea**" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:39 -msgid "To determine the population served by a hospital based on travel time" +#: ../../build/docs/un_sdg/sdg3-health.rst:38 +msgid "" +"Population residing along the roads which reach to a hospital within a " +"particular time is dependant on that hospital." msgstr "" #: ../../build/docs/un_sdg/sdg3-health.rst:41 -msgid "**Core Idea**" +msgid "**Approach**" msgstr "" #: ../../build/docs/un_sdg/sdg3-health.rst:43 -msgid "" -"Population residing along the roads which reach to a hospital within a " -"particular time is dependant on that hospital." +msgid "Get the data of" +msgstr "" + +#: ../../build/docs/un_sdg/sdg3-health.rst:45 +msgid "Roads" msgstr "" #: ../../build/docs/un_sdg/sdg3-health.rst:46 -msgid "**Approach**" +msgid "Buildings" msgstr "" #: ../../build/docs/un_sdg/sdg3-health.rst:48 -msgid "To prepare a dataset with:" +msgid "Small analysis of the database." +msgstr "" + +#: ../../build/docs/un_sdg/sdg3-health.rst:49 +msgid "Simulate census data." msgstr "" #: ../../build/docs/un_sdg/sdg3-health.rst:50 -msgid "Edges: Roads" +msgid "Remove disconnected roads from the graph." msgstr "" #: ../../build/docs/un_sdg/sdg3-health.rst:51 -msgid "Polygons: Buildings with population" +msgid "Estimate the population living on the buildings." msgstr "" #: ../../build/docs/un_sdg/sdg3-health.rst:53 -msgid "Find the travel-time based the roads served" -msgstr "" - -#: ../../build/docs/un_sdg/sdg3-health.rst:54 -msgid "Estimate the population of the buildings" +msgid "Find the nearest road to the buildings." msgstr "" #: ../../build/docs/un_sdg/sdg3-health.rst:55 -msgid "Find the nearest road to the buildings" +msgid "Estimate the population living on the roads." msgstr "" #: ../../build/docs/un_sdg/sdg3-health.rst:56 -msgid "Store the sum of population of nearest buildings in roads table" +msgid "Calculate the walking travel time from a road to a hospital." msgstr "" #: ../../build/docs/un_sdg/sdg3-health.rst:57 -msgid "Find the sum of population on all the roads in the roads served" +msgid "Calculate the population within 10 mintues waking to a location." +msgstr "" + +#: ../../build/docs/un_sdg/sdg3-health.rst:59 +msgid "First step is to prepare the data obtained from :doc:`data`." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:60 +#: ../../build/docs/un_sdg/sdg3-health.rst:61 +msgid "" +"Follow the instructions in :doc:`data` to create and populate the ``mumbai`` " +"database." +msgstr "" + +#: ../../build/docs/un_sdg/sdg3-health.rst:64 +msgid "Following image shows the roads and buildings." +msgstr "" + +#: ../../build/docs/un_sdg/sdg3-health.rst:71 msgid "PostreSQL basics" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:63 +#: ../../build/docs/un_sdg/sdg3-health.rst:73 msgid "Preparing work area" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:65 +#: ../../build/docs/un_sdg/sdg3-health.rst:75 msgid "" "The ``search_path`` is a variable that determines the order in which " "database schemas are searched for objects." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:68 +#: ../../build/docs/un_sdg/sdg3-health.rst:78 msgid "" "By setting the ``search_path`` to appropriate values, prepending the schema " "name to tables can be avoided." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:72 +#: ../../build/docs/un_sdg/sdg3-health.rst:82 msgid "Exercise 1: Inspecting schemas" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:74 +#: ../../build/docs/un_sdg/sdg3-health.rst:84 msgid "" "Inspect the schemas by displaying all the present schemas using the " "following command" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:85 +#: ../../build/docs/un_sdg/sdg3-health.rst:95 msgid "" "The schema names are ``buildings``, ``roads`` and ``public``. The owner " "depends on who has the rights to the database." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:89 +#: ../../build/docs/un_sdg/sdg3-health.rst:99 msgid "Exercise 2: Inspecting the search path" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:91 +#: ../../build/docs/un_sdg/sdg3-health.rst:101 msgid "Display the current search path using the following query." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:102 +#: ../../build/docs/un_sdg/sdg3-health.rst:112 msgid "" "This is the current search path. Tables in other schemas cannot be accessed " "with this path." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:106 -msgid "Exercise 3: Fixing the search path" +#: ../../build/docs/un_sdg/sdg3-health.rst:116 +msgid "Exercise 3: Adjusting the search path" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:108 +#: ../../build/docs/un_sdg/sdg3-health.rst:118 msgid "" "In this case, the search path needs to include ``roads`` and ``buildings`` " "schemas. The following query is used to adjust the search path." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:119 +#: ../../build/docs/un_sdg/sdg3-health.rst:130 msgid "Checking the search path again" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:131 +#: ../../build/docs/un_sdg/sdg3-health.rst:143 msgid "Exercise 4: Enumerating tables" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:133 +#: ../../build/docs/un_sdg/sdg3-health.rst:145 msgid "With ``\\dt`` the tables are listed showing the schema and the owner" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:144 -msgid "Preparing roads and buildings data" +#: ../../build/docs/un_sdg/sdg3-health.rst:156 +msgid "Simulation of census data" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:146 -msgid "First step is to prepare the data obtained from :doc:`data`." +#: ../../build/docs/un_sdg/sdg3-health.rst:158 +msgid "" +"Due to the lack of census data, this exercise will estimate the population, " +"based on the area size of the building and the kind of use the building gets." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:148 -msgid "" -"This section will work the graph and data that is going to be used for " -"processing. While building the graph, the data has to be inspected to " -"determine if there is any invalid data. This is a very important step to " -"make sure that the data is of required quality. pgRouting can also be used " -"to do some Data Adjustments." +#: ../../build/docs/un_sdg/sdg3-health.rst:161 +msgid "Buildings of OpenStreetMap data are classified into various categories." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:156 -msgid "Exercise 5: Counting the number of roads and buildings" +#: ../../build/docs/un_sdg/sdg3-health.rst:173 +msgid "For this exercise, the population will be set as follows:" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:158 -msgid "" -"The importance of counting the information on this workshop is to make sure " -"that the same data is used and consequently the results are same. Also, some " -"of the rows can be seen to understand the structure of the table and how the " -"data is stored in it." +#: ../../build/docs/un_sdg/sdg3-health.rst:175 +msgid "Negligible:" +msgstr "" + +#: ../../build/docs/un_sdg/sdg3-health.rst:177 +#: ../../build/docs/un_sdg/sdg3-health.rst:185 +msgid "People do not live in these places." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:181 -msgid "Following image shows the roads and buildings visualised." +#: ../../build/docs/un_sdg/sdg3-health.rst:178 +msgid "Population: 1 person." +msgstr "" + +#: ../../build/docs/un_sdg/sdg3-health.rst:180 +msgid "There may be people guarding the place." +msgstr "" + +#: ../../build/docs/un_sdg/sdg3-health.rst:182 +msgid "Very Sparse:" +msgstr "" + +#: ../../build/docs/un_sdg/sdg3-health.rst:184 +msgid "``retail``, ``commercial``, ``school``" +msgstr "" + +#: ../../build/docs/un_sdg/sdg3-health.rst:186 +msgid "Population: At least 2 persons." msgstr "" #: ../../build/docs/un_sdg/sdg3-health.rst:188 -msgid "Preprocessing Buildings" +#: ../../build/docs/un_sdg/sdg3-health.rst:195 +msgid "Because there may be people guarding the place." msgstr "" #: ../../build/docs/un_sdg/sdg3-health.rst:190 -msgid "" -"The table ``buildings_ways`` contains the buildings in ``LINGSTING`` type. " -"They have to be converted into polygons to get the area, as the area is " -"going to be used to get an estimate of the population living in the building." +msgid "Sparse:" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:195 -msgid "Exercise 6: Removing columns" +#: ../../build/docs/un_sdg/sdg3-health.rst:192 +msgid "Buildings with low population density, like ``university``." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:197 -msgid "" -"Columns can be deleted from a table. In this case instead of creating a " -"view, columns that are not related to a **buidling** concept are dropped " -"from ``buildings_ways``." +#: ../../build/docs/un_sdg/sdg3-health.rst:193 +msgid "Population: At least 3 persons." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:212 -msgid "Exercise 7: Add a spatial column to the table" +#: ../../build/docs/un_sdg/sdg3-health.rst:196 +msgid "Students might live there." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:214 +#: ../../build/docs/un_sdg/sdg3-health.rst:198 +msgid "Moderate:" +msgstr "" + +#: ../../build/docs/un_sdg/sdg3-health.rst:200 msgid "" -"Add a spatial column named ``poly_geom`` to the table ``buildings_ways`` to " -"store the Polygon Geometry" +"Location where people might be living temporarly, like ``hotel`` and " +"``hospital``." +msgstr "" + +#: ../../build/docs/un_sdg/sdg3-health.rst:202 +msgid "Population: At least 5 persons." +msgstr "" + +#: ../../build/docs/un_sdg/sdg3-health.rst:204 +msgid "Dense:" msgstr "" +#: ../../build/docs/un_sdg/sdg3-health.rst:206 +msgid "A medium sized residential building." +msgstr "" + +#: ../../build/docs/un_sdg/sdg3-health.rst:207 +msgid "Population: At least 7 persons." +msgstr "" + +#: ../../build/docs/un_sdg/sdg3-health.rst:209 +msgid "Very Dense:" +msgstr "" + +#: ../../build/docs/un_sdg/sdg3-health.rst:211 +#: ../../build/docs/un_sdg/sdg3-health.rst:225 +msgid "A large sized residential building, like ``apartments``." +msgstr "" + +#: ../../build/docs/un_sdg/sdg3-health.rst:212 #: ../../build/docs/un_sdg/sdg3-health.rst:226 -msgid "Inspecting the table:" +msgid "Population: At least 10 persons." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:237 -msgid "Exercise 8: Removing the polygons with less than 4 points" +#: ../../build/docs/un_sdg/sdg3-health.rst:215 +msgid "Exercise 5: Estimating the population" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:239 +#: ../../build/docs/un_sdg/sdg3-health.rst:216 msgid "" -"``ST_NumPoints`` is used to find the number of points on a geometry. Also, " -"polygons with less than 3 points/vertices are not considered valid polygons " -"in PostgreSQL. Hence, the buildings having less than 3 vertices need to be " -"cleaned up. Follow the steps given below to complete this task." +"Each density class has a **class-specific factor** that represents how many " +"people per square meter are expected (e.g., 0.0002 for Very Sparse, 1.0 for " +"Very Dense). This factor is multiplied by a building's area to estimate its " +"population, with a minimum floor per class." +msgstr "" + +#: ../../build/docs/un_sdg/sdg3-health.rst:221 +msgid "For example:" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:254 -msgid "Exercise 9: Creating the polygons" +#: ../../build/docs/un_sdg/sdg3-health.rst:223 +msgid "Very Dense" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:256 +#: ../../build/docs/un_sdg/sdg3-health.rst:228 msgid "" -"``ST_MakePolygons`` is used to make the polygons. This step stores the " -"geometry of polygons in the ``poly_geom`` column which was created earlier." +"Each class has a specific numeric factor (visible in the SQL function below) " +"that scales the building area to estimate the number of residents." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:270 -msgid "Exercise 10: Calculating the area" +#: ../../build/docs/un_sdg/sdg3-health.rst:231 +msgid "" +"This class specific factor is multiplied with the area of each building to " +"get the population. Follow the steps given below to complete this task." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:272 +#: ../../build/docs/un_sdg/sdg3-health.rst:235 msgid "" -"After getting the polygon geometry, next step is to find the area of the " -"polygons. Follow the steps given below to complete this task." +"Create a function to find population using class-specific factor and area." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:275 -msgid "Adding a column for storing the area" +#: ../../build/docs/un_sdg/sdg3-health.rst:242 +msgid "Testing the function with 100 square meters buildings." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:282 -msgid "Storing the area in the new column" +#: ../../build/docs/un_sdg/sdg3-health.rst:253 +msgid "Testing the function with 300 square meters buildings." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:284 +#: ../../build/docs/un_sdg/sdg3-health.rst:263 msgid "" -"``ST_Area`` is used to calculate area of polygons. Area is stored in the new " -"column" +"More complicated estimation functions can be done that consider height of " +"the apartments." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:297 -msgid "Exercise 11: Estimating the population" +#: ../../build/docs/un_sdg/sdg3-health.rst:266 +msgid "Using census data can achieve more accurate estimation." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:299 -msgid "" -"Due to the lack of census data, this exercise will fill up and estimate of " -"the population living on the buildings, based on the area of the building " -"and the kind of use the building gets." +#: ../../build/docs/un_sdg/sdg3-health.rst:269 +msgid "Preparing roads information" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:303 -msgid "Buildings of OpenStreetMap data are classified into various categories." +#: ../../build/docs/un_sdg/sdg3-health.rst:271 +msgid "" +"pgRouting algorithms are only useful when the road network belongs to a " +"single graph (or all the roads are connected to each other). Hence, the " +"disconnected roads have to be removed from their network to get appropriate " +"results. This image gives an example of the disconnected edges." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:315 -msgid "For this exercise, the population will be set as follows:" +#: ../../build/docs/un_sdg/sdg3-health.rst:280 +msgid "" +"For example, in the above figure roads with label ``119`` are disconnected " +"from the network. Hence they will have same connected component number. But " +"the count of this number will be less count of fully connected network. All " +"the edges with the component number with count less than maximum count will " +"be removed" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:317 -msgid "Negligible:" +#: ../../build/docs/un_sdg/sdg3-health.rst:285 +msgid "" +"Disconnected road segments are unreachable from the main network. If they " +"are kept, routing queries like ``pgr_drivingDistance`` or ``pgr_dijkstra`` " +"will either fail to find paths on those segments or produce misleading " +"results (e.g., infinite cost, no path found)." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:319 -#: ../../build/docs/un_sdg/sdg3-health.rst:327 -msgid "People do not live in these places." +#: ../../build/docs/un_sdg/sdg3-health.rst:290 +msgid "" +"Removing them ensures that every building in the network is reachable and " +"that population-serving analysis works correctly." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:320 -msgid "Population: 1 person" +#: ../../build/docs/un_sdg/sdg3-health.rst:293 +msgid "" +"Once each road segment has a component identifier, you can isolate the main " +"network by keeping only the component with the highest edge count. A new " +"table (or view) can be created that contains just those edges, discarding " +"all unreachable segments in one step." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:322 -msgid "There may be people guarding the place." +#: ../../build/docs/un_sdg/sdg3-health.rst:299 +msgid "Exercise 6: Calculate the components of the roads" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:324 -msgid "Very Sparse:" +#: ../../build/docs/un_sdg/sdg3-health.rst:301 +msgid "" +"To remove the disconnected components on the road network, the following " +"pgRouting functions, discussed on :doc:`../basic/graphs` chapter, will be " +"used:" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:326 -msgid "``retail``, ``commercial``, ``school``" +#: ../../build/docs/un_sdg/sdg3-health.rst:304 +msgid "``pgr_extractVertices``" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:328 -msgid "Population: At least 2 persons." +#: ../../build/docs/un_sdg/sdg3-health.rst:305 +msgid "``pgr_connectedComponents``" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:330 -#: ../../build/docs/un_sdg/sdg3-health.rst:337 -msgid "Because there may be people guarding the place." +#: ../../build/docs/un_sdg/sdg3-health.rst:308 +msgid "Add a components column." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:332 -msgid "Sparse:" +#: ../../build/docs/un_sdg/sdg3-health.rst:315 +msgid "Create a vertices table." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:334 -msgid "Buildings with low population density, like ``university``." +#: ../../build/docs/un_sdg/sdg3-health.rst:323 +msgid "Fill up the ``x``, ``y`` and ``geom`` columns." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:335 -msgid "Population: At least 3 persons." +#: ../../build/docs/un_sdg/sdg3-health.rst:331 +msgid "Fill up the ``component`` column on the vertices table." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:338 -msgid "Students might live there." +#: ../../build/docs/un_sdg/sdg3-health.rst:339 +msgid "Fill up the ``component`` column on the edges table." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:340 -msgid "Moderate:" +#: ../../build/docs/un_sdg/sdg3-health.rst:347 +msgid "Exercise 7: Create a roads_net table." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:342 +#: ../../build/docs/un_sdg/sdg3-health.rst:349 msgid "" -"Location where people might be living temporarly, like ``hotel`` and " -"``hospital``." +"The ``roads_net`` table stores road edges with travel costs in **minutes**, " +"assuming a walking speed of **1 m/s**." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:344 -msgid "Population: At least 5 persons." +#: ../../build/docs/un_sdg/sdg3-health.rst:352 +msgid "Since :math:`time = distance / speed`:" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:346 -msgid "Dense:" +#: ../../build/docs/un_sdg/sdg3-health.rst:354 +msgid ":math:`time = length\\_m / 1\\ m/s`" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:348 -msgid "A medium sized residential building." +#: ../../build/docs/un_sdg/sdg3-health.rst:356 +msgid "" +"This gives time in **seconds**. To convert to **minutes**, divide by 60:" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:349 -msgid "Population: At least 7 persons." +#: ../../build/docs/un_sdg/sdg3-health.rst:358 +msgid ":math:`time = length\\_m / 60`" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:351 -msgid "Very Dense:" +#: ../../build/docs/un_sdg/sdg3-health.rst:361 +msgid "Create roads_net with only the largest component" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:353 -msgid "A large sized residential building, like ``apartments``." +#: ../../build/docs/un_sdg/sdg3-health.rst:362 +msgid "" +"This query creates the ``roads_net`` table by keeping only edges belonging " +"to the most connected component." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:354 -msgid "Population: At least 10 persons." +#: ../../build/docs/un_sdg/sdg3-health.rst:365 +msgid "" +"It calculates travel cost as ``length_m / 60`` (seconds converted to minutes " +"at 1 m/s) and" +msgstr "" + +#: ../../build/docs/un_sdg/sdg3-health.rst:367 +msgid "" +"initializes the population column as ``NULL`` for later population of the " +"roads." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:357 -msgid "Reference: :ref:`un_sdg/data:Appendix`" +#: ../../build/docs/un_sdg/sdg3-health.rst:376 +msgid "Delete vertices not belonging to the most connected component." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:359 +#: ../../build/docs/un_sdg/sdg3-health.rst:377 msgid "" -"This class-specific factor is multiplied with the area of each building to " -"get the population. Follow the steps given below to complete this task." +"Once ``roads_net`` is filtered to only the largest connected component, the " +"``vertices`` table still contains vertices from the discarded components." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:362 +#: ../../build/docs/un_sdg/sdg3-health.rst:380 msgid "" -"Create a function to find population using class-specific factor and area." +"These orphan vertices have no edges in ``roads_net``, so they are useless " +"for routing and would pollute nearest-vertex lookups. Deleting them keeps " +"the vertex table consistent with the trimmed network." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:374 +#: ../../build/docs/un_sdg/sdg3-health.rst:392 +msgid "Preparing buildings population information" +msgstr "" + +#: ../../build/docs/un_sdg/sdg3-health.rst:394 msgid "" -"All these are estimations based on this particular area. More complicated " -"functions can be done that consider height of the apartments but the design " -"of a function is going to depend on the availability of the data. For " -"example, using census data can achieve more accurate estimation." +"This section links buildings to the road network and estimates their " +"population." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:379 -msgid "Add a column for storing the population in the ``buildings_ways``" +#: ../../build/docs/un_sdg/sdg3-health.rst:396 +msgid "" +"First, functions are created to find the nearest road and vertex for each " +"building." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:390 +#: ../../build/docs/un_sdg/sdg3-health.rst:398 msgid "" -"3. Use the ``population`` function to store the population in the new column " -"created in the ``building_ways``." +"Then building geometries are converted from ``LINESTRING`` to polygons to " +"calculate area, which feeds the ``population`` function." +msgstr "" + +#: ../../build/docs/un_sdg/sdg3-health.rst:400 +msgid "Finally, the estimated population is aggregated onto the road segments." msgstr "" #: ../../build/docs/un_sdg/sdg3-health.rst:403 -msgid "Preprocessing Roads" +msgid "Exercise 8: Get the nearest road to a building" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:404 -msgid "" -"pgRouting algorithms are only useful when the road network belongs to a " -"single graph (or all the roads are connected to each other). Hence, the " -"disconnected roads have to be removed from their network to get appropriate " -"results. This image gives an example of the disconnected edges." +#: ../../build/docs/un_sdg/sdg3-health.rst:406 +msgid "Create the building_road function" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:413 +#: ../../build/docs/un_sdg/sdg3-health.rst:407 msgid "" -"For example, in the above figure roads with label ``119`` are disconnected " -"from the network. Hence they will have same connected component number. But " -"the count of this number will be less count of fully connected network. All " -"the edges with the component number with count less than maximum count will " -"be removed" +"This function finds the closest road edge to a building using PostGIS' " +"spatial distance operator (``<->``). It returns the ``id`` of the nearest " +"edge from ``roads_net``, which is later used to link each building to the " +"road network." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:418 -#: ../../build/docs/un_sdg/sdg3-health.rst:733 -msgid "Follow the steps given below to complete this task." +#: ../../build/docs/un_sdg/sdg3-health.rst:419 +#: ../../build/docs/un_sdg/sdg3-health.rst:458 +msgid "Test the function" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:421 -msgid "Exercise 12: Remove disconnected components" +#: ../../build/docs/un_sdg/sdg3-health.rst:431 +msgid "Exercise 9: Find the closest road vertex" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:423 +#: ../../build/docs/un_sdg/sdg3-health.rst:433 msgid "" -"To remove the disconnected components on the road network, the following " -"pgRouting functions, discussed on :doc:`../basic/graphs`, will be used:" +"There are multiple road vertices near the hospital. Create a function to " +"find the geographically closest road vertex. ``get_vertex`` function takes a " +"geometry as input and returns the id of the closest vertex by comparing " +"``geom`` of both tables." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:426 -msgid "``pgr_extractVertices``" +#: ../../build/docs/un_sdg/sdg3-health.rst:443 +msgid "Create the get_vertex function" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:427 -msgid "``pgr_connectedComponents``" +#: ../../build/docs/un_sdg/sdg3-health.rst:444 +msgid "This function finds the closest road vertex to a building" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:430 -msgid "Create a vertices table." +#: ../../build/docs/un_sdg/sdg3-health.rst:446 +msgid "Using PostGIS' spatial distance operator (``<->``)." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:441 -msgid "Fill up the ``x``, ``y`` and ``geom`` columns." +#: ../../build/docs/un_sdg/sdg3-health.rst:447 +msgid "Returns the ``id`` of the nearest vertex from the ``vertices`` table," msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:452 -msgid "Add a ``component`` column on the edges and vertices tables." +#: ../../build/docs/un_sdg/sdg3-health.rst:449 +msgid "Used as the start point for ``pgr_drivingDistance`` queries." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:463 -msgid "Fill up the ``component`` column on the vertices table." +#: ../../build/docs/un_sdg/sdg3-health.rst:470 +msgid "Exercise 10: Create the buildings table" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:474 -msgid "Fill up the ``component`` column on the edges table." +#: ../../build/docs/un_sdg/sdg3-health.rst:472 +msgid "" +"A ``buildings`` table is created for efficient access throughout the " +"remaining exercises." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:485 -msgid "Get the component number with the most number of edges." +#: ../../build/docs/un_sdg/sdg3-health.rst:476 +msgid "The query" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:496 -msgid "Delete edges not belonging to the most connected component." +#: ../../build/docs/un_sdg/sdg3-health.rst:477 +msgid "converts ``LINESTRING`` geometries to ``Polygon``," msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:507 -msgid "Delete vertices not belonging to the most connected component." +#: ../../build/docs/un_sdg/sdg3-health.rst:478 +msgid "calculates the area using ``ST_Area``," +msgstr "" + +#: ../../build/docs/un_sdg/sdg3-health.rst:479 +msgid "and estimates population using the ``population`` function." +msgstr "" + +#: ../../build/docs/un_sdg/sdg3-health.rst:482 +msgid "The result" +msgstr "" + +#: ../../build/docs/un_sdg/sdg3-health.rst:483 +msgid "Is stored in the ``buildings`` table." +msgstr "" + +#: ../../build/docs/un_sdg/sdg3-health.rst:492 +msgid "Exercise 11: Storing the population in the roads" +msgstr "" + +#: ../../build/docs/un_sdg/sdg3-health.rst:494 +msgid "" +"After finding the nearest road, the sum of population of all the nearest " +"buildings is stored in the population column of the roads table. Following " +"image shows the visualised output where the blue colour labels shows the " +"population stored in roads." +msgstr "" + +#: ../../build/docs/un_sdg/sdg3-health.rst:504 +msgid "Update the population of the roads." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:518 +#: ../../build/docs/un_sdg/sdg3-health.rst:512 msgid "Find the roads served by the hospitals" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:519 +#: ../../build/docs/un_sdg/sdg3-health.rst:514 msgid "" "After pre-processing the data, next step is to find the area served by the " "hospital. This area can be computed from the entrance of the hospital or " @@ -527,23 +663,23 @@ msgid "" "roads served. The steps to be followed are:" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:525 +#: ../../build/docs/un_sdg/sdg3-health.rst:520 msgid "Finding the closest road vertex" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:526 +#: ../../build/docs/un_sdg/sdg3-health.rst:521 msgid "Finding the roads served" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:527 +#: ../../build/docs/un_sdg/sdg3-health.rst:522 msgid "Generalising the roads served" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:530 +#: ../../build/docs/un_sdg/sdg3-health.rst:525 msgid "pgr_drivingDistance" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:531 +#: ../../build/docs/un_sdg/sdg3-health.rst:526 msgid "" "For the next step ``pgr_drivingDistance`` will be used. This returns the " "driving distance from a start node. It uses the Dijkstra algorithm to " @@ -552,108 +688,62 @@ msgid "" "tree." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:537 +#: ../../build/docs/un_sdg/sdg3-health.rst:532 msgid "Signatures" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:544 +#: ../../build/docs/un_sdg/sdg3-health.rst:539 msgid "" "`pgr_drivingDistance Documentation `__ can be found at this link for more information." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:548 -msgid "Exercise 13: Find the closest road vertex" -msgstr "" - -#: ../../build/docs/un_sdg/sdg3-health.rst:549 -msgid "" -"There are multiple road vertices near the hospital. Create a function to " -"find the geographically closest road vertex. ``closest_vertex`` function " -"takes geometry of other table as input and gives the gid of the closest " -"vertex as output by comparing ``geom`` of both the tables." -msgstr "" - -#: ../../build/docs/un_sdg/sdg3-health.rst:558 -msgid "The following query creates a function to find the closest road vertex." -msgstr "" - -#: ../../build/docs/un_sdg/sdg3-health.rst:570 -msgid "Testing the function" +#: ../../build/docs/un_sdg/sdg3-health.rst:543 +msgid "Exercise 12: Finding the served roads using pgr_drivingDistance" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:583 -msgid "Exercise 14: Finding the served roads using pgr_drivingDistance" -msgstr "" - -#: ../../build/docs/un_sdg/sdg3-health.rst:586 +#: ../../build/docs/un_sdg/sdg3-health.rst:546 msgid "Problem" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:587 -msgid "" -"Find the roads within 10 minutes walking distance from the hospitals. Use " -"``1 m/s`` as walking speed." +#: ../../build/docs/un_sdg/sdg3-health.rst:547 +msgid "Find the roads within 10 minutes walking distance from the hospitals." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:591 +#: ../../build/docs/un_sdg/sdg3-health.rst:550 msgid "Solution" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:592 -msgid "" -"In this exercise, the roads served are calculated based on a walking time of " -"``1 m/s``, by using ``pgrdrivingDistance`` function from pgRouting extension." +#: ../../build/docs/un_sdg/sdg3-health.rst:551 +msgid "Using ``pgrdrivingDistance`` function from pgRouting extension." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:595 +#: ../../build/docs/un_sdg/sdg3-health.rst:553 msgid "Time in minutes is considered as ``cost``." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:596 +#: ../../build/docs/un_sdg/sdg3-health.rst:554 msgid "the graph is undirected." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:598 -msgid "Preparing a query" -msgstr "" - -#: ../../build/docs/un_sdg/sdg3-health.rst:610 -msgid "For the following query," -msgstr "" - -#: ../../build/docs/un_sdg/sdg3-health.rst:612 -msgid "The prepared statement is used." -msgstr "" - -#: ../../build/docs/un_sdg/sdg3-health.rst:613 -msgid "Pedestrian speed is set to be ``1 m/s``." -msgstr "" - -#: ../../build/docs/un_sdg/sdg3-health.rst:615 -msgid "" -"As ``time`` = ``distance/speed``, ``length_m`` / ``1 m/s`` / ``60`` gives " -"the time in minutes." -msgstr "" - -#: ../../build/docs/un_sdg/sdg3-health.rst:618 +#: ../../build/docs/un_sdg/sdg3-health.rst:555 msgid "" "``tag_id = '318'`` as 318 is the value for hospital in the configuration " "table of the buildings." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:621 +#: ../../build/docs/un_sdg/sdg3-health.rst:557 msgid "``10`` for 10 minutes, which is a threshold for ``agg_cost``" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:632 +#: ../../build/docs/un_sdg/sdg3-health.rst:569 msgid "" "Following figure shows the visualised output of the above query. The lines " "highlighted by red colour show the area from where the hospital can be " "reached within 10 minutes of walking at the speed of ``1 m/s``." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:636 +#: ../../build/docs/un_sdg/sdg3-health.rst:573 msgid "" "It is noticable from the output figure that some of the roads which are near " "to the hospital are not highlighted. For example, to roads in the north of " @@ -661,11 +751,11 @@ msgid "" "by the query." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:646 -msgid "Exercise 15: Generalising the served roads" +#: ../../build/docs/un_sdg/sdg3-health.rst:583 +msgid "Exercise 13: Adding adjacent roads" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:648 +#: ../../build/docs/un_sdg/sdg3-health.rst:585 msgid "" "The edges which are near to to hospital should also be selected in the roads " "served as the hospital also serves those buildings. The following query " @@ -674,7 +764,7 @@ msgid "" "that of ``subquery`` (Line 14)." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:663 +#: ../../build/docs/un_sdg/sdg3-health.rst:601 msgid "" "Following figure shows the visualised output of the above query. Lines " "highlighted in ``yellow`` show the `generalised the roads served`. This " @@ -682,11 +772,11 @@ msgid "" "by a particular speed." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:672 +#: ../../build/docs/un_sdg/sdg3-health.rst:610 msgid "Calculating the total population served by the hospital" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:674 +#: ../../build/docs/un_sdg/sdg3-health.rst:612 msgid "" "Now the next step is to estimate the dependant population. Official source " "of population is Census conducted by the government. But for this exercise, " @@ -695,58 +785,11 @@ msgid "" "steps explain this process in detail." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:682 -msgid "Exercise 16: Finding the nearest roads of the buildings" -msgstr "" - -#: ../../build/docs/un_sdg/sdg3-health.rst:684 -msgid "" -"To store the population of buildings in the roads, nearest road to a " -"building is to be found. Follow the steps given below to complete this task." -msgstr "" - -#: ../../build/docs/un_sdg/sdg3-health.rst:687 -msgid "Create Function for finding the closest edge." -msgstr "" - -#: ../../build/docs/un_sdg/sdg3-health.rst:698 -msgid "Add a column in ``buildings_ways`` for storing the id of closest edge" -msgstr "" - -#: ../../build/docs/un_sdg/sdg3-health.rst:710 -msgid "" -"Store the edge id of the closest edge in the new column of ``buildings_ways``" -msgstr "" - -#: ../../build/docs/un_sdg/sdg3-health.rst:723 -msgid "Exercise 17: Storing the population in the roads" -msgstr "" - -#: ../../build/docs/un_sdg/sdg3-health.rst:724 -msgid "" -"After finding the nearest road, the sum of population of all the nearest " -"buildings is stored in the population column of the roads table. Following " -"image shows the visualised output where the blue colour labels shows the " -"population stored in roads." -msgstr "" - -#: ../../build/docs/un_sdg/sdg3-health.rst:735 -msgid "Add a column in ``roads_ways`` for storing population" -msgstr "" - -#: ../../build/docs/un_sdg/sdg3-health.rst:746 -msgid "Update the roads with the sum of population of buildings closest to it" -msgstr "" - -#: ../../build/docs/un_sdg/sdg3-health.rst:758 -msgid "Verify is the population is stored using the following query." -msgstr "" - -#: ../../build/docs/un_sdg/sdg3-health.rst:771 -msgid "Exercise 18: Find total population served by the hospital" +#: ../../build/docs/un_sdg/sdg3-health.rst:620 +msgid "Exercise 14: Find total population served by the hospital" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:773 +#: ../../build/docs/un_sdg/sdg3-health.rst:622 msgid "" "Final step is to find the total population served by the hospital based on " "travel time." diff --git a/locale/pot/basic/data.pot b/locale/pot/basic/data.pot index 7e82e79c4..b503d9918 100644 --- a/locale/pot/basic/data.pot +++ b/locale/pot/basic/data.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Workshop FOSS4G Hiroshima 3.2\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-06-25 21:50+0000\n" +"POT-Creation-Date: 2026-07-01 17:09+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -145,9 +145,33 @@ msgid "Depending on the osm2pgrouting version `-W password` is needed" msgstr "" #: ../../build/docs/basic/data.rst:132 -msgid "Tables on the database" +msgid "Compatibility with older osm2pgrouting versions" msgstr "" #: ../../build/docs/basic/data.rst:134 +msgid "Check the installed version:" +msgstr "" + +#: ../../build/docs/basic/data.rst:140 +msgid "If you are using version 2.x, the column names differ from those used in this workshop:" +msgstr "" + +#: ../../build/docs/basic/data.rst:143 +msgid "``gid`` instead of ``id``" +msgstr "" + +#: ../../build/docs/basic/data.rst:144 +msgid "``the_geom`` instead of ``geom``" +msgstr "" + +#: ../../build/docs/basic/data.rst:146 +msgid "Run the following script to rename them:" +msgstr "" + +#: ../../build/docs/basic/data.rst:154 +msgid "Tables on the database" +msgstr "" + +#: ../../build/docs/basic/data.rst:156 msgid "To inspect the tables that were created during this process:" msgstr "" diff --git a/locale/pot/basic/sql_function.pot b/locale/pot/basic/sql_function.pot index ba1865acf..e3ebc3781 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-2025 pgRouting Developers -# This file is distributed under the same license as the Workshop FOSS4G Auckland package. +# This file is distributed under the same license as the Workshop FOSS4G Hiroshima package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Workshop FOSS4G Auckland 3.1\n" +"Project-Id-Version: Workshop FOSS4G Hiroshima 3.2\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-06-14 15:20+0000\n" +"POT-Creation-Date: 2026-07-01 17:09+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -16,494 +16,413 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: ../../build/docs/basic/sql_function.rst:12 +#: ../../build/docs/basic/sql_function.rst:7 msgid "SQL function" msgstr "" -#: ../../build/docs/basic/sql_function.rst:18 +#: ../../build/docs/basic/sql_function.rst:13 msgid "Chapter Contents" msgstr "" -#: ../../build/docs/basic/sql_function.rst:20 +#: ../../build/docs/basic/sql_function.rst:15 msgid "While pgRouting functions provide a low-level interface, developing for a higher-level application requires these requirements to be represented directly 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:28 +#: ../../build/docs/basic/sql_function.rst:23 msgid "The function requirements" msgstr "" -#: ../../build/docs/basic/sql_function.rst:30 +#: ../../build/docs/basic/sql_function.rst:25 msgid "The function will wrap ``pgr_dijkstra``." msgstr "" -#: ../../build/docs/basic/sql_function.rst:32 -msgid "The function needs to work on any of the networks designed:" +#: ../../build/docs/basic/sql_function.rst:27 +msgid "The function will use:" msgstr "" -#: ../../build/docs/basic/sql_function.rst:34 -#: ../../build/docs/basic/sql_function.rst:339 +#: ../../build/docs/basic/sql_function.rst:29 msgid "``vehicle_net``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:35 -#: ../../build/docs/basic/sql_function.rst:340 -msgid "``taxi_net``" +#: ../../build/docs/basic/sql_function.rst:30 +msgid "``vehicle_penalized_net``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:37 -msgid "The function needs to return the following routing information:" +#: ../../build/docs/basic/sql_function.rst:32 +msgid "The function returns the following routing information:" msgstr "" -#: ../../build/docs/basic/sql_function.rst:39 +#: ../../build/docs/basic/sql_function.rst:34 msgid "``seq`` - A unique identifier of the rows" msgstr "" -#: ../../build/docs/basic/sql_function.rst:40 +#: ../../build/docs/basic/sql_function.rst:35 msgid "``id`` - The segment's identifier" msgstr "" -#: ../../build/docs/basic/sql_function.rst:41 -msgid "``name`` - The segment's name" +#: ../../build/docs/basic/sql_function.rst:36 +msgid "``seconds`` - Number of seconds to traverse the segment" msgstr "" -#: ../../build/docs/basic/sql_function.rst:42 -msgid "``length`` - The segment's length" +#: ../../build/docs/basic/sql_function.rst:37 +msgid "``name`` - The segment's name" msgstr "" -#: ../../build/docs/basic/sql_function.rst:43 -msgid "``seconds`` - Number of seconds to traverse the segment" +#: ../../build/docs/basic/sql_function.rst:38 +msgid "``length`` - The segment's length" msgstr "" -#: ../../build/docs/basic/sql_function.rst:44 +#: ../../build/docs/basic/sql_function.rst:39 msgid "``azimuth`` - The azimuth of the segment" msgstr "" -#: ../../build/docs/basic/sql_function.rst:45 -msgid "``route_geom`` - The routing geometry" +#: ../../build/docs/basic/sql_function.rst:40 +msgid "``readable`` - The geometry in human readable form." msgstr "" -#: ../../build/docs/basic/sql_function.rst:46 -msgid "``route_readable`` - The geometry in human readable form." +#: ../../build/docs/basic/sql_function.rst:41 +msgid "``geom`` - The routing geometry" msgstr "" -#: ../../build/docs/basic/sql_function.rst:49 +#: ../../build/docs/basic/sql_function.rst:44 msgid "Design of the function" msgstr "" -#: ../../build/docs/basic/sql_function.rst:50 +#: ../../build/docs/basic/sql_function.rst:45 msgid "The function to be created ``wrk_dijkstra`` with the following input parameters and output columns:" msgstr "" -#: ../../build/docs/basic/sql_function.rst:54 +#: ../../build/docs/basic/sql_function.rst:49 msgid "Input parameters" msgstr "" -#: ../../build/docs/basic/sql_function.rst:56 +#: ../../build/docs/basic/sql_function.rst:51 msgid "Parameter" msgstr "" -#: ../../build/docs/basic/sql_function.rst:56 -#: ../../build/docs/basic/sql_function.rst:66 +#: ../../build/docs/basic/sql_function.rst:51 +#: ../../build/docs/basic/sql_function.rst:62 msgid "Type" msgstr "" -#: ../../build/docs/basic/sql_function.rst:56 -#: ../../build/docs/basic/sql_function.rst:66 +#: ../../build/docs/basic/sql_function.rst:51 +#: ../../build/docs/basic/sql_function.rst:62 msgid "Description" msgstr "" -#: ../../build/docs/basic/sql_function.rst:58 -msgid "``edges_subset``" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:58 -msgid "REGCLASS" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:58 -msgid "The table/view that is going to be used for processing" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:59 +#: ../../build/docs/basic/sql_function.rst:53 msgid "``source``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:59 -#: ../../build/docs/basic/sql_function.rst:60 -#: ../../build/docs/basic/sql_function.rst:69 +#: ../../build/docs/basic/sql_function.rst:53 +#: ../../build/docs/basic/sql_function.rst:54 +#: ../../build/docs/basic/sql_function.rst:65 msgid "BIGINT" msgstr "" -#: ../../build/docs/basic/sql_function.rst:59 -msgid "The identifier of the `departure` location." +#: ../../build/docs/basic/sql_function.rst:53 +msgid "The identifier of the `departure` location." msgstr "" -#: ../../build/docs/basic/sql_function.rst:60 +#: ../../build/docs/basic/sql_function.rst:54 msgid "``target``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:60 -msgid "The identifier of the `destination` location." +#: ../../build/docs/basic/sql_function.rst:54 +msgid "The identifier of the `destination` location." msgstr "" -#: ../../build/docs/basic/sql_function.rst:64 -msgid "output columns" +#: ../../build/docs/basic/sql_function.rst:60 +msgid "Output columns" msgstr "" -#: ../../build/docs/basic/sql_function.rst:66 +#: ../../build/docs/basic/sql_function.rst:62 msgid "Name" msgstr "" -#: ../../build/docs/basic/sql_function.rst:68 -#: ../../build/docs/basic/sql_function.rst:97 +#: ../../build/docs/basic/sql_function.rst:64 msgid "``seq``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:68 +#: ../../build/docs/basic/sql_function.rst:64 msgid "INTEGER" msgstr "" -#: ../../build/docs/basic/sql_function.rst:68 +#: ../../build/docs/basic/sql_function.rst:64 msgid "A unique number for each result row." msgstr "" -#: ../../build/docs/basic/sql_function.rst:69 -#: ../../build/docs/basic/sql_function.rst:98 +#: ../../build/docs/basic/sql_function.rst:65 msgid "``id``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:69 +#: ../../build/docs/basic/sql_function.rst:65 msgid "The edge identifier." msgstr "" -#: ../../build/docs/basic/sql_function.rst:70 -#: ../../build/docs/basic/sql_function.rst:99 -msgid "``name``" +#: ../../build/docs/basic/sql_function.rst:66 +msgid "``seconds``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:70 -#: ../../build/docs/basic/sql_function.rst:74 -msgid "TEXT" +#: ../../build/docs/basic/sql_function.rst:66 +#: ../../build/docs/basic/sql_function.rst:68 +#: ../../build/docs/basic/sql_function.rst:69 +msgid "FLOAT" msgstr "" -#: ../../build/docs/basic/sql_function.rst:70 -msgid "The name of the segment." +#: ../../build/docs/basic/sql_function.rst:66 +msgid "The number of seconds it takes to traverse the segment." msgstr "" -#: ../../build/docs/basic/sql_function.rst:71 -#: ../../build/docs/basic/sql_function.rst:100 -msgid "``seconds``" +#: ../../build/docs/basic/sql_function.rst:67 +msgid "``name``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:71 -#: ../../build/docs/basic/sql_function.rst:72 -#: ../../build/docs/basic/sql_function.rst:73 -msgid "FLOAT" +#: ../../build/docs/basic/sql_function.rst:67 +#: ../../build/docs/basic/sql_function.rst:70 +msgid "TEXT" msgstr "" -#: ../../build/docs/basic/sql_function.rst:71 -msgid "The number of seconds it takes to traverse the segment." +#: ../../build/docs/basic/sql_function.rst:67 +msgid "The name of the segment." msgstr "" -#: ../../build/docs/basic/sql_function.rst:72 -#: ../../build/docs/basic/sql_function.rst:101 +#: ../../build/docs/basic/sql_function.rst:68 msgid "``length``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:72 +#: ../../build/docs/basic/sql_function.rst:68 msgid "The length in meters of the segment." msgstr "" -#: ../../build/docs/basic/sql_function.rst:73 +#: ../../build/docs/basic/sql_function.rst:69 +#: ../../build/docs/basic/sql_function.rst:218 msgid "``azimuth``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:73 +#: ../../build/docs/basic/sql_function.rst:69 msgid "The azimuth of the segment." msgstr "" -#: ../../build/docs/basic/sql_function.rst:74 -msgid "``route_readable``" +#: ../../build/docs/basic/sql_function.rst:70 +#: ../../build/docs/basic/sql_function.rst:217 +msgid "``readable``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:74 +#: ../../build/docs/basic/sql_function.rst:70 msgid "The geometry in human readable form." msgstr "" -#: ../../build/docs/basic/sql_function.rst:75 -msgid "``route_geom``" +#: ../../build/docs/basic/sql_function.rst:71 +#: ../../build/docs/basic/sql_function.rst:216 +msgid "``geom``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:75 +#: ../../build/docs/basic/sql_function.rst:71 msgid "geometry" msgstr "" -#: ../../build/docs/basic/sql_function.rst:75 +#: ../../build/docs/basic/sql_function.rst:71 msgid "The geometry of the segment in the correct direction." msgstr "" -#: ../../build/docs/basic/sql_function.rst:80 +#: ../../build/docs/basic/sql_function.rst:77 msgid "Additional information handling" msgstr "" -#: ../../build/docs/basic/sql_function.rst:82 +#: ../../build/docs/basic/sql_function.rst:79 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:86 +#: ../../build/docs/basic/sql_function.rst:83 msgid "Exercise 1: Get additional information" msgstr "" -#: ../../build/docs/basic/sql_function.rst:88 +#: ../../build/docs/basic/sql_function.rst:85 msgid "Route showing names" msgstr "" -#: ../../build/docs/basic/sql_function.rst:93 -#: ../../build/docs/basic/sql_function.rst:145 -#: ../../build/docs/basic/sql_function.rst:184 -#: ../../build/docs/basic/sql_function.rst:237 -#: ../../build/docs/basic/sql_function.rst:301 -msgid "Problem" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:94 -#: ../../build/docs/basic/sql_function.rst:140 -#: ../../build/docs/basic/sql_function.rst:179 +#: ../../build/docs/basic/sql_function.rst:90 +#: ../../build/docs/basic/sql_function.rst:120 +#: ../../build/docs/basic/sql_function.rst:144 +#: ../../build/docs/basic/sql_function.rst:171 #: ../../build/docs/basic/sql_function.rst:213 -msgid "From |ch7_place_1| to |ch7_place_2|" +msgid "Problem" msgstr "" -#: ../../build/docs/basic/sql_function.rst:95 -msgid "Get the following information:" +#: ../../build/docs/basic/sql_function.rst:91 +msgid "Create a function that gets all the required information" msgstr "" -#: ../../build/docs/basic/sql_function.rst:104 -#: ../../build/docs/basic/sql_function.rst:153 -#: ../../build/docs/basic/sql_function.rst:192 -#: ../../build/docs/basic/sql_function.rst:247 -#: ../../build/docs/basic/sql_function.rst:307 +#: ../../build/docs/basic/sql_function.rst:94 +#: ../../build/docs/basic/sql_function.rst:124 +#: ../../build/docs/basic/sql_function.rst:148 +#: ../../build/docs/basic/sql_function.rst:175 +#: ../../build/docs/basic/sql_function.rst:221 msgid "Solution" msgstr "" -#: ../../build/docs/basic/sql_function.rst:105 -msgid "The function returns the columns asked. (line **4**)" +#: ../../build/docs/basic/sql_function.rst:95 +msgid "The function returns the columns asked." msgstr "" -#: ../../build/docs/basic/sql_function.rst:106 -msgid "Rename ``pgr_dijkstra`` results to application requirements names. (line **12**)." +#: ../../build/docs/basic/sql_function.rst:96 +msgid "Rename ``pgr_dijkstra`` results to application requirements names." msgstr "" -#: ../../build/docs/basic/sql_function.rst:108 -msgid "``LEFT JOIN`` the results with ``vehicle_net`` to get the additional information. (line **17**)" +#: ../../build/docs/basic/sql_function.rst:97 +msgid "``LEFT JOIN`` the results with ``vehicle_net`` to get the additional information." msgstr "" -#: ../../build/docs/basic/sql_function.rst:111 -msgid "``LEFT`` to include the row with ``id = -1`` because it does not exist on ``vehicle_net``" +#: ../../build/docs/basic/sql_function.rst:100 +msgid "``LEFT JOIN`` to include the row with ``id = -1`` because it does not exist on ``vehicle_net``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:114 -#: ../../build/docs/basic/sql_function.rst:158 -#: ../../build/docs/basic/sql_function.rst:195 -#: ../../build/docs/basic/sql_function.rst:312 -msgid "Test from |ch7_id_1| to |ch7_id_2| on ``vehicle_net``. (Last line)" +#: ../../build/docs/basic/sql_function.rst:110 +msgid "Using the function" msgstr "" -#: ../../build/docs/basic/sql_function.rst:130 -msgid "Geometry handling" +#: ../../build/docs/basic/sql_function.rst:113 +msgid "Exercise 2: Route geometry (binary format)" msgstr "" -#: ../../build/docs/basic/sql_function.rst:132 -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." +#: ../../build/docs/basic/sql_function.rst:115 +msgid "Route showing readable" msgstr "" -#: ../../build/docs/basic/sql_function.rst:138 -msgid "Exercise 2: Route geometry (human readable)" +#: ../../build/docs/basic/sql_function.rst:121 +msgid "Get the geometries of the route from |place_1| to |place_2|" msgstr "" -#: ../../build/docs/basic/sql_function.rst:146 -#: ../../build/docs/basic/sql_function.rst:185 -#: ../../build/docs/basic/sql_function.rst:238 -msgid "Route from the |ch7_place_1| to |ch7_place_2|" +#: ../../build/docs/basic/sql_function.rst:125 +msgid "Select the column ``geom``." msgstr "" -#: ../../build/docs/basic/sql_function.rst:148 -#: ../../build/docs/basic/sql_function.rst:187 -msgid "Additionally to the previous exercise, get the" +#: ../../build/docs/basic/sql_function.rst:137 +msgid "Exercise 3: Route geometry (human readable)" msgstr "" -#: ../../build/docs/basic/sql_function.rst:150 -msgid "geometry ``geom`` in human readable form named as ``route_readable``" +#: ../../build/docs/basic/sql_function.rst:139 +#: ../../build/docs/basic/sql_function.rst:287 +msgid "From |ch7_place_1| to |ch7_place_2|" msgstr "" -#: ../../build/docs/basic/sql_function.rst:154 -msgid "The function returns ``route_readable``. (line **6**)" +#: ../../build/docs/basic/sql_function.rst:145 +msgid "Get the geometries in readable form of the route from |place_1| to |place_2|" msgstr "" -#: ../../build/docs/basic/sql_function.rst:155 -msgid "The routing query named ``results`` in a WITH clause. (line **11**)" +#: ../../build/docs/basic/sql_function.rst:149 +msgid "Select the column ``readable``." msgstr "" -#: ../../build/docs/basic/sql_function.rst:156 -msgid "The ``geom`` processed with ``ST_AsText`` to get the human readable form. (line **19**)." +#: ../../build/docs/basic/sql_function.rst:161 +msgid "Exercise 5: Get the azimuth" msgstr "" -#: ../../build/docs/basic/sql_function.rst:177 -msgid "Exercise 3: Route geometry (binary format)" +#: ../../build/docs/basic/sql_function.rst:163 +msgid "Route showing azimuth" msgstr "" -#: ../../build/docs/basic/sql_function.rst:189 -#: ../../build/docs/basic/sql_function.rst:243 -msgid "``geom`` in binary format with the name ``route_geom``" +#: ../../build/docs/basic/sql_function.rst:167 +msgid "There are many geometry functions in PostGIS, the workshop coveres some of them like ``ST_AsText``, ``ST_Reverse``, ``ST_EndPoint``, ``ST_Azimuth``." msgstr "" -#: ../../build/docs/basic/sql_function.rst:193 -msgid "The function returns ``route_geom``. (line **7**)" +#: ../../build/docs/basic/sql_function.rst:172 +msgid "Get the azimuth of the geometries of the route from |place_1| to |place_2|" msgstr "" -#: ../../build/docs/basic/sql_function.rst:194 -msgid "The geometry ``geom`` of the segments (line **21**)" +#: ../../build/docs/basic/sql_function.rst:176 +msgid "The function returns ``azimuth``." msgstr "" -#: ../../build/docs/basic/sql_function.rst:211 +#: ../../build/docs/basic/sql_function.rst:189 msgid "Exercise 4: Route geometry directionality" msgstr "" -#: ../../build/docs/basic/sql_function.rst:217 -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:220 -msgid "To have correct directionality, the ending point of a geometry must match the starting point of the next geometry" +#: ../../build/docs/basic/sql_function.rst:191 +msgid "wrong direccionality" msgstr "" -#: ../../build/docs/basic/sql_function.rst:223 -msgid "Inspecting the detail of the results of `Exercise 2: Route geometry (human readable)`_" +#: ../../build/docs/basic/sql_function.rst:195 +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:240 -msgid "Fix the directionality of the geometries of the previous exercise" +#: ../../build/docs/basic/sql_function.rst:198 +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:242 -msgid "``geom`` in human readable form named as ``route_readable``" +#: ../../build/docs/basic/sql_function.rst:201 +msgid "Inspecting the detail of the results of `Exercise 3: Route geometry (human readable)`_" msgstr "" -#: ../../build/docs/basic/sql_function.rst:244 -msgid "Both columns must have the geometry fixed for directionality." +#: ../../build/docs/basic/sql_function.rst:214 +msgid "Fix the directionality of the geometries and of the columns that depend on it." msgstr "" -#: ../../build/docs/basic/sql_function.rst:248 +#: ../../build/docs/basic/sql_function.rst:222 msgid "To get the correct direction some geometries need to be reversed:" msgstr "" -#: ../../build/docs/basic/sql_function.rst:250 +#: ../../build/docs/basic/sql_function.rst:224 msgid "Reversing a geometry will depend on the ``node`` column of the query to Dijkstra." msgstr "" -#: ../../build/docs/basic/sql_function.rst:253 -msgid "A conditional ``CASE`` statement that returns the geometry in human readable form:" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:256 -msgid "Of the geometry when ``node`` is the ``source`` column." -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:257 -msgid "Of the reversed geometry when ``node`` is not the ``source`` column." -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:259 +#: ../../build/docs/basic/sql_function.rst:227 msgid "A conditional ``CASE`` statement that returns:" msgstr "" -#: ../../build/docs/basic/sql_function.rst:261 +#: ../../build/docs/basic/sql_function.rst:229 msgid "The geometry when ``node`` is the ``source`` column." msgstr "" -#: ../../build/docs/basic/sql_function.rst:262 +#: ../../build/docs/basic/sql_function.rst:230 msgid "The reversed geometry when ``node`` is not the ``source`` column." msgstr "" -#: ../../build/docs/basic/sql_function.rst:275 +#: ../../build/docs/basic/sql_function.rst:239 msgid "Inspecting the problematic rows, the directionality has been fixed." msgstr "" -#: ../../build/docs/basic/sql_function.rst:288 -msgid "Exercise 5: Using the geometry" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:290 -msgid "From |ch7_place_1| to the |ch7_place_2| show azimuth" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:295 -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:302 -msgid "Modify the query from the previous exercise" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:304 -msgid "Additionally obtain the azimuth in degrees of the corrected geometry." -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:308 -msgid "The function returns ``aximuth``. (line **8**)" +#: ../../build/docs/basic/sql_function.rst:250 +msgid "good direccionality" msgstr "" -#: ../../build/docs/basic/sql_function.rst:309 -msgid "The query from previous exercise is wrapped under additional subquery. (line **18**)" +#: ../../build/docs/basic/sql_function.rst:255 +msgid "Writing the final function" msgstr "" -#: ../../build/docs/basic/sql_function.rst:311 -msgid "The ``azimuth`` is processed in degrees. (line **35**)." +#: ../../build/docs/basic/sql_function.rst:257 +msgid "The final function using ``vehicle_penalized_net``" msgstr "" -#: ../../build/docs/basic/sql_function.rst:327 +#: ../../build/docs/basic/sql_function.rst:266 msgid "Exercise 6: Using the function" msgstr "" -#: ../../build/docs/basic/sql_function.rst:329 +#: ../../build/docs/basic/sql_function.rst:268 msgid "Try the function with a combination of the interesting places:" msgstr "" -#: ../../build/docs/basic/sql_function.rst:331 +#: ../../build/docs/basic/sql_function.rst:270 msgid "|id_1| |place_1|" msgstr "" -#: ../../build/docs/basic/sql_function.rst:332 +#: ../../build/docs/basic/sql_function.rst:271 msgid "|id_2| |place_2|" msgstr "" -#: ../../build/docs/basic/sql_function.rst:333 +#: ../../build/docs/basic/sql_function.rst:272 msgid "|id_3| |place_3|" msgstr "" -#: ../../build/docs/basic/sql_function.rst:334 +#: ../../build/docs/basic/sql_function.rst:273 msgid "|id_4| |place_4|" msgstr "" -#: ../../build/docs/basic/sql_function.rst:335 +#: ../../build/docs/basic/sql_function.rst:274 msgid "|id_5| |place_5|" msgstr "" -#: ../../build/docs/basic/sql_function.rst:337 -msgid "Using different networks:" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:341 -msgid "``walk_net``" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:343 +#: ../../build/docs/basic/sql_function.rst:276 msgid "Names of the streets in the route" msgstr "" - -#: ../../build/docs/basic/sql_function.rst:354 -msgid "Total seconds spent in each street" -msgstr "" - -#: ../../build/docs/basic/sql_function.rst:365 -msgid "Why it does not fully work with ``walk_net``?" -msgstr "" diff --git a/locale/pot/basic/withPoints.pot b/locale/pot/basic/withPoints.pot index 062550c31..75d8b3fef 100644 --- a/locale/pot/basic/withPoints.pot +++ b/locale/pot/basic/withPoints.pot @@ -1,14 +1,14 @@ # SOME DESCRIPTIVE TITLE. # Copyright (C) 2010-2025 pgRouting Developers -# This file is distributed under the same license as the Workshop FOSS4G Auckland package. +# This file is distributed under the same license as the Workshop FOSS4G Hiroshima package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Workshop FOSS4G Auckland 3.1\n" +"Project-Id-Version: Workshop FOSS4G Hiroshima 3.2\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-06-14 15:20+0000\n" +"POT-Creation-Date: 2026-07-01 17:09+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -16,534 +16,473 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: ../../build/docs/basic/withPoints.rst:11 +#: ../../build/docs/basic/withPoints.rst:6 msgid "Routing using points" msgstr "" -#: ../../build/docs/basic/withPoints.rst:18 +#: ../../build/docs/basic/withPoints.rst:13 msgid "For more advanced requirements, you can utilize `PL/pgSQL `_. As application logic grows more complex, using PL/pgSQL to dynamically construct SQL queries and execute them using internal variables becomes necessary." msgstr "" -#: ../../build/docs/basic/withPoints.rst:22 +#: ../../build/docs/basic/withPoints.rst:18 msgid "pgRouting functions in this chapter" msgstr "" -#: ../../build/docs/basic/withPoints.rst:24 +#: ../../build/docs/basic/withPoints.rst:20 msgid "`pgr_findCloseEdges`_" msgstr "" -#: ../../build/docs/basic/withPoints.rst:25 +#: ../../build/docs/basic/withPoints.rst:21 msgid "`pgr_withPoints`_" msgstr "" -#: ../../build/docs/basic/withPoints.rst:27 +#: ../../build/docs/basic/withPoints.rst:23 msgid "Chapter contents" msgstr "" -#: ../../build/docs/basic/withPoints.rst:30 +#: ../../build/docs/basic/withPoints.rst:26 msgid "Requirements for routing lat,lon points" msgstr "" -#: ../../build/docs/basic/withPoints.rst:33 +#: ../../build/docs/basic/withPoints.rst:29 msgid "Chapter problem:" msgstr "" -#: ../../build/docs/basic/withPoints.rst:34 +#: ../../build/docs/basic/withPoints.rst:30 msgid "Create a function ``wrk_withPoints`` that allows routing from two point geometries and works for" msgstr "" -#: ../../build/docs/basic/withPoints.rst:37 +#: ../../build/docs/basic/withPoints.rst:33 msgid "``vehicle_net``" msgstr "" -#: ../../build/docs/basic/withPoints.rst:38 -msgid "``taxi_net``" -msgstr "" - -#: ../../build/docs/basic/withPoints.rst:39 -msgid "``walk_net``" -msgstr "" - -#: ../../build/docs/basic/withPoints.rst:41 +#: ../../build/docs/basic/withPoints.rst:35 msgid "The function takes as input parameters:" msgstr "" -#: ../../build/docs/basic/withPoints.rst:43 +#: ../../build/docs/basic/withPoints.rst:37 msgid "The edges table name" msgstr "" -#: ../../build/docs/basic/withPoints.rst:44 -msgid "Latitude/longitude of two point" +#: ../../build/docs/basic/withPoints.rst:38 +msgid "Latitude/longitude of two points" msgstr "" -#: ../../build/docs/basic/withPoints.rst:46 +#: ../../build/docs/basic/withPoints.rst:40 msgid "Returns" msgstr "" -#: ../../build/docs/basic/withPoints.rst:48 +#: ../../build/docs/basic/withPoints.rst:42 msgid "the same information as in :doc:`sql_function` chapter problem." msgstr "" -#: ../../build/docs/basic/withPoints.rst:49 +#: ../../build/docs/basic/withPoints.rst:43 msgid "or the query that it builds" msgstr "" -#: ../../build/docs/basic/withPoints.rst:52 +#: ../../build/docs/basic/withPoints.rst:46 msgid "The detailed description:" msgstr "" -#: ../../build/docs/basic/withPoints.rst:55 +#: ../../build/docs/basic/withPoints.rst:49 msgid "Input parameters" msgstr "" -#: ../../build/docs/basic/withPoints.rst:57 +#: ../../build/docs/basic/withPoints.rst:51 msgid "Parameter" msgstr "" -#: ../../build/docs/basic/withPoints.rst:57 +#: ../../build/docs/basic/withPoints.rst:51 msgid "type" msgstr "" -#: ../../build/docs/basic/withPoints.rst:57 -#: ../../build/docs/basic/withPoints.rst:72 +#: ../../build/docs/basic/withPoints.rst:51 +#: ../../build/docs/basic/sql_function.rst:6 msgid "Description" msgstr "" -#: ../../build/docs/basic/withPoints.rst:59 -msgid "``edges_subset``" -msgstr "" - -#: ../../build/docs/basic/withPoints.rst:59 -msgid "REGCLASS" -msgstr "" - -#: ../../build/docs/basic/withPoints.rst:59 -msgid "Edge table name identifier." -msgstr "" - -#: ../../build/docs/basic/withPoints.rst:60 +#: ../../build/docs/basic/withPoints.rst:53 msgid "``lat1``" msgstr "" -#: ../../build/docs/basic/withPoints.rst:60 -#: ../../build/docs/basic/withPoints.rst:61 -#: ../../build/docs/basic/withPoints.rst:62 -#: ../../build/docs/basic/withPoints.rst:63 +#: ../../build/docs/basic/withPoints.rst:53 +#: ../../build/docs/basic/withPoints.rst:54 +#: ../../build/docs/basic/withPoints.rst:55 +#: ../../build/docs/basic/withPoints.rst:56 msgid "NUMERIC" msgstr "" -#: ../../build/docs/basic/withPoints.rst:60 +#: ../../build/docs/basic/withPoints.rst:53 msgid "The latitude of the `departure` point." msgstr "" -#: ../../build/docs/basic/withPoints.rst:61 +#: ../../build/docs/basic/withPoints.rst:54 msgid "``lon1``" msgstr "" -#: ../../build/docs/basic/withPoints.rst:61 +#: ../../build/docs/basic/withPoints.rst:54 msgid "The longitude of the `departure` point." msgstr "" -#: ../../build/docs/basic/withPoints.rst:62 +#: ../../build/docs/basic/withPoints.rst:55 msgid "``lat2``" msgstr "" -#: ../../build/docs/basic/withPoints.rst:62 +#: ../../build/docs/basic/withPoints.rst:55 msgid "The latitude of the `destination` point." msgstr "" -#: ../../build/docs/basic/withPoints.rst:63 +#: ../../build/docs/basic/withPoints.rst:56 msgid "``lon2``" msgstr "" -#: ../../build/docs/basic/withPoints.rst:63 +#: ../../build/docs/basic/withPoints.rst:56 msgid "The longitude of the `destination` point." msgstr "" -#: ../../build/docs/basic/withPoints.rst:64 +#: ../../build/docs/basic/withPoints.rst:57 msgid "``do_debug``" msgstr "" -#: ../../build/docs/basic/withPoints.rst:64 +#: ../../build/docs/basic/withPoints.rst:57 msgid "BOOLEAN" msgstr "" -#: ../../build/docs/basic/withPoints.rst:64 +#: ../../build/docs/basic/withPoints.rst:57 msgid "Flag to create a ``NOTICE`` with the query that is been executed" msgstr "" -#: ../../build/docs/basic/withPoints.rst:70 +#: ../../build/docs/basic/sql_function.rst:4 msgid "Output columns" msgstr "" -#: ../../build/docs/basic/withPoints.rst:72 +#: ../../build/docs/basic/sql_function.rst:6 msgid "Name" msgstr "" -#: ../../build/docs/basic/withPoints.rst:72 +#: ../../build/docs/basic/sql_function.rst:6 msgid "Type" msgstr "" -#: ../../build/docs/basic/withPoints.rst:74 +#: ../../build/docs/basic/sql_function.rst:8 msgid "``seq``" msgstr "" -#: ../../build/docs/basic/withPoints.rst:74 +#: ../../build/docs/basic/sql_function.rst:8 msgid "INTEGER" msgstr "" -#: ../../build/docs/basic/withPoints.rst:74 +#: ../../build/docs/basic/sql_function.rst:8 msgid "A unique number for each result row." msgstr "" -#: ../../build/docs/basic/withPoints.rst:75 +#: ../../build/docs/basic/sql_function.rst:9 msgid "``id``" msgstr "" -#: ../../build/docs/basic/withPoints.rst:75 +#: ../../build/docs/basic/sql_function.rst:9 msgid "BIGINT" msgstr "" -#: ../../build/docs/basic/withPoints.rst:75 +#: ../../build/docs/basic/sql_function.rst:9 msgid "The edge identifier." msgstr "" -#: ../../build/docs/basic/withPoints.rst:76 -msgid "``name``" +#: ../../build/docs/basic/sql_function.rst:10 +msgid "``seconds``" msgstr "" -#: ../../build/docs/basic/withPoints.rst:76 -#: ../../build/docs/basic/withPoints.rst:80 -msgid "TEXT" +#: ../../build/docs/basic/sql_function.rst:10 +#: ../../build/docs/basic/sql_function.rst:12 +#: ../../build/docs/basic/sql_function.rst:13 +msgid "FLOAT" msgstr "" -#: ../../build/docs/basic/withPoints.rst:76 -msgid "The name of the segment." +#: ../../build/docs/basic/sql_function.rst:10 +msgid "The number of seconds it takes to traverse the segment." msgstr "" -#: ../../build/docs/basic/withPoints.rst:77 -msgid "``seconds``" +#: ../../build/docs/basic/sql_function.rst:11 +msgid "``name``" msgstr "" -#: ../../build/docs/basic/withPoints.rst:77 -#: ../../build/docs/basic/withPoints.rst:78 -#: ../../build/docs/basic/withPoints.rst:79 -msgid "FLOAT" +#: ../../build/docs/basic/sql_function.rst:11 +#: ../../build/docs/basic/sql_function.rst:14 +msgid "TEXT" msgstr "" -#: ../../build/docs/basic/withPoints.rst:77 -msgid "The number of seconds it takes to traverse the segment." +#: ../../build/docs/basic/sql_function.rst:11 +msgid "The name of the segment." msgstr "" -#: ../../build/docs/basic/withPoints.rst:78 +#: ../../build/docs/basic/sql_function.rst:12 msgid "``length``" msgstr "" -#: ../../build/docs/basic/withPoints.rst:78 +#: ../../build/docs/basic/sql_function.rst:12 msgid "The length in meters of the segment." msgstr "" -#: ../../build/docs/basic/withPoints.rst:79 +#: ../../build/docs/basic/sql_function.rst:13 msgid "``azimuth``" msgstr "" -#: ../../build/docs/basic/withPoints.rst:79 +#: ../../build/docs/basic/sql_function.rst:13 msgid "The azimuth of the segment." msgstr "" -#: ../../build/docs/basic/withPoints.rst:80 -msgid "``route_readable``" +#: ../../build/docs/basic/sql_function.rst:14 +msgid "``readable``" msgstr "" -#: ../../build/docs/basic/withPoints.rst:80 +#: ../../build/docs/basic/sql_function.rst:14 msgid "The geometry in human readable form." msgstr "" -#: ../../build/docs/basic/withPoints.rst:81 -msgid "``route_geom``" +#: ../../build/docs/basic/sql_function.rst:15 +msgid "``geom``" msgstr "" -#: ../../build/docs/basic/withPoints.rst:81 +#: ../../build/docs/basic/sql_function.rst:15 msgid "geometry" msgstr "" -#: ../../build/docs/basic/withPoints.rst:81 +#: ../../build/docs/basic/sql_function.rst:15 msgid "The geometry of the segment in the correct direction." msgstr "" -#: ../../build/docs/basic/withPoints.rst:85 +#: ../../build/docs/basic/withPoints.rst:66 msgid "For this chapter, the following points will be used for testing." msgstr "" -#: ../../build/docs/basic/withPoints.rst:87 -msgid "(lat,lon) = (-36.850329, 174.763094)" +#: ../../build/docs/basic/withPoints.rst:68 +msgid "(lat,lon) = (34.399086, 132.453875)" msgstr "" -#: ../../build/docs/basic/withPoints.rst:88 -msgid "(lat,lon) = (-36.853675, 174.764448)" +#: ../../build/docs/basic/withPoints.rst:69 +msgid "(lat,lon) = (34.391111, 132.451490)" msgstr "" -#: ../../build/docs/basic/withPoints.rst:91 +#: ../../build/docs/basic/withPoints.rst:72 msgid "pgr_findCloseEdges" msgstr "" -#: ../../build/docs/basic/withPoints.rst:93 +#: ../../build/docs/basic/withPoints.rst:74 msgid "Finds the close edges to a point geometry." msgstr "" -#: ../../build/docs/basic/withPoints.rst:96 -#: ../../build/docs/basic/withPoints.rst:143 +#: ../../build/docs/basic/withPoints.rst:77 +#: ../../build/docs/basic/withPoints.rst:123 msgid "Signature Summary" msgstr "" -#: ../../build/docs/basic/withPoints.rst:108 +#: ../../build/docs/basic/withPoints.rst:89 msgid "Exercise 1: Get the nearest edge" msgstr "" -#: ../../build/docs/basic/withPoints.rst:115 -#: ../../build/docs/basic/withPoints.rst:165 -#: ../../build/docs/basic/withPoints.rst:193 -#: ../../build/docs/basic/withPoints.rst:295 +#: ../../build/docs/basic/withPoints.rst:96 +#: ../../build/docs/basic/withPoints.rst:145 +#: ../../build/docs/basic/withPoints.rst:173 +#: ../../build/docs/basic/withPoints.rst:256 msgid "Problem" msgstr "" -#: ../../build/docs/basic/withPoints.rst:116 +#: ../../build/docs/basic/withPoints.rst:97 msgid "Get the nearest edge on the graph of the following points." msgstr "" -#: ../../build/docs/basic/withPoints.rst:118 -msgid "(pid, lat, lon) = (1, -36.850329, 174.763094)" +#: ../../build/docs/basic/withPoints.rst:99 +msgid "(pid, lat, lon) = (1, 34.399086, 132.453875)" msgstr "" -#: ../../build/docs/basic/withPoints.rst:119 -msgid "(pid, lat, lon) = (2, -36.853675, 174.764448)" +#: ../../build/docs/basic/withPoints.rst:100 +msgid "(pid, lat, lon) = (2, 34.391111, 132.451490)" msgstr "" -#: ../../build/docs/basic/withPoints.rst:122 -#: ../../build/docs/basic/withPoints.rst:172 -#: ../../build/docs/basic/withPoints.rst:200 -#: ../../build/docs/basic/withPoints.rst:315 +#: ../../build/docs/basic/withPoints.rst:103 +#: ../../build/docs/basic/withPoints.rst:152 +#: ../../build/docs/basic/withPoints.rst:180 +#: ../../build/docs/basic/withPoints.rst:269 msgid "Solution" msgstr "" -#: ../../build/docs/basic/withPoints.rst:123 -msgid "Build the geometry of the points with the appropiate SRID. (lines **4** and **10**)" +#: ../../build/docs/basic/withPoints.rst:104 +msgid "Build the geometry of the points with the appropiate SRID." msgstr "" -#: ../../build/docs/basic/withPoints.rst:125 +#: ../../build/docs/basic/withPoints.rst:105 msgid "Get the union of the individual queries" msgstr "" -#: ../../build/docs/basic/withPoints.rst:138 +#: ../../build/docs/basic/withPoints.rst:118 msgid "pgr_withPoints" msgstr "" -#: ../../build/docs/basic/withPoints.rst:140 +#: ../../build/docs/basic/withPoints.rst:120 msgid "Returns the shortest path in a graph with additional temporary vertices." msgstr "" -#: ../../build/docs/basic/withPoints.rst:158 +#: ../../build/docs/basic/withPoints.rst:138 msgid "Exercise 2: Point routing" msgstr "" -#: ../../build/docs/basic/withPoints.rst:166 +#: ../../build/docs/basic/withPoints.rst:146 msgid "Route from point **1** to point **2** on the ``vehicle_net`` where:" msgstr "" -#: ../../build/docs/basic/withPoints.rst:168 -msgid "point **1**: (lat, lon) = (1, -36.850329, 174.763094)" +#: ../../build/docs/basic/withPoints.rst:148 +msgid "point **1**: (lat, lon) = (1, 34.399086, 132.453875)" msgstr "" -#: ../../build/docs/basic/withPoints.rst:169 -msgid "point **2**: (lat, lon) = (2, -36.853675, 174.764448)" +#: ../../build/docs/basic/withPoints.rst:149 +msgid "point **2**: (lat, lon) = (2, 34.391111, 132.451490)" msgstr "" -#: ../../build/docs/basic/withPoints.rst:173 +#: ../../build/docs/basic/withPoints.rst:153 msgid "The query from `Exercise 1: Get the nearest edge`_ is used as the inner query for points." msgstr "" -#: ../../build/docs/basic/withPoints.rst:175 +#: ../../build/docs/basic/withPoints.rst:155 msgid "Using negative values to avoid conficts with vertices with the same value:" msgstr "" -#: ../../build/docs/basic/withPoints.rst:177 +#: ../../build/docs/basic/withPoints.rst:157 msgid "Routing from point **-1** to point **-2**" msgstr "" -#: ../../build/docs/basic/withPoints.rst:190 +#: ../../build/docs/basic/withPoints.rst:170 msgid "Exercise 3: Creating the point routing function" msgstr "" -#: ../../build/docs/basic/withPoints.rst:194 +#: ../../build/docs/basic/withPoints.rst:174 msgid "Create the function ``wrk_withPoints`` to route from locations using latitude and longitude values." msgstr "" -#: ../../build/docs/basic/withPoints.rst:197 +#: ../../build/docs/basic/withPoints.rst:177 msgid "Analyze the function." msgstr "" -#: ../../build/docs/basic/withPoints.rst:201 +#: ../../build/docs/basic/withPoints.rst:181 msgid "Creating a ``plpgsql`` function." msgstr "" -#: ../../build/docs/basic/withPoints.rst:210 +#: ../../build/docs/basic/withPoints.rst:190 msgid "Analysis" msgstr "" -#: ../../build/docs/basic/withPoints.rst:211 +#: ../../build/docs/basic/withPoints.rst:191 msgid "The function's signature:" msgstr "" -#: ../../build/docs/basic/withPoints.rst:213 +#: ../../build/docs/basic/withPoints.rst:193 msgid "The input parameters instead of vertex identifiers, now it has the latitude and longitude of a couple of points." msgstr "" -#: ../../build/docs/basic/withPoints.rst:215 +#: ../../build/docs/basic/withPoints.rst:195 msgid "The function returns the same set of values calculated on the :doc:`sql_function`." msgstr "" -#: ../../build/docs/basic/withPoints.rst:224 -msgid "Getting the closest query:" +#: ../../build/docs/basic/withPoints.rst:204 +msgid "The points SQL:" msgstr "" -#: ../../build/docs/basic/withPoints.rst:226 +#: ../../build/docs/basic/withPoints.rst:206 msgid "The query looks like the one on `Exercise 1: Get the nearest edge`_" msgstr "" -#: ../../build/docs/basic/withPoints.rst:227 -#: ../../build/docs/basic/withPoints.rst:244 -#: ../../build/docs/basic/withPoints.rst:262 +#: ../../build/docs/basic/withPoints.rst:207 +#: ../../build/docs/basic/withPoints.rst:224 msgid "Using PostgreSQL ``format`` to make substitutions." msgstr "" -#: ../../build/docs/basic/withPoints.rst:229 +#: ../../build/docs/basic/withPoints.rst:209 msgid "The first parameter is the string to be replaced" msgstr "" -#: ../../build/docs/basic/withPoints.rst:230 +#: ../../build/docs/basic/withPoints.rst:210 msgid "The rest are the data parameters, are the strings use for replacement." msgstr "" -#: ../../build/docs/basic/withPoints.rst:231 -msgid "``lat1``, ``lon1`` values will replace ``%2$s, %3$s`` respectively." +#: ../../build/docs/basic/withPoints.rst:211 +msgid "``lat1``, ``lon1`` values will replace ``%2$s, %1$s`` respectively." msgstr "" -#: ../../build/docs/basic/withPoints.rst:232 -msgid "``lat2``, ``lon2`` values will replace ``%4$s, %5$s`` respectively." +#: ../../build/docs/basic/withPoints.rst:212 +msgid "``lat2``, ``lon2`` values will replace ``%4$s, %3$s`` respectively." msgstr "" -#: ../../build/docs/basic/withPoints.rst:241 -msgid "Getting the routing results:" +#: ../../build/docs/basic/withPoints.rst:221 +msgid "The routing results:" msgstr "" -#: ../../build/docs/basic/withPoints.rst:243 +#: ../../build/docs/basic/withPoints.rst:223 msgid "The query looks like the one on `Exercise 2: Point routing`" msgstr "" -#: ../../build/docs/basic/withPoints.rst:246 -msgid "The ``edges_subset`` value will replace ``%1$I``." -msgstr "" - -#: ../../build/docs/basic/withPoints.rst:247 -msgid "The ``closest_query`` value will replace ``%2$s``." -msgstr "" - -#: ../../build/docs/basic/withPoints.rst:256 -msgid "Getting the additional information:" -msgstr "" - -#: ../../build/docs/basic/withPoints.rst:258 -msgid "The subquery looks like the one in the function created on :doc:`sql_function`." -msgstr "" - -#: ../../build/docs/basic/withPoints.rst:260 -msgid "A joined table can not be a variable" -msgstr "" - -#: ../../build/docs/basic/withPoints.rst:263 -msgid "To make it work on the ``walk_net``, the whole query needs to be in ``TEXT``." -msgstr "" - -#: ../../build/docs/basic/withPoints.rst:265 -msgid "The ``edges_subset`` value will replace ``%1$I``:" +#: ../../build/docs/basic/withPoints.rst:226 +msgid "The ``points_sql`` value will replace ``%1$s``." msgstr "" -#: ../../build/docs/basic/withPoints.rst:274 +#: ../../build/docs/basic/withPoints.rst:235 msgid "Building the complete query:" msgstr "" -#: ../../build/docs/basic/withPoints.rst:276 +#: ../../build/docs/basic/withPoints.rst:237 msgid "The complete query looks like the one in the function created on :doc:`sql_function`." msgstr "" -#: ../../build/docs/basic/withPoints.rst:278 +#: ../../build/docs/basic/withPoints.rst:239 msgid "Concatenation of strings is used." msgstr "" -#: ../../build/docs/basic/withPoints.rst:288 +#: ../../build/docs/basic/withPoints.rst:249 msgid "Exercise 4: Using wrk_withPoints" msgstr "" -#: ../../build/docs/basic/withPoints.rst:296 +#: ../../build/docs/basic/withPoints.rst:257 msgid "Use ``wrk_withPoints``" msgstr "" -#: ../../build/docs/basic/withPoints.rst:298 -msgid "Departure point is: (lat,lon) = ``(-36.850329, 174.763094)``" -msgstr "" - -#: ../../build/docs/basic/withPoints.rst:299 -msgid "Destination point is: (lat,lon) = ``(-36.853675, 174.764448)``" -msgstr "" - -#: ../../build/docs/basic/withPoints.rst:300 -#: ../../build/docs/basic/withPoints.rst:316 -msgid "For ``vehicle_net``:" +#: ../../build/docs/basic/withPoints.rst:259 +msgid "Departure point is: (lat,lon) = ``(34.399086, 132.453875)``" msgstr "" -#: ../../build/docs/basic/withPoints.rst:302 -msgid "Get the names of the streets of the route." -msgstr "" - -#: ../../build/docs/basic/withPoints.rst:304 -#: ../../build/docs/basic/withPoints.rst:332 -msgid "For ``taxi_net``:" +#: ../../build/docs/basic/withPoints.rst:260 +msgid "Destination point is: (lat,lon) = ``(34.391111, 132.451490)``" msgstr "" -#: ../../build/docs/basic/withPoints.rst:306 +#: ../../build/docs/basic/withPoints.rst:262 msgid "Get the query that is been generated." msgstr "" -#: ../../build/docs/basic/withPoints.rst:308 -#: ../../build/docs/basic/withPoints.rst:345 -msgid "For ``walk_net``:" +#: ../../build/docs/basic/withPoints.rst:263 +msgid "Get the names of the streets of the route." msgstr "" -#: ../../build/docs/basic/withPoints.rst:310 -#: ../../build/docs/basic/withPoints.rst:321 -msgid "Use with default value of ``do_debug``." +#: ../../build/docs/basic/withPoints.rst:264 +msgid "Create a view to be used on QGIS." msgstr "" -#: ../../build/docs/basic/withPoints.rst:311 -msgid "Store results on a table." +#: ../../build/docs/basic/withPoints.rst:266 +msgid "Test the view by listing the names of each segment of the route." msgstr "" -#: ../../build/docs/basic/withPoints.rst:312 -msgid "Show the table contents." +#: ../../build/docs/basic/withPoints.rst:270 +msgid "The next two parameters are the latitude and longitude of the departure point." msgstr "" -#: ../../build/docs/basic/withPoints.rst:318 -msgid "The first parameter is the table name." +#: ../../build/docs/basic/withPoints.rst:271 +msgid "The next two parameters are the latitude and longitude of the destination point." msgstr "" -#: ../../build/docs/basic/withPoints.rst:319 -msgid "The next two parameters are the latitude and longitude of the departure point." +#: ../../build/docs/basic/withPoints.rst:272 +msgid "Use with default value of ``do_debug``." msgstr "" -#: ../../build/docs/basic/withPoints.rst:320 -msgid "The next two parameters are the latitude and longitude of the destination point." +#: ../../build/docs/basic/withPoints.rst:283 +msgid "Do a dry run by adding ``true`` to get the query that is executed." msgstr "" -#: ../../build/docs/basic/withPoints.rst:334 -msgid "Do a dry run by adding ``true`` to get the query that is executed." +#: ../../build/docs/basic/withPoints.rst:294 +msgid "Create the view and test it." msgstr "" diff --git a/locale/pot/un_sdg/data.pot b/locale/pot/un_sdg/data.pot index 74dabf070..e76937caa 100644 --- a/locale/pot/un_sdg/data.pot +++ b/locale/pot/un_sdg/data.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Workshop FOSS4G Hiroshima 3.2\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-06-25 21:50+0000\n" +"POT-Creation-Date: 2026-07-01 17:09+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -21,235 +21,276 @@ msgid "Data for Sustainable Development Goals" msgstr "" #: ../../build/docs/un_sdg/data.rst:11 -msgid "To be able to use pgRouting, data has to be imported into a database. This chapter will use ``osm2pgrouting`` to get that the data from OpenStreetMap (OSM). This data will be used for exercises in further chapters." +msgid "To be able to use pgRouting, data has to be imported into a database. This chapter will use ``osm2pgrouting`` to get the data from OpenStreetMap (OSM). This data will be used for exercises in further chapters." msgstr "" #: ../../build/docs/un_sdg/data.rst:15 -msgid "Chapter Contents" +msgid "pgRouting is an extension which requires:" +msgstr "" + +#: ../../build/docs/un_sdg/data.rst:17 +msgid "Supported PostgreSQL version" msgstr "" #: ../../build/docs/un_sdg/data.rst:18 -msgid "Work Directory for pgRouting data manipulation" +msgid "Supported PostGIS version" msgstr "" -#: ../../build/docs/un_sdg/data.rst:26 -msgid "Mumbai database" +#: ../../build/docs/un_sdg/data.rst:20 +msgid "These requirements are met on OSGeoLive. When the required software is installed, open a terminal window by pressing ``ctrl-alt-t`` and follow the instructions. Information about installing OSGeoLive can be found in :doc:`../appendix/osgeolive` of this workshop." msgstr "" -#: ../../build/docs/un_sdg/data.rst:28 -msgid "pgRouting is pre-installed as an extension which requires:" +#: ../../build/docs/un_sdg/data.rst:25 +msgid "If you don't have pgRouting installed. You can find the installation procedure at this `link `__" msgstr "" -#: ../../build/docs/un_sdg/data.rst:30 -msgid "Supported PostgreSQL version" +#: ../../build/docs/un_sdg/data.rst:29 +msgid "The database to install depends on the UN SDG chapter you are working on:" msgstr "" -#: ../../build/docs/un_sdg/data.rst:31 -msgid "Supported PostGIS version" +#: ../../build/docs/un_sdg/data.rst:35 +msgid "Chapter" msgstr "" -#: ../../build/docs/un_sdg/data.rst:33 -msgid "These requirements are met on OSGeoLive. When the required software is installed, open a terminal window by pressing ``ctrl-alt-t`` and follow the instructions. Information about installing OSGeoLive can be found in :doc:`../appendix/osgeolive` of this workshop." +#: ../../build/docs/un_sdg/data.rst:36 +msgid "Database" +msgstr "" + +#: ../../build/docs/un_sdg/data.rst:37 +#: ../../build/docs/un_sdg/data.rst:213 +msgid ":doc:`sdg3-health`" msgstr "" #: ../../build/docs/un_sdg/data.rst:38 -msgid "If you don't have pgRouting installed. You can find the installation procedure at this `link `__" +#: ../../build/docs/un_sdg/data.rst:40 +msgid "`Mumbai database`_" +msgstr "" + +#: ../../build/docs/un_sdg/data.rst:39 +#: ../../build/docs/un_sdg/data.rst:214 +msgid ":doc:`sdg7-energy`" +msgstr "" + +#: ../../build/docs/un_sdg/data.rst:41 +#: ../../build/docs/un_sdg/data.rst:347 +msgid ":doc:`sdg11-cities`" msgstr "" -#: ../../build/docs/un_sdg/data.rst:44 +#: ../../build/docs/un_sdg/data.rst:42 +msgid "`Bangladesh database`_" +msgstr "" + +#: ../../build/docs/un_sdg/data.rst:45 +msgid "Chapter Contents" +msgstr "" + +#: ../../build/docs/un_sdg/data.rst:48 +msgid "Mumbai database" +msgstr "" + +#: ../../build/docs/un_sdg/data.rst:51 +#: ../../build/docs/un_sdg/data.rst:220 +msgid "Contents" +msgstr "" + +#: ../../build/docs/un_sdg/data.rst:54 msgid "Create Mumbai database compatible with pgRouting" msgstr "" -#: ../../build/docs/un_sdg/data.rst:46 +#: ../../build/docs/un_sdg/data.rst:56 msgid "Use the following command to create ``mumbai`` database" msgstr "" -#: ../../build/docs/un_sdg/data.rst:52 -#: ../../build/docs/un_sdg/data.rst:185 +#: ../../build/docs/un_sdg/data.rst:62 +#: ../../build/docs/un_sdg/data.rst:231 msgid "To connect to the database do the following" msgstr "" -#: ../../build/docs/un_sdg/data.rst:58 -#: ../../build/docs/un_sdg/data.rst:192 -msgid "After connecting to the database, first step is to create ``EXTENSION`` to enable pgRouting and PostGIS in the database. Then add the ``SCHEMA`` for each table." +#: ../../build/docs/un_sdg/data.rst:68 +msgid "After connecting to the database, the first step is to create ``EXTENSION`` to enable pgRouting and PostGIS in the database. Then add the ``SCHEMA`` that are needed." msgstr "" -#: ../../build/docs/un_sdg/data.rst:68 +#: ../../build/docs/un_sdg/data.rst:78 msgid "Get the Mumbai Data" msgstr "" -#: ../../build/docs/un_sdg/data.rst:69 +#: ../../build/docs/un_sdg/data.rst:79 msgid "The pgRouting workshop will make use of OpenStreetMap data of an area in Mumbai City. The instructions for downloading the data are given below." msgstr "" -#: ../../build/docs/un_sdg/data.rst:73 +#: ../../build/docs/un_sdg/data.rst:83 msgid "Downloading Mumbai data from OSGeo" msgstr "" -#: ../../build/docs/un_sdg/data.rst:75 +#: ../../build/docs/un_sdg/data.rst:84 msgid "The following command is used to download the snapshot of the Mumbai area data used in this workshop, using the download service of OSGeo." msgstr "" -#: ../../build/docs/un_sdg/data.rst:78 +#: ../../build/docs/un_sdg/data.rst:87 msgid "The Mumbai data for this workshop depends on this `snapshot `__." msgstr "" -#: ../../build/docs/un_sdg/data.rst:88 -msgid "Downloading Mumbai data from OpenStreetMap (OSM)" +#: ../../build/docs/un_sdg/data.rst:96 +msgid "The following command was used in June 2021 to download the OpenStreetMap data of the area in Mumbai, India." +msgstr "" + +#: ../../build/docs/un_sdg/data.rst:107 +msgid "Upload Mumbai data to the database" msgstr "" -#: ../../build/docs/un_sdg/data.rst:89 -msgid "The following command is used to download the OpenStreetMap data of the area in Mumbai, India." +#: ../../build/docs/un_sdg/data.rst:109 +#: ../../build/docs/un_sdg/data.rst:280 +msgid "The next step is to run ``osm2pgrouting`` converter, which is a command line tool that inserts the data in the database, \"ready\" to be used with pgRouting. See :doc:`../appendix/appendix-3` for additional information about ``osm2pgrouting``." msgstr "" -#: ../../build/docs/un_sdg/data.rst:91 -msgid "OpenStreetMap data changes on a day to day basis, therefore if this data is used, the results might change and some queries might need adjustments. The command was used to take the snapshot of the data on June 2021." +#: ../../build/docs/un_sdg/data.rst:113 +#: ../../build/docs/un_sdg/data.rst:284 +msgid "For this step the following is used:" msgstr "" -#: ../../build/docs/un_sdg/data.rst:102 -msgid "Upload Mumbai data to the database" +#: ../../build/docs/un_sdg/data.rst:115 +msgid "Configuration file: ``buildings.xml``" msgstr "" -#: ../../build/docs/un_sdg/data.rst:104 -#: ../../build/docs/un_sdg/data.rst:233 -msgid "The next step is to run ``osm2pgrouting`` converter, which is a command line tool that inserts the data in the database, \"ready\" to be used with pgRouting. See :doc:`../appendix/appendix-3` for additional information about ``osm2pgrouting``." +#: ../../build/docs/un_sdg/data.rst:116 +msgid "Configuration file: the default ``mapconfig.xml`` provided with ``osm2pgrouting``" msgstr "" -#: ../../build/docs/un_sdg/data.rst:108 -#: ../../build/docs/un_sdg/data.rst:237 -msgid "For this step the following is used:" +#: ../../build/docs/un_sdg/data.rst:118 +msgid "Copy the ``buildings.xml`` configuration file." msgstr "" -#: ../../build/docs/un_sdg/data.rst:110 -msgid "``mumbai_buildings.xml`` and ``mumbai_roads.xml`` configuration files for osm2pgrouting." +#: ../../build/docs/un_sdg/data.rst:126 +msgid "Importing Mumbai Roads" msgstr "" -#: ../../build/docs/un_sdg/data.rst:111 -msgid "``~/Desktop/workshop/mumbai.osm`` - OSM data from the previous step" +#: ../../build/docs/un_sdg/data.rst:128 +msgid "The following ``osm2pgrouting`` command will be used to import the ``mumbai.osm`` roads into a pgRouting compatible database." msgstr "" -#: ../../build/docs/un_sdg/data.rst:112 -msgid "``mumbai`` database." +#: ../../build/docs/un_sdg/data.rst:143 +msgid "Importing Mumbai Buildings" msgstr "" -#: ../../build/docs/un_sdg/data.rst:114 -#: ../../build/docs/un_sdg/data.rst:243 -msgid "Contents of the configuration files are given in the `Appendix`_. Create a XML file using these contents and save it into the root directory ``~/Desktop/workshop``." +#: ../../build/docs/un_sdg/data.rst:145 +msgid "The following ``osm2pgrouting`` command will be used to import the ``mumbai.osm`` buildings into a pgRouting compatible database." msgstr "" -#: ../../build/docs/un_sdg/data.rst:117 -msgid "Open a terminal window by ``ctrl-alt-t`` and move to the workshop directory by ``cd ~/Desktop/workshop``. The following ``osm2pgrouting`` command will be used to convert the osm files to pgRouting friendly format which we will use for further exercises." +#: ../../build/docs/un_sdg/data.rst:160 +msgid "Compatibility with older osm2pgrouting versions (Mumbai)" msgstr "" -#: ../../build/docs/un_sdg/data.rst:122 -msgid "Importing Mumbai Roads" +#: ../../build/docs/un_sdg/data.rst:162 +#: ../../build/docs/un_sdg/data.rst:317 +msgid "Check the installed version:" msgstr "" -#: ../../build/docs/un_sdg/data.rst:124 -msgid "The following ``osm2pgrouting`` command will be used to import the Roads from OpenStreetMaps file to pgRouting database which we will use for further exercises." +#: ../../build/docs/un_sdg/data.rst:168 +#: ../../build/docs/un_sdg/data.rst:323 +msgid "If you are using version 2.x, the column names differ from those used in this workshop:" msgstr "" -#: ../../build/docs/un_sdg/data.rst:134 -#: ../../build/docs/un_sdg/data.rst:155 -#: ../../build/docs/un_sdg/data.rst:261 -msgid "Depending on the osm2pgrouting version `-W password` is needed" +#: ../../build/docs/un_sdg/data.rst:171 +#: ../../build/docs/un_sdg/data.rst:326 +msgid "``gid`` instead of ``id``" msgstr "" -#: ../../build/docs/un_sdg/data.rst:137 -#: ../../build/docs/un_sdg/data.rst:158 -#: ../../build/docs/un_sdg/data.rst:264 -msgid "Output:" +#: ../../build/docs/un_sdg/data.rst:172 +#: ../../build/docs/un_sdg/data.rst:327 +msgid "``the_geom`` instead of ``geom``" msgstr "" -#: ../../build/docs/un_sdg/data.rst:143 -msgid "Importing Mumbai Buildings" +#: ../../build/docs/un_sdg/data.rst:174 +#: ../../build/docs/un_sdg/data.rst:329 +msgid "Run the following script to rename them:" msgstr "" -#: ../../build/docs/un_sdg/data.rst:145 -msgid "Similar to Roads, ``osm2pgrouting`` command will be used to import the Buildings from OpenStreetMaps file to pgRouting database which we will use for further exercises." +#: ../../build/docs/un_sdg/data.rst:182 +msgid "Verify the data (Mumbai)" msgstr "" -#: ../../build/docs/un_sdg/data.rst:163 -#: ../../build/docs/un_sdg/data.rst:269 +#: ../../build/docs/un_sdg/data.rst:184 +#: ../../build/docs/un_sdg/data.rst:339 msgid "To connect to the database, type the following in the terminal." msgstr "" -#: ../../build/docs/un_sdg/data.rst:171 -msgid "Bangladesh database" +#: ../../build/docs/un_sdg/data.rst:190 +msgid "The importance of counting the information on this workshop is to make sure that the same data is used and consequently the results are same." msgstr "" -#: ../../build/docs/un_sdg/data.rst:173 -msgid "Now download the data for an area in Bangladesh by following the same steps like that of Mumbai." +#: ../../build/docs/un_sdg/data.rst:211 +#: ../../build/docs/un_sdg/data.rst:345 +msgid "Continue with the workshop:" msgstr "" -#: ../../build/docs/un_sdg/data.rst:177 +#: ../../build/docs/un_sdg/data.rst:217 +msgid "Bangladesh database" +msgstr "" + +#: ../../build/docs/un_sdg/data.rst:223 msgid "Create Bangladesh area database compatible with pgRouting" msgstr "" -#: ../../build/docs/un_sdg/data.rst:179 +#: ../../build/docs/un_sdg/data.rst:225 msgid "Use the following command to create ``bangladesh`` database" msgstr "" -#: ../../build/docs/un_sdg/data.rst:202 +#: ../../build/docs/un_sdg/data.rst:238 +msgid "After connecting to the database, the first step is to create ``EXTENSION`` to enable pgRouting and PostGIS in the database. Then add the ``SCHEMA`` for each table." +msgstr "" + +#: ../../build/docs/un_sdg/data.rst:248 msgid "Get the Bangladesh Data" msgstr "" -#: ../../build/docs/un_sdg/data.rst:205 +#: ../../build/docs/un_sdg/data.rst:251 msgid "Downloading Bangladesh data from OSGeo" msgstr "" -#: ../../build/docs/un_sdg/data.rst:207 +#: ../../build/docs/un_sdg/data.rst:252 msgid "The following command is used to download the snapshot of the Bangladesh area data used in this workshop, using the download service of OSGeo." msgstr "" -#: ../../build/docs/un_sdg/data.rst:210 +#: ../../build/docs/un_sdg/data.rst:255 msgid "The Bangladesh data for this workshop depends on this `snapshot `__." msgstr "" -#: ../../build/docs/un_sdg/data.rst:220 -msgid "Downloading Bangladesh data from OpenStreetMap" -msgstr "" - -#: ../../build/docs/un_sdg/data.rst:221 -msgid "The following command is used to download the OSM data of the area in Munshigang, Bangladesh." +#: ../../build/docs/un_sdg/data.rst:264 +msgid "The following command was used in June 2021 to download the OpenStreetMap data of the area in Munshigang, Bangladesh." msgstr "" -#: ../../build/docs/un_sdg/data.rst:231 +#: ../../build/docs/un_sdg/data.rst:278 msgid "Upload Bangladesh data to the database" msgstr "" -#: ../../build/docs/un_sdg/data.rst:239 -msgid "``waterways.xml`` configuration file" +#: ../../build/docs/un_sdg/data.rst:286 +msgid "Configuration file: ``waterways.xml``" msgstr "" -#: ../../build/docs/un_sdg/data.rst:240 +#: ../../build/docs/un_sdg/data.rst:287 msgid "``~/Desktop/workshop/bangladesh.osm`` - OSM data from the previous step" msgstr "" -#: ../../build/docs/un_sdg/data.rst:241 +#: ../../build/docs/un_sdg/data.rst:288 msgid "``bangladesh`` database" msgstr "" -#: ../../build/docs/un_sdg/data.rst:246 -msgid "Open a terminal window by ``ctrl-alt-t`` and move to the workshop directory by ``cd ~/Desktop/workshop``." +#: ../../build/docs/un_sdg/data.rst:290 +msgid "Copy the ``waterways.xml`` configuration file." msgstr "" -#: ../../build/docs/un_sdg/data.rst:250 +#: ../../build/docs/un_sdg/data.rst:298 msgid "Importing Bangladesh Waterways" msgstr "" -#: ../../build/docs/un_sdg/data.rst:252 -msgid "The following ``osm2pgrouting`` command will be used to import the Waterways from OpenStreetMaps file to pgRouting database which we will use for further exercises." -msgstr "" - -#: ../../build/docs/un_sdg/data.rst:278 -msgid "Appendix" +#: ../../build/docs/un_sdg/data.rst:300 +msgid "The following ``osm2pgrouting`` command will be used to import the Waterways from the OpenStreetMap file to the pgRouting database which we will use for further exercises." msgstr "" -#: ../../build/docs/un_sdg/data.rst:281 -msgid "Configuration information for Buildings" +#: ../../build/docs/un_sdg/data.rst:315 +msgid "Compatibility with older osm2pgrouting versions (Bangladesh)" msgstr "" -#: ../../build/docs/un_sdg/data.rst:289 -msgid "Configuration information for Waterways" +#: ../../build/docs/un_sdg/data.rst:337 +msgid "Verify the data (Bangladesh)" msgstr "" diff --git a/locale/pot/un_sdg/sdg11-cities.pot b/locale/pot/un_sdg/sdg11-cities.pot index d7d6450c3..8736cbeb3 100644 --- a/locale/pot/un_sdg/sdg11-cities.pot +++ b/locale/pot/un_sdg/sdg11-cities.pot @@ -1,14 +1,14 @@ # SOME DESCRIPTIVE TITLE. # Copyright (C) 2010-2025 pgRouting Developers -# This file is distributed under the same license as the Workshop FOSS4G Auckland package. +# This file is distributed under the same license as the Workshop FOSS4G Hiroshima package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Workshop FOSS4G Auckland 3.1\n" +"Project-Id-Version: Workshop FOSS4G Hiroshima 3.2\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-06-14 15:17+0000\n" +"POT-Creation-Date: 2026-07-01 17:09+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -16,287 +16,287 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: ../../build/docs/un_sdg/sdg11-cities.rst:11 +#: ../../build/docs/un_sdg/sdg11-cities.rst:6 msgid "Sustainable Cities and Communities" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:13 +#: ../../build/docs/un_sdg/sdg11-cities.rst:8 msgid "`Sustainable Cities and Communities` is the 11th Sustainable Development Goal which aspires to make cities `inclusive, safe, resilient` and `sustainable`.The world is becoming increasingly urbanized. Since 2007, more than half the world’s population has been living in cities. This makes it very important for the cities to remain alert when there is a chance of disaster like floods. Local administration should know if their city is going to get affected by the rains which happen in their proximity so that they can raise an alert amongst the citizens. This exercise will solve one of such problems." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:22 +#: ../../build/docs/un_sdg/sdg11-cities.rst:17 msgid "Sustainable Development Goal 11: Sustainable Cities and Communities" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:26 +#: ../../build/docs/un_sdg/sdg11-cities.rst:21 msgid "`Image Source `__" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:28 +#: ../../build/docs/un_sdg/sdg11-cities.rst:23 msgid "Chapter Contents" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:31 +#: ../../build/docs/un_sdg/sdg11-cities.rst:26 msgid "Problem: City getting affected by rain or not" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:33 +#: ../../build/docs/un_sdg/sdg11-cities.rst:28 msgid "**Problem Statement**" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:35 +#: ../../build/docs/un_sdg/sdg11-cities.rst:30 msgid "To determine the areas where if it rains will affect a city/town" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:41 +#: ../../build/docs/un_sdg/sdg11-cities.rst:36 msgid "**Core Idea**" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:43 +#: ../../build/docs/un_sdg/sdg11-cities.rst:38 msgid "If it rains in vicinity of a river connecting the city, the city will get affected by the rains." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:46 +#: ../../build/docs/un_sdg/sdg11-cities.rst:41 msgid "**Approach**" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:48 -#: ../../build/docs/un_sdg/sdg11-cities.rst:59 +#: ../../build/docs/un_sdg/sdg11-cities.rst:43 +#: ../../build/docs/un_sdg/sdg11-cities.rst:54 msgid "Choose a city" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:49 +#: ../../build/docs/un_sdg/sdg11-cities.rst:44 msgid "Get the Rivers (Edges)" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:50 +#: ../../build/docs/un_sdg/sdg11-cities.rst:45 msgid "Create river components" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:51 +#: ../../build/docs/un_sdg/sdg11-cities.rst:46 msgid "Create a Buffer around the city" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:52 +#: ../../build/docs/un_sdg/sdg11-cities.rst:47 msgid "Finding the components intersecting the buffer" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:53 +#: ../../build/docs/un_sdg/sdg11-cities.rst:48 msgid "Finding the rain zones" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:61 +#: ../../build/docs/un_sdg/sdg11-cities.rst:56 msgid "For this exercise, Munshigang city from Bangladesh is chosen. This city has multiple rivers in its proximity which makes it an apt location to demonstrate this exercise. The exercise will try to find the areas, where if it rains the city will be affected. To define the location of this city and use it in for further steps, create a table to store the name along with latitude and longitude values of City's location. This stores the city as a point." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:69 +#: ../../build/docs/un_sdg/sdg11-cities.rst:64 msgid "Exercise 1: Create a point for the city" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:72 +#: ../../build/docs/un_sdg/sdg11-cities.rst:67 msgid "Create a table for the cities" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:83 +#: ../../build/docs/un_sdg/sdg11-cities.rst:78 msgid "Insert Munshigang" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:94 +#: ../../build/docs/un_sdg/sdg11-cities.rst:89 msgid "Simulate the city region with a buffer" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:105 +#: ../../build/docs/un_sdg/sdg11-cities.rst:100 msgid "See description of the table" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:114 +#: ../../build/docs/un_sdg/sdg11-cities.rst:109 msgid "Latitude and longitude values are converted into ``geometry`` form using ``ST_Point`` which returns a point with the given X and Y coordinate values. ``ST_SetSRID`` is used to set the SRID (Spatial Reference Identifier) on the point geometry to ``4326``." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:120 +#: ../../build/docs/un_sdg/sdg11-cities.rst:115 msgid "Prepare the database" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:122 +#: ../../build/docs/un_sdg/sdg11-cities.rst:117 msgid "Data obtained in :doc:`data`." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:124 +#: ../../build/docs/un_sdg/sdg11-cities.rst:119 msgid "This section will cover the status of the database in order to get the same results when processing the queries." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:128 +#: ../../build/docs/un_sdg/sdg11-cities.rst:123 msgid "Exercise 2: Set the search path" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:130 +#: ../../build/docs/un_sdg/sdg11-cities.rst:125 msgid "First step in pre processing is to set the search path for ``Waterways`` data. Search path is a list of schemas that helps the system determine how a particular table is to be imported." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:145 +#: ../../build/docs/un_sdg/sdg11-cities.rst:140 msgid "Exercise 3: Verify database configuration" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:147 +#: ../../build/docs/un_sdg/sdg11-cities.rst:142 msgid "As part of the every project tasks: inspect the database structure." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:150 +#: ../../build/docs/un_sdg/sdg11-cities.rst:145 msgid "Get the extensions that are installed" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:160 +#: ../../build/docs/un_sdg/sdg11-cities.rst:155 msgid "List installed tables" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:170 +#: ../../build/docs/un_sdg/sdg11-cities.rst:165 msgid "Exercise 4: Count the number of Waterways" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:172 +#: ../../build/docs/un_sdg/sdg11-cities.rst:167 msgid "The importance of counting the information on this workshop is to make sure that the same data is used and consequently the results are same. Also, some of the rows can be seen to understand the structure of the table and how the data is stored in it." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:187 +#: ../../build/docs/un_sdg/sdg11-cities.rst:182 msgid "Processing waterways data" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:189 +#: ../../build/docs/un_sdg/sdg11-cities.rst:184 msgid "This section will work the graph that is going to be used for processing. While building the graph, the data has to be inspected to determine if there is any invalid data. This is a very important step to make sure that the data is of required quality. pgRouting can also be used to do some Data Adjustments." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:195 +#: ../../build/docs/un_sdg/sdg11-cities.rst:190 msgid "Exercise 5: Remove waterways not for the problem" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:197 +#: ../../build/docs/un_sdg/sdg11-cities.rst:192 msgid "Waterways to be removed" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:201 -msgid "This exercise focusses only the areas in the mainland, where if it rains the city is affected. Hence, the rivers which are there in the swamp area wich is in a lower altitude of the city, are to be removed from the ``waterways_ways`` table." +#: ../../build/docs/un_sdg/sdg11-cities.rst:196 +msgid "This exercise focusses only the areas in the mainland, where if it rains the city is affected. Hence, the rivers which are there in the swamp area wich is in a lower altitude of the city, are to be removed from the ``waterways.ways`` table." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:206 +#: ../../build/docs/un_sdg/sdg11-cities.rst:201 msgid "Remove swamp rivers" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:216 +#: ../../build/docs/un_sdg/sdg11-cities.rst:211 msgid "When working for many cities, a better approach might be to create views." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:220 +#: ../../build/docs/un_sdg/sdg11-cities.rst:215 msgid "Also delete a boundary tagged as waterway" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:230 +#: ../../build/docs/un_sdg/sdg11-cities.rst:225 msgid "A better approach might be to fix the original data in OSM website." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:233 +#: ../../build/docs/un_sdg/sdg11-cities.rst:228 msgid "Exercise 6: Get the Connected Components of Waterways" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:235 -msgid "As the rivers in the data are not having single edges, i.e, multiple edges make up a river, it is important to find out the connected edges and store the information in the ``waterways_ways`` table. This will help us to identify which edges belong to a river. First, the connected components are found and then stored in a new column named ``component``." +#: ../../build/docs/un_sdg/sdg11-cities.rst:230 +msgid "As the rivers in the data are not having single edges, i.e, multiple edges make up a river, it is important to find out the connected edges and store the information in the ``waterways.ways`` table. This will help us to identify which edges belong to a river. First, the connected components are found and then stored in a new column named ``component``." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:241 +#: ../../build/docs/un_sdg/sdg11-cities.rst:236 msgid "The pgRouting function ``pgr_connectedComponents`` is used to complete this task and its explaind with more detail in :doc:`../basic/graphs`." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:244 -msgid "A sub-query is created to find out all the connected components. After that, the ``component`` column is updated using the results obtained from the sub-query. This helps in storing the component id in the ``waterways_ways_vertices_pgr`` table. Next query uses this output and stores the component id in the waterways_ways (edges) table. Follow the steps given below to complete this task." +#: ../../build/docs/un_sdg/sdg11-cities.rst:239 +msgid "A sub-query is created to find out all the connected components. After that, the ``component`` column is updated using the results obtained from the sub-query. This helps in storing the component id in the ``waterways.waterway_vertices`` table. Next query uses this output and stores the component id in the waterways.ways (edges) table. Follow the steps given below to complete this task." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:251 +#: ../../build/docs/un_sdg/sdg11-cities.rst:246 msgid "Create a vertices table." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:262 +#: ../../build/docs/un_sdg/sdg11-cities.rst:257 msgid "Fill up the ``x``, ``y`` and ``geom`` columns." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:273 +#: ../../build/docs/un_sdg/sdg11-cities.rst:268 msgid "Add a ``component`` column on the edges and vertices tables." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:284 +#: ../../build/docs/un_sdg/sdg11-cities.rst:279 msgid "Fill up the ``component`` column on the vertices table." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:295 +#: ../../build/docs/un_sdg/sdg11-cities.rst:290 msgid "Fill up the ``component`` column on the edges table." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:302 +#: ../../build/docs/un_sdg/sdg11-cities.rst:297 msgid "Exercise 7: Creating a function that gets the city buffer" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:304 +#: ../../build/docs/un_sdg/sdg11-cities.rst:299 msgid "A function can be created for the same task. This will be help when the table has more than one city." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:319 +#: ../../build/docs/un_sdg/sdg11-cities.rst:314 msgid "Exercise 8: Finding the components intersecting the buffer" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:321 +#: ../../build/docs/un_sdg/sdg11-cities.rst:316 msgid "Next step is to find the components of waterways which lie in the buffer zone of the city. These are the waterways which will affect the city when it rains around them. This is done using ``ST_Intersects``. Note that ``get_city_buffer`` function is used in the query below." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:336 +#: ../../build/docs/un_sdg/sdg11-cities.rst:331 msgid "Output shows the distinct component numbers which lie in the buffer zone of the city. That is, the rivers that lie within the city." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:341 +#: ../../build/docs/un_sdg/sdg11-cities.rst:336 msgid "Exercise 9: Get the rain zones" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:343 +#: ../../build/docs/un_sdg/sdg11-cities.rst:338 msgid "In this excercise the area , where if it rains, the city would be affected, is calculated. This area is called ``rain zone`` in the excercise" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:346 +#: ../../build/docs/un_sdg/sdg11-cities.rst:341 msgid "Create a Buffer around the river components." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:348 -msgid "Add columns named ``rain_zone`` in waterways_ways" +#: ../../build/docs/un_sdg/sdg11-cities.rst:343 +msgid "Add columns named ``rain_zone`` in waterways.ways" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:350 +#: ../../build/docs/un_sdg/sdg11-cities.rst:345 msgid "To store buffer geometry of the rain zones." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:352 +#: ../../build/docs/un_sdg/sdg11-cities.rst:347 msgid "Find the buffer for every edge that intersects the city buffer area using ``ST_Buffer``" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:353 +#: ../../build/docs/un_sdg/sdg11-cities.rst:348 msgid "and update the ``rain_zone`` column." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:356 +#: ../../build/docs/un_sdg/sdg11-cities.rst:351 msgid "Adding column to store Buffer geometry" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:367 +#: ../../build/docs/un_sdg/sdg11-cities.rst:362 msgid "Storing Buffer geometry" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:377 +#: ../../build/docs/un_sdg/sdg11-cities.rst:372 msgid "This will give us the requires area, where if it rains, the city will be affected." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:380 +#: ../../build/docs/un_sdg/sdg11-cities.rst:375 msgid "Exercise 10: Create a union of rain zones" msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:381 +#: ../../build/docs/un_sdg/sdg11-cities.rst:376 msgid "Multiple polygons that are obtained can also be merged using ``ST_Union``. This will give a single polygon as the output." msgstr "" -#: ../../build/docs/un_sdg/sdg11-cities.rst:388 +#: ../../build/docs/un_sdg/sdg11-cities.rst:383 msgid "When it rains in the vicinity, the city will get affected by the rain." msgstr "" diff --git a/locale/pot/un_sdg/sdg3-health.pot b/locale/pot/un_sdg/sdg3-health.pot index 0ece757aa..bc44d7aab 100644 --- a/locale/pot/un_sdg/sdg3-health.pot +++ b/locale/pot/un_sdg/sdg3-health.pot @@ -1,14 +1,14 @@ # SOME DESCRIPTIVE TITLE. # Copyright (C) 2010-2025 pgRouting Developers -# This file is distributed under the same license as the Workshop FOSS4G Auckland package. +# This file is distributed under the same license as the Workshop FOSS4G Hiroshima package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Workshop FOSS4G Auckland 3.1\n" +"Project-Id-Version: Workshop FOSS4G Hiroshima 3.2\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-06-14 15:17+0000\n" +"POT-Creation-Date: 2026-07-01 17:09+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -16,601 +16,639 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: ../../build/docs/un_sdg/sdg3-health.rst:11 +#: ../../build/docs/un_sdg/sdg3-health.rst:6 msgid "Good Health and Well Being" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:13 -msgid "`Good Health and Well Being` is the 3rd Sustainable Development Goal which aspires to ensure health and well-being for all, including a bold commitment to end the epidemics like AIDS, tuberculosis, malaria and other communicable diseases by 2030. It also aims to achieve universal health coverage, and provide access to safe and effective medicines and vaccines for all. Supporting research and development for vaccines is an essential part of this process as well as expanding access to affordable medicines. Hospitals are a very important part of a well functioning health infrastructure. An appropriate planning is required for optimal distribution of the population of an area to its hospitals. Hence, it is very important to estimate the number of dependant people living near the hospital for better planning which would ultimately help in achieving universal coverage of health services. This chapter will focus on solving one of such problems." -msgstr "" - -#: ../../build/docs/un_sdg/sdg3-health.rst:26 +#: ../../build/docs/un_sdg/sdg3-health.rst:8 msgid "Sustainable Development Goal 3: Good Health and Well Being" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:30 +#: ../../build/docs/un_sdg/sdg3-health.rst:12 msgid "`Image Source `__" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:32 +#: ../../build/docs/un_sdg/sdg3-health.rst:14 +msgid "`Good Health and Well Being` is the 3rd Sustainable Development Goal which aspires to ensure health and well-being for all, including a bold commitment to end the epidemics like AIDS, tuberculosis, malaria and other communicable diseases by 2030. It also aims to achieve universal health coverage, and provide access to safe and effective medicines and vaccines for all. Supporting research and development for vaccines is an essential part of this process as well as expanding access to affordable medicines. Hospitals are a very important part of a well functioning health infrastructure. An appropriate planning is required for optimal distribution of the population of an area to its hospitals. Hence, it is very important to estimate the number of dependant people living near the hospital for better planning which would ultimately help in achieving universal coverage of health services. This chapter will focus on solving one of such problems." +msgstr "" + +#: ../../build/docs/un_sdg/sdg3-health.rst:27 msgid "Chapter Contents" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:35 +#: ../../build/docs/un_sdg/sdg3-health.rst:30 msgid "Problem: Estimation of Population Served by Hospitals" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:37 +#: ../../build/docs/un_sdg/sdg3-health.rst:32 msgid "**Problem Statement**" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:39 -msgid "To determine the population served by a hospital based on travel time" +#: ../../build/docs/un_sdg/sdg3-health.rst:34 +msgid "Determine the population served by a hospital based on walking travel time." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:41 +#: ../../build/docs/un_sdg/sdg3-health.rst:36 msgid "**Core Idea**" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:43 +#: ../../build/docs/un_sdg/sdg3-health.rst:38 msgid "Population residing along the roads which reach to a hospital within a particular time is dependant on that hospital." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:46 +#: ../../build/docs/un_sdg/sdg3-health.rst:41 msgid "**Approach**" msgstr "" +#: ../../build/docs/un_sdg/sdg3-health.rst:43 +msgid "Get the data of" +msgstr "" + +#: ../../build/docs/un_sdg/sdg3-health.rst:45 +msgid "Roads" +msgstr "" + +#: ../../build/docs/un_sdg/sdg3-health.rst:46 +msgid "Buildings" +msgstr "" + #: ../../build/docs/un_sdg/sdg3-health.rst:48 -msgid "To prepare a dataset with:" +msgid "Small analysis of the database." +msgstr "" + +#: ../../build/docs/un_sdg/sdg3-health.rst:49 +msgid "Simulate census data." msgstr "" #: ../../build/docs/un_sdg/sdg3-health.rst:50 -msgid "Edges: Roads" +msgid "Remove disconnected roads from the graph." msgstr "" #: ../../build/docs/un_sdg/sdg3-health.rst:51 -msgid "Polygons: Buildings with population" +msgid "Estimate the population living on the buildings." msgstr "" #: ../../build/docs/un_sdg/sdg3-health.rst:53 -msgid "Find the travel-time based the roads served" -msgstr "" - -#: ../../build/docs/un_sdg/sdg3-health.rst:54 -msgid "Estimate the population of the buildings" +msgid "Find the nearest road to the buildings." msgstr "" #: ../../build/docs/un_sdg/sdg3-health.rst:55 -msgid "Find the nearest road to the buildings" +msgid "Estimate the population living on the roads." msgstr "" #: ../../build/docs/un_sdg/sdg3-health.rst:56 -msgid "Store the sum of population of nearest buildings in roads table" +msgid "Calculate the walking travel time from a road to a hospital." msgstr "" #: ../../build/docs/un_sdg/sdg3-health.rst:57 -msgid "Find the sum of population on all the roads in the roads served" +msgid "Calculate the population within 10 mintues waking to a location." +msgstr "" + +#: ../../build/docs/un_sdg/sdg3-health.rst:59 +msgid "First step is to prepare the data obtained from :doc:`data`." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:60 +#: ../../build/docs/un_sdg/sdg3-health.rst:61 +msgid "Follow the instructions in :doc:`data` to create and populate the ``mumbai`` database." +msgstr "" + +#: ../../build/docs/un_sdg/sdg3-health.rst:64 +msgid "Following image shows the roads and buildings." +msgstr "" + +#: ../../build/docs/un_sdg/sdg3-health.rst:71 msgid "PostreSQL basics" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:63 +#: ../../build/docs/un_sdg/sdg3-health.rst:73 msgid "Preparing work area" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:65 +#: ../../build/docs/un_sdg/sdg3-health.rst:75 msgid "The ``search_path`` is a variable that determines the order in which database schemas are searched for objects." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:68 +#: ../../build/docs/un_sdg/sdg3-health.rst:78 msgid "By setting the ``search_path`` to appropriate values, prepending the schema name to tables can be avoided." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:72 +#: ../../build/docs/un_sdg/sdg3-health.rst:82 msgid "Exercise 1: Inspecting schemas" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:74 +#: ../../build/docs/un_sdg/sdg3-health.rst:84 msgid "Inspect the schemas by displaying all the present schemas using the following command" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:85 +#: ../../build/docs/un_sdg/sdg3-health.rst:95 msgid "The schema names are ``buildings``, ``roads`` and ``public``. The owner depends on who has the rights to the database." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:89 +#: ../../build/docs/un_sdg/sdg3-health.rst:99 msgid "Exercise 2: Inspecting the search path" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:91 +#: ../../build/docs/un_sdg/sdg3-health.rst:101 msgid "Display the current search path using the following query." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:102 +#: ../../build/docs/un_sdg/sdg3-health.rst:112 msgid "This is the current search path. Tables in other schemas cannot be accessed with this path." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:106 -msgid "Exercise 3: Fixing the search path" +#: ../../build/docs/un_sdg/sdg3-health.rst:116 +msgid "Exercise 3: Adjusting the search path" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:108 +#: ../../build/docs/un_sdg/sdg3-health.rst:118 msgid "In this case, the search path needs to include ``roads`` and ``buildings`` schemas. The following query is used to adjust the search path." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:119 +#: ../../build/docs/un_sdg/sdg3-health.rst:130 msgid "Checking the search path again" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:131 +#: ../../build/docs/un_sdg/sdg3-health.rst:143 msgid "Exercise 4: Enumerating tables" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:133 +#: ../../build/docs/un_sdg/sdg3-health.rst:145 msgid "With ``\\dt`` the tables are listed showing the schema and the owner" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:144 -msgid "Preparing roads and buildings data" +#: ../../build/docs/un_sdg/sdg3-health.rst:156 +msgid "Simulation of census data" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:146 -msgid "First step is to prepare the data obtained from :doc:`data`." +#: ../../build/docs/un_sdg/sdg3-health.rst:158 +msgid "Due to the lack of census data, this exercise will estimate the population, based on the area size of the building and the kind of use the building gets." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:148 -msgid "This section will work the graph and data that is going to be used for processing. While building the graph, the data has to be inspected to determine if there is any invalid data. This is a very important step to make sure that the data is of required quality. pgRouting can also be used to do some Data Adjustments." +#: ../../build/docs/un_sdg/sdg3-health.rst:161 +msgid "Buildings of OpenStreetMap data are classified into various categories." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:156 -msgid "Exercise 5: Counting the number of roads and buildings" +#: ../../build/docs/un_sdg/sdg3-health.rst:173 +msgid "For this exercise, the population will be set as follows:" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:158 -msgid "The importance of counting the information on this workshop is to make sure that the same data is used and consequently the results are same. Also, some of the rows can be seen to understand the structure of the table and how the data is stored in it." +#: ../../build/docs/un_sdg/sdg3-health.rst:175 +msgid "Negligible:" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:181 -msgid "Following image shows the roads and buildings visualised." +#: ../../build/docs/un_sdg/sdg3-health.rst:177 +#: ../../build/docs/un_sdg/sdg3-health.rst:185 +msgid "People do not live in these places." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:188 -msgid "Preprocessing Buildings" +#: ../../build/docs/un_sdg/sdg3-health.rst:178 +msgid "Population: 1 person." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:190 -msgid "The table ``buildings_ways`` contains the buildings in ``LINGSTING`` type. They have to be converted into polygons to get the area, as the area is going to be used to get an estimate of the population living in the building." +#: ../../build/docs/un_sdg/sdg3-health.rst:180 +msgid "There may be people guarding the place." msgstr "" +#: ../../build/docs/un_sdg/sdg3-health.rst:182 +msgid "Very Sparse:" +msgstr "" + +#: ../../build/docs/un_sdg/sdg3-health.rst:184 +msgid "``retail``, ``commercial``, ``school``" +msgstr "" + +#: ../../build/docs/un_sdg/sdg3-health.rst:186 +msgid "Population: At least 2 persons." +msgstr "" + +#: ../../build/docs/un_sdg/sdg3-health.rst:188 #: ../../build/docs/un_sdg/sdg3-health.rst:195 -msgid "Exercise 6: Removing columns" +msgid "Because there may be people guarding the place." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:197 -msgid "Columns can be deleted from a table. In this case instead of creating a view, columns that are not related to a **buidling** concept are dropped from ``buildings_ways``." +#: ../../build/docs/un_sdg/sdg3-health.rst:190 +msgid "Sparse:" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:212 -msgid "Exercise 7: Add a spatial column to the table" +#: ../../build/docs/un_sdg/sdg3-health.rst:192 +msgid "Buildings with low population density, like ``university``." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:214 -msgid "Add a spatial column named ``poly_geom`` to the table ``buildings_ways`` to store the Polygon Geometry" +#: ../../build/docs/un_sdg/sdg3-health.rst:193 +msgid "Population: At least 3 persons." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:226 -msgid "Inspecting the table:" +#: ../../build/docs/un_sdg/sdg3-health.rst:196 +msgid "Students might live there." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:237 -msgid "Exercise 8: Removing the polygons with less than 4 points" +#: ../../build/docs/un_sdg/sdg3-health.rst:198 +msgid "Moderate:" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:239 -msgid "``ST_NumPoints`` is used to find the number of points on a geometry. Also, polygons with less than 3 points/vertices are not considered valid polygons in PostgreSQL. Hence, the buildings having less than 3 vertices need to be cleaned up. Follow the steps given below to complete this task." +#: ../../build/docs/un_sdg/sdg3-health.rst:200 +msgid "Location where people might be living temporarly, like ``hotel`` and ``hospital``." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:254 -msgid "Exercise 9: Creating the polygons" +#: ../../build/docs/un_sdg/sdg3-health.rst:202 +msgid "Population: At least 5 persons." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:256 -msgid "``ST_MakePolygons`` is used to make the polygons. This step stores the geometry of polygons in the ``poly_geom`` column which was created earlier." +#: ../../build/docs/un_sdg/sdg3-health.rst:204 +msgid "Dense:" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:270 -msgid "Exercise 10: Calculating the area" +#: ../../build/docs/un_sdg/sdg3-health.rst:206 +msgid "A medium sized residential building." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:272 -msgid "After getting the polygon geometry, next step is to find the area of the polygons. Follow the steps given below to complete this task." +#: ../../build/docs/un_sdg/sdg3-health.rst:207 +msgid "Population: At least 7 persons." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:275 -msgid "Adding a column for storing the area" +#: ../../build/docs/un_sdg/sdg3-health.rst:209 +msgid "Very Dense:" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:282 -msgid "Storing the area in the new column" +#: ../../build/docs/un_sdg/sdg3-health.rst:211 +#: ../../build/docs/un_sdg/sdg3-health.rst:225 +msgid "A large sized residential building, like ``apartments``." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:284 -msgid "``ST_Area`` is used to calculate area of polygons. Area is stored in the new column" +#: ../../build/docs/un_sdg/sdg3-health.rst:212 +#: ../../build/docs/un_sdg/sdg3-health.rst:226 +msgid "Population: At least 10 persons." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:297 -msgid "Exercise 11: Estimating the population" +#: ../../build/docs/un_sdg/sdg3-health.rst:215 +msgid "Exercise 5: Estimating the population" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:299 -msgid "Due to the lack of census data, this exercise will fill up and estimate of the population living on the buildings, based on the area of the building and the kind of use the building gets." +#: ../../build/docs/un_sdg/sdg3-health.rst:216 +msgid "Each density class has a **class-specific factor** that represents how many people per square meter are expected (e.g., 0.0002 for Very Sparse, 1.0 for Very Dense). This factor is multiplied by a building's area to estimate its population, with a minimum floor per class." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:303 -msgid "Buildings of OpenStreetMap data are classified into various categories." +#: ../../build/docs/un_sdg/sdg3-health.rst:221 +msgid "For example:" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:315 -msgid "For this exercise, the population will be set as follows:" +#: ../../build/docs/un_sdg/sdg3-health.rst:223 +msgid "Very Dense" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:317 -msgid "Negligible:" +#: ../../build/docs/un_sdg/sdg3-health.rst:228 +msgid "Each class has a specific numeric factor (visible in the SQL function below) that scales the building area to estimate the number of residents." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:319 -#: ../../build/docs/un_sdg/sdg3-health.rst:327 -msgid "People do not live in these places." +#: ../../build/docs/un_sdg/sdg3-health.rst:231 +msgid "This class specific factor is multiplied with the area of each building to get the population. Follow the steps given below to complete this task." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:320 -msgid "Population: 1 person" +#: ../../build/docs/un_sdg/sdg3-health.rst:235 +msgid "Create a function to find population using class-specific factor and area." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:322 -msgid "There may be people guarding the place." +#: ../../build/docs/un_sdg/sdg3-health.rst:242 +msgid "Testing the function with 100 square meters buildings." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:324 -msgid "Very Sparse:" +#: ../../build/docs/un_sdg/sdg3-health.rst:253 +msgid "Testing the function with 300 square meters buildings." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:326 -msgid "``retail``, ``commercial``, ``school``" +#: ../../build/docs/un_sdg/sdg3-health.rst:263 +msgid "More complicated estimation functions can be done that consider height of the apartments." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:328 -msgid "Population: At least 2 persons." +#: ../../build/docs/un_sdg/sdg3-health.rst:266 +msgid "Using census data can achieve more accurate estimation." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:330 -#: ../../build/docs/un_sdg/sdg3-health.rst:337 -msgid "Because there may be people guarding the place." +#: ../../build/docs/un_sdg/sdg3-health.rst:269 +msgid "Preparing roads information" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:332 -msgid "Sparse:" +#: ../../build/docs/un_sdg/sdg3-health.rst:271 +msgid "pgRouting algorithms are only useful when the road network belongs to a single graph (or all the roads are connected to each other). Hence, the disconnected roads have to be removed from their network to get appropriate results. This image gives an example of the disconnected edges." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:334 -msgid "Buildings with low population density, like ``university``." +#: ../../build/docs/un_sdg/sdg3-health.rst:280 +msgid "For example, in the above figure roads with label ``119`` are disconnected from the network. Hence they will have same connected component number. But the count of this number will be less count of fully connected network. All the edges with the component number with count less than maximum count will be removed" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:335 -msgid "Population: At least 3 persons." +#: ../../build/docs/un_sdg/sdg3-health.rst:285 +msgid "Disconnected road segments are unreachable from the main network. If they are kept, routing queries like ``pgr_drivingDistance`` or ``pgr_dijkstra`` will either fail to find paths on those segments or produce misleading results (e.g., infinite cost, no path found)." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:338 -msgid "Students might live there." +#: ../../build/docs/un_sdg/sdg3-health.rst:290 +msgid "Removing them ensures that every building in the network is reachable and that population-serving analysis works correctly." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:340 -msgid "Moderate:" +#: ../../build/docs/un_sdg/sdg3-health.rst:293 +msgid "Once each road segment has a component identifier, you can isolate the main network by keeping only the component with the highest edge count. A new table (or view) can be created that contains just those edges, discarding all unreachable segments in one step." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:342 -msgid "Location where people might be living temporarly, like ``hotel`` and ``hospital``." +#: ../../build/docs/un_sdg/sdg3-health.rst:299 +msgid "Exercise 6: Calculate the components of the roads" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:344 -msgid "Population: At least 5 persons." +#: ../../build/docs/un_sdg/sdg3-health.rst:301 +msgid "To remove the disconnected components on the road network, the following pgRouting functions, discussed on :doc:`../basic/graphs` chapter, will be used:" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:346 -msgid "Dense:" +#: ../../build/docs/un_sdg/sdg3-health.rst:304 +msgid "``pgr_extractVertices``" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:348 -msgid "A medium sized residential building." +#: ../../build/docs/un_sdg/sdg3-health.rst:305 +msgid "``pgr_connectedComponents``" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:349 -msgid "Population: At least 7 persons." +#: ../../build/docs/un_sdg/sdg3-health.rst:308 +msgid "Add a components column." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:351 -msgid "Very Dense:" +#: ../../build/docs/un_sdg/sdg3-health.rst:315 +msgid "Create a vertices table." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:353 -msgid "A large sized residential building, like ``apartments``." +#: ../../build/docs/un_sdg/sdg3-health.rst:323 +msgid "Fill up the ``x``, ``y`` and ``geom`` columns." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:354 -msgid "Population: At least 10 persons." +#: ../../build/docs/un_sdg/sdg3-health.rst:331 +msgid "Fill up the ``component`` column on the vertices table." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:357 -msgid "Reference: :ref:`un_sdg/data:Appendix`" +#: ../../build/docs/un_sdg/sdg3-health.rst:339 +msgid "Fill up the ``component`` column on the edges table." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:359 -msgid "This class-specific factor is multiplied with the area of each building to get the population. Follow the steps given below to complete this task." +#: ../../build/docs/un_sdg/sdg3-health.rst:347 +msgid "Exercise 7: Create a roads_net table." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:362 -msgid "Create a function to find population using class-specific factor and area." +#: ../../build/docs/un_sdg/sdg3-health.rst:349 +msgid "The ``roads_net`` table stores road edges with travel costs in **minutes**, assuming a walking speed of **1 m/s**." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:374 -msgid "All these are estimations based on this particular area. More complicated functions can be done that consider height of the apartments but the design of a function is going to depend on the availability of the data. For example, using census data can achieve more accurate estimation." +#: ../../build/docs/un_sdg/sdg3-health.rst:352 +msgid "Since :math:`time = distance / speed`:" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:379 -msgid "Add a column for storing the population in the ``buildings_ways``" +#: ../../build/docs/un_sdg/sdg3-health.rst:354 +msgid ":math:`time = length\\_m / 1\\ m/s`" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:390 -msgid "3. Use the ``population`` function to store the population in the new column created in the ``building_ways``." +#: ../../build/docs/un_sdg/sdg3-health.rst:356 +msgid "This gives time in **seconds**. To convert to **minutes**, divide by 60:" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:403 -msgid "Preprocessing Roads" +#: ../../build/docs/un_sdg/sdg3-health.rst:358 +msgid ":math:`time = length\\_m / 60`" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:404 -msgid "pgRouting algorithms are only useful when the road network belongs to a single graph (or all the roads are connected to each other). Hence, the disconnected roads have to be removed from their network to get appropriate results. This image gives an example of the disconnected edges." +#: ../../build/docs/un_sdg/sdg3-health.rst:361 +msgid "Create roads_net with only the largest component" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:413 -msgid "For example, in the above figure roads with label ``119`` are disconnected from the network. Hence they will have same connected component number. But the count of this number will be less count of fully connected network. All the edges with the component number with count less than maximum count will be removed" +#: ../../build/docs/un_sdg/sdg3-health.rst:362 +msgid "This query creates the ``roads_net`` table by keeping only edges belonging to the most connected component." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:418 -#: ../../build/docs/un_sdg/sdg3-health.rst:733 -msgid "Follow the steps given below to complete this task." +#: ../../build/docs/un_sdg/sdg3-health.rst:365 +msgid "It calculates travel cost as ``length_m / 60`` (seconds converted to minutes at 1 m/s) and" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:421 -msgid "Exercise 12: Remove disconnected components" +#: ../../build/docs/un_sdg/sdg3-health.rst:367 +msgid "initializes the population column as ``NULL`` for later population of the roads." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:423 -msgid "To remove the disconnected components on the road network, the following pgRouting functions, discussed on :doc:`../basic/graphs`, will be used:" +#: ../../build/docs/un_sdg/sdg3-health.rst:376 +msgid "Delete vertices not belonging to the most connected component." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:426 -msgid "``pgr_extractVertices``" +#: ../../build/docs/un_sdg/sdg3-health.rst:377 +msgid "Once ``roads_net`` is filtered to only the largest connected component, the ``vertices`` table still contains vertices from the discarded components." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:427 -msgid "``pgr_connectedComponents``" +#: ../../build/docs/un_sdg/sdg3-health.rst:380 +msgid "These orphan vertices have no edges in ``roads_net``, so they are useless for routing and would pollute nearest-vertex lookups. Deleting them keeps the vertex table consistent with the trimmed network." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:430 -msgid "Create a vertices table." +#: ../../build/docs/un_sdg/sdg3-health.rst:392 +msgid "Preparing buildings population information" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:441 -msgid "Fill up the ``x``, ``y`` and ``geom`` columns." +#: ../../build/docs/un_sdg/sdg3-health.rst:394 +msgid "This section links buildings to the road network and estimates their population." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:452 -msgid "Add a ``component`` column on the edges and vertices tables." +#: ../../build/docs/un_sdg/sdg3-health.rst:396 +msgid "First, functions are created to find the nearest road and vertex for each building." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:463 -msgid "Fill up the ``component`` column on the vertices table." +#: ../../build/docs/un_sdg/sdg3-health.rst:398 +msgid "Then building geometries are converted from ``LINESTRING`` to polygons to calculate area, which feeds the ``population`` function." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:474 -msgid "Fill up the ``component`` column on the edges table." +#: ../../build/docs/un_sdg/sdg3-health.rst:400 +msgid "Finally, the estimated population is aggregated onto the road segments." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:485 -msgid "Get the component number with the most number of edges." +#: ../../build/docs/un_sdg/sdg3-health.rst:403 +msgid "Exercise 8: Get the nearest road to a building" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:496 -msgid "Delete edges not belonging to the most connected component." +#: ../../build/docs/un_sdg/sdg3-health.rst:406 +msgid "Create the building_road function" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:507 -msgid "Delete vertices not belonging to the most connected component." +#: ../../build/docs/un_sdg/sdg3-health.rst:407 +msgid "This function finds the closest road edge to a building using PostGIS' spatial distance operator (``<->``). It returns the ``id`` of the nearest edge from ``roads_net``, which is later used to link each building to the road network." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:518 -msgid "Find the roads served by the hospitals" +#: ../../build/docs/un_sdg/sdg3-health.rst:419 +#: ../../build/docs/un_sdg/sdg3-health.rst:458 +msgid "Test the function" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:519 -msgid "After pre-processing the data, next step is to find the area served by the hospital. This area can be computed from the entrance of the hospital or from any point on road near the hospital. In this exercise it is computed from closest road vertex. ``pgr_drivingDistance`` will be used to find the roads served. The steps to be followed are:" +#: ../../build/docs/un_sdg/sdg3-health.rst:431 +msgid "Exercise 9: Find the closest road vertex" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:525 -msgid "Finding the closest road vertex" +#: ../../build/docs/un_sdg/sdg3-health.rst:433 +msgid "There are multiple road vertices near the hospital. Create a function to find the geographically closest road vertex. ``get_vertex`` function takes a geometry as input and returns the id of the closest vertex by comparing ``geom`` of both tables." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:526 -msgid "Finding the roads served" +#: ../../build/docs/un_sdg/sdg3-health.rst:443 +msgid "Create the get_vertex function" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:527 -msgid "Generalising the roads served" +#: ../../build/docs/un_sdg/sdg3-health.rst:444 +msgid "This function finds the closest road vertex to a building" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:530 -msgid "pgr_drivingDistance" +#: ../../build/docs/un_sdg/sdg3-health.rst:446 +msgid "Using PostGIS' spatial distance operator (``<->``)." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:531 -msgid "For the next step ``pgr_drivingDistance`` will be used. This returns the driving distance from a start node. It uses the Dijkstra algorithm to extract all the nodes that have costs less than or equal to the value distance. The edges that are extracted conform to the corresponding spanning tree." +#: ../../build/docs/un_sdg/sdg3-health.rst:447 +msgid "Returns the ``id`` of the nearest vertex from the ``vertices`` table," msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:537 -msgid "Signatures" +#: ../../build/docs/un_sdg/sdg3-health.rst:449 +msgid "Used as the start point for ``pgr_drivingDistance`` queries." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:544 -msgid "`pgr_drivingDistance Documentation `__ can be found at this link for more information." +#: ../../build/docs/un_sdg/sdg3-health.rst:470 +msgid "Exercise 10: Create the buildings table" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:548 -msgid "Exercise 13: Find the closest road vertex" +#: ../../build/docs/un_sdg/sdg3-health.rst:472 +msgid "A ``buildings`` table is created for efficient access throughout the remaining exercises." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:549 -msgid "There are multiple road vertices near the hospital. Create a function to find the geographically closest road vertex. ``closest_vertex`` function takes geometry of other table as input and gives the gid of the closest vertex as output by comparing ``geom`` of both the tables." +#: ../../build/docs/un_sdg/sdg3-health.rst:476 +msgid "The query" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:558 -msgid "The following query creates a function to find the closest road vertex." +#: ../../build/docs/un_sdg/sdg3-health.rst:477 +msgid "converts ``LINESTRING`` geometries to ``Polygon``," msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:570 -msgid "Testing the function" +#: ../../build/docs/un_sdg/sdg3-health.rst:478 +msgid "calculates the area using ``ST_Area``," msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:583 -msgid "Exercise 14: Finding the served roads using pgr_drivingDistance" +#: ../../build/docs/un_sdg/sdg3-health.rst:479 +msgid "and estimates population using the ``population`` function." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:586 -msgid "Problem" +#: ../../build/docs/un_sdg/sdg3-health.rst:482 +msgid "The result" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:587 -msgid "Find the roads within 10 minutes walking distance from the hospitals. Use ``1 m/s`` as walking speed." +#: ../../build/docs/un_sdg/sdg3-health.rst:483 +msgid "Is stored in the ``buildings`` table." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:591 -msgid "Solution" +#: ../../build/docs/un_sdg/sdg3-health.rst:492 +msgid "Exercise 11: Storing the population in the roads" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:592 -msgid "In this exercise, the roads served are calculated based on a walking time of ``1 m/s``, by using ``pgrdrivingDistance`` function from pgRouting extension." +#: ../../build/docs/un_sdg/sdg3-health.rst:494 +msgid "After finding the nearest road, the sum of population of all the nearest buildings is stored in the population column of the roads table. Following image shows the visualised output where the blue colour labels shows the population stored in roads." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:595 -msgid "Time in minutes is considered as ``cost``." +#: ../../build/docs/un_sdg/sdg3-health.rst:504 +msgid "Update the population of the roads." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:596 -msgid "the graph is undirected." +#: ../../build/docs/un_sdg/sdg3-health.rst:512 +msgid "Find the roads served by the hospitals" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:598 -msgid "Preparing a query" +#: ../../build/docs/un_sdg/sdg3-health.rst:514 +msgid "After pre-processing the data, next step is to find the area served by the hospital. This area can be computed from the entrance of the hospital or from any point on road near the hospital. In this exercise it is computed from closest road vertex. ``pgr_drivingDistance`` will be used to find the roads served. The steps to be followed are:" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:610 -msgid "For the following query," +#: ../../build/docs/un_sdg/sdg3-health.rst:520 +msgid "Finding the closest road vertex" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:612 -msgid "The prepared statement is used." +#: ../../build/docs/un_sdg/sdg3-health.rst:521 +msgid "Finding the roads served" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:613 -msgid "Pedestrian speed is set to be ``1 m/s``." +#: ../../build/docs/un_sdg/sdg3-health.rst:522 +msgid "Generalising the roads served" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:615 -msgid "As ``time`` = ``distance/speed``, ``length_m`` / ``1 m/s`` / ``60`` gives the time in minutes." +#: ../../build/docs/un_sdg/sdg3-health.rst:525 +msgid "pgr_drivingDistance" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:618 -msgid "``tag_id = '318'`` as 318 is the value for hospital in the configuration table of the buildings." +#: ../../build/docs/un_sdg/sdg3-health.rst:526 +msgid "For the next step ``pgr_drivingDistance`` will be used. This returns the driving distance from a start node. It uses the Dijkstra algorithm to extract all the nodes that have costs less than or equal to the value distance. The edges that are extracted conform to the corresponding spanning tree." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:621 -msgid "``10`` for 10 minutes, which is a threshold for ``agg_cost``" +#: ../../build/docs/un_sdg/sdg3-health.rst:532 +msgid "Signatures" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:632 -msgid "Following figure shows the visualised output of the above query. The lines highlighted by red colour show the area from where the hospital can be reached within 10 minutes of walking at the speed of ``1 m/s``." +#: ../../build/docs/un_sdg/sdg3-health.rst:539 +msgid "`pgr_drivingDistance Documentation `__ can be found at this link for more information." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:636 -msgid "It is noticable from the output figure that some of the roads which are near to the hospital are not highlighted. For example, to roads in the north of the hospital. This is because the only one edge per road vertex was selected by the query." +#: ../../build/docs/un_sdg/sdg3-health.rst:543 +msgid "Exercise 12: Finding the served roads using pgr_drivingDistance" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:646 -msgid "Exercise 15: Generalising the served roads" +#: ../../build/docs/un_sdg/sdg3-health.rst:546 +msgid "Problem" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:648 -msgid "The edges which are near to to hospital should also be selected in the roads served as the hospital also serves those buildings. The following query takes the query from previous section as a ``subquery`` and selects all the edges from ``roads_ways`` that have the same ``source`` and ``target`` to that of ``subquery`` (Line 14)." +#: ../../build/docs/un_sdg/sdg3-health.rst:547 +msgid "Find the roads within 10 minutes walking distance from the hospitals." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:663 -msgid "Following figure shows the visualised output of the above query. Lines highlighted in ``yellow`` show the `generalised the roads served`. This gives a better estimate of the areas from where the hospital can be reached by a particular speed." +#: ../../build/docs/un_sdg/sdg3-health.rst:550 +msgid "Solution" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:672 -msgid "Calculating the total population served by the hospital" +#: ../../build/docs/un_sdg/sdg3-health.rst:551 +msgid "Using ``pgrdrivingDistance`` function from pgRouting extension." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:674 -msgid "Now the next step is to estimate the dependant population. Official source of population is Census conducted by the government. But for this exercise, population will be estimated from the ``area`` as well as the ``category`` of the building. This area will be stored in the nearest roads. Following steps explain this process in detail." +#: ../../build/docs/un_sdg/sdg3-health.rst:553 +msgid "Time in minutes is considered as ``cost``." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:682 -msgid "Exercise 16: Finding the nearest roads of the buildings" +#: ../../build/docs/un_sdg/sdg3-health.rst:554 +msgid "the graph is undirected." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:684 -msgid "To store the population of buildings in the roads, nearest road to a building is to be found. Follow the steps given below to complete this task." +#: ../../build/docs/un_sdg/sdg3-health.rst:555 +msgid "``tag_id = '318'`` as 318 is the value for hospital in the configuration table of the buildings." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:687 -msgid "Create Function for finding the closest edge." +#: ../../build/docs/un_sdg/sdg3-health.rst:557 +msgid "``10`` for 10 minutes, which is a threshold for ``agg_cost``" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:698 -msgid "Add a column in ``buildings_ways`` for storing the id of closest edge" +#: ../../build/docs/un_sdg/sdg3-health.rst:569 +msgid "Following figure shows the visualised output of the above query. The lines highlighted by red colour show the area from where the hospital can be reached within 10 minutes of walking at the speed of ``1 m/s``." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:710 -msgid "Store the edge id of the closest edge in the new column of ``buildings_ways``" +#: ../../build/docs/un_sdg/sdg3-health.rst:573 +msgid "It is noticable from the output figure that some of the roads which are near to the hospital are not highlighted. For example, to roads in the north of the hospital. This is because the only one edge per road vertex was selected by the query." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:723 -msgid "Exercise 17: Storing the population in the roads" +#: ../../build/docs/un_sdg/sdg3-health.rst:583 +msgid "Exercise 13: Adding adjacent roads" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:724 -msgid "After finding the nearest road, the sum of population of all the nearest buildings is stored in the population column of the roads table. Following image shows the visualised output where the blue colour labels shows the population stored in roads." +#: ../../build/docs/un_sdg/sdg3-health.rst:585 +msgid "The edges which are near to to hospital should also be selected in the roads served as the hospital also serves those buildings. The following query takes the query from previous section as a ``subquery`` and selects all the edges from ``roads_ways`` that have the same ``source`` and ``target`` to that of ``subquery`` (Line 14)." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:735 -msgid "Add a column in ``roads_ways`` for storing population" +#: ../../build/docs/un_sdg/sdg3-health.rst:601 +msgid "Following figure shows the visualised output of the above query. Lines highlighted in ``yellow`` show the `generalised the roads served`. This gives a better estimate of the areas from where the hospital can be reached by a particular speed." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:746 -msgid "Update the roads with the sum of population of buildings closest to it" +#: ../../build/docs/un_sdg/sdg3-health.rst:610 +msgid "Calculating the total population served by the hospital" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:758 -msgid "Verify is the population is stored using the following query." +#: ../../build/docs/un_sdg/sdg3-health.rst:612 +msgid "Now the next step is to estimate the dependant population. Official source of population is Census conducted by the government. But for this exercise, population will be estimated from the ``area`` as well as the ``category`` of the building. This area will be stored in the nearest roads. Following steps explain this process in detail." msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:771 -msgid "Exercise 18: Find total population served by the hospital" +#: ../../build/docs/un_sdg/sdg3-health.rst:620 +msgid "Exercise 14: Find total population served by the hospital" msgstr "" -#: ../../build/docs/un_sdg/sdg3-health.rst:773 +#: ../../build/docs/un_sdg/sdg3-health.rst:622 msgid "Final step is to find the total population served by the hospital based on travel time." msgstr ""