๐บ Triangle Widget
Available from v2.0.0
The Triangle Widget is a powerful tool within QGIS designed for constructing triangles from a known baseline and two side lengths. ๐ This widget is indispensable for land surveying, particularly in FMB (Field Measurement Book) workflows, where plots are often demarcated using triangulation.
It is available as a tab within the Plotter tool.
๐ง Key Featuresโ
-
๐ Flexible Unit Conversion
- Meters
- Metric Links (1 = 0.2 meters)
- Gunterโs Links (1 = 0.201168 meters)
- Feet (1 = 0.3048 meters)
- Yards (1 = 0.9144 meters)
-
๐ฑ๏ธ Interactive Baseline Definition
- Two-Point Selection: Select two points directly on the QGIS map canvas.
- Fixed-Length Baseline: After selecting the first point, press the
Lkey to define a precise baseline length and unit, then click on the canvas to set its direction. - Supports snapping for precise point placement.
-
๐ Triangle Construction
- Define the lengths of the two sides extending from the baseline.
- Choose the triangleโs orientation (
LeftorRightof the baseline).
-
๐๏ธ Live Preview
- A real-time rubber band preview of the triangle is displayed on the map as you adjust the lengths and orientation.
-
๐๏ธ Memory Layer Integration
- The final triangle is drawn on a new or existing memory layer named "Triangle Lines".
-
๐ก๏ธ Robust Error Handling
- Prevents the creation of invalid triangles by checking the triangle inequality theorem.
- Provides clear, interactive feedback via a status label.
๐ How to Use the Triangle Widgetโ
๐ช Step 1: Launch the Widgetโ
- Open QGIS.
- From the main tool panel, open the Plotter tool.
- Select the Triangle tab.
๐ Step 2: Define the Baselineโ
You have two ways to define the baseline:
Option A: Interactively Select Two Pointsโ
- Click the Select Points button. The button will change to "Selecting..." and a status message will guide you.
- Click two points on the map canvas to define the baseline.
- The first point will be marked in green (๐ข).
- The second point will be marked in red (๐ด).
- A solid blue line will show the final baseline.
โน๏ธ Use snapping for higher accuracy. You can right-click at any time to reset the point selection.
Option B: Use a Fixed Lengthโ
- Click the Select Points button.
- Click the first point on the map canvas (the green point ๐ข).
- Press the
Lkey on your keyboard. A dialog will appear. - Enter the desired Length for the baseline and select the Unit. Click OK.
- Move your mouse on the canvas to orient the baseline. A dashed line will show the preview.
- Click a second time to set the direction and finalize the baseline's end point (the red point ๐ด).
๐ ๏ธ Step 3: Configure Inputsโ
๐ a. Lengthsโ
- ๐ข Start Side Length: Enter the length of the side originating from the first (green) point.
- ๐ด End Side Length: Enter the length of the side originating from the second (red) point.
๐งญ b. Orientationโ
Choose the direction to draw the triangle relative to the baseline:
LeftRight
๐ฃ c. Unitsโ
Choose the measurement unit for the side lengths. This can be different from the unit used for the baseline.
MetersMetric LinksGunterโs LinksFeetYards
๐งฉ Step 4: Draw the Triangleโ
- Click Draw Triangle โถ๏ธ
- The tool calculates the apex and draws the three sides of the triangle on a memory layer named "Triangle Lines".
๐บ๏ธ Step 5: Visualize the Resultโ
The newly created triangle will appear on the map. The "Triangle Lines" layer will contain three line features representing the sides of the triangle ("Base Line", "Start Side", "End Side").
๐๏ธ Step 6: Clear Pointsโ
- Click the Clear Points button to remove the selected baseline and reset the tool for a new operation.
โ ๏ธ Error Messages & Troubleshootingโ
| โ Error Message | ๐ก Cause | โ Solution |
|---|---|---|
| "Please select two points first." | "Draw Triangle" was clicked before a baseline was defined. | Use the "Select Points" button to define the baseline. |
| "No active layer to determine CRS." | No layer is active in the Layers panel. | Select or activate a layer in your project to provide a Coordinate Reference System. |
| "Invalid side lengths. Triangle cannot be formed." | The entered side lengths violate the triangle inequality theorem. | Adjust the side lengths to form a valid triangle. |
| "Second point must be different from first point." | The start and end points of the baseline are the same. | Ensure the two selected points for the baseline are in different locations. |
๐ Best Practicesโ
- โ๏ธ Use snapping to ensure the baseline aligns perfectly with existing features.
- โจ๏ธ Press the
Lkey when you need to create a baseline of a precise, known length. - ๐ Double-check your units to match the project's requirements.
- ๐๏ธ Use the live preview to visualize the triangle before drawing.
- ๐พ If you need to keep the generated triangle, right-click the "Triangle Lines" memory layer and choose Export > Save Features As... to save it to a permanent file (e.g., Shapefile, GeoPackage).
๐ Example Use Caseโ
๐บ๏ธ Scenario: You need to plot a triangular parcel of land. You have a known baseline on your map, and the other two sides are 30m and 40m.
- Click Select Points and click the two ends of the baseline on the map.
- Set ๐ข Start Side Length to
30. - Set ๐ด End Side Length to
40. - Set Orientation to
Right. - Set Units to
Meters. - Click Draw Triangle.
๐งฎ Result: A new triangle is drawn on the "Triangle Lines" layer, with the apex 30m from the start point and 40m from the end point, on the right side of the baseline.
๐ The Triangle Widget simplifies the creation of triangulated geometries, making it an essential tool for accurate and efficient cadastral mapping and survey data processing. ๐บ๏ธ๐