lab 3: digitizing in qgis - gis courses · pdf filegis fundamentals: introduction to gis lab...

15
GIS Fundamentals: Introduction to GIS Lab 3, Digitizing 1 Lab 3: Digitizing in QGIS What You’ll Learn: In this Lab you’ll be introduced to basic digitizing techniques using QGIS. You should read Chapter 4 in the GIS Fundamentals textbook before starting this lab, as the chapter covers the basics of data entry, properties of hardcopy maps, and digitizing mechanics. Data are located in the \L3 subdirectory, including Boat_Docks.shp, Houses.shp, and Islands_in_River.shp, files with errors that you’ll fix, and Lab3_image.img, an image file that you’ll use as a data source. All data are in UTM Zone 15, NAD83 coordinates. Videos are on the website. Manual Digitizing Digitizing is the process of interpreting and converting paper map or image data to vector digital data. In manual digitizing you trace the lines or points from the source media. You control a cursor, usually with a mouse or digitizing puck, and sample vertices to define the point, line, or polygonal features you wish to capture. The source media may be hardcopy, e.g., maps taped to a digitizing table, or softcopy, e.g., a digital image or scanned map. QGIS software allows us to digitize using either hardcopy or softcopy sources. On Screen Digitizing in QGIS Our practice exercise will involve digitizing a set of features from a scanned photo. Digitizing directly on screen is sometimes called “heads-up” or softcopy digitizing. Flatbed scanners and digital cameras are common, so softcopy digitizing is a standard procedure. Scanned photos have some geometric distortion that depends primarily on how the photo was taken (flying height, terrain, camera tilt, and other factors). GIS data are commonly entered from scanned photos because we can easily adjust the display scale, zooming in or out as needed. This often reduces both interpretation and digitizing errors. Setting File Properties As described in Lab 1, before you get started you should: Create a new directory, preferably on your USB drive, and copy the Lab 3 data there Start QGIS and create an empty/new project Save the project to the just created directory (Project, Save) Set your path names relative to that directory

Upload: hoangquynh

Post on 10-Feb-2018

252 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Lab 3: Digitizing in QGIS - GIS Courses · PDF fileGIS Fundamentals: Introduction to GIS Lab 3, Digitizing 1 Lab 3: Digitizing in QGIS What You’ll Learn: In this Lab you’ll be

GIS Fundamentals: Introduction to GIS Lab 3, Digitizing

1

Lab 3: Digitizing in QGIS What You’ll Learn: In this Lab you’ll be introduced to basic digitizing techniques using QGIS. You should read Chapter 4 in the GIS Fundamentals textbook before starting this lab, as the chapter covers the basics of data entry, properties of hardcopy maps, and digitizing mechanics. Data are located in the \L3 subdirectory, including Boat_Docks.shp, Houses.shp, and Islands_in_River.shp, files with errors that you’ll fix, and Lab3_image.img, an image file that you’ll use as a data source. All data are in UTM Zone 15, NAD83 coordinates. Videos are on the website. Manual Digitizing Digitizing is the process of interpreting and converting paper map or image data to vector digital data. In manual digitizing you trace the lines or points from the source media. You control a cursor, usually with a mouse or digitizing puck, and sample vertices to define the point, line, or polygonal features you wish to capture. The source media may be hardcopy, e.g., maps taped to a digitizing table, or softcopy, e.g., a digital image or scanned map. QGIS software allows us to digitize using either hardcopy or softcopy sources. On Screen Digitizing in QGIS Our practice exercise will involve digitizing a set of features from a scanned photo. Digitizing directly on screen is sometimes called “heads-up” or softcopy digitizing. Flatbed scanners and digital cameras are common, so softcopy digitizing is a standard procedure. Scanned photos have some geometric distortion that depends primarily on how the photo was taken (flying height, terrain, camera tilt, and other factors). GIS data are commonly entered from scanned photos because we can easily adjust the display scale, zooming in or out as needed. This often reduces both interpretation and digitizing errors. Setting File Properties As described in Lab 1, before you get started you should:

