Skip to content
Learn QGIS with BNHR

Module 2 · Intermediate

Preparing the area data

Creating the prescribed corner and boundary shapefiles, plotting the application area, validating its geometry, and filling in its attributes.

Module 2Level Intermediate
On this page
  1. Overview
  2. Before we begin
  3. What we want to achieve
  4. What we have
  5. Relevant QGIS knowledge/skills
  6. The prescribed shapefiles
  7. Area corners (point)
  8. Area boundary (polygon)
  9. Translating the prescribed types to QGIS
  10. 2.1. Creating the area corners and area boundary shapefiles
  11. What we want to achieve
  12. Plotting the application area
  13. 2.2. Plotting the area from a technical description
  14. What we want to achieve
  15. What we have
  16. 2.3. Plotting the area from a list of corner coordinates
  17. What we want to achieve
  18. What we have
  19. 2.4. Preparing the area from an existing layer
  20. What we want to achieve
  21. Validating the geometry
  22. 2.5. Checking and fixing the application area
  23. What we have
  24. Filling in the attributes
  25. Rules for attribute values
  26. 2.6. Computing the area and location attributes
  27. What we want to achieve
  28. Multiple parcels
  29. Quizzes
  30. Certification and support

QGIS usually offers several ways to do the same task: a processing algorithm, the Field Calculator, a plugin, or editing by hand. The steps in this module are examples of how to do each task, tested with the course’s sample data. They are not the only way, and other methods are equally valid as long as the outputs meet the guide’s requirements and agree with each other. Where a choice affects correctness (for example, using area($geometry) instead of $area), the module says why.

For exercises in this module, you will use the bnhr_qgis-sflma-mapping-001.gpkg inside the data subfolder in the BNHR_QGIS-for-SFLMA-Mapping folder.

This geopackage contains all the data and projects associated with the exercises.

  1. Create the area corners (point) and area boundary (polygon) shapefiles with the prescribed attributes.
  2. Plot the application area from a technical description, from a list of corner coordinates, and from an existing layer.
  3. Validate the geometry of the application area.
  4. Fill in the attributes following the guide’s rules.
  1. bnhr_qgis-sflma-mapping-001.gpkg that contains:
    • sample_td - the technical description (bearings and distances) of the sample application
    • sample_tie_point - the reference point (tie point) of the sample technical description, with its coordinates and the tie line as given in the technical description (given_bearing, given_distance)
    • sample_invalid - a polygon with geometry errors, for the validity exercise
    • ref_barangays, ref_municipalities, and ref_provinces - reference administrative boundaries
  2. sample_corners.csv - the corner coordinates of the sample application
  3. sample_td_tie-line.txt and sample_td_boundary.txt - the sample technical description as input files for the Azimuth and Distance plugin
  1. Know the attributes and data types prescribed for the area corners and area boundary shapefiles.
  2. Translate the prescribed data types into QGIS field types.
  3. Create both shapefiles in QGIS with the prescribed fields.

The guide requires two shapefiles: the tenure corners as a point layer and the tenure boundary as a polygon layer.

Field name Data type Description
T_CORNER Short Integer Precision: 0
NORTHINGS Double Northing (Y) coordinate of the point in meters. Precision: 0
EASTINGS Double Easting (X) coordinate of the point in meters. Precision: 0
X Double Precision: 0. Must be left blank
Y Double Precision: 0. Must be left blank
NAME Text Name of applicant, do not abbreviate. Length: 255
TENURE Text Name of tenure, do not abbreviate
REGION Text Region, in Roman numerals. Length: 50
PROVINCE Text Province, do not abbreviate. Length: 255
MUNI_CTY Text Municipality/City, do not abbreviate. If two or more, alphabetize and use only a comma as separator. Length: 255
BARANGAY Text Barangay, do not abbreviate. If two or more, alphabetize and use only a comma as separator. Length: 255
Field name Data type Remarks
AREA Double In hectares. Precision: 0
NAME Text Name of applicant, do not abbreviate. Length: 255
TENURE Text Name of tenure, do not abbreviate
REGION Text Region, in Roman numerals. Length: 50
PROVINCE Text Province, do not abbreviate. Length: 255
MUNI_CTY Text Municipality/City, do not abbreviate. If two or more, alphabetize and use only a comma as separator. Length: 255
BARANGAY Text Barangay, do not abbreviate. If two or more, alphabetize and use only a comma as separator. Length: 255

The guide’s data types use ArcGIS names. In the New Shapefile Layer dialog of QGIS they are:

Guide QGIS type Length Precision
Short Integer Integer (32 bit) 4
Double (NORTHINGS, EASTINGS, X, Y) Decimal (double) 20 3
Double (AREA) Decimal (double) 20 4
Text, length 255 Text (string) 254
Text, length 50 Text (string) 50

The shapefile format limits text fields to 254 characters. If you enter 255, QGIS silently creates the field with 254.

The guide’s own example coordinates have three decimals (millimeters, e.g. Easting: 526493.828). A precision of 3 keeps that, and it also controls how many decimals QGIS writes when you export the coordinates to CSV: with the shapefile default of 15 decimals, a northing of 1629584.143 is written as 1629584.142999999923632.

