{"id":36,"date":"2020-03-30T07:00:00","date_gmt":"2020-03-30T07:00:00","guid":{"rendered":"http:\/\/wcwp.rf.gd\/2020\/03\/30\/https-landscapearchaeology-org-2020-direction-viewshed\/"},"modified":"2020-03-30T07:00:00","modified_gmt":"2020-03-30T07:00:00","slug":"direction-viewshed","status":"publish","type":"post","link":"https:\/\/landscapeanalysis.org\/?p=36","title":{"rendered":"Distance and direction filters for QGIS Viewshed analysis"},"content":{"rendered":"<p>Viewshed analysis produces a model of visible areas from a chosen point, given a 2.5 or 3D elevation model. Most often, we model full range visibility, in all directions from an observer point, but such models may not satisfy all uses. For instance, we are sometimes interested in a scene that an observer can see in front of him\/her, excluding the scenery behind his\/her back. We may also prefer to exclude certain zones for various reasons, for instance when we model different visibility ranges (close, middle, far).<\/p>\n<p>A single visibility model can easily be tailored by deleting unwanted zones, but the problem is not trivial when dealing with hundreds of viewsheds. Starting with the 1.1 version of the <a href=\"https:\/\/landscapeanalysis.org\/qgis-visibility-analysis\/\">Viewshed analysis plugin for QGIS<\/a> users will be able to define a doughnut &amp; wedge shaped mask for each visibility model by associating three parameters with each observer point. These are entered in the observer points data table, under columns <em>radius_in<\/em> (inside radius), <em>azim_1<\/em> and <em>azim_2<\/em> (azimuth angles that limit the wedge zone). Note that in the circular domain of angular variables both, 300 to 20 and 20 to 300 ranges are valid; they cover two opposite sectors.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-medium wp-image-67\" src=\"http:\/\/landscapearchaeology.org\/wp-content\/uploads\/figures-jekyll\/20-03-30-shema.png\" alt=\"20-03-30-shema.png\" \/><\/p>\n<h2 id=\"directional-viewshed-analysis-a-tutorial\">Directional viewshed analysis: a tutorial<\/h2>\n<p>Our example will be a section of the beautiful Premu\u017ei\u0107 trail which is following the main ridge of the Velebit mountain, Croatia. The trail was built in the 1930\u2019s specifically for hiking, and is truly a masterpiece (see on <a href=\"http:\/\/www.np-sjeverni-velebit.hr\/posjeti\/lokaliteti\/premuzicevastaza\/?lang=en\">NP Velebit<\/a>).<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-medium wp-image-67\" src=\"http:\/\/landscapearchaeology.org\/wp-content\/uploads\/figures-jekyll\/20-03-30-premuzic_path.jpg\" alt=\"20-03-30-premuzic_path.jpg\" \/><\/p>\n<p>Let\u2019s answer the following question: what scenery does a hiker see while walking along the path? Obviously, he\/she cannot see behind his\/her back, so we need to restrict the viewing range, let\u2019s say to 45 degrees on each side. Since we\u2019re interested in the overall scenery, we will exclude the immediate zone up to one kilometre distance. The overall analysis radius will be 25 kilometres, to test for far reaching views.<\/p>\n<p>We start with a line drawn along the path. Find the \u201cExtract vertices\u201d algorithm and use it to transform the path into points.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-medium wp-image-67\" src=\"http:\/\/landscapearchaeology.org\/wp-content\/uploads\/figures-jekyll\/20-03-30-extract_vertices.JPG\" alt=\"20-03-30-extract_vertices.JPG\" \/><\/p>\n<p>Take a look at the data table of the new file. We have line direction (angle), distance and an ID number for each vertex (yay, all in one step!).<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-medium wp-image-67\" src=\"http:\/\/landscapearchaeology.org\/wp-content\/uploads\/figures-jekyll\/20-03-30-vertices_table.JPG\" alt=\"20-03-30-vertices_table.JPG\" \/><\/p>\n<p>Now, create observer points for the viewshed analysis using desired parameters. Use <em>vertex_index<\/em> as feature ID.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-medium wp-image-67\" src=\"http:\/\/landscapearchaeology.org\/wp-content\/uploads\/figures-jekyll\/20-03-30-create_viewpoints.JPG\" alt=\"20-03-30-create_viewpoints.JPG\" \/><\/p>\n<p>The observer file does not contain the azimuth data: we have to create a data join with the previous file.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-medium wp-image-67\" src=\"http:\/\/landscapearchaeology.org\/wp-content\/uploads\/figures-jekyll\/20-03-30-join.jpg\" alt=\"20-03-30-join.jpg\" \/><\/p>\n<p>We will now calculate our azimuths and store the parameter in table fields named <em>azim_1<\/em> and <em>azim_2<\/em>. My formula for <em>azim_1<\/em> is as following, considering a 90\u00b0 view range:<\/p>\n<div class=\"language-python highlighter-rouge\">\n<div class=\"highlight\">\n<pre class=\"highlight\"><code><span class=\"n\">CASE<\/span> \n  <span class=\"n\">WHEN<\/span> <span class=\"s\">\"Vertices_angle\"<\/span> <span class=\"o\">&gt;<\/span> <span class=\"mi\">45<\/span>\n     <span class=\"n\">THEN<\/span> <span class=\"s\">\"Vertices_angle\"<\/span> <span class=\"o\">-<\/span> <span class=\"mi\">45<\/span>\n  <span class=\"n\">ELSE<\/span>  <span class=\"s\">\"Vertices_angle\"<\/span> <span class=\"o\">-<\/span> <span class=\"mi\">45<\/span> <span class=\"o\">+<\/span> <span class=\"mi\">360<\/span>\n<span class=\"n\">END<\/span>\n<\/code><\/pre>\n<\/div>\n<\/div>\n<p><img decoding=\"async\" class=\"alignnone size-medium wp-image-67\" src=\"http:\/\/landscapearchaeology.org\/wp-content\/uploads\/figures-jekyll\/20-03-30-azim_calc.JPG\" alt=\"20-03-30-azim_calc.JPG\" \/><\/p>\n<p>And for <em>azim_2<\/em> field:<\/p>\n<div class=\"language-python highlighter-rouge\">\n<div class=\"highlight\">\n<pre class=\"highlight\"><code><span class=\"n\">CASE<\/span> \n  <span class=\"n\">WHEN<\/span> <span class=\"s\">\"Vertices_angle\"<\/span> <span class=\"o\">&lt;<\/span> <span class=\"mi\">315<\/span>\n    <span class=\"n\">THEN<\/span> <span class=\"s\">\"Vertices_angle\"<\/span> <span class=\"o\">+<\/span> <span class=\"mi\">45<\/span>\n  <span class=\"n\">ELSE<\/span>  <span class=\"s\">\"Vertices_angle\"<\/span> <span class=\"o\">+<\/span> <span class=\"mi\">45<\/span> <span class=\"o\">-<\/span> <span class=\"mi\">360<\/span>\n<span class=\"n\">END<\/span>\n<\/code><\/pre>\n<\/div>\n<\/div>\n<p>If needed, you can also specify the inner radius in the <em>radius_in<\/em> filed. Here, it will be 1000 meters.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-medium wp-image-67\" src=\"http:\/\/landscapearchaeology.org\/wp-content\/uploads\/figures-jekyll\/20-03-30-radius_in.jpg\" alt=\"20-03-30-radius_in.jpg\" \/><\/p>\n<p>Now, we can finally run the viewshed analysis. All vital parameters have been entered into Viewpoints data table, we just choose file input\/output. (25 kilometres is a fairly large radius, the calculation may take a couple of minutes.)<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-medium wp-image-67\" src=\"http:\/\/landscapearchaeology.org\/wp-content\/uploads\/figures-jekyll\/20-03-30-viewshed.JPG\" alt=\"20-03-30-viewshed.JPG\" \/><\/p>\n<p>We have, now, a model of directed cumulative viewshed which reveals the areas most often seen by a hiker taking the Premu\u017ei\u0107 trail.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-medium wp-image-67\" src=\"http:\/\/landscapearchaeology.org\/wp-content\/uploads\/figures-jekyll\/20-03-30-view_go.jpg\" alt=\"20-03-30-view_go.jpg\" \/><\/p>\n<p>But wait, what happens when he\/she goes back? Well, we simply readjust our <em>azim_1<\/em> and <em>azim_2<\/em> parameters to point in the opposite direction. (I\u2019m leaving you the pleasure of figuring out the calculation. Or, you can use \u201cReverse line direction\u201d in QGIS and repeat all the steps, if you\u2019re lazy\u2026 )<\/p>\n<p>Here is our return viewshed model. Apparently, it is more oriented towards the sea than the previous one.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-medium wp-image-67\" src=\"http:\/\/landscapearchaeology.org\/wp-content\/uploads\/figures-jekyll\/20-03-30-view_back.jpg\" alt=\"20-03-30-view_back.jpg\" \/><\/p>\n<p>Happy mapping!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Viewshed analysis produces a model of visible areas from a chosen point, given a 2.5 or 3D elevation model. Most often, we model full range visibility, in all directions from an observer point, but such models may not satisfy all uses. For instance, we are sometimes interested in a scene that an observer can see [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[13],"class_list":["post-36","post","type-post","status-publish","format-standard","hentry","category-qgis-plugins","tag-qgis-visibility-plugin"],"_links":{"self":[{"href":"https:\/\/landscapeanalysis.org\/index.php?rest_route=\/wp\/v2\/posts\/36","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/landscapeanalysis.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/landscapeanalysis.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/landscapeanalysis.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/landscapeanalysis.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=36"}],"version-history":[{"count":0,"href":"https:\/\/landscapeanalysis.org\/index.php?rest_route=\/wp\/v2\/posts\/36\/revisions"}],"wp:attachment":[{"href":"https:\/\/landscapeanalysis.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=36"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/landscapeanalysis.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=36"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/landscapeanalysis.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=36"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}