Week 2 Hands-On — First Map in QGIS¶
Hands-On Practice · Day 3 · Thursday of Week 2 — GIS Data Models
Topics¶
- Raster and image data models, continued
- Make a map in QGIS using each data type
- Live demo of creating and editing vector data in QGIS
Materials¶
- UtahCountyData.zip: download
Feeds Lab 1.
At a glance¶
| Goal | Every student leaves with a QGIS project that has a basemap, the four Utah County layers, and a point layer they created and edited themselves. |
| Why this week | Tuesday named the data models (vector point, line, polygon; raster). Today students see each one as a real layer, and they learn the two moves Lab 1 depends on: adding a web basemap and adding downloaded data. |
| Students bring | Laptop with QGIS 3.44 LTR. UtahCountyData.zip downloaded and unzipped (38 MB; have them start the download while the devotional happens). |
| Graded item | In Class Activity: First Map: Utah County (5 points). Upload a screenshot. |
Practice run before class¶
Tip
Twenty minutes on your own laptop and you will have done every move the class does. Work through it once and the session runs itself.
What you need. QGIS 3.44 LTR and UtahCountyData.zip, unzipped to a folder with a
short path such as C:\GIS\UtahCounty or ~/GIS/UtahCounty. On macOS keep it out of Desktop,
Documents and Downloads; QGIS cannot read those without extra permission.
Do this, in order.
- New empty project. In the Browser panel expand XYZ Tiles and double-click OpenStreetMap. A world basemap appears.
- Right-click XYZ Tiles > New Connection..., name it
Google Satellite, pastehttps://mt1.google.com/vt/lyrs=s&x={x}&y={y}&z={z}, click OK, double-click the new entry. - Layer > Add Layer > Add Vector Layer... and add the county boundary, the roads and the
towers. Pick the
.shpfile each time, not the.dbfor.shx. - Layer > Add Layer > Add Raster Layer... and add the DEM.
- For each layer, right-click Properties > Information and find the line naming its data model: Geometry: Point, Line, Polygon, and for the DEM the Dimensions and Pixel size.
- Layer > Create Layer > New GeoPackage Layer..., database
week02.gpkg, tablenew_towers, geometry Point, CRS EPSG:26912, fieldsname(text) andheight_m(integer). Toggle editing, add three points, fill the form, Save Layer Edits. - Select the roads layer, toggle editing, pick the Vertex Tool, drag one vertex, then toggle editing off and choose Discard. Watch the road snap back.
You are ready when the Layers panel holds a basemap, four county layers and your own point layer, and you can say out loud which data model each one is without opening the dialog.
The one that bites. Adding a shapefile gives "Invalid data source" because a sidecar file was
picked instead of the .shp. Do it once on purpose so you recognize it in the room.
Before class¶
- [ ] QGIS 3.44 open on the projector machine, a new empty project, and the zip already unzipped to a folder with a short path (for example
C:\GIS\UtahCountyor~/GIS/UtahCounty). - [ ] The Google satellite XYZ connection already added under XYZ Tiles in the Browser panel (steps below), so the demo does not stall on typing a URL.
- [ ] Learning Suite open to the First Map: Utah County activity so you can show where the screenshot goes.
- [ ] The Lab 1 page open in a tab.
Plan (50 minutes)¶
| Time | Segment |
|---|---|
| 0:00 | Mini-devotional |
| 0:03 | Today's goal; students unzip the data |
| 0:06 | Demo 1: a web basemap two ways (OpenStreetMap, then a Google satellite XYZ connection) |
| 0:14 | Demo 2: add the four Utah County layers and read each one's data model in Layer Properties |
| 0:24 | Demo 3: create a GeoPackage point layer, digitize three "new towers," move a vertex on a road |
| 0:34 | Students build the same map and add their own points |
| 0:45 | Screenshot and upload; show where Lab 1 lives and the UGRC download page it starts from |
Walkthrough¶
1. A basemap two ways¶
- In the Browser panel, expand XYZ Tiles and double-click OpenStreetMap. It ships with QGIS; nothing to configure.
- Right-click XYZ Tiles > New Connection... Name it
Google Satelliteand paste the URL:https://mt1.google.com/vt/lyrs=s&x={x}&y={y}&z={z}. Click OK, then double-click the new entry. - Point out the coordinates in the status bar as you move the mouse, and the EPSG:3857 badge at bottom right: web basemaps set the project to Web Mercator. That is fine for today.
Say out loud: a basemap is a picture of the world served in tiles. You cannot click on a road in it and ask its name. That is the difference between a raster picture and vector data, which is the next step.
2. Four layers, four data models¶
- Layer > Add Layer > Add Vector Layer... (or drag from the Browser panel). Add the county boundary, the major roads, and the cellular towers from the unzipped folder. Choose the
.shpfile for each. - Layer > Add Layer > Add Raster Layer... and add the DEM.
- Drag layers so the order is towers, roads, boundary, DEM, basemap. Layers draw bottom to top.
- For each layer, right-click Properties > Information and read the line that names the data model: Geometry: Point, Line, Polygon, or for the DEM the Dimensions and Pixel size lines. Ask the class which model each is before you reveal it.
- Use the Identify Features tool (the blue "i") on a tower and on a road. Vector features carry attributes; the DEM returns a single number, the elevation of that cell.
- Open the towers Attribute Table (F6). One row per feature is the whole idea of a vector layer.
3. Create and edit a layer¶
- Layer > Create Layer > New GeoPackage Layer... Database: browse to the data folder and name it
week02.gpkg. Table namenew_towers, geometry type Point, CRS EPSG:26912 (NAD83 / UTM zone 12N) so coordinates are in meters. Add a text fieldnameand an integer fieldheight_m. OK. - Select the new layer, click Toggle Editing (the pencil), then Add Point Feature. Click three spots on the map; fill in the attribute form each time.
- Save Layer Edits, then toggle editing off. Show that the points survive a project save and reopen; the shapefile towers and your GeoPackage towers are the same kind of thing.
- Select the roads layer, toggle editing, choose the Vertex Tool, and drag one vertex of a road a little. Then discard the change (toggle editing off and choose Discard) so the class sees that edits are not real until saved.
4. Where Lab 1 starts¶
Open gis.utah.gov/products/sgid and show Browse our data > Geoscience > Utah Quaternary Faults > Download > Shapefile. Lab 1 is exactly the sequence they just did: download, unzip, add vector layer, add basemap, symbolize.
Student activity¶
Students reproduce the map with their own three points, arrange layers so the towers sit on top of the satellite basemap, and take a screenshot showing the map canvas and the Layers panel. Upload it to In Class Activity: First Map: Utah County on Learning Suite before leaving. Full credit for a screenshot with the four layers plus their own point layer visible.
Common snags¶
- "Invalid data source" when adding a shapefile. They picked one of the sidecar files (
.dbf,.shx). Choose the.shp. - Layers do not line up, or the basemap is blank. The DEM or a shapefile is missing its
.prj. Right-click the layer > Set CRS to EPSG:26912. The basemap needs internet; the Clyde building Wi-Fi occasionally drops. - Nothing happens when they click to add a point. Editing is not toggled on, or the wrong layer is selected in the Layers panel. Both show the same symptom.
- Google tiles refuse to load. Fall back to OpenStreetMap; the exercise does not depend on imagery.
- macOS says the zip "can't be opened." Move it out of Downloads first; QGIS on macOS cannot read from Desktop, Documents, or Downloads without permission.