Run Analysis
The Run Analysis tool performs comprehensive boundary topology and discrepancy detection across LGU and PSA polygon layers and building points. It first resolves a single authoritative boundary per city/municipality — deduplicating repeated submissions, giving precedence to the LGU's latest submission over the PSA reference, and labeling every remaining non-LGU polygon's source as PSA — then consolidates all Gaps/Overlaps/Disputed findings against that boundary into a unified Reference MBI layer named ref_mbi_cases.
Access
- Processing Toolbox: GMD Pipeline → 1Map → Run Analysis
- Algorithm ID:
gmd_pipeline:run_analysis
When to Use
Use this tool when:
- Establishing the baseline Reference MBI cases layer (
ref_mbi_cases) for a municipality or province. - Generating the required reference input layer consumed by the MBI Validator tool.
- Resolving LGU vs PSA boundary precedence: the LGU layer is treated as the latest submission, so any city/municipality with at least one LGU polygon uses LGU boundaries exclusively; a city/municipality with no LGU submission falls back to PSA.
- Cleaning up duplicate boundary submissions (the same barangay digitized twice, or the same area present in more than one selected input layer) before they can produce false gap/overlap findings.
- Detecting sliver gaps between adjacent barangay polygons while automatically excluding already-recorded disputed territories.
- Identifying boundary overlaps across different administrative levels (Inter-Region, Inter-Province, Inter-City/Municipality, Inter-Barangay, or Within-Barangay).
- Extracting contested boundary claims tagged as disputed in LGU datasets.
- Setting up pre-configured attribute table dropdown widgets (
ValueMapformbi_status) for provincial field validation.
Parameters
Inputs
| Parameter | Type | Description |
|---|---|---|
| Select Polygon Layer(s) | Multiple Layers (Polygon) | One or more vector polygon layers representing barangay boundaries from LGU and PSA datasets. Required. |
| Select Building Point Layer(s) | Multiple Layers (Point) | One or more point layers representing structures/buildings used to count intersecting points within each finding. Required. |
Fixed Analysis Execution
All three boundary analyses (Gaps, Overlaps, and Disputed Areas) execute automatically as mandatory procedures. No manual analysis mode parameter is required.
Outputs
| Output | Type | Description |
|---|---|---|
| 2026_province_boundary | Vector Layer (MultiPolygon, In-Memory) | The resolved authoritative boundary set in EPSG:4326: rows sharing a geocode merged into one multipart feature, LGU polygons kept wherever an LGU submission exists for a city_mun (its PSA counterpart excluded), and every remaining non-LGU polygon explicitly labeled source = PSA. One row per geocode per source, with islets retained as parts of their barangay. Detection below runs on a single-part working copy of this same boundary. |
| ref_mbi_cases | Feature Sink (Polygon) | A consolidated polygon layer in EPSG:4326 containing all detected boundary findings categorized by mbi_type. Formatted with pre-configured attribute table editor widgets. |
Output Layer Schema
The resulting ref_mbi_cases layer contains the following standardized attributes:
| Field Name | Type | Access | Description |
|---|---|---|---|
| case_uuid | String | Read-Only | Unique UUID string assigned to each individual finding. |
| geocode | String | Editable | 9-digit PSGC geocode associated with the primary reference polygon. |
| region | String | Read-Only | Region name or code. |
| province | String | Read-Only | Province name. |
| city_mun | String | Editable | City or municipality name. |
| barangay | String | Editable | Barangay name. |
| source | String | Read-Only | Data source provenance label (e.g. LGU or PSA; NULL for gaps). |
| mbi_level | String | Read-Only | Administrative boundary hierarchy level: Inter-Region, Inter-Province, Inter-City/Municipality, Inter-Barangay, or Within-Barangay. |
| involved_areas | String | Read-Only | Comma-separated list of all involved PSGC geocodes. |
| involved_bgys | String | Read-Only | Semicolon-separated list of all involved barangay and city/municipality names. |
| count_involved_areas | Integer | Read-Only | Total count of distinct administrative units participating in the finding. |
| mbi_type | String | Read-Only | Classification category: 1_Gap, 2_Overlap, or 3_Disputed. |
| num_bldg_pts | Integer | Read-Only | Count of intersecting building points falling within the finding polygon. |
| mbi_status | String | Editable | Status field equipped with a QGIS ValueMap dropdown widget: 1_Updated or 2_Pending. |
| mbi_remarks | String | Read-Only | System remarks populated automatically when an overlap touches a disputed polygon (For Review - Involves Disputed Area). |
| pso_remarks | String | Editable | Text field reserved for notes entered by Provincial Statistical Offices. |
| lgu_bgy_name | String | Editable | LGU-declared barangay name populated specifically for Disputed records (NULL for gaps/overlaps). |
How It Works
Layer Pre-Processing and Coordinate Normalization:
- Multiple input polygon and building point layers are refactored, merged, and projected to Web Mercator (
EPSG:3857) for accurate metric area calculations and geometric topological operations. - Geometries are validated and repaired using geometry fixing algorithms. Multipart geometries are deliberately not exploded at this stage — the boundary is resolved and published first, so a barangay with an islet stays a single feature.
- Multiple input polygon and building point layers are refactored, merged, and projected to Web Mercator (
Merging Rows That Share a Geocode:
- Every feature sharing a
geocode+sourceis merged into one multipart feature, sogeocodeis unique per source in the published boundary. - Rows share a geocode for two different reasons, and the union handles both: a barangay submitted twice produces overlapping rows, whose union is that same area (nothing is double-counted even if the two submissions were digitized slightly differently); a barangay whose islet was stored as its own row produces disjoint rows, whose union keeps the islet as a second part instead of discarding it.
sourcestays in the key because LGU and PSA carry the same geocode for the same barangay — merging them here would pre-empt the precedence rule below.
- Every feature sharing a
Boundary Precedence Resolution:
- The LGU layer is treated as the latest submission. For every
city_munwhere at least one polygon'ssourcecontainsLGU, that city_mun's PSA polygon(s) are excluded and only the LGU polygon(s) are kept. - A
city_munwith no LGU submission at all falls back to using its PSA polygon(s) unchanged. - Every non-LGU polygon that survives this step then has its
sourceattribute explicitly set toPSA(overwriting a blank/NULL/other value), so downstream findings never carry an ambiguous source label. - The resolved boundary is repaired with
native:fixgeometriesbefore anything else happens to it, since merging rows by geocode unions geometries together and can leave a self-intersection behind. Both the published layer and the detection working copy inherit the repaired version. - The resulting authoritative set is reprojected to
EPSG:4326and published as 2026_province_boundary with multipart barangays intact — one row per geocode per source, so de-duplicating the table by geocode can never delete an islet.
- The LGU layer is treated as the latest submission. For every
Spatial Indexing & Attribute Extraction:
- A separate single-part working copy of the resolved boundary is produced with
multiparttosingleparts, used only by the detection steps below — it never reaches the published layer. - Spatial bounding box indexes (
QgsSpatialIndex) and cached feature lookups are constructed for both that working copy and the building points. - Core administrative attributes (
geocode,region,province,city_mun,barangay,boundary,source) are normalized into structured lookup records.
- A separate single-part working copy of the resolved boundary is produced with
Disputed Territory Identification:
- Polygons tagged with
boundary = Contestedor disputed markers are isolated. - Each contested area is converted to
3_Disputedin the output schema and its footprint is unioned in memory.
- Polygons tagged with
Overlap Detection Engine:
- Pairs of intersecting polygons are detected using the spatial index.
- The geometric intersection is computed, filtered to retain polygons with areas greater than 0.10 square meters, and tagged with administrative level hierarchy (
mbi_level). - If either overlapping polygon is marked as disputed,
mbi_remarksis automatically populated withFor Review - Involves Disputed Area. - Intersecting building points within the overlap polygon are tallied into
num_bldg_pts.
Gap Detection Engine:
- Non-disputed boundary polygons are dissolved into a unified regional coverage.
- Holes within the dissolved polygon coverage are filled, and a symmetric difference is computed between the filled coverage and the original dissolved coverage to extract internal void slivers.
- The unioned footprint of all Disputed territories is subtracted from the candidate gap geometries, ensuring that contested territories are never duplicated as gaps.
- Qualifying gap slivers are linked to adjacent participating barangays and assigned
mbi_type=1_Gap.
Output Layer Generation, Styling & Editor Widget Application:
- All findings are transformed to WGS 84 (
EPSG:4326) and added to the consolidatedref_mbi_caseslayer. - Each finding is checked with
isGeosValid()first and repaired withmakeValid()if needed, since gap and overlap geometries come straight out of raw intersection and difference results and can be self-intersecting. A repair returning anything non-polygonal is discarded rather than written, so the layer's geometry type never changes; the number of repaired findings is reported in the execution log. - The layer post-processor (
FieldWidgetPostProcessor) automatically loads and applies the embedded categorized QML style (ref_mbi_cases.qml), displaying distinct symbology and labeling for1_Gap,2_Overlap, and3_Disputedcases. - Attaches
ValueMapeditor widgets tombi_status(1_Updated,2_Pending) and text input setups to remarks fields directly upon loading into QGIS. - Sets computed reference attributes to Read-Only (
case_uuid,region,province,source,mbi_level,involved_areas,involved_bgys,count_involved_areas,mbi_type,num_bldg_pts, andmbi_remarks) to prevent accidental edits while keeping reviewer fields (geocode,city_mun,barangay,mbi_status,pso_remarks, andlgu_bgy_name) fully Editable.
- All findings are transformed to WGS 84 (
Supported Geometry Types
- Polygon and MultiPolygon (Vector boundary layers)
- Point and MultiPoint (Building point layers)
Reference Layer Downstream Compatibility
The output layer ref_mbi_cases is engineered to feed directly into the MBI Validator tool. When opening MBI Validator, it will automatically detect and pre-select ref_mbi_cases as the Reference layer input.
Reviewing Boundary Precedence Decisions
Inspect 2026_province_boundary's attribute table to confirm which polygons were kept, superseded, or relabeled: a city_mun with mixed LGU/PSA submissions will show only LGU polygons for that city_mun, and any polygon whose source was blank or non-LGU will read PSA. This is the exact boundary set that Gaps/Overlaps/Disputed detection ran against.