このレッスンでは、QGISでの完全なGIS解析を通して案内します。
ノート
Lesson developed by Linfiniti and S Motala (Cape Peninsula University of Technology)
You are tasked with finding areas in and around the Cape Peninsula that are a suitable habitat for a rare fynbos plant species. The extent of your area of investigation in the Cape Peninsula is: south of Melkbosstrand, west of Strand. Botanists have provided you with the following preferences exhibited by the species in question:
それは、東向き斜面に生えています。
As a volunteer for Cape Nature, you have agreed to search for the plant on the closest suitable piece of land to your house. Use your GIS skills to determine where you should go to look.
In order to solve this problem, you will have to use the available data (available in exercise_data/more_analysis) to find the candidate area that is closest to your house. If you don’t live in Cape Town (where this problem is based) you can choose any house in the Cape Town region. The solution will involve:
OK をクリックします。マップは UTM33S のCRSです。
In order to process the data, you will need to load the necessary layers (street names, zones, rainfall, DEM) into the map canvas.
表示されるダイアログで、 ファイル のラジオボタンが選択されているかを確認します。
ブラウズ ボタンをクリックします。
表示されるダイアログで、 exercise_data/more_analysis/streets ディレクトリを開きます。
Street_Names_UTM33S.shp を選択します。
The dialog closes and shows the original dialog, with the file path specified in the text field next to the Browse button. This allows you to ensure that the correct file is selected. It is also possible to enter the file path in this field manually, should you wish to do so.
レイヤを Streets にリネームします。
マップを保存します。
In order to properly see what’s going on, the symbology for the layers needs to be changed.
表示されているダイアログで スタイル タブに切り替えます。
表示されるダイアログで新しい色を選択します。
ラスタレイヤシンボロジはどこか違います。
Now that all the data is loaded and properly visible, the analysis can begin. It is best if the clipping operation is done first. This is so that no processing power is wasted on computing values in areas that aren’t going to be used anyway.
Districts にリネームします。
You will now build a query to select only the following list of districts:
Simons Town, そして
In order to select more than one district, you’ll need to use the OR boolean operator.
Click the OR button and it will be added to the SQL query.
Using a process similar to the above, add the following to the existing SQL query:
"NAME_2" = 'Cape'
Add another OR operator, then work your way through the list of districts above in a similar fashion.
最終的なクエリはこうであるべきです
"NAME_2" = 'Bellville' OR "NAME_2" = 'Cape' OR "NAME_2" = 'Goodwood' OR
"NAME_2" = 'Kuils River' OR "NAME_2" = 'Mitchells Plain' OR "NAME_2" =
'Simons Town' OR "NAME_2" = 'Wynberg'
Click OK. The districts shown in your map are now limited to those in the list above.
Now that you have an area of interest, you can clip the rasters to this area.
Rasterprac ディレクトリに移動します。
ファイル名を入力します。
マップを保存します。
これらのレイヤ上で右クリックし、 削除 を選択します。
Streets レイヤのラベリングを無効にします。
ラベリング ボタンをクリックします。
再度 Streets をすべて表示します。
クエリ を選択します。
マップを保存します。
In order to create the hillshade, you will need to use a plugin that was written for this purpose.
This plugin is included by default in QGIS 1.8. However, it may not be immediately visible. To check if it is accessible on your system:
You will now have access to this plugin via the Raster ‣ Terrain analysis menu item.
Remember that plugins may sometimes depend on certain Python modules being installed on your system. Should a plugin refuse to work while complaining of missing dependencies, please ask your tutor or lecturer for assistance.
結果をプロジェクトに追加する をチェックします。
処理が完了するのを待ちます。
The new hillshade layer has appeared in your Layers list.
ダイアログで OK をクリックします。
結果をプロジェクトに追加する をチェックします。
The slope image has been calculated and added to the map. However, as usual it is just a gray rectangle. To properly see what’s going on, change the symbology as follows.
スタイル タブをクリックします。
定期的にマップを保存することを忘れないで下さい。
In the Raster bands list on the left, you will see all the raster layers in your Layers list. If your Slope layer is called slope, it will be listed as slope@1.
The slope needs to be between 15 and 60 degrees. Everything less than 15 or greater than 60 must therefore be excluded.
Using the list items and buttons in the interface, build the following expression:
((slope@1 < 15) OR (slope@1 > 60)) = 0
Set the Output layer field to an appropriate location and file name.
Click OK.
Now find the correct aspect (east-facing: between 45 and 135 degrees) using the same approach.
次の式を組み立てます:
((aspect@1 < 45) OR (aspect@1 > 135)) = 0
Find the correct rainfall (greater than 1200mm) the same way. Build the following expression:
(rainfall@1 < 1200) = 0
Having reclassified all the rasters, you will now see them displayed as gray rectangles in your map (assuming that they have been added to the map correctly). To properly display raster data with only two classes (1 and 0, meaning true or false), you will need to change their symbology.
読み込み ボタンをクリックします:
The Custom min / max values fields should now populate with 0 and 1, respectively. (If they do not, then there was a mistake with your reclassification of the data, and you will need to go over that part again.)
The only criterion that remains is that the area must be 250m away from urban areas. We will satisfy this requirement by ensuring that the areas we compute are 250m or more from the edge of a rural area. Hence, we need to find all rural areas first.
Hide all layers in the Layers list.
Unhide the Zoning vector layer.
Right-click on it and bring up the Query dialog.
次のクエリをビルドします:
"Gen_Zoning" = 'Rural'
See the earlier instructions for building the Streets query if you get stuck.
それを実行したら :guilabel:`クエリ`ダイアログを閉じます。
You should see a collection of polygons from the Zoning layer. You will need to save these to a new layer file.
出力ファイル名を rural.shp とします。
レイヤをマップに追加します。
はい をクリックします。
ディゾルブ ダイアログを閉じます。
マップを保存します。
Now you need to exclude the areas that are within 250m from the edge of the rural areas. Do this by creating a negative buffer, as explained below.
バッファ結果をディゾルブする ボックスにチェックします。
出力ファイル名を :kbd:`rural_buffer.shp`とします。
OK をクリックして処理が完了するのを待ちます。
ダイアログに現れる:guilabel:Yes を選択します。
マップを保存します。
In order to incorporate the rural zones into the same analysis with the three existing rasters, it will need to be rasterized as well. But in order for the rasters to be compatible for analysis, they will need to be the same size. Therefore, before you can rasterize, you’ll need to clip the vector to the same area as the three rasters. A vector can only be clipped by another vector, so you will first need to create a bounding box polygon the same size as the rasters.
OKをクリックします。
シェープIDの任意の番号を入力します。
編集を保存 ボタンをクリックします。
マップを保存します。
Now that you have a bounding box, you can use it to clip the rural buffer layer.
出力ファイル名を file :kbd:`rural_clipped`とします。
ダイアログを閉じます。
これでラスタライズする準備ができました。
You’ll need to specify a pixel size for a new raster that you create, so first you’ll need to know the size of one of your existing rasters.
:guilabel:`メタデータ`タブに切り替えます。
プロパティ ダイアログを閉じます。
入力レイヤとして:guilabel:`rural_clipped`を選択します。
出力ファイル名を :kbd:`rural_raster.tif``とします。
キャンバスにロードします ボタンをチェックします。
マップを保存します。
Now that you have all four criteria each in a separate raster, you need to combine them to see which areas satisfy all the criteria. To do so, the rasters will be multiplied with each other. When this happens, all overlapping pixels with a value of 1 will retain the value of 1, but if a pixel has the value of 0 in any of the four rasters, then it will be 0 in the result. In this way, the result will contain only the overlapping areas.
Click the Raster ‣ Raster calculator menu item.
Build the following expression (with the appropriate names for your layers, depending on what you called them):
[Rural raster] * [Reclassified aspect] * [Reclassified slope] *
[Reclassified rainfall]
出力場所を :kbd:`Rasterprac`ディレクトリに設定します。
Name the output raster cross_product.tif.
結果をプロジェクトに追加する ボックスがチェックされていることを確認します。
OKをクリックします。
Change the symbology of the new raster in the same way as you set the style for the other reclassified rasters. The new raster now properly displays the areas where all the criteria are satisfied.
To get the final result, you need to select the areas that are greater than 6000m^2. However, computing these areas accurately is only possible for a vector layer, so you will need to vectorize the raster.
出力場所を:kbd:`Rasterprac`に設定します。
:kbd:`candidate_areas.shp`と改名します。
終了時にキャンバスにロードします ボタンがチェックされていることを確認します。
OKをクリックします。
処理が完了したらダイアログを閉じます。
All areas of the raster have been vectorized, so you need to select only the areas that have a value of 1.
Open the Query dialog for the new vector.
クエリのビルド:
"DN" = 1
Click OK.
Create a new vector file from the results by saving the candidate_areas vector after the query is complete (and only the areas with a value of 1 are visible). Use the Save as... function in the layer’s right-click menu for this.
:kbd:`Rasterprac`ディレクトリにファイルを保存します。
:guilabel:`candidate_areas_only.shp`と名前を付けます。
マップを保存します。
新規ベクタレイヤの右クリックメニューを表示します。
属性テーブルを開く を選択します。
Click the Toggle editing mode button along the bottom of the table, or press Ctrl+E.
Click the Open field calculator button along the bottom of the table, or press Ctrl+I.
Under the New field heading in the dialog that appears, enter the field name area. The output field type should be an integer, and the field width should be 10.
:guilabel:`フィールド演算式`で、タイプ:
$area
This means that the field calculator will calculate the area of each polygon in the vector layer and will then populate a new integer column (called area) with the computed value.
Click OK.
Do the same thing for another new field called id. In Field calculator expression, type:
$id
This ensures that each polygon has a unique ID for identification purposes.
Click Toggle editing mode again, and save your edits if prompted to do so.
今このエリアは知られています:
Build a query (as usual) to select only the polygons larger than 6000m^2. The query is:
"area" > 6000
Save the selection as a new vector layer called solution.shp.
You now have your solution areas, from which you will pick the one nearest to your house.
それが正しいCRSであることを確認します!
新規レイヤを:kbd:`house.shp`とします。
新規レイヤ作成の完了
(新規レイヤが選択された状態で)編集モードにします。
シェープIDの任意の番号を入力します。
編集内容を保存し、編集モードを終了します。
マップを保存します。
You will need to find the centroids (“centers of mass”) for the solution area polygons in order to decide which is closest to your house.
適切な出力場所と名前を設定します。
これは、研究の質問への最終的な答えです。
For your submission, include the semi-transparent hillshade layer over an appealing raster of your choice (such as the DEM or the slope raster, for example). Also include the polygon of the closest solution area(s), as well as your house. Follow all the best practices for cartography in creating your output map.