Create a new directory, preferably on your USB drive, and copy the Lab 3 data there

Start QGIS and create an empty/new project

Save the project to the just created directory (Project, Save)

Set your path names relative to that directory

Page 2: Lab 3: Digitizing in QGIS - GIS Courses · PDF fileGIS Fundamentals: Introduction to GIS Lab 3, Digitizing 1 Lab 3: Digitizing in QGIS What You’ll Learn: In this Lab you’ll be

GIS Fundamentals: Introduction to GIS Lab 3, Digitizing

2

Digitizing

Select the Add Raster Layer button ( ); navigate to the \L3 folder, and add the image named lab3_image.img. An image should be displayed, similar to that shown below:

This is an area near Stillwater, Minnesota, with a mix of forests, houses, and farm fields. The St. Croix river runs through the eastern (right) part of the image. When it first displays, the coloring isn’t the best; it’s a bit too bright, and the fields a bit washed out. We will first adjust the image “stretch.” Right click on the image name in the table of contents (TOC), and left click on properties, then select Style to display a window that allows you to control the symbology:

Page 3: Lab 3: Digitizing in QGIS - GIS Courses · PDF fileGIS Fundamentals: Introduction to GIS Lab 3, Digitizing 1 Lab 3: Digitizing in QGIS What You’ll Learn: In this Lab you’ll be

GIS Fundamentals: Introduction to GIS Lab 3, Digitizing

3

In the upper right is a set of buttons for changing the coloration, under the heading load min/max values. Click on the button that says Mean +/- standard deviation x, and change the number in the adjacent box to 2.0, then click on Load below the box, then Apply at the bottom of the menu. This should provide a better color stretch. There are various other settings, you can

Page 4: Lab 3: Digitizing in QGIS - GIS Courses · PDF fileGIS Fundamentals: Introduction to GIS Lab 3, Digitizing 1 Lab 3: Digitizing in QGIS What You’ll Learn: In this Lab you’ll be

GIS Fundamentals: Introduction to GIS Lab 3, Digitizing

4

experiment, and if you make the image unviewable, you can always remove the image and add it back, and apply the +/- 2 standard deviation stretch. The image is an orthophoto registered to the NAD83, UTM zone 15N coordinate system, thus the coordinates are visible at the bottom of the image, and the EPSG number displayed Inspect the image with the zoom (magnifying glasses) and pan utilities (hand). Digitizing Features Your goal is to digitize points (ponds), lines (major roads), and polygons (selected fields) from this image. See the map at the end of this document labeled “Digitized and Corrected features in Stillwater Township, 2006” for the minimum number of roads, ponds and field you need to digitize; you can do more if you wish. You don’t have to do exactly the specific features in the map at the end, just do an approximately equal number of features. You’ll need to create three new data layers (one each for points, lines, and polygon features) and zoom in and pan around to identify all the features on the map. These steps for the pond layer are shown in the Video: Start Digitizing. Left click on New Shapefile Tool, often docked on the left sidebar:

A window pops up that allows you to select the type of layer through buttons along the top, specify the CRS, and add attributes, as shown in the video listed above. Here, don’t bother adding attributes, just change the CRS to match that of the image (look up the ESPG number on the display), hit o.k., and name it ponds and save it into your Lab 3 directory. Now we’ll create new point features for the ponds layer. Use the pan and zoom tools to zoom to inspect the image. Note that there are several ponds, dark blobs in the fields, often surrounded by a light- and/or brownish-colored ring. Your task is to

Page 5: Lab 3: Digitizing in QGIS - GIS Courses · PDF fileGIS Fundamentals: Introduction to GIS Lab 3, Digitizing 1 Lab 3: Digitizing in QGIS What You’ll Learn: In this Lab you’ll be

GIS Fundamentals: Introduction to GIS Lab 3, Digitizing

5