2.1. Creating the area corners and area boundary shapefiles

Section titled “2.1. Creating the area corners and area boundary shapefiles”

Level: Beginner

  • Two empty shapefiles, one point and one polygon, with the prescribed fields and in the CRS of the technical description, named in the prescribed format.
  1. Open Layer ‣ Create Layer ‣ New Shapefile Layer….
  2. Create the point shapefile for the area corners:
    • File name: IV-A_SFLMA_Point_Bagong Gubat Agroforestry Cooperative.shp
    • Geometry type: Point
    • CRS: EPSG:3123 - PRS92 / Philippines zone 3
    • Remove the default id field from the Fields List.
    • Add each field in the area corners table using the QGIS types: type the Name, choose the Type, set the Length and Precision, then click Add to Fields List.
New Shapefile Layer dialog for the area corners
The area corners shapefile with the prescribed fields
  1. Create the polygon shapefile for the area boundary in the same way, named IV-A_SFLMA_Polygon_Bagong Gubat Agroforestry Cooperative.shp, with the fields in the area boundary table.
New Shapefile Layer dialog for the area boundary
The area boundary shapefile with the prescribed fields
  1. In the Layers panel, rename the two layers area_corners and area_boundary. The expressions and the layout template in this course refer to the layers by these names.

Keep a copy of the two empty shapefiles as templates. For every new application, copy the templates and rename the files instead of recreating the fields.

  1. Plot an application area from a technical description and its tie point.
  2. Plot an application area from a list of corner coordinates.
  3. Prepare an application area from an existing layer.

How you plot the area depends on what the applicant provides. All three methods end in the same place: a closed polygon in the area boundary shapefile, in the correct CRS.

2.2. Plotting the area from a technical description

Section titled “2.2. Plotting the area from a technical description”

Level: Beginner

  • The boundary of the sample application plotted from its bearings and distances, starting from the tie point.
  • sample_td_tie-line.txt - the tie point’s coordinates and the tie line, as input for the Azimuth and Distance plugin
  • sample_td_boundary.txt - the nine lines of the technical description, from corner 1 back to corner 1

Review Mapping land parcels with the Azimuth and Distance plugin if you have not used the plugin before. The input files look like this:

angle=Bearing
heading=Coordinate_System
dist_units=Default
angle_unit=degree
survey=Polygonal
[data]
S 70° 48' 03" E;186.90;90
S 52° 40' 51" E;223.86;90
...
N 59° 19' 00" E;182.83;90
  1. Open the plugin (Plugins ‣ Topography ‣ Azimuth and distance). In the Drawing tab, click Import and open sample_td_tie-line.txt. The starting point becomes the tie point, and the tie line runs to corner 1.
The tie line loaded in the Azimuth and Distance plugin
The tie line from the tie point to corner 1
  1. Click Use Last Vertex. The starting point moves to the end of the tie line: corner 1.
  2. Click Import again and open sample_td_boundary.txt. The preview shows the nine lines of the boundary.
The boundary loaded in the Azimuth and Distance plugin
The nine lines of the technical description, starting at corner 1

The last line should return to corner 1. For the sample, it misses by 4.9 millimeters, because the bearings are rounded to the second and the distances to the centimeter. What would a miss of several meters tell you? We will measure this properly in Cross-validation and quality control.

  1. Select the last line (9-1) in the Segment List and click Remove. A polygon closes itself back to its first point, so keeping the closing line would add a tenth corner 4.9 mm away from corner 1.
  2. Select area_boundary in the Layers panel, choose Active Layer in the plugin, and click Draw.
Ready to draw the boundary into the active layer
The closing line removed and the area_boundary layer selected
  1. Save your edits (Save edits button). The area boundary now has exactly nine corners.
The boundary drawn into the area_boundary layer
The plotted boundary of the sample application

2.3. Plotting the area from a list of corner coordinates

Section titled “2.3. Plotting the area from a list of corner coordinates”

Level: Beginner

  • The boundary of the sample application created from a CSV of corner coordinates.
  • sample_corners.csv - the corner numbers, eastings, and northings of the sample application
  1. Open Layer ‣ Add Layer ‣ Add Delimited Text Layer… and choose sample_corners.csv. Under Geometry Definition, choose Point coordinates, set X field to EASTINGS and Y field to NORTHINGS, and set the Geometry CRS to EPSG:3123.
Loading the corner coordinates as a delimited text layer
The corner coordinates loaded as points
  1. Connect the corners in order with Processing Toolbox ‣ Points to path: check Create closed paths and set the Order expression to T_CORNER.
The Points to path algorithm
Points to path, closed and ordered by T_CORNER
  1. Convert the path into a polygon with Processing Toolbox ‣ Lines to polygons.
The Lines to polygons algorithm
Lines to polygons
  1. Copy the polygon (Edit ‣ Copy Features) and paste it into the area boundary shapefile (Edit ‣ Paste Features).

2.4. Preparing the area from an existing layer

Section titled “2.4. Preparing the area from an existing layer”

