代写GGRA30: GIS and Empirical Reasoning Practical #3 Fall 2024代写留学生SQL语言

2025-06-16 代写GGRA30: GIS and Empirical Reasoning Practical #3 Fall 2024代写留学生SQL语言

GGRA30: GISand Empirical Reasoning

Quantum GIS (QGIS) Overview and Intro

Practical #3 (Week 4)

Fall 2024

1 Learning Objectives

This exercise is intended to provide an introduction to three basic components of the QGIS Desktop:

•  QGIS Graphical User Interface (GUI) overview and use.

•  Configuration of map tiling services to provide base maps.

•  QGIS Print Layout overview and use to create and print maps.

Note that these instructions have been updated to match QGIS Version 3.34 which is the current long-term (support) release (LTR) version of QGIS and is installed in the Bladen Wing computer labs and the Geography and City Studies (GCS) Lab (HL205). If you use another (but recent) version on your own system, expect at least minor differences in the user interface and layout of functions but the basic operations should still be similar.

2   QGIS GUI (Graphical User Interface) Overview

From the Start Menu, find and start the QGIS Desktop. When QGIS starts, you are presented with the graphical user interface. An annotated screenshot of the QGIS GUI is shown in Figure 1, with interface sections numbered and outlined to emphasize the following components:

Figure 1: QGIS application window with interface sections labelled.

1.  Menu bar

2.  Tool bars

3.  Browser panel (list of data sources, organized by type)

4.  Layers list (data layers included and configured as part of the project).  Until you start loading map layers, this section may show some start-up panels instead.

5.  Map view.  Initially, this section of the user interface may be occupied by tiles that act as re- minders and shortcuts to recent projects, news items, and other information. Once you select a project or add something to you project, the map view will appear.

6.  Status bar

The Menu Bar provides access to various QGIS features using a hierarchical menu on the top row.

There are many functions available through these menues and we will have time to use and understand only a few during this course.  In QGIS terminology, the configuration of a map and its data sets is termed a “project.” Functions to save the map, open a map, or modify options that apply to the entire map are then sometimes found in the Project menu at the left of the menu bar.

Although the Browser panel and the Layers list may appear as shown to the left in Figure 1, the default layout in some versions of QGIS uses a tabbed interface for switching between these and other panels to provide a more compact user interface.  If so, you might see only one or the other of the Browser panel and Layers list at any given time. You would then need to click on the appropriate tab, shown at the bottom of the panels in Figure 2, to make the one you want to see and work with visible.

Figure 2: QGIS Browser panel (a) and Layers list (b) as seen with a tabbed interface for switching between them.

3 Procedures

We will first save and reopen an empty QGIS project.

1.  From the menu, select Project.

2.  Select Save as. . . and, when prompted, navigate to a folder in which you want to store your QGIS project. Name it “First_QGIS_Project”.

•  Notice that the suggested name does not include spaces. In gen- eral, software should be able to handle file and folder names with spaces in the names but often does not.

•  Some QGIS tools will not work properly if you use spaces in file or folder names.

3.  Exit QGIS (Project | Quit).

4.  Start QGIS Desktop again.

5.  If you started QGIS from the start panel, you may still need to open the saved project. It may be called First_QGIS_Project.qgs or First_QGIS_Project.qgz, if you used the name suggested above, depending on your version of QGIS. Select Project | Open. . . and navigate to the folder you saved the project in to select it.  Or open it from QGIS’s list of recent projects (not shown in Figure 1). Or open it by using your OS file browser to navigate to the folder in which you saved the project and double-clicking the project file.

While working with the QGIS project, save it periodically to prevent loss of work (e.g., power failure, software crash).  For today’s practical, you will not be saving any data locally but when you do work with local data it is a very good practice to store this project file and your data together.  Even if you don’t do that, get in the habit of paying attention to where you store your project files and data.

Note that I will often write the menu struc- ture for a function in a compact form. The command  to  save a QGIS project under a new name would be

Project | Save as. . .

3.1 Web Map Server Overview

We are going to make a straightforward map of the UTSC campus as a means to experiment with the QGIS GUI and QGIS’s Print Layout interface that is used to design map page layouts. To do this, we need some geographic information for the campus.  For today, we will use an online service that provides map images in a form that can be included by client applications like web browsers (with the correct software extensions) or GIS.

