Territorial Mapping & Geo-Index
Relevant source files
The following files were used as context for generating this wiki page:
The Territorial Mapping & Geo-Index system serves as the geospatial foundation of the RDM Digital platform. It provides a "Digital Twin" of the Real del Monte territory, integrating structural modeling, forensic auditing, and real-time operational telemetry. This system transitions urban management from reactive dependence to a proactive technical sovereignty by anchoring immutable evidence of infrastructure and public works within a digital 1:1 twin.
This module is responsible for the visualization and indexing of Points of Interest (POIs), structural versioning of physical assets (roads, drainage, etc.), and the simulation of physical events like hydraulic flows and mechanical stress. It acts as a "Third Technical Witness" to ensure transparency in territorial management.
Sources: src/components/rdm/territory.tsx:10-14, README.md:9-14
Data Model and Persistence
The geospatial data is persisted in a PostgreSQL database managed by Supabase. The core entity is the pois (Points of Interest) table, which stores geographic coordinates, altitude, and cultural significance, linked to specific operational "Federations."
Points of Interest (POIs) Schema
| Field | Type | Description |
|---|---|---|
id | uuid | Primary identifier for the POI. |
name | text | Name of the location or asset. |
category | text | Classification (e.g., mineria, templo, geologico). |
lat | double | Latitude coordinate (WGS84). |
lng | double | Longitude coordinate (WGS84). |
altitude_m | integer | Altitude in meters above sea level. |
federation_id | text | Reference to the governing Federation. |
Sources: supabase/migrations/20260512080845_110fe96e-4027-403f-98c8-f6d495c1bf4c.sql:43-57, scripts/002_rdm_seed.sql:47-57
Database Relationship Diagram
The following diagram illustrates how geospatial entities relate to the project's broader federated governance structure.
Mapping Architecture and Visualization
The frontend utilizes a multi-layered mapping approach, combining raw SVG projections for stylized displays and Leaflet for interactive, real-time geographic exploration.
1. Stylized SVG Projection
A specialized TerritoryMap component calculates relative coordinates to project POIs onto a stylized topographic grid without requiring a full GIS engine. It uses a projection function to map GPS coordinates to percentage-based CSS positions.
const project = (lat: number, lng: number) => {
const x = ((lng - bounds.minLng) / (bounds.maxLng - bounds.minLng)) * 100
const y = ((bounds.maxLat - lat) / (bounds.maxLat - bounds.minLat)) * 100
return { x, y }
}
Sources: src/components/rdm/territory-map.tsx:21-25
2. Interactive Leaflet Implementation
The main Territorio page provides a robust GIS interface using react-leaflet. It supports multiple base layers (Topographic and Street views) and implements a Heatmap layer that weights usage intensity based on altitude.
Sources: src/pages/Territorio.tsx:49-115
Operational and Forensic Capabilities
The system is designed for "Forensic Resilience," treating territorial assets as versioned structural entities.
- 1:1 Digital Twin: Models roads, drainage systems, and retaining walls to provide a reproducible audit of public works.
- Edge Inference: Uses CFD (Computational Fluid Dynamics) and Monte Carlo simulations to predict sinkholes and structural failures based on crowd-sourced data.
- Immutable Chain of Custody: Event telemetry is signed with Post-Quantum Cryptography (PQC) and Merkle trees, ensuring that records of rain, damage, or maintenance cannot be altered.
- Island Mode: Maintains a local P2P mesh to provide risk maps and evacuation routes even if external fiber optics or roads collapse.
Sources: src/components/rdm/territory.tsx:82-106
Geo-Categorization System
The platform categorizes territory POIs to facilitate different operational modules (Tourism, Governance, Health).
| Category | UI Color | Significance |
|---|---|---|
mineria | #F59E0B | Mining heritage, structural risk audit. |
templo | #A855F7 | Ritual centers, community hubs. |
geologico | #10B981 | Natural reserves, geotourism. |
mercado | #EF4444 | Economic nodes, sovereign commerce. |
escuela | #3B82F6 | Educational and cognitive infrastructure. |
Sources: src/pages/Territorio.tsx:23-30, src/components/rdm/territory-map.tsx:27-34
Summary
The Territorial Mapping & Geo-Index module is the spatial backbone of the RDM Digital system. By combining high-precision database persistence of POIs with advanced visualization layers (SVG and Leaflet), it creates an auditable "Digital Twin" of Real del Monte. This system provides a sovereign technical framework for managing urban infrastructure, predicting environmental risks, and maintaining an immutable record of territorial changes.