README.md (4751B)
1 # Profile Interpreter 2 3 A QGIS 3.40+ plugin for placing 3D interpretation points by clicking directly 4 on the **Elevation Profile** view. 5 6 It is data-agnostic: use it to digitize geological boundaries, borehole picks, 7 geophysical layer tops, or any other interpretation on a profile/cross-section 8 view — for example the profiles produced by the 9 [TEM Loader](https://gitlab.com/qgeomodel/qgis-tem-loader) plugin. 10 11 ## How it works 12 13 When you click on the elevation profile, the plugin converts the click into a 14 real-world 3D coordinate: 15 16 ``` 17 click position (canvas pixels) 18 -> QgsElevationProfileCanvas.canvasPointToPlotPoint() 19 -> QgsProfilePoint(distance_along_section, elevation) 20 -> interpolate X/Y along the profile curve at `distance` 21 -> QgsPoint(x, y, z = elevation) -> PointZ feature 22 ``` 23 24 The clicked vertical position becomes the feature's elevation (Z), and the 25 horizontal position is mapped back to a true map X/Y along the cross-section 26 line. If the **active layer** is an editable PointZ vector layer, clicked points land 27 there (only the fields that already exist are written; the schema is never 28 altered). Otherwise points are stored in a memory layer named 29 **Profile interpretations** with `id`, `distance`, and `elevation` fields. 30 31 ## Requirements 32 33 - QGIS 3.40.0 or later (QGIS 4.x is also supported) 34 - Python 3 (bundled with QGIS) 35 36 ## Installation 37 38 1. Build the zip: `make package`. 39 2. In QGIS: **Plugins > Manage and Install Plugins > Install from ZIP**. 40 3. Select `profile_interpreter.zip` and click **Install Plugin**. 41 42 ## Usage 43 44 1. Load data that supports elevation profiles (e.g. TEM Loader layers). 45 2. Open the profile panel: **View > Elevation Profile**, then draw a profile 46 line across your data so the section renders. 47 3. Toggle **Interpret on Profile** (toolbar button or **Plugins > Profile 48 Interpreter**) on. 49 4. Click on the profile where you interpret a boundary. A PointZ feature is 50 added to the active layer (if it is a writable PointZ layer) or to the 51 fallback **Profile interpretations** memory layer. The point's X/Y/Z is 52 printed to the Python console and shown in the message bar. 53 5. To remove the point you just placed, click **Undo Point**. While the tool is 54 on, this button is added to the Elevation Profile panel's own toolbar; it is 55 always available under **Plugins > Profile Interpreter** as well, and stays 56 disabled until you have placed at least one point. Repeated clicks walk back 57 through the points in reverse order. 58 6. To move a point, check **Edit Point**, click the point (it is selected), then 59 click its new position. Its `distance` and `elevation` fields are updated if 60 the layer has them. Right-click or uncheck **Edit Point** to cancel a 61 selection. 62 7. To remove a point, check **Delete Point** and click the point. 63 8. **Edit Point** and **Delete Point** sit next to **Undo Point** on the panel 64 toolbar and in the plugin menu. Only one of them can be checked at a time; 65 with neither checked, clicks add points. A point counts as clicked when it is 66 drawn within 10 pixels of the cursor. 67 9. Toggle the tool off to return to normal pan/zoom on the profile. 68 69 # Limitations 70 71 - When no active PointZ layer is set, interpretation points are stored in an 72 in-memory fallback layer only; there is no GeoPackage persistence or 73 per-boundary classification. 74 - The plugin grabs the profile canvas by walking the Qt widget tree 75 (`findChildren(QgsElevationProfileCanvas)`); there is no official PyQGIS 76 accessor. With multiple profile docks open it picks the first visible one. 77 - **Undo Point** only walks back points placed in the current QGIS session, in 78 reverse order; it does not participate in QGIS's own undo stack (points are 79 written straight to the data provider, not through an edit buffer). 80 - Moving and deleting points cannot be undone. **Undo Point** skips deleted 81 points; undoing after moving a point deletes the moved point. 82 - **Edit Point** and **Delete Point** only search the layer new points go to 83 (the active PointZ layer, otherwise the fallback memory layer). Selecting a 84 point for editing replaces that layer's current selection. 85 - The panel buttons are placed on the profile panel by locating the 86 panel's toolbar in the Qt widget tree. If a QGIS build lays the panel out 87 differently, the buttons are silently omitted there and remain in the plugin 88 menu. 89 - No snapping configuration UI; snapping is left to the user's QGIS settings. 90 91 ## Development 92 93 ```sh 94 make lint # run flake8 95 make test # run unit tests (no QGIS required) 96 make verify # lint + test (what CI runs) 97 make package # build profile_interpreter.zip for installation 98 make clean # remove the zip 99 ``` 100 101 ## License 102 103 ISC: see [LICENSE](LICENSE).