digitize at least 20 ponds; we’ll get to that in a minute, but first a few words about scale. Scale is important when digitizing. Too small a scale magnifies errors, e.g., 1:50,000. Too large a scale is inefficient, e.g., digitizing at 1:100 you will be very accurate but will require frequent panning. The best scale depends in part on the level of accuracy you need, and how the features you wish to digitize appear on the images. Right click on the Lab3_image in the TOC and select Zoom to Best Scale (100%). Notice you now zoomed to something like 1:900. This is probably larger than needed for this Lab. You can directly enter a scale in the scale box along the bottom of the display; here use 1:4000, a good compromise (simple type 4000, without the comma or the 1 and colon, in the data view scale box), or select an appropriate scale, if listed, from a dropdown menu activated by the cared on the right side of the scale box. Find the editing cluster of tools, usually a horizontal series of icons near the upper-left side of the main QGIS window (see below). The tools are detachable, and may be in a different place, set up as free floating, or along the left or right edge or along the bottom, so you may have to search for them on different systems.

The tools allow you to add or modify features. Note that not all icons work for all features, some are just for points, some just for lines, some only for polygons, nor are the actions exactly the same, depending on the features you are editing. If you “hover” the mouse pointer over an icon, hold it still without clicking, a banner name of the tool should display. Click on the pond layer in the table of contents, then click on the toggle edit button to open the pond layer for editing: The button should appear “shadowed” as shown above, indicating it is active, or in editing mode. Pan and zoom until there are several ponds visible in the image.

You use the point tool to add points. Note the cursor now changes when you move it over the image, to a cross and circle. This indicates your left-clicks will add data. To digitize points place the cursor over a pond, and single left-click. Each click creates a

Page 6: Lab 3: Digitizing in QGIS - GIS Courses · PDF fileGIS Fundamentals: Introduction to GIS Lab 3, Digitizing 1 Lab 3: Digitizing in QGIS What You’ll Learn: In this Lab you’ll be

GIS Fundamentals: Introduction to GIS Lab 3, Digitizing

6

feature. A window will open, asking you to enter an ID for the pond, and perhaps other attributes (depends on how you specified the layer). Navigate and digitize at least 20 ponds as new points. Place the point in the middle of the pond by positioning the cursor and left-clicking. If the default point symbols are difficult to see, you can change the symbol color, size, or type by double clicking on the legend entry for the layer in the table of contents, as you would for any theme. Note that when you select other functions during digitizing, e.g., changing the color or size of a symbol of another layer, you may have to re-activate the point data layer you’re adding features to, and then continue digitizing. You should right click on the ponds layer in the TOC left click on Save Layer Edits every few features, and when you are done digitizing ponds. QGIS can crash, and you’ll lose any unsaved work. You can edit existing point features with the Node Tool: You activate features for editing with the node tool to move them. Activate the node tool and left click on the feature. Note that a (typically red) box appears around the point you have selected. You click on the feature again and hold the colored box should change to blue, then continue to hold and drag to move a feature. In an alternate sequence, you can select features with the Select Single Feature Tool: Clicking on a feature in the active layer (the one highlighted in the TOC) selects it and colors it (typically yellow) to indicate it is selected. You may then activate the Move Features Tool, and click-drag to reposition: Practice with a few points. If you wish to delete a feature, you must first select it with the Select Single Feature Tool. Delete the feature by pressing the delete button on the keyboard, or the Delete Selected Feature Tool on the editing toolbar:

Page 7: Lab 3: Digitizing in QGIS - GIS Courses · PDF fileGIS Fundamentals: Introduction to GIS Lab 3, Digitizing 1 Lab 3: Digitizing in QGIS What You’ll Learn: In this Lab you’ll be

GIS Fundamentals: Introduction to GIS Lab 3, Digitizing

7