Web Map Tile Services (WMTS) and XYZ Tile Services publish map imagery online for use in a GIS.

These are useful resources that provide a quick way to load map reference layers, or base layers, with- out worrying about downloading the raw geographic information or designing your own symbols and colour schemes for the base map. Although this is convenient, it is not possible to modify the look of the base layer provided by the service, thereby forcing you to work within the styling someone else has chosen for the map.

Although WMTS and XYZ tile services fulfill nearly identical functions, returning image tiles of sec- tions ofa map in response to requests describing location and zoom level of the map fragment desired, you can think of them as responding to different request dialects, what we would normally refer to as different protocols or (more recently - and not necessarily helpfully) different application program- ming interfaces. Table 1lists a selection of map tiling services and the “type” column shows whether each is WMTS or XYZ. The instructions below will explain how you configure each service type in QGIS to have one of these services provide a base layer foryour map. You only need one base layer —keeping more in your project, after initial experimentation, will just fetch extra data needlessly and slow your work down.

Table 1: Web Map Tile Service (WMTS) and XYZ Tile Service connection info.

Service Name

Type

URL

GeoGratis Canada Base Map — Transportation (CBMT)

WMTS

https://maps-cartes.services.geo.ca/server2_serveur2/rest/services/ BaseMaps/CBMT3978/MapServer/WMTS

Toronto Orthoimagery - current - WMTS

WMTS

https://gis.toronto.ca/arcgis/rest/services/basemap/cot_ortho/ MapServer/WMTS

Esri Standard Tile Service

XYZ

https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_ Map/MapServer/tile/{z}/{y}/{x}

OpenStreetMap (OSM) Tile Service

XYZ

https://tile.openstreetmap.org/{z}/{x}/{y}.png

Please note that the URLs listed in Table 1 link to web services and these are not standard web pages. Clicking on these links or loading them directly into a browser will not produce a map. We will talk about web services more later in the term.

3.2 Connecting toa Tile Service

For this exercise, you will experiment with loading WMTS and / or XYZ layers. You may use any of the services listed in Table 1 (using one of the procedures described below).

Sometimes a tile server may become a bit slow if it is being heavily used.  By providing you with choices, hopefully the class all trying to complete this practical won’t render the server you select un- usable. Each has a slightly different map design as well and you may find that you like the look of one more than the others. Connect to more than one to see if you have a preference.

3.2.1 Connecting to aWMTS

1.  Using the QGIS menues, select Layer | Add Layer | Add WMS/WMTS Layer. . . This will open QGIS’s data source manager with the WMS/WMTS tab selected.

2.  In the Layers tab, click on New.

3.  Pick one of the WMTS from Table 1.

a) Enter the Name from the table as the name of the service in the connection details. This is not the name of the layer. This is the name of the web map service. A single service often offers multiple layers or a composite layer.

b) Enter the URL from the table in the URL of the service connection details. Right-click on the link in Table 1and copy it. Then paste it into the QGIS connection details.

4.  Click OK.

5.  Next, with that service shown in the layers drop-down list, click on the Connect button to fetch the list of layers available from the WMTS just configured and wait for the list to load. It might be a list with only one entry. Once loaded, QGIS will present a table with each row representing one tile layer available from the server. Click on one of the rows and then click Add.

You should see the WMTS layer(s) load into the QGIS Layers List and Map View.  This may take some time, especially if the WMTS is responding to a number of requests at the same time. If the layers selected do not seem to display properly, try one of the other listed layer IDs from that service or try one of the other services.

3.2.2 Connecting to an XYZ Tile Service

The procedure for connecting to an XYZ Tile Service is almost the same as a connecting to a WMTS.

1.  Using the QGIS menues, select Layer | Add Layer |Add XYZ Layer. . . This will open QGIS’s data source manager with the XYZ tab selected.

2.  In the Layers tab, click on New.

3.  Pick one of the WMTS from Table 1.

a) Enter the Name from the table as the name of the service in the connection details. This is not the name of the layer. This is the name of the web map service. A single service often offers multiple layers or a composite layer.

b) Enter the URL from the table in the URL of the service connection details. Right-click on the link in Table 1and copy it. Then paste it into the QGIS connection details.

4.  Click OK.

