In this module we will correlate Hiking Routes downloaded from Open Street Maps with various Himalayan terrains and features. We will identify route sections through forests and across glaciers, identify which mountain passes and glacial lakes are accessible through hiking routes and identify hamlets along a hiking route through various QGIS processing functions.
Mountain pass coverage
Let’s take a look for which mountain passes (module 10A) we have mapped hiking routes in OSM. Enable the passes (271) and hiking routes (181) vector layers in QGIS. We will identify the mountain passes which fall within 100 meters from any hiking route. See Image 1 below.
Let’s use the “Buffer” QGIS processing function to add 100 meters left/right of each hiking route (1 degree equals 60 minutes x 1857 meters per minute). Run this function to create a new polygon vector layer “Buffer” which represents the 200 meters wide ‘exploded’ hiking routes. See Images 2+3 below.
We can now “intersect” the mountain passes with these “buffer”-ed routes to identify which passes fall within 100 meters from any hiking route. 87 out of 271 mountain passes in Himachal have a mapped hiking route in OSM (accessible to hikers). See Images 4+5 below.
Right click on the newly created “Intersection” vector layer and “Open Attribute Table” to see which hiking route passes fall within 100 meters of each of the 87 mountain passes. See Image 6 below.Hiking routes and mountain passes in Himachal. Right panel shows QGIS “Processing Toolbox”
Blow up hiking routes by 100 degrees / 1857 meters per minute / 60 minutes per degree = 100 meters
“Buffered” polygons representing blown up hiking routes – 200 meters wide
Intersecting mountain passes with “buffer”-ed hiking routes
87 mountain passes fall within 100 meters from hiking routes
Hiking route (name_2) corresponding to each mountain pass (name)
Routes & Terrains
QGIS allows us to identify the overlap of hiking routes with different Himalayan terrains: forests, glaciers…. Let’s intersect hiking routes (line-strings) with glaciers (polygons). A new vector layer “Intersection” is added representing 21 sections of hiking routes traversing across glaciers in Himachal. See Images 1+2+3 below.
Right click on “Intersection” and bring up “Open Attribute Table” to identify which glacier (name_2) each route segment (name) traverses. See Image 4 below.
Update the “Length” attribute to the distance of each route segment. Click the “Select Features by Expression” icon to calculate the total distance of hiking route segments across glaciers – 60km out of total 4103km or 1.4%. See Images 5+6 below.
Similar we can calculate the % of hiking routes in Himachal going through forest (OSM “natural” = “wood”).Hiking routes and glaciers (natural=glacier) mapped in OSM for Himachal
Intersecting hiking routes and glaciers
21 hiking route segments go across with glaciers in Himachal
Hiking routes (name) which go across glaciers (name_2)
Update the Length of each route segment in kilometers
Calculating total distance of hiking routes across glaciers in Himachal
Hamlets along Route
In this section let’s identify the hamlets along (within 500 meters) a given hiking route. This can be useful to plan night halts and food resupply. Same logic can be applied to campsites, shelters, stream crossings, etc. We will use following steps to solve this problem:
1. Create points every 100m along hiking route
2. Identify nearest hamlet (and distance) to each point along route
3. Identify points (distance) along route which are closest to each unique hamlet along the way
Select the “route hiking” layer and click “Select Features by Expression” icon on QGIS toolbar. In the Expression Editor enter “name = ‘Tapri to Lippa’ ” to select this particular hiking route. See Image 1 below.
Next, use the “Points along geometry” processing function for “route_hiking”, enable “Selected features only”, “distance” = “100 / 1857 / 60” (every 100 meters / 1857 meters per minute / 60 minutes per degree). A new “interpolated points” point vector layer is created with 100 meter distance points (879 points) along hiking route. Bring up the “Open Attributes Table” to view the distance (in degrees) and angle for each point along the route. See Images 2+3+4 below.
Finally use the “Distance to nearest hub (line to hub”) function on the “interpolated points” layer, destination hubs “place_hamlets”, hub name “name”, distance “Meters”. A new “hub distance” vector layer is created showing the shortest hamlet for each 100m point along the hiking route. Bring up the “Open Attributes Table” to view the name and distance to the nearest hamlet for each point. See Images 5+6+7 below.Select the “Tapri to Lippa” hiking route
Break down the selected hiking route in 100m distance points
Hiking route broken down in points every 100m along the route
Distance (degrees) / angle of each 100m point along the hiking route
Identify nearest hamlet for each 100m point along hiking route
Hub distance line vector layer showing nearest hamlet for each 100m point along hiking route
Name and distance to nearest hamlet for each 100m point along route
SQL
To extract the unique hamlets along (within 500 meters) the hiking route (+distance along the route) from the above data set (879 points along route) we will make use of a simple SQL query.
Distance of point along hiking route is given in degrees (“distance” column). To simply things let’s first add a new attribute “dist” to “hub distance” layer which has distance in meter. See Images 1+2 below.
Next, open up the “DB Manager” from the QGIS “Database” menu and select “Hub distance” under “Virtual Layers”. Open up “SQL Window” from the “Database” menu in the DB Manager. Let’s start with a simple SQL query “Select dist, hubname, hubdist from ‘Hub Distance’ ” to retrieve the corresponding attributes of 879 points from “hub distance” layer. See Image 3 below.
Now, let’s refine our query to select only those 30 points along the hiking route which are closest (minimum distance) to each hamlet. SQL query = “Select dist, hubname, min(hubdist) from ‘Hub distance’ group by Hubname”. See Image 4 below.
Finally, let’s refine our query to select only those 10 points along the hiking route which are within 500 meters from the nearby village, sorted by distance along the hiking route (from start to end). SQL query = “Select dist, hubname, min(hubdist) from ‘Hub distance’ where hubdist < ‘500’ group by Hubname” order by dist “. See Image 5 below.
Congratulations! You can now automatically find all POIs (points of interest) along one or more hiking routes in the Himalayas!Add new attribute “dist” to “hub distance” layer
Update “dist” to distance in meters from start of route
SQL query to retrieve distance, nearest hamlet name / distance
SQL query to retrieve points along route closest to each unique hamlet along the way
SQL query to retrieve nearby hamlets (within 500 meters) along hiking route and distance from route
Assignment
Acknowledge your understanding of the concepts learned in this module by submitting the assignment below.