To de-select feature(s), left click on QGIS canvas somewhere off of the feature, or on Deselect Features From All Layers Tool: The features should then be deselected, and the color should now match the rest of the features. Finish digitizing all your ponds, save your edits, and stop editing (click on the Toggle Editing Tool). Note that most of the editing functions are available via the Edit Menu, a dropdown list from the main QGIS toolbar along the top of the canvas or screen: The Undo, at the top of the menu, is perhaps the most useful tool not yet covered. This “rewinds” your last action, particularly helpful when you’ve done something you regret. Also note that there are keyboard shortcuts for some of the actions, and these are shown to the right of the tool. Most of the shortcuts begin with an escape character, the command key ( ) or shift+ key on Macs, and cmd or control keys on an MSWindows computer. Sometimes it is helpful to learn them for oft-repeated actions.

Page 8: Lab 3: Digitizing in QGIS - GIS Courses · PDF fileGIS Fundamentals: Introduction to GIS Lab 3, Digitizing 1 Lab 3: Digitizing in QGIS What You’ll Learn: In this Lab you’ll be

GIS Fundamentals: Introduction to GIS Lab 3, Digitizing

8

Digitizing Line and Polygon Features with Snapping Next we’ll digitize lines and then polygon features, but first we should set the snapping environment. You should read about snapping in Chapter 4 of the textbook before doing this section. You set snapping via the QGIS-Preferences menu, found on the main toolbar at the top right of the QGIS window frame: Click on Preferences and select Digitizing in the left options column of the menu. This displays a set of options that you may select via checkboxes, pick lists, or numeric entry. You may suppress the attribute form that appears when you digitize each feature (near top, check box), change how things appear when digitizing. You can change the color or transparency of features or lines you are digitizing via the “Rubberband” settings, especially helpful when digitizing polygons from an image, as we’ll do below. Right now we’re interested in the Snapping settings, near the middle of the menu. You specify the snap mode, whether it is on, snaps to just vertices, or both to vertices and lines. You then set the snapping tolerance, the distance to which things may be snapped. Typically these are set in map units, meters for this case, because these have a direct physical measure, and you won’t be confused if you have multiple images displayed. As noted in the book, you set the snapping tolerance below the spatial accuracy required for your work, but large enough to speed up digitizing, say, 1 to 4 meters here.

Page 9: Lab 3: Digitizing in QGIS - GIS Courses · PDF fileGIS Fundamentals: Introduction to GIS Lab 3, Digitizing 1 Lab 3: Digitizing in QGIS What You’ll Learn: In this Lab you’ll be

GIS Fundamentals: Introduction to GIS Lab 3, Digitizing

9

You can also choose the search radius for vertices when you are editing, to make it easier to select points or line nodes when editing. There is a check a box to add a snapping options dock when starting QGIS, but this won’t take effect until the next time you start the project in QGIS. Set the units and options as you desire, and then click OK You may change the options after digitizing a bit if you find you’ve set your snapping tolerance too high or low. With snapping set, we’ll digitize line features into the roads data layer. Add and select the roads layer in the canvas (Video: Digitize Roads and Snapping). Create a new feature for digitizing (see earlier section if need be), but this time be sure to specify a line feature, and name is something like roads, and save it with your other Lab 3 data. You’ll digitize the set of roads shown in the map at the end of these instructions. Set your scale to something like 1:4000 to 1:8000, and Toggle Editing for your roads layer. Click on the Add Feature Tool, notice its different appearance for lines: Move the cursor to the start of the road you wish to digitize, and left click. Move along the center of the road, left-clicking when you need a vertex. Note that this shows completed segments for the current line as solid red, and the segment you’ve digitized as dotted red. If you make a mistake while digitizing, you can hit the delete key on the keyboard to remove the last vertex, provided you do this before “ending” a line. End the line with a right click. Note that lines you’ve completed are shown as black with red crosses. You can change the color/shape/transparency settings in the QGIS-Preferences-Digitizing options described just previously, but note that the changes don’t take effect for a feature you’re currently digitizing.

Page 10: Lab 3: Digitizing in QGIS - GIS Courses · PDF fileGIS Fundamentals: Introduction to GIS Lab 3, Digitizing 1 Lab 3: Digitizing in QGIS What You’ll Learn: In this Lab you’ll be