5.  Now, unlike the WMTS service, there is no intermediate “connect” step with an XYZ tile service layer because each service offers only a single layer.  If a server offers multiple layers, each will be presented as a separate XYZ Tile Service with a different URL. With that service shown in the layers drop-down list, click Add.

You should see the XYZ layer load into the QGIS Layers List and Map View. As with WMTS, look for other layers if the service you have tried is not loading.

3.3   QGIS Layers List - Configuration and Information Interface

Once the map tile service layer you have selected is successfully loaded, you can close the data source manager window and examine the new layer in the Layers List (Figure 2a).

1.  Use the check box to turn the visibility of the layer on or off.

2. Right-click on the layer in the list and examine the menu options that appear (e.g., layer prop- erties). In particular, notice that you can use this menu to remove a layer you no longer want in your map.

3.  We will make much more use of the layer’s list in next week’s practical

Once you find a base layer that works, ensure that you right-click the others in QGIS layer’s list and remove them because loading multiple tile service layers will slow down your QGIS session and only the top one listed in the project layers list will be visible anyway.

3.4 QGIS Map Navigation Tools

You will now examine the Map Navigation Tool Bar.

1.  Use Zoom in and Zoom out to adjust the scale of your map to show Toronto and then UTSC. By default, you should also be able to adjust zoom with your mouse’s scroll wheel.

2.  Use Pan map to further position the map so it shows the UTSC Humanities Wing.

3.  Lastly, take a look at the Status Bar.

Hover your cursor over the UTSC Humanities Wing. Notice that the coordinate display on the status bar changes as you move the mouse. What are the coordinates of the UTSC Hu- manities Wing?  (These coordinates are unlikely to be meaningful to you — they are not in Latitude / Longitude coordinates. We are not going to worry about this now.)

•  What is the scale of the map? (1:?) This indicates how much territory is shown in the map. If you zoom in and out on the map, you will see how the scale changes.

If you have loaded the OpenStreetMap tile layer and positioned your map to show the Humanities Wing at UTSC, your QGIS application could look similar to Figure 3.

3.5 Print Layout

The Print Layout is used to create and design your maps to be printed or saved as an image file using graphic formats like PDF, SVG, or PNG.

Opening the Print Layout provides you with a blank canvas that represents the page you are going to fill with a map. The print layout interface includes buttons on the left beside the canvas to add map composer items to the page, examples of which are shown in Figure4, along with buttons to adjust your view of the layout, select items within the layout, and to adjust the map extent shown in a selected map frame. The top toolbar of the print layout also includes some buttons to adjust the view of the layout (zoom presets) and the alignment of objects on the page.  Figure 5 shows a Print Layout with a page design in progress.

1.  Open a new print layout template by selecting Project | New Print Layout. . . Enter a title foryour first map in the dialogue — “My first map.” Press OK.

2.  Right click on the empty page shown in the Print Layout and select Page Properties. . . . The Item Properties tab in the Print Layout right side panel will be updated to show properties for the page itself. Set the page to be Letter paper and landscape orientation if these are not the defaults.

3.  Add a map to the print layout by clicking on Add Item | Add Map (or use the “add QGIS map canvas” button shown in Figure 4). Once selected, sketch a rectangular area on the canvas where you would like your map to be placed. You can precisely position the map on the canvas later.

Figure 3: QGIS showing OpenStreetMap tile service centred on UTSC.

4.  As you add items to your print layout, you can select them in one of two ways:

a) Click on the “select items in layout” button shown in Figure 4 and then click on an item to be selected on the layout page.

b) Click on an item listed in the print layout’s Items list in the right side panel of the Print Layout (see Figure 5).

Once an item has been selected, you can view and edit configuration properties for that item by selecting the Item Properties tab in the right side panel (see Figure 5). This will allow you to adjust at least size and position of items on the page but also many other configuration options specific to each type of item. You will only become familiar with the options by spending time working with the interface. For today, these instructions ask you to find and adjust a few.

5. Select the map frame. and adjust its properties:

(a)  Under position and size, set the map’s x and y locations to .75” (19.1 mm), set the map’s width to 9.5” (241.2 mm), and set the map’s height to 7” (177.7 mm).  Leave the reference point as the top left corner of the map.  This will create a .75 inch margin all around your map (on letter paper).

(b)  Check the box to add a frame to the map.

