# This file contains metadata for your plugin.

# This file should be included when you package your plugin.# Mandatory items:

[general]
name=geol_qmaps
qgisMinimumVersion=3.30.0
qgisMaximumVersion=4.99
description=The geol_qmaps plugin facilitates legacy field data import, fieldwork preparation and post-fieldwork processing using the GEOL-QMAPS QGIS mapping template developed by the WAXI Team. 
version=3.2.2
author=Julien Perret, Mark Jessell and Eliott Betend (Centre for Exploration Targeting, University of Western Australia)
email=julien.perret@uwa.edu.au

about= The geol_qmaps plugin facilitates legacy field data import, fieldwork preparation and post-fieldwork processing using the GEOL-QMAPS QGIS mapping template developed by the WAXI Team. 

tracker=https://github.com/swaxi/WAXI_QF/issues
repository=https://github.com/swaxi/WAXI_QF
# End of mandatory metadata

# Recommended items:

hasProcessingProvider=no
# Uncomment the following line and add your changelog:
changelog=3.2.2
     3.2.2 2026-10
       **GEOL-QMAPS Template v3.2.2 Compatibility**
       * Updated code to match the template's reference CSV files being renamed (no more "_WAXI4" suffix): columns_reference_WAXI4.csv -> columns_reference.csv, columns_reference_fieldnames_aliases_WAXI4.csv -> columns_reference_fieldnames_aliases.csv, and the (currently unused/commented-out) reference to columns_types_structures_WAXI4.csv -> columns_types_structures.csv.
       * Fixed three stale pre-v3.2.1 field names left over in the template's own columns_reference.csv and columns_reference_fieldnames_aliases.csv, which map real GeoPackage field names on CURRENT_MISSION/COMPILATION layers to their standard alias/description for the Import Legacy Field Data tool: Struct_Tec -> Strain_Pattern, Metamorphi -> Index_Minerals, Reliabilit -> Confidence_Index (the gpkg schema itself is unchanged between v3.2.1 and v3.2.2; these two reference files had simply never been updated when those fields were renamed in v3.2.1).
       * A later v3.2.2 revision renamed four more fields to align the odd ones out with the name already used everywhere else: Dikes-Sills_PT/Lithology zones_PG's Lithology -> Litho, Dikes-Sills_PT's Strain_Intensity -> Def_int, Density_PT's Stratigraphic_Unit -> Stratigraphy, and Planar structures_LN's Nature -> Reliability. Updated the two existing FIELD_RENAME_RULES entries for Strain_Intensity/Stratigraphic_Unit to chain through to their new v3.2.2 target field via their v3.2.1 name as an extra historical candidate, and added two new rules for Lithology->Litho and Nature->Reliability, so Rejig and Merge Projects keep carrying a project's data over correctly regardless of which of these naming generations it was created under. The Import Legacy Field Data tool needed no code change, since it already reads field names dynamically from the layer rather than hard-coding them; as a side effect it now also correctly recognises Dikes-Sills_PT/Lithology zones_PG's lithology column on import, since columns_reference_fieldnames_aliases.csv only ever had an entry for "Litho", never "Lithology".
       * Replaced GEOL-QMAPS_v3.2.1_data_dictionary.xlsx with the updated GEOL-QMAPS_v3.2.2_data_dictionary.xlsx (verified to already reflect all of the above field names) and updated both README links to it.
       **Audit of All Tools Against the Current Schema**
       * Fixed the Merge Layers tool (Step 4 of Import Legacy Field Data) copying feature attributes by column position rather than by name, the same class of bug already fixed in Merge Projects/append_gpkg: a scratch layer generated by Step 3 and a Compilation_ layer can drift out of field-order sync if the project is rejigged between generating the scratch layer and merging it, which would have silently written values into the wrong fields. It now matches attributes by name, with the same FIELD_RENAME_RULES fallback used by Rejig and Merge Projects.
       * Fixed the Create Virtual Stops tool reading COMPILATION.gpkg from whichever project was active the last time the plugin dock was (re)opened rather than the one currently active (the same stale-project pattern already fixed in Export Compilation Layers to Common Themes); it now resolves the path fresh from the currently active project each time it runs.
       * Re-audited every other tool (Clip, Save Style Template, Remove Duplicate UUIDs, Sync QField to QGIS, FieldMove Import, Edit Dictionaries, Set User by Default) against the current schema: none hard-code any of the field names renamed in v3.2.1/v3.2.2, since they all read field names dynamically from the layer rather than hard-coding them.
       **Dependencies & QGIS 4 (Qt6)**
       * requirements.txt now declares minimum versions only, harmonised with the Stereoplot and Geochemistry Plotting Tools plugins (numpy>=1.21 ; scipy>=1.7 ; pandas>=1.3, plus the unversioned Pillow, fiona, defusedxml, rapidfuzz and fuzzywuzzy). The previous upper caps (numpy<2.0, pandas<3.0) conflicted with the numpy 2.x / pandas 3.x that QGIS 3.44 and QGIS 4 ship, making qpip install older duplicate copies that shadow QGIS's own packages (which can break QGIS's GDAL bindings). The floors are the oldest versions the plugin actually needs (it only uses basic pandas I/O/DataFrame features and scipy.spatial.distance.euclidean), so qpip never replaces the packages QGIS ships. Removed the unused "packaging" entry (the plugin never imports it).
       * Fixed the plugin panel failing to open under QGIS 4 (Qt6/PyQt6): the Python-generated dock widget used unscoped Qt enum values (Qt.AlignRight, Qt.AlignVCenter, Qt.ScrollBarAsNeeded, Qt.ScrollBarAlwaysOn, QFrame.VLine, QFrame.NoFrame), which PyQt6 no longer accepts; they are now fully scoped (Qt.AlignmentFlag.AlignRight, QFrame.Shape.VLine ...), which works on both Qt5 and Qt6. Same fix for the two folder pickers of the Sync QField to QGIS tool (QFileDialog.Option.ShowDirsOnly / ReadOnly).
       * Removed the remaining runtime "sys.executable -m pip install" calls - for fiona/fuzzywuzzy in the plugin's constructor (i.e. at every QGIS start-up) and the defusedxml import fallback - which could hang QGIS the same way as the start-up dependency check removed in 3.2.1 (on QGIS's bundled Python, sys.executable is the QGIS executable itself, so they launched a second QGIS instance). Dependencies are installed by qpip from requirements.txt; fuzzywuzzy and defusedxml are also bundled in biblio_Python, and a missing fiona is now reported in the QGIS log instead.
       * Checked QGIS 4 readiness: QGIS 4 only uses qgisMaximumVersion (4.99) to decide compatibility, and the supportsQt6 flag is obsolete (removed from QGIS core), so it stays out of metadata.txt. A static check of the whole plugin against PyQt6 found no other unscoped enums, removed classes or removed methods.
     
     3.2.1 2026-10
       **Fixed QGIS Hang on Plugin Load (Windows/macOS)**
       * Removed the startup dependency check that shelled out to "sys.executable -m pip install --upgrade -r requirements.txt" whenever scipy was below 1.17.0. On QGIS's bundled Python, sys.executable is the QGIS executable itself (not python.exe), so that command launched a second QGIS instance instead of running pip; the first QGIS then hung on the main thread waiting for it to close, with no timeout, and the command's exit code was never checked, so the "dependencies updated" message shown afterwards was misleading in every case (pip never ran).
       * Lowered the scipy requirement from ">=1.17.0,<1.18" to ">=1.10", so the plugin's own check no longer fails against the scipy version QGIS itself bundles (e.g. 1.13.0 on QGIS 3.42). The plugin only ever used scipy.spatial.distance.euclidean (in the DBSCAN-based Create Virtual Stops tool); the tighter pin reflected alignment with the Stereoplot/Geochemistry Plotting Tools plugins' own numpy pin, not an actual GEOL-QMAPS requirement, and those two plugins don't depend on scipy at all.
       * Removed an unused "from scipy.spatial.distance import cdist" top-level import (cdist was imported but never called), so scipy is no longer imported at plugin load at all; it is now only imported lazily inside the Create Virtual Stops tool, where it was already being used.
       * Set plugin_dependencies=qpip in metadata.txt so the QGIS Plugin Manager can offer to install qpip automatically when installing GEOL-QMAPS, instead of relying solely on the manual step described in the README.
       * Fixed the Rejig tool failing with "Could not locate a QGIS_TEMPLATE folder" when updating a second project in a parent folder that already contains the latest template (left over from updating a first project there): the extracted template folder was located by diffing the parent folder's contents before/after extraction, so an already-present copy was wrongly treated as "nothing new"; it is now located directly from the downloaded archive's own top-level folder name, which works whether or not that folder already existed.
       * Fixed the Edit Dictionaries / Set User by Default tools leaving newly added (or deleted) dictionary items invisible to other layers' ValueRelation dropdowns: reload_csv() used to just call dataProvider().reloadData() on the one layer object passed in, which does not reliably pick up a table that a separate fiona/GDAL connection just dropped and recreated on disk (e.g. a brand new default User showed unresolved in curly braces on new features, because the "General // List of Users" layer that other layers' ValueRelation widgets query was still showing its pre-edit content even though the CSV/table itself, and the Edit Dictionaries delete dropdown which reads it fresh each time, already had the new entry). reload_csv() now forces a genuinely fresh read and refreshes every loaded layer sharing that name in place (not just the first match), since ValueRelation widgets are bound to layers by id, and a project can end up with more than one layer sharing a name after a merge or rejig.
       * Fixed the Synchronise QField to QGIS tool rejecting a QField package whose project file QFieldSync had written as .qgz instead of .qgs (it could produce either depending on its own settings/version): the package root used to be located by finding a .qgs file (never actually opened/read, just used to locate CURRENT_MISSION.gpkg relative to it), so a .qgz-based package falsely failed with "No .qgs project file found". The package root is now located directly from CURRENT_MISSION.gpkg itself, removing the dependency on the project file's format entirely.
       * Fixed the Export Compilation Layers to Common Themes tool always exporting data from whichever GEOL-QMAPS project was active the last time the plugin dock was (re)opened - typically the first one in the QGIS session - rather than the project currently active, if the user had since switched to a different one without reopening the plugin. The export's COMPILATION.gpkg path is now resolved fresh from the currently active project each time the tool runs.
       * Removed a redundant step in the same tool that re-wrote the "Layer" attribute on every feature of every CURRENT_MISSION layer before exporting: that field is already native to the GEOL-QMAPS schema and already populated when each feature is created, and in any case this step touched the CURRENT_MISSION layers, not the Compilation_ layers actually merged into the export, so it had no effect on the exported output - only an unnecessary edit/commit to the user's live field data on every export.
       * Removed an empty "export" layer with no features that the same tool always left behind in the output GeoPackage: a step meant to bootstrap/create export.gpkg before merging the real data into it wrote an empty memory layer in first, which GDAL's GPKG driver named after the output file (export.gpkg -> "export") since no explicit layer name was set. Each named merge table (zonal_data, litho_data, ...) already creates the GeoPackage itself on first write, so the bootstrap step was unnecessary; export.gpkg is now also deleted first if a previous run already created one, so a stale "export" layer from before this fix doesn't linger either.
       * Thanks to the user who reported this with a detailed py-spy stack trace and root-cause analysis.
       **GEOL-QMAPS Template v3.2.1 Compatibility**
       * Renamed the Photographs_PT / Compilation_Photographs_PT "Azimut" field references to "Azimuth" throughout the plugin (image-direction map tip, the EXIF-to-Azimuth tool, and the in-memory photo layer built by the FieldMove import), matching the field rename made in GEOL-QMAPS template v3.2.1
       * Made the photo-layer map tip detect the Azimuth field dynamically instead of assuming it exists, since the same map tip is also applied to Sampling_PT/Compilation_Sampling_PT layers, which have no Azimuth field
       * Replaced the hard-coded Zenodo template download URL/version and extracted-folder name in the Rejig tool with dynamic resolution via GEOL-QMAPS' stable Zenodo "concept" record, so the tool automatically follows whichever template release is currently latest (past and future) without requiring a plugin code change at every template release
       **Import Tool Fix**
       * Fixed Step 3 (Generate QGIS Layers) of the Import Legacy Field Data tool silently generating no scratch layers at all: UUID hashing relied on the "Existing databases - raw data" column being encountered before "UUID" while looping over fields in schema order, but the template's actual field order has UUID first on every layer, so the hash was referenced before assignment (NameError) on every single row, silently dropping it. The hash and parsed value are now computed once per row from their column directly, independent of field order.
       **Copyright Notice**
       * Updated the copyright notice shown across the plugin windows to "2026 Centre for Exploration Targeting, School of Earth and Oceans, University of Western Australia. All Rights Reserved."
       **Cross-Version Field-Rename Awareness (Rejig & Merge Projects)**
       * Fixed the Rejig tool silently dropping a field's data when migrating an older project to the latest template if that field had since been renamed (e.g. Azimut/Reliabilit/Metamorphi/Deformatio/Stratigrap/Struct_Tec/Struc_Tect/Texture/DipDir/Width_mm): feature copying now falls back to the field's known historical name(s) whenever the current name doesn't exist on the source feature, so the value still carries over
       * Fixed the Merge Projects tool copying feature attributes by column *position* rather than by name, which could silently misassign values into the wrong field whenever the two projects' GeoPackages came from different template versions with different column layouts; attributes are now matched by name (with the same rename-aware fallback as Rejig)
       * Introduced a single shared, documented table of known historical field renames (FIELD_RENAME_RULES) used by both tools, making it straightforward to add future renames in one place
       * Reviewed the full template field/layer schema against the plugin's hard-coded field-name references; confirmed all other v3.2.1 field renames (Reliabilit->Confidence_Index/Reliability, Metamorphi->Index_Minerals, Deformatio->Strain_Intensity, Stratigrap->Stratigraphic_Unit, Struct_Tec/Struc_Tect/Texture->Strain_Pattern, DipDir->Dip_Dir, Width_mm->Width_m on Dikes-Sills_PT) require no further plugin code changes beyond the above
     
     3.2.0.2 2026-08
       * Fixed a crash in the Sync QField to QGIS tool caused by the temporary-directory variable not being initialized on some early-return paths.
       * Improved robustness of QField package sync validation on macOS and Windows.
       * Improved photograph path updates for the CURRENT_MISSION and COMPILATION photograph layers so the Source and Full_Path attributes stay consistent with map tips.
       **Dependency Harmonisation & Qt6 Fixes**
       * Harmonised numpy/scipy/pandas version constraints in Requirements.txt with the Stereoplot and Geochemistry Plotting Tools plugins, so installing all three on the same QGIS Python environment converges on one mutually compatible dependency set instead of drifting on install order (scipy>=1.17.0,<1.18 ; pandas>=1.5.0,<3.0 ; numpy>=1.26.4,<2.0)
       * Declared the previously undeclared rapidfuzz dependency (used as the preferred fuzzy-matching backend, with an existing fallback to fuzzywuzzy/difflib)
       * Fixed a NameError crash in ppigrf.py's get_legendre() caused by an undefined float64 reference
       * Fixed a broken defusedxml fallback path that referenced a non-existent module and would have raised ModuleNotFoundError if the primary import and the pip-install-then-reimport attempt both failed
       * Aligned the internal scipy auto-upgrade version check with the new Requirements.txt floor (was checking against an older, inconsistent floor)
       * Fixed a Qt6/QGIS4 compatibility bug: QAction is now imported with a Qt5/Qt6-safe fallback (previously imported only from QtWidgets, which raises ImportError under Qt6 since QAction moved to QtGui)
     
     3.2.0.1 2026-07
       * Updated and completed Requirements.txt
       * Optimisation and bug fixes for the Set User By Default tool
       * Fixed the Edit Dictionaries tool
       * General code security and robustness improvements
     
     3.2.0 2026-06
       **GUI Improvements**
       * Replaced the legacy .ui-based dockwidget with a fully Python-generated interface
       * Improved compatibility with Qt6 and future QGIS releases
       * Corrected multiple widget alignment and display issues
       * Improved layout consistency across plugin tabs
       * Harmonised button and tooltip styling
       **Functional Changes**
       * Removed the Stereographic Projection Settings tool from the Data Management tab, as this functionality is now handled directly by the latest qgis-stereonet plugin through its embedded control button
       * Updated the Rejig tool to apply layer styles and configuration from the regenerated FIELD_DATA.qlr to the copied project, ensuring template style updates are reflected when opening the rejigged project
       * Preserved the existing project structure, layer hierarchy, layer IDs, loaded layers, and map themes by updating layer styling in-place rather than replacing the FIELD DATA group
       * Updated the Archive Current Field Data tool for better handling of photographs
       **Documentation**
       * Updated README documentation to reflect the revised plugin architecture and stereonet workflow
    
    3.1.5 2025-11
      * Supports QT6
      **Bug Fixes & Functional Improvements**  
      * **Import tool**:  
      ** Fixed bug affecting import of data if a geometry column exists in the imported shapefile and in the absence of a kinematics column for structural data.
      ** Fixed bug with multiple display of warning boxes
      **New Functionalities**  
      * New **QField Compass Tool** to use your mobile device as a geological compass in QField, with autoloading of structural information  
      * New **QField Stereonet Tool** to plot structural measurements in a lower-hemisphere stereonet on the fly in QField 
    
    3.1.4 2025-08
      * Updated the plugin to support retrieval of the latest version (v3.1.4) from the Zenodo repository  
      * Improved compatibility checks: added warnings or approval messages when opening the plugin against different template versions  
      * Implemented pre- and postflight checks to detect excessively long filenames (≥256 characters) that may trigger Python errors on Windows; applied to the following tools: Rejig, Clip, Merge, Save QLR, Export, and SyncQFieldToQGIS  
      * Harmonised and improved tooltips across all plugin buttons  
      * Refined behaviour of “Reset Window” buttons  
      * Minor GUI improvements  
      * Corrected links in the Help tab
      **Bug Fixes & Functional Improvements**  
      * **Merge Projects tool**:  
      ** Fixed bug affecting merging of projects with modified names (e.g., subsets of a master project)  
      ** Automatically generates merged project filename based on shared name substrings (≥5 characters); defaults to `Merged.qgz` otherwise  
      * **Clip tool**:  
      ** Automatically generates the list of project folders to copy, removing reliance on the hard-coded `cp_dirs` list  
      * **Save Style Template tool**:  
      **Resolved bug affecting the saving process  
      * **Photograph Management tool**:  
      ** EXIF data is now correctly retrieved and written to the Image Direction field (logic block fixed)  
      * **Import FieldMove Project tool**:  
      ** Now creates a dedicated subfolder to store generated scratch layers  
      **Shapefile Import Tool – Enhancements**  
      * Created subfolders for scratch layer outputs  
      * Fixed issue when importing legacy data lacking lithological information  
      * Added management of structural lineations  
      * Improved warning messages  
      **New Functionalities**  
      * **New tool in the Data Management tab** to synchronise a QField package (ZIP or folder) to the GEOL-QMAPS QGIS master project (creates a local copy)  
      * **New tool in the Data Management tab** to update the current GEOL-QMAPS QGIS project to the latest version of the template hosted on Zenodo  
    
    3.1.3 2025-04
      **Updated import tool**
      * add tester code for non-import functionality
      * GUI tweaks


# Tags are comma separated with spaces allowed
tags=Digital Geological Mapping, Legacy Field Data Import, FieldWork Preparation, Post-Field Processing, West Africa Exploration Initiative, QField

homepage=https://github.com/swaxi/WAXI_QF
category=Plugins
icon=icon.png
# experimental flag
experimental=False

# deprecated flag (applies to the whole plugin, not just a single version)
deprecated=False

# Since QGIS 3.8, a comma separated list of plugins to be installed
# (or upgraded) can be specified.
# Check the documentation for more information.
plugin_dependencies=qpip

# Category of the plugin: Raster, Vector, Database or Web
# category=

# If the plugin can run on QGIS Server.
server=False