GIS Fundamentals: Introduction to GIS Lab 3, Digitizing

10

If the entire road segment you wish to digitize is not in the view, you can navigate around the image using the pan and zoom tool while a feature is being edited. The feature remains live when you move the cursor off of the “canvas,” but you don’t add any new points while you have the pan or zoom tools activated. After you are done repositioning/scaling the image with pan or zoom, you must click again on the Add Feature Tool in the Create Features window to return to the digitizing cursor. When you select the Add Features Tool, that same feature becomes active, and you take up digitizing where you left off. If you’ve already ended the line and decide there are too many errors to fix by editing, you can remove the entire last line you digitized by selecting Edit-Undo from the main QGIS menu. Start digitizing a new road feature. Note that if you move the cursor near an existing vertex (cross), when you get within the snap tolerance you’re the vertex changes color (purple in my installation). This indicates snapping will occur when you digitize, matching the vertices. Digitize a few more road features from the set on the map at the end of these instructions. Fixing Mistakes What if you make a mistake on a few vertices while digitizing, and don’t notice them or decide not to fixe them until you’re done? Activate the Node Tool (same as above), and click on the offending vertex or line. All vertices for the line should be surrounded by a box. You may then click on the vertex, and hold-drag to reposition it. If you wish to remove an entire line, you may use the Select Single Feature Tool and the delete key or Delete Selected Feature Tool to remove it. You may select several lines by holding down the command key (Mac) or shift key (Windows), and left clicking on each of them to select, then delete or move en masse. To move an entire line you select, then activate the Reposition Feature Tool and click-drag to move it. Note that the entire line will move, but it connections to adjacent lines will not be maintained, i.e., snapping just puts the ending vertices for adjacent lines in the same place, but does not attach or “weld” the lines together.

Page 11: Lab 3: Digitizing in QGIS - GIS Courses · PDF fileGIS Fundamentals: Introduction to GIS Lab 3, Digitizing 1 Lab 3: Digitizing in QGIS What You’ll Learn: In this Lab you’ll be

GIS Fundamentals: Introduction to GIS Lab 3, Digitizing

11

Digitize and fix mistakes until all indicated roads are digitized. Remember to set and use your snapping tolerance so you don’t have under and overshoots. Save frequently using Editor > Save Edits, and stop editing when you’ve digitized the roads shown in the example map below. You can digitize more than the example map roads, but you don’t have to. Now add a new, polygon layer named something like “fields”, making sure to click the polygon radio button, and specifying the NAD83 Zone 15 UTM projection when creating the layer. Use the Add Feature Tool to digitize field polygons, noticing the icon has changed: There are two other settings you can use to avoid most gaps and overlaps where the field edges join. First, set your snapping tolerances (QGIS-Preferences) at something reasonable, about 3 to 6 meters, and set snapping to both vertices and segments. Second, use the Settings-Snapping Options from the QGIS main menu bar to further set up the snapping environment. This will display a window that allows you to specify -snapping on intersection -enable topological editing (clip overlapping polygons) -avoiding intersections when you digitize overlapping areas Set up the snapping options as shown below, making sure to check the box under Avoid Int. next on the right side of the fields row:

This setup won’t automatically avoid gaps, so you have to be careful to slightly overlap adjacent polygons or have the lines/nodes exactly match through snapping, but you can produce

relatively clean polygons using these few options and care in digitizing. (Video: Digitize Fields)

Page 12: Lab 3: Digitizing in QGIS - GIS Courses · PDF fileGIS Fundamentals: Introduction to GIS Lab 3, Digitizing 1 Lab 3: Digitizing in QGIS What You’ll Learn: In this Lab you’ll be

GIS Fundamentals: Introduction to GIS Lab 3, Digitizing

12