6.  Coarsely adjust the geographic extent displayed in the map. You can do this in two ways:

Figure 4: QGIS print layout tool functions and icons.

a) Click on the “pan and zoom map contents” button in the Print Layout and then zoom and pan the map the contents ofthe map frame directly.

b)  Adjust the positioning and zoom of the map in QGIS’s main window.  Then, with the map selected on the page layout, click on the “set map extent to match main canvas extent” button at the top of the map frame’s item properties tab in the right side panel.

You can match map extents in either direction: make main map match layout or vice versa, using buttons in the same part of the map’s item properties.

7.  Do fine adjustments to the print layout map layout to make the map show just UTSC and a small area around it (see Figure 5 as an example).  In the print layout, the pan and zoom controls, by default, adjust your view of the page being composed rather than the extent of the map shown in the layout. So if you spin your mouse wheel to zoom in or out, for example, you will be scaling the view of the page layout without adjusting what the map shows. To adjust the area shown in the map directly in the print layout, you either move the content within the map using a specific cursor tool or you adjust the scale of the map to show a larger or smaller geographic area by editing the map scale in the map’s item properties.

a)  Adjust the geographic area displayed by the map. Ensure the “pan and zoom map contents” tool is selected (Figure 4). Click and drag within the map to adjust the area shown by the map.  Scroll in or out over the map while it is selected to adjust the map scale.

b)  With the default cursor tool (“select items in layout”) selected, click on the map in the print layout to show the map’s item properties.  Scroll the item properties panel to the top, if re- quired, and find the scale text box. Adjust the scale by changing the map scale value — start

Figure 5:  QGIS print layout showing configured campus map  (from OpenStreetMap WMTS service).

by changing the value by a small amount until you are familiar with map scales. Larger map scales show larger areas in the same size map.

8.  Add a title by clicking on Add Item | Add Label or the “add text label” button shown in Figure 4:

(a)  Drag a rectangular area approximately where you want to place the label. You’ll be able to select the label later and move it on the page if required.

(b)  Using the item properties panel on the right, change the title from the default text shown in the label’s properties to “University of Toronto Scarborough Campus”.

(c)  Position the title on the map — not in the page margin. You will lose marks in mapping as- signments if you clutter the margin with information. Find an area of your map that doesn’t contain information important to the topic of your map and place map elements in those places.

(d)  In the label’s item properties, check the boxes for frame and background to add a white background and border, making it legible over top of the map.

9.  Add another label and type your name and student number into this one. As above for the title, add a frame. and background for this label.

10.  Add a scale bar (Add Item | Add Scalebar). Adjust the scale bar properties:

(a)  Adjust the scale bar units to be metres with a multiplier of 1.0 (in the units options) and ad- just the fixed width value (in the segments options) to 100 units. This will set the scale bar segments to show 100m segments that are appropriate to this map because we are show- ing a very small area.  For other maps you will have to adjust your scale bar configuration according to the scale.

(b)  Unless there is a solid coloured area (or close to solid) in which you can place the scale bar, add a frame and background to the scale bar to ensure it can be read.  Legibility is your objective with these visual items.

Your map in the print layout should now look similar to Figure 5. It will look somewhat different if you used a base map other than the OpenStreetMap tile service.

3.6 Export your Map

Finally, select Layout | Export as PDF to export your map as a PDF file. Save it to a file and open it with a PDF document viewer to verify that your map has exported properly.

4 Upload Map to Complete Practical Quiz

To complete your practical quiz, upload the exported PDF of your map to the Quercus quiz question set up for this purpose.

•  Your map will be marked according to how closely you have followed the instructions to create a map that contains the map elements described in these instructions and framed to show the campus. It does not matter which of the suggested map tile services you have used for this exer- cise and your framing and layout of map elements will be different.

•  Do not upload anything other than the PDF created for this exercise. You will lose marks for not following instructions if you upload other files instead of or along with the PDF.

When you upload a file in the practical quiz, Quercus will display a link to your file once the upload is done. Check that it is the file you intended to upload by clicking on the link before you submit the quiz.

If you’ve uploaded the wrong file or decide that you are not happy with the file for any rea- son, the quiz will allow you to replace that file as long as you haven’t yet submitted the quiz. Once you submit the quiz no further changes will be possible and grading will be based on your final file selection.