Level: Intermediate

  • An application area digitized or edited against reference layers, with clean, snapped vertices.
  1. Enable snapping in the Snapping Toolbar: snap to vertices and segments of all layers, with a tolerance of about 12 pixels.
The Snapping Toolbar
Snapping to vertices and segments of all layers
  1. Toggle editing on the area boundary shapefile and digitize the area with the Add Polygon Feature tool (Add Polygon Feature button), tracing shared boundaries where appropriate.
  2. Use the Advanced Digitizing Panel to enter exact bearings and distances where the boundary follows a surveyed line.
  3. Save your edits (Save edits button).
  1. Detect geometry errors before computing anything from the polygon.
  2. Fix them without changing the shape of the application area.

An invalid polygon gives a wrong area and a wrong technical description, so validation comes before any computation.

2.5. Checking and fixing the application area

Section titled “2.5. Checking and fixing the application area”

Level: Beginner

  • sample_invalid - the sample boundary with two corners swapped (so the boundary crosses itself) and one corner entered twice
  1. Run Processing Toolbox ‣ Check validity on sample_invalid with the GEOS method.
The Check validity algorithm
Check validity on the broken sample
  1. The Error output layer marks where the boundary crosses itself.
The self-intersection found by Check validity
The self-intersection marked on the broken sample
  1. Fix the error with the Vertex Tool by moving the swapped corners back into order, and delete the repeated corner. Run Check validity again until the polygon is valid.
  2. Check that the polygon has the same number of corners as the technical description.

Processing Toolbox ‣ Fix geometries makes the sample valid by splitting it into two parts at the crossing. The result is valid, but it is no longer the application area. Fix boundary errors by hand, against the technical description.

  1. Apply the guide’s rules for names, regions, and multiple municipalities or barangays.
  2. Compute the area in hectares from the polygon.
  3. Derive location attributes from reference layers.
  • Do not abbreviate names of the applicant, tenure, province, municipality/city, or barangay.
  • Write the region in Roman numerals.
  • If the area covers two or more municipalities/cities or barangays, list them alphabetically, separated only by a comma.
  • Leave X and Y blank in the area corners shapefile.

2.6. Computing the area and location attributes

Section titled “2.6. Computing the area and location attributes”

Level: Intermediate

  • A filled-in area boundary attribute table, with AREA computed in hectares and the location fields derived from the reference layers.
  1. Open the Field Calculator (Field Calculator button) on area_boundary, check Update existing field, choose AREA, and enter:
area($geometry) / 10000
Computing AREA in the Field Calculator
AREA in hectares, a number the field’s precision of 4 keeps to four decimals

$area computes the area on the project’s ellipsoid, while area($geometry) computes it on the national grid, the same plane as the technical description’s coordinates. For the sample application, $area gives 237,587.16 m² and area($geometry) gives 237,585.24 m²: a difference in the fourth decimal of the hectares. Use area($geometry) so the area agrees with the corner coordinates and the technical description.

  1. Update BARANGAY with the barangays the polygon overlaps, sorted alphabetically and joined with a comma:
array_to_string(array_sort(array_distinct(overlay_intersects('ref_barangays', "barangay", min_overlap:=1))), ',')
Computing BARANGAY in the Field Calculator
BARANGAY from the barangays the area overlaps: Batangan,Maigang

min_overlap:=1 ignores barangays that only touch the application area along its edge, or overlap it by less than one square meter.

  1. Update MUNI_CTY and PROVINCE in the same way, using the muni_city and province fields of ref_barangays:
array_to_string(array_sort(array_distinct(overlay_intersects('ref_barangays', "muni_city", min_overlap:=1))), ',')
array_to_string(array_sort(array_distinct(overlay_intersects('ref_barangays', "province", min_overlap:=1))), ',')
  1. Fill in NAME ('Bagong Gubat Agroforestry Cooperative'), TENURE ('Sustainable Forest Land Management Agreement'), and REGION ('IV-A'), then save your edits.
The completed attribute table of the area boundary
The completed attributes of the area boundary

AREA is a Double, in hectares, and the field’s precision of 4 keeps it to four decimals. Sample maps in circulation show areas with two to six decimal places. Confirm with your reviewing office how many decimal places AREA should carry, and change the 4 in the field’s precision and in the map’s area label accordingly.

If the application involves multiple parcels:

  • put all parcels in one polygon shapefile, one feature per parcel, and
  • create one point shapefile per parcel, each with its own corner numbering.

Quizzes

The quizzes are on BNHR Quizzes and count toward nothing. Learning on your own, a quiz opens as the self-paced one; while a training runs, it asks which training you are in.

Saved in this browser only

Certification and support

We offer additional resources, certificates, official QGIS certification, ongoing support, and other perks to those who join our instructor-led training.

Join an upcoming training to take this as an instructor-led course, or contact us to arrange one for your team or organization.

Something new

Identify results
LayerDid you know?
TopicOpen source
FactSteve Coast founded OpenStreetMap in 2004. Its first contribution was a street he entered on December 10, 2004, after cycling around London's Regent's Park with a GPS receiver.
SourceHistory of OpenStreetMap (OpenStreetMap Wiki) (opens in a new tab) ↗
LinkShare this fact