Translation is a community effort you can join. This page is currently translated at 40.67%.

14.3. Lesson: Digitizing Forest Stands

除非打算将配准地图用作简单的背景图像,否则下一步自然是将其元素数字化。当您对学校场地数字化时,已经在 Lesson: Creating a New Vector Dataset 的有关创建矢量数据的练习中完成了此操作。在本课,您将对地图中显示为绿线的林分边界进行数字化,此地图不是使用航拍图像,而是使用配准地图。

本课目标: 学习一种帮助完成数字化任务的技术,将林分数字化,并最终将清查数据添加到其中。

14.3.1. ★☆☆ Follow Along: Extracting the Forest Stands Borders

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


如果您用来数字化的是一张不错的地图,就像我们的示例一样,很可能会清晰地显示每种元素类型不同颜色的线条信息。使用类似 GIMP 这样的图像处理软件,可以相对容易地提取用来辅助数字化的单独图像,如下所示。


  1. 打开GIMP (如果您还未安装,可以从网上下载或咨询您的老师)。

  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).


  3. 现在,您可以选择图像中构成林分边界的像素 (绿色像素):

    1. 打开工具 选择 ► 按颜色

    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. 在线中间单击并拖动鼠标光标,以便该工具收集多个像素颜色值。

    4. 释放鼠标左键并等待几秒钟,与工具收集的颜色相匹配的像素将在整个图像中被选中。

    5. 缩小视图,查看在整个图像中绿色像素的选择情况。

    6. 如果对结果不满意,请重复单击并拖动操作。

    7. 您的像素选择应该类似于下右图。


  4. 完成选择后,需要将此选择复制为新图层,然后另存为单独的图像文件:

    1. Copy (Ctrl+C or Edit ► Copy) the selected pixels.

    2. And paste the pixels directly as a new layer (Edit ► Paste as ► New Layer). GIMP will display the pasted pixels as a new layer (Pasted Layer) in the Layers panel.

    3. 单击原图像图层旁边的 "眼睛" 图标将其关闭,这样只有 被粘贴的图层 可见:


  5. Finally, select File ► Export As..., 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.


14.3.2. ★☆☆ Try Yourself: Georeference the Green Pixels Image


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.

  • 应该使用您保存的GCP 文件 ► 加载地面控制点

  • 请查看 变换设置

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


14.3.3. ★☆☆ Follow Along: Creating Supporting Points for Digitizing


  1. 使用 栅格 ► 转换 ► 栅格矢量化 (栅格转矢量) 工具将绿线矢量化为多边形。如果忘记如何操作,可以温习 Lesson: Raster to Vector Conversion

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

  3. 放大并查看多边形的外观,您会得到这样的结果:


  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.


  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. 转到 符号化 选项卡。

    3. Set Size to 1.00 and choose Map Units


14.3.4. ★☆☆ Follow Along: Digitize the Forest Stands

现在,您可以开始真正的数字化工作了。可以先创建 多边形类型 的矢量文件,但对于本练习,有一个Shapefile,其中关注区的一部分已经数字化。您只需将主要道路 (宽粉色线) 和湖泊之间剩下的一半林分数字化即可:


  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.


  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


    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:

  • 不要试图过于精确数字化边界。

  • 如果边界是一条直线,只需两个结点即可将其数字化。通常,使用尽可能少的结点进行数字化。

  • 仅当您认为需要精确时才放大到近距离,例如,在某些拐角处,或者当您希望某个多边形在某个结点与另一个多边形连接时。

  • 在数字化时,使用鼠标中键进行放大/缩小和平移。

  • 一次仅能数字化一个多边形。

  • 数字化一个多边形后,写出从地图上可以看到的林分ID。


  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.


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. 单击 确定

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.



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. 在林分357的一个公共角开始数字化林分358。

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

  3. 最后,数字化多边形357内的几个点,确保公共边界不相交。见下左图。

  4. 右键单击完成对林分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.


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. ★☆☆ Try Yourself: Finish Digitizing the Forest Stands



在数字化过程中,可能需要编辑或删除结点、分割或合并多边形。您可在 Lesson: Feature Topology 中学习了有关必要的工具,现在可能是复习的好时机。

请记住, 启用拓扑编辑 激活后,可以移动两个多边形的公共结点,以便同时编辑两个多边形的公共边界。



14.3.6. ★☆☆ Follow Along: Joining the Forest Stand Data

有可能地图上的森林资源清查数据写在纸上。在这种情况下,您必须首先将数据录入文本文件或电子表格。对于本练习,1994年清单 (与地图相同的清单) 中的信息以逗号分隔文本 (csv) 文件的形式准备就绪。

  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:

    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. 转到 连接 选项卡。

    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. 单击 确定 两次。

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. 转到 连接 选项卡。

  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


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


14.3.7. ★☆☆ 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: Supplementary Exercise. 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


14.3.9. What's Next?