Lesson 4: Create a local GeoPackage layer
Complexity: foundation → intermediate
Outcome: an editable observations point layer stored in 02_working/course.gpkg, with three teaching records, stable IDs and a simple controlled form.
Before you begin
Complete Lesson 3 first.
You need:
03_project/qgis-course.qgz02_working/course.gpkg- the
ingoa_wahilayer created in Lesson 3 - a visible public/familiar area where you can place three non-sensitive teaching points
The three observations in this lesson are invented teaching records. Do not use sensitive wāhi, private personal information or culturally restricted locations just to complete the exercise.
1. Open the course project
- Start QGIS.
- Choose Project → Open….
- Open
03_project/qgis-course.qgz. - Confirm
ingoa_wahiis present in the Layers panel. - Confirm the project CRS in the lower-right corner is
EPSG:2193. - Use your spatial bookmark or another existing layer to return to an area where you can add three teaching points.
- Save the project.
2. Open the New GeoPackage Layer dialog
- Choose Layer → Create Layer → New GeoPackage Layer….
- The New GeoPackage Layer dialog opens.
- Beside Database, click the browse button.
- Browse to
qgis-course/02_working. - Select
course.gpkg. - Click Open.
- In Table name, type:
observations
- In Geometry type, choose Point.
- Set the CRS to NZGD2000 / New Zealand Transverse Mercator 2000 – EPSG:2193.
- If Create a spatial index is offered and ticked by default, leave it ticked.
Do not click OK yet. Add the fields first.
3. Add the observation fields
QGIS creates an internal feature ID for GeoPackage features. You will also create your own stable project identifier called obs_id.
Add each field one at a time using the New field section of the dialog.
Add obs_id
- In Name, type
obs_id. - Set Type to Text data.
- Set a maximum length such as
20if the dialog asks for one. - Click Add to Fields List.
Add category
- Type
category. - Choose Text data.
- Use a length such as
30. - Click Add to Fields List.
Add status
- Type
status. - Choose Text data.
- Use a length such as
30. - Click Add to Fields List.
Add observed
- Type
observed. - Choose Date as the field type.
- Click Add to Fields List.
Add source
- Type
source. - Choose Text data.
- Use a length such as
100. - Click Add to Fields List.
Add notes
-
Type
notes. -
Choose Text data.
-
Use a generous length such as
500if offered. -
Click Add to Fields List.
-
Review the field list. It should contain:
obs_id
category
status
observed
source
notes
- Click OK.
- If QGIS asks whether to overwrite an existing
observationstable, stop and choose Cancel unless you deliberately intend to replace it. A first-time learner should not overwrite an existing layer accidentally.
You should now see
A new observations point layer in the Layers panel.
4. Verify the new layer before editing
- Right-click
observations. - Choose Properties.
- Click Information.
- Confirm geometry type is Point.
- Confirm CRS is EPSG:2193.
- Click Fields or Source Fields, depending on the wording in your installation.
- Confirm
obs_id,category,status,observed,sourceandnotesare present. - Click Cancel or OK without changing anything.
If any field is missing, fix it now rather than building the rest of the exercise on an incomplete structure.
5. Configure a controlled category list
A Value Map limits the form to known choices while still storing ordinary text values.
- Double-click
observationsto open Layer Properties. - Choose Attributes Form in the left-hand list.
- In the field list, click
category. - Find Widget Type.
- Choose Value Map.
- Add these choices one at a time. Use the same text for the displayed description and stored value:
access
erosion
planting
infrastructure
other
- Click Apply.
- Click
observedin the field list. - Confirm its widget type is a date/date-time widget appropriate for a Date field.
- Click OK.
- Save the project.
6. Start editing
- In the Layers panel click
observationsonce so it is selected. - Find Toggle Editing on the Digitizing toolbar. It normally uses a pencil icon.
- If the Digitizing toolbar is missing, choose View → Toolbars → Digitizing Toolbar.
- Click Toggle Editing.
- Look beside the layer name in the Layers panel. QGIS should indicate that the layer is editable.
Do not confuse editing the data layer with editing the QGIS project. You will need to save both.
7. Add the first point
- With
observationsstill selected and editing enabled, click Add Point Feature on the Digitizing toolbar. - Click a non-sensitive teaching location in the map canvas.
- An attribute form opens.
- Enter:
obs_id: OBS-001
category: access
status: checked
observed: choose a valid recent teaching date
source: QGIS course teaching observation
notes: first teaching point
- For
category, use the drop-down Value Map you configured rather than typing a new spelling. - Click OK on the feature form.
- The point should appear on the map.
8. Add the second point
- Click Add Point Feature again.
- Click a different nearby teaching location.
- Enter:
obs_id: OBS-002
category: erosion
status: follow_up
observed: choose a valid teaching date
source: QGIS course teaching observation
notes: second teaching point
- Click OK.
9. Add the third point
- Click Add Point Feature again.
- Click a third nearby location.
- Enter:
obs_id: OBS-003
category: planting
status: checked
observed: choose a valid teaching date
source: QGIS course teaching observation
notes: third teaching point
- Click OK.
You should now see
Three new point features on the map.
10. Save the layer edits
- Click Save Layer Edits on the Digitizing toolbar.
- Wait until QGIS finishes writing the changes.
- Click Toggle Editing to turn editing off.
- If QGIS asks whether to save remaining changes, choose Save.
- Press Ctrl+S on Windows or Command+S on macOS to save the QGIS project as well.
This two-part save matters:
- Save Layer Edits writes feature changes into
course.gpkg - Save Project writes the project configuration into
qgis-course.qgz
11. Check the attribute table
- Right-click
observations. - Choose Open Attribute Table.
- Confirm there are three rows.
- Confirm the
obs_idvalues are exactly:
OBS-001
OBS-002
OBS-003
- Confirm each appears once.
- Confirm the category values are
access,erosionandplanting. - Confirm dates and notes are present.
- Close the table.
If an ID has a typo, turn editing back on, correct it in the attribute table, save layer edits, then turn editing off again.
12. Create a useful display expression
The internal numeric feature ID is not very meaningful when QGIS shows a feature in Identify Results. Create a display expression based on your own ID and category.
- Double-click
observations. - Open Display in Layer Properties.
- Find Display Name or Display expression.
- Click the expression button if needed.
- Enter:
"obs_id" || ' · ' || coalesce("category", 'uncategorised')
- Click OK in the expression editor if one opened.
- Click Apply.
- Click OK.
- Save the project.
13. Test the display expression
- Click
observationsin the Layers panel. - Select Identify Features.
- Click one of your points.
- The result heading or displayed feature name should use something similar to:
OBS-001 · access
If QGIS still displays only a number, reopen Layer Properties → Display and confirm the expression was saved.
14. Style the points by category
- Double-click
observations. - Choose Symbology.
- Change the renderer from Single Symbol to Categorized.
- In Value, choose
category. - Click Classify.
- QGIS creates categories for the values in your data.
- Confirm at least
access,erosionandplantingappear. - Keep the automatically generated symbols for this exercise. The goal is to learn the categorised workflow, not perfect cartography.
- Click Apply.
- Click OK.
- Save the project.
You should now see
The three teaching points shown as separate categories in the map and Layers panel legend.
15. Find the GeoPackage in the Browser panel
- In the Browser panel, expand the folder path containing
qgis-course/02_working, or use Favorites if you have added the course folder there. - Find
course.gpkg. - Expand it using the arrow beside the filename.
- Confirm it contains at least:
ingoa_wahi
observations
The GeoPackage is one file that can contain several vector layers and tables.
16. Close and reopen the project
- Save the project.
- Choose Project → Close.
- Reopen
03_project/qgis-course.qgz. - Wait for the project to load.
- Right-click
observationsand choose Zoom to Layer(s). - Confirm all three points still exist.
- Open the attribute table and confirm all three records still exist.
- Close the table.
This reopen test proves the features were written to disk rather than living only in an unsaved editing session.
17. Make a file-level backup
Close QGIS before copying a GeoPackage that you have been editing. This avoids copying while the database is actively in use.
- Save the project.
- Close QGIS completely.
- Open File Explorer or Finder.
- Go to
qgis-course/02_working. - Copy
course.gpkg. - Open
qgis-course/02_working/backups. - Paste the copy.
- Rename the copy using today's date, for example:
course-2026-09-04.gpkg
- Confirm both the working file and backup exist.
- Start QGIS again.
- Reopen
03_project/qgis-course.qgz.
Do not replace the working GeoPackage with the backup unless you are deliberately recovering from a problem.
18. Record the layer design
Open 03_project/README.md and add:
Lesson 4 local layer
Database: 02_working/course.gpkg
Layer: observations
Geometry: Point
CRS: EPSG:2193
Stable key: obs_id
Teaching records: OBS-001, OBS-002, OBS-003
Category choices: access, erosion, planting, infrastructure, other
Backup made: [today's date]
Save the README.
Verify before moving on
You should be able to show another person:
course.gpkgin02_workingingoa_wahiandobservationsinside the GeoPackage- three observation features on the map
- three unique
obs_idvalues - the category drop-down in the editing form
- categorised symbology
- the display expression
- editing turned off after saving
- a dated backup in
02_working/backups - the project reopening without losing any records
Common problems
I created a temporary scratch layer instead
A temporary layer can disappear when QGIS closes. Right-click it → Export → Save Features As…, choose GeoPackage, save into 02_working/course.gpkg, then use the saved layer.
The Add Point Feature button is greyed out
Make sure observations is selected in the Layers panel and Toggle Editing is on.
I cannot see the Digitizing toolbar
Choose View → Toolbars → Digitizing Toolbar.
The category field is still a free-text box
Open Layer Properties → Attributes Form, select category, set Widget Type to Value Map, add the five approved values, click Apply, then OK.
My points disappeared after restarting QGIS
You probably did not save layer edits. Recreate the missing points, click Save Layer Edits, turn editing off, then save the project.
The GeoPackage seems locked when I try to copy it
Close QGIS and any other program using the file, then make the backup copy.
QGIS generated different internal IDs after processing
That is why this layer has obs_id. Use obs_id for course joins and references rather than treating the internal feature ID as a permanent business key.
Next: Lesson 5: Join a spreadsheet.
Official reference: QGIS creating layers.
Test basis: QGIS 3.44 LTR. Last reviewed: 4 September 2026