14.3. Lesson: Digitizarea Arboretului Forestier

Unless you are going to use your georeferenced map as a simple background image, the next natural step is to digitize elements from it. You have already done so in the exercises about creating vector data in Lesson: Crearea unui Nou Set de Date Vectoriale, when you digitized the school fields. In this lesson, you are going to digitize the forest stands» borders that appear in the map as green lines but instead of doing it using an aerial image, you will use your georeferenced map.

Scopul acestei lecții: Învățarea unei tehnici pentru a ajuta activitatea de digitizare a arboretului forestier și, în cele din urmă, adunarea din acesta a datelor de inventar.

14.3.1. basic Follow Along: Extragerea Limitelor Arboretului Forestier

Open your map_digitizing.qgs project in QGIS, that you saved from the previous lesson.

O dată ce ați scanat și georeferențiat harta, ați putea începe digitizarea, folosind imaginea drept ghid. Acesta ar fi, probabil, cel mai potrivit mod de lucru, atunci când imaginea pe care trebuie să o digitizați reprezintă, de fapt, o fotografie aeriană.

If what you are using to digitize is a good map, as it is in our case, it is likely that the information is clearly displayed as lines with different colors for each type of element. Those colors can be relatively easy extracted as individual images using an image processing software like GIMP. Such separate images can be used to assist the digitizing, as you will see below.

Primul pas va fi de a utiliza GIMP la obținerea unei imagini care conține doar pâlcuri de pădure, reprezentate de toate acele linii verzui pe care le puteți vedea în harta originală, scanată:

  1. Deschideți GIMP (dacă nu l-ați instalat încă, descărcați-l de pe internet sau cereți-l profesorului dvs.).

  2. Open the original map image, File ► Open, rautjarvi_map.tif in the exercise_data/forestry folder. Note that the forest stands are represented as green lines (with the number of the stand also in green inside each polygon).

    ../../../_images/gimp_map.png

  3. Acum puteți selecta pixelii din imagine, care reprezintă limitele parcelelor forestiere (pixelii verzui):

    1. Deschideți instrumentul Select ► By color.

    2. With the tool active, zoom into the image (Ctrl + mouse wheel) so that a forest stand line is close enough to differentiate the pixels forming the line. See the left image below.

    3. Faceți clic și glisați cursorul mouse-ului în partea din mijloc a liniei, astfel încât instrumentul va colecta valorile câtorva dintre culorile pixelilor.

    4. Eliberați butonul mouse-ului și așteptați câteva secunde. Din întreaga imagine vor fi selectați pixelii care se potrivesc culorilor colectate de către instrument.

    5. Micșorați, pentru a vedea cum au fost selectați pixelii verzui din întreaga imagine.

    6. Dacă rezultatul nu vă mulțumește, repetați operațiunea de clic și glisare.

    7. Pixelii selectați de către dumneavoastră ar trebui să arate în genul imaginii din dreapta-jos.

    ../../../_images/green_px_selected.png

  4. O dată ce ați terminat selecția, trebuie să o copiați sub forma unui nou strat, care se va salva ulterior ca fișier de tip imagine:

    1. Copy (Ctr+C) the selected pixels.

    2. And paste the pixels directly (Ctr+V), GIMP will display the pasted pixels as a new temporary layer in the Layers - Brushes panel as a Floating Selection (Pasted Layer).

    3. Faceți clic dreapta pe stratul temporar, apoi selectați Către Noul Strat.

    4. Faceți clic pe pictograma „ochiului” de lângă stratul de imagine original pentru a-l dezactiva, astfel încât numai Stratul Lipit va fi vizibil:

    ../../../_images/saving_green_px.png

  5. Finally, select File ► Export…, set Select File Type (By Extension) as a TIFF image, select the digitizing folder and name it rautjarvi_map_green.tif. Select no compression when asked.

Ați putea face același proces cu alte elemente din imagine, de exemplu, extrăgând liniile negre care reprezintă drumurile, sau cele maro care reprezintă liniile de contur ale terenului. Dar pentru noi, arboretul forestier este suficient.

14.3.2. basic Try Yourself Georeferențiați Imaginea Pixelilor Verzi

Ca și în lecția anterioară, trebuie să georeferențiați această nouă imagine pentru a o putea folosi cu restul de date.

Note that you don’t need to digitize the ground control points anymore because this image is basically the same image as the original map image, as far as the Georeferencer tool is concerned. Here are some things you should remember:

  • This image is also, of course, in KKJ / Finland zone 2 CRS.

  • Ar trebui să utilizați punctele de control din teren salvate, Fișier ► Încărcare puncte GCP.

  • Amintiți-vă să revizuiți Setările de Transformare.

  • Name the output raster as rautjarvi_green_georef.tif in the digitizing folder.

Verificați dacă noul raster se potrivește cu harta originală.

14.3.3. basic Follow Along: Crearea Punctelor de Sprijin pentru Digitizare

Având în vedere instrumentele de digitizare din QGIS, v-ați putea gândi că ar fi de ajutor acroșarea la pixelii verzi, pe durata digitizării. Exact acest lucru îl veți face în continuare: veți crea puncte din acei pixeli, pentru a le folosi mai târziu ca ghidaje în digitizarea arboretelor forestiere, când se vor utiliza instrumentele de acroșare disponibile în QGIS.

  1. Folosiți instrumentul Raster ► Conversie ► Poligonizare (Din Raster în Vector) pentru a vectoriza liniile verzi în poligoane. Dacă nu vă mai amintiți cum se efectuează acest lucru, puteți să reexaminați Lesson: Conversia din Raster în Vector.

  2. Save as rautjarvi_green_polygon.shp inside the digitizing folder.

  3. Măriți și analizați forma poligoanelor. Veți obține ceva de genul:

    ../../../_images/green_polygons.png

  4. Next option to get points out of those polygons is to get their centroids:

    1. Open Vector ► Geometry Tools ► Centroids….

    2. Set Input Layer to polygonLayer rautjarvi_green_polygon (the polygon layer you have just created)

    3. Set Centroids output to green_centroids.shp file within the folder digitizing

    4. Check checkbox Open output file after running algorithm

    5. Press Run. This will calculate the centroids for the polygons as a new layer and add it to the project.

    ../../../_images/green_points.png

  5. Now you can remove the polygonLayer rautjarvi_green_polygon layer from the TOC.

  6. Change the symbology of the centroids layer as follows:

    1. Open the Layer Properties for pointLayer green_centroids.

    2. Mergeți la fila Simbologiei.

    3. Set Size to 1.00 and choose Map Units

It is not necessary to differentiate points from each other, you just need them to be there for the snapping tools to use them. You can use those points now to follow the original lines much easily than without them.

14.3.4. basic Follow Along: Digitizarea Pâlcurilor de Pădure

Now you are ready to start with the actual digitizing work. You would start by creating a vector file of polygon type, but for this exercise, there is a shapefile with part of the area of interest already digitized. You will just finish digitizing the half of the forest stands that are left between the main roads (wide pink lines) and the lake:

../../../_images/forest_stands_to_digitize.png

  1. Go to the digitizing folder using your file manager browser.

  2. Drag and drop the forest_stands.shp vector file to your map.

  3. Change the new layer’s symbology so that it will be easier to see the polygons that have already been digitized.

    1. Set Fill color to green - and change the Opacity to 50%.

    2. Select Simple Fill and set Stroke width to 1.00 mm.

Acum, așa cum vă amintiți de la modulele din trecut, trebuie să configurați și activați opțiunile de acroșare:

  1. Go to Project ► Snapping options…

  2. Press snapping Enable Snapping and select Advanced Configuration

  3. Check the green_centroids and forest_stands layers

  4. Set Type for each layer to Vertex

  5. Set Tolerance for each layer to 10

  6. Set Units for each layer to pixels

  7. Check checkbox Avoid Overlap for the forest_stands layer

  8. Press topologicalEditing Topological editing

  9. Choose avoidIntersectionsLayers Follow Advanced Configuration

  10. Close the pop-up

    ../../../_images/snapping_settings_forest.png

    With these snapping settings, whenever you are digitizing and get close enough to one of the points in the centroids layer or any vertex of your digitized polygons, a pink square will appear on the point that will be snapped to.

  11. Finally, turn off the visibility of all the layers except forest_stands and rautjarvi_georef. Make sure that the map image has not transparency any more.

A few important things to note before you start digitizing:

  • Nu încercați să fiți prea exacți în digitizarea frontierelor.

  • If a border is a straight line, digitize it with just two nodes. In general, digitize using as few nodes as possible.

  • Zoom in to close ranges only if you feel that you need to be accurate, for example, at some corners or when you want a polygon to connect with another polygon at a certain node.

  • Folosiți butonul din mijloc al mouse-ului pentru a mări/micșora și deplasa, pe durata digitizării.

  • Digitizați doar un singur poligon la un moment dat.

  • După digitizarea unui poligon, scrieți id-ul pâlcului de pădure pe care îl puteți vedea în hartă.

Acum puteți începe digitizarea:

  1. Locate the forest stand number 357 in the map window.

  2. Select the forest_stands layer.

  3. Click the toggleEditing Toggle Editing button to enable editing

  4. Select capturePolygon Add Polygon Feature tool.

  5. Start digitizing the stand 357 by connecting some of the dots. Note the pink crosses indicating the snapping.

../../../_images/dgitizing_357_1.png

When you are done:

  1. Right click to end digitizing that polygon.

  2. Enter the forest stand ID within the form (in this case 357).

  3. Clic pe OK

If a form did not appear when you finished digitizing the polygon, go to Settings ► Options ► Digitizing and make sure that the Suppress attribute form pop-up after feature creation is not checked.

Poligonul dvs. digitizat va arăta astfel:

../../../_images/dgitizing_357_3.png

Now for the second polygon, pick up the stand number 358. Make sure that checkbox Avoid Overlap is checked for the forest_stands layer (as shown above). This option ensures polygons do not overlap. So, if you digitize over an existing polygon, the new polygon will be trimmed to meet the border of the existing polygons. You can use this option to automatically obtain a common border.

  1. Începeți digitizarea standului 358 la unul dintre colțurile comune cu pâlcul 357.

  2. Continue normally until you get to the other common corner for both stands.

  3. Finally, digitize a few points inside polygon 357 making sure that the common border is not intersected. See left image below.

  4. Clic-dreapta pentru a termina editarea pâlcului de pădure 358.

  5. Enter the ID as 358.

  6. Click OK. Your new polygon should have a common border with the stand 357 as you can see in the image below.

../../../_images/dgitizing_358_5.png

The part of the polygon that was overlapping the existing polygon has been automatically trimmed and you are left with a common border - as you intended it to be.

14.3.5. basic Try Yourself Încheierea Digitizării Pâlcurilor de Pădure

Now you have two forest stands ready. And a good idea on how to proceed. Continue digitizing on your own until you have digitized all the forest stands that are limited by the main road and the lake.

It might look like a lot of work, but you will soon get used to digitizing the forest stands. It should take you about 15 minutes.

During the digitizing you might need to edit or delete nodes, split or merge polygons. You learned about the necessary tools in Lesson: Topologia Entității, now is probably a good moment to go read about them again.

Remember that having Enable topological editing activated, allows you to move nodes common to two polygons so that the common border is edited at the same time for both polygons.

Rezultatul dvs. va arăta în felul următor:

../../../_images/stands_fully_digitized.png

14.3.6. basic Follow Along: Îmbinarea Datelor pentru Pâlcurile de Pădure

It is possible that the forest inventory data you have for you map is also written in paper. In that case, you would have to first write that data to a text file or a spreadsheet. For this exercise, the information from the inventory for 1994 (the same inventory as the map) is ready as a comma separated text (csv) file.

  1. Open the rautjarvi_1994.csv file from the exercise_data\forestry directory in a text editor and note that the inventory data file has an attribute called ID that has the numbers of the forest stands. Those numbers are the same as the forest stands ids you have entered for your polygons and can be used to link the data from the text file to your vector file. You can see the metadata for this inventory data in the file rautjarvi_1994_legend.txt in the same folder.

  2. Now add this file into the project:

    1. Use the addDelimitedTextLayer Add Delimited Text Layer tool. This is accessed via Layer ► Add Layer ► Add Delimited Text Layer….

    2. Set details in the dialog as follows:

      ../../../_images/inventory_csv_import.png
    3. Press Add to load the formatted csv file in the project.

  3. To link the data from the .csv file with the digitized polygons, create a join between the two layers:

    1. Open the Layer Properties for the forest_stands layer.

    2. Mergeți la fila Îmbinări.

    3. Click symbologyAdd Add new join on the bottom of the dialog box.

    4. Select rautjarvi_1994.csv as the Join layer

    5. Set the Join field to ID

    6. Set the Target field to ID

    7. Faceți clic pe Ok de două ori.

The data from the text file should be now linked to your vector file. To see what has happened, select the forest_stands layer and use openTable Open Attribute Table. You can see that all the attributes from the inventory data file are now linked to your digitized vector layer.

You will see that the field names are prefixed with rautjarvi_1994_. To change this:

  1. Open the Layer Properties for the forest_stands layer.

  2. Mergeți la fila Îmbinări.

  3. Select Join Layer rautjarvi_1994

  4. Click the toggleEditing Edit selected join button to enable editing

  5. Under checkbox Custom field name prefix remove the prefix name

    ../../../_images/join_csv.png

The data from the .csv file is just linked to your vector file. To make this link permanent, so that the data is actually recorded to the vector file you need to save the forest_stands layer as a new vector file. To do this:

  1. Right click on forest_stands layer

  2. Choose Export ► Save Features As…

  3. Set Format to ESRI Shapefile

  4. Set file name to forest_stands_1994.shp under the forestry folder

  5. To include the new file as a layer in the project, check checkbox Add saved file to map

../../../_images/save_vector_layer.png

14.3.7. basic Try Yourself Adding Area and Perimeter

To finish gathering the information related to these forest stands, you might calculate the area and the perimeter of the stands. You calculated areas for polygons in Lesson: Exercițiu Suplimentar. Go back to that lesson if you need to and calculate the areas for the forest stands. Name the new attribute Area and make sure that the values calculated are in hectares. You could also do the same for the perimeter.

Now your forest_stands_1994 layer is ready and packed with all the available information.

Save your project to keep the current map layers in case you need to come back later to it.

14.3.8. In Conclusion

It has taken a few clicks of the mouse but you now have your old inventory data in digital format and ready for use in QGIS.

14.3.9. What’s Next?

You could start doing different analysis with your brand new dataset, but you might be more interested in performing analysis in a dataset more up to date. The topic of the next lesson will be the creation of forest stands using current aerial photos and the addition of some relevant information to your dataset.