It helps to set the data layer as semi-transparent. Do this in the symbology (remember where? Right click TOC, Properties, Style). There is a slider for transparency; if you move it somewhere towards the middle you’ll be able to see through your already digitized polygons. Digitize the fields shown in the example map. Move the cursor to a border of the field you wish to digitize and left-click the mouse. This starts a new polygon. Each time you left-click, you will be placing a vertex for a polygon, until you double click, which closes the polygon. Move the cursor to the next field, and repeat the digitizing process. Continue digitizing features, at least as many as are shown in the sample map at right. Save frequently. Editing Shapefiles Add the following shapefiles to your data view: Boat_Docks.shp Houses.shp Islands_in_River.shp Video: More Polygon Editing, Correcting Polygons Specify a display scale of 1:1500, because we’ll need to view these data with a high magnification to edit them. These layers have errors. The houses are not in the correct places, the Islands include water, and the boat docks are unconnected or in the river. You will fix all three, using the tools you learned above. Toggle editing on with the layer to “Houses” selected in the TOC, and use the Node Tool to reposition the house features. Remember to click once on the feature to show a red square, then a second click-hold-drag to reposition the

Page 13: Lab 3: Digitizing in QGIS - GIS Courses · PDF fileGIS Fundamentals: Introduction to GIS Lab 3, Digitizing 1 Lab 3: Digitizing in QGIS What You’ll Learn: In this Lab you’ll be

GIS Fundamentals: Introduction to GIS Lab 3, Digitizing

13

feature over a nearby house. You may need to recolor/resize the features so that they are all conspicuous and may be corrected. You may need to add and/or delete house features, using the tools learned above. When you are finished, save your edits. Load and display the Boat_Docks. Set the snapping tolerance, to something like 2 to 3 meters. Zoom to layer extent (right click on name in TOC, then select first option in dropdown). You may have to re-color the symbology so that lines are conspicuous, changing the thickness and color. Red or yellow are not recommended, because selection and digitizing defaults include these colors. Make sure editing it toggled on, and fix the two errors:

- the unconnected docks in the northwest corner (upper left of the boat dock features)

- trim the too long dock at the southern end (bottom of boat dock features)

Save your edits and stop editing.

Page 14: Lab 3: Digitizing in QGIS - GIS Courses · PDF fileGIS Fundamentals: Introduction to GIS Lab 3, Digitizing 1 Lab 3: Digitizing in QGIS What You’ll Learn: In this Lab you’ll be

GIS Fundamentals: Introduction to GIS Lab 3, Digitizing

14

Finally, fix the Islands_in_River shapefile. Load it, perhaps change to a hollow symbology, and set the snapping tolerances properties, and the snapping options. The four errors to fix, starting from the upper left corner and moving clockwise, are:

- delete the spurious island to the northwest (left) of the larger islands - reshape the northernmost island to match the tree/water boundary - remove the overlap, and create one island from the two pieces - split the polygon, removing the water from the middle and creating two distinct

polygons.

You may create new features or add vertices and reshape features as described above, as well as splitting, reshaping, and other tasks that are accessed through the Editor Toolbar.

Page 15: Lab 3: Digitizing in QGIS - GIS Courses · PDF fileGIS Fundamentals: Introduction to GIS Lab 3, Digitizing 1 Lab 3: Digitizing in QGIS What You’ll Learn: In this Lab you’ll be

GIS Fundamentals: Introduction to GIS Lab 3, Digitizing

15

To split a polygon into two parts, first make sure the advanced editing toolbar is checked: This should display a set of tools, typically below or to the right of the normal editing toolbars. Find the Split Polygon Tool: You use this tool to split polygons in an editable layer by: selecting a polygon activating the split polygon tool start digitizing outside of but adjacent to the polygon

you wish to split digitizing across the polygon along the split path,

ending the path outside the polygon Fix all the errors in the layer, saving frequently.

To Turn In Below is the “approximate” Key for your digitizing. Digitize the Ponds, Road and Fields and correct the Houses, Docks and Islands, and produce a PDF that looks approximately like the image below. Remember to include a North arrow, legend, title, your name, and scale.