Agent SIG Web pour GWR

VérifiéSûr

Parse des données GeoJSON GWR et configure des couches cartographiques Leaflet avec choroplèthes et popups interactifs.

Spar Skills Guide Bot
Data & IAIntermédiaire
23/07/2026
Claude CodeCursorWindsurfCopilotCodex
#geojson#leaflet#choropleth#gwr#spatial-visualization

Recommandé pour

Synthèse automatique

Analyse un GeoJSON de résultats GWR (Land Surface Temperature) et génère une carte Leaflet avec choroplèthe, infobulles détaillées et légende.

Points forts

  • Définit explicitement le schéma de propriétés GWR attendu (lst_predicted, local_r2, residual, coefficients), ce qui évite les ambiguïtés.
  • Fournit une échelle de couleurs LST bleu → jaune → rouge pilotée par les données, avec légende à points de rupture.
  • Inclut une implémentation de référence complète en JavaScript : style, popups, surbrillance au survol et contrôle de légende.
  • Couvre le chargement depuis un fichier local ou un endpoint Flask /api/data.

Limites

  • Centrage, zoom et seuils LST sont calibrés pour Hô Chi Minh-Ville ; il faut les adapter pour une autre zone.
  • Suppose des géométries Polygon et des noms de propriétés exacts ; ne gère ni points, ni lignes, ni champs renommés.
  • Ne calcule pas la régression GWR elle-même : le skill se limite à la visualisation d'une sortie existante.
Quand l'utiliser

Pour transformer rapidement un GeoJSON de prédictions LST/GWR en carte interactive Leaflet destinée à l'analyse ou à la présentation.

Quand l'éviter

À éviter si vous devez calculer une GWR, prendre en charge d'autres géométries que des polygones ou utiliser un moteur cartographique autre que Leaflet.

Analyse de sécurité

Sûr
Score qualité76/100

The file is pure documentation plus a Leaflet/GeoJSON reference implementation. It contains no shell commands, no destructive operations, no credential handling, no obfuscated or encoded payloads, and instructs nothing to be exfiltrated. The only meaningful concerns are ordinary web-app ones: HTML-unescaped property interpolation into popups and outbound calls to a public tile server for map imagery, both expected for this kind of GIS front-end.

Points d'attention
  • •Popup HTML is built with unescaped template interpolation of GeoJSON properties (${p.district}, ${p.lst_predicted}, etc.) bound via bindPopup — stored-XSS risk if the source data is untrusted
  • •Runtime fetches external OpenStreetMap tiles from {s}.tile.openstreetmap.org and a relative /api/data endpoint; normal for a Leaflet app but worth noting for offline/privacy contexts
Comment cette analyse est faite

Exemples

Build the LST choropleth map
Build the Leaflet map for hcmc_gwr_output.geojson: colour districts by lst_predicted on a blue→yellow→red scale, add a legend with labelled breakpoints, and bind popups showing local_r2, residual and all three GWR coefficients.
Retune the colour scale
Change the LST breakpoints to 31/33/35/37 °C instead of the defaults, keep the getColor helper data-driven, and update the legend so it matches the new ramp.
Load from the Flask API
Switch the map to fetch GWR features from the Flask /api/data endpoint instead of a local file, and keep the same popup template and mouseover/mouseout highlight behaviour.

name: webgis-agent description: > Parses GeoJSON (including Geographically Weighted Regression outputs) and configures Leaflet map layers with choropleth styling and interactive popups. Specialised for spatial analysis results such as Land Surface Temperature (LST) variations across Ho Chi Minh City.

WebGIS Agent Skill

This skill provides instructions and examples for parsing GeoJSON data — including GWR (Geographically Weighted Regression) outputs — and visualising it on an interactive Leaflet map with:

  • Choropleth polygon fills coloured by Predicted LST (blue → red).
  • Interactive popups showing all GWR fields per feature.

GWR Data Schema

When the Data_Agent passes a GWR GeoJSON payload, each feature's properties object is expected to contain the following fields:

| Field | Description | Unit | |---|---|---| | district | District / zone label | string | | lst_predicted | Predicted Land Surface Temperature | °C | | local_r2 | Local goodness-of-fit (0–1) | dimensionless | | residual | Observed minus predicted LST | °C | | coeff_ndvi | Local GWR coefficient for NDVI | — | | coeff_impervious | Local GWR coefficient for impervious surface | — | | coeff_water_dist | Local GWR coefficient for distance to water | — |

Note: When you swap in your real GWR output file, make sure it contains these exact property names, or update the popup template below accordingly.


Instructions

Follow these steps when building the WebGIS application for GWR / LST data:

1. Parse and Validate GWR GeoJSON

  • Load the GeoJSON file (e.g., hcmc_gwr_output.geojson) from disk or via the Flask /api/data endpoint.
  • Confirm the FeatureCollection has features with Polygon geometries.
  • Extract the full range of lst_predicted values across all features to compute the colour scale domain (min → max) for the choropleth.

2. Build the LST Colour Scale

  • Use a blue → yellow → red sequential gradient to encode LST intensity:
    • Cool (< 32 °C) → #313695
    • Moderate (≈ 35 °C) → #ffffbf
    • Hot (> 38 °C) → #a50026
  • Implement a getColor(lst) helper function using breakpoints derived from the actual data range so the scale is always data-driven.

3. Initialise the Leaflet Map

  • Centre the map on Ho Chi Minh City: [10.76, 106.69], zoom 10.
  • Add an OpenStreetMap base tile layer for geographic context.

4. Add GWR Choropleth Layer

  • Use L.geoJSON() with two options:
    • style: Set fillColor using getColor(feature.properties.lst_predicted), fillOpacity: 0.75, weight: 1.5, color: '#fff'.
    • onEachFeature: Bind a rich popup and add hover highlight events (mouseover / mouseout to lighten/darken the fill).

5. Popup Content Template

Each popup must display all GWR fields in a structured card:

<div class="gwr-popup">
  <h3>{district}</h3>
  <table>
    <tr><td>🌡️ Predicted LST</td><td><b>{lst_predicted} °C</b></td></tr>
    <tr><td>📊 Local R²</td><td>{local_r2}</td></tr>
    <tr><td>📐 Residual</td><td>{residual} °C</td></tr>
    <tr><td>🌿 Coeff NDVI</td><td>{coeff_ndvi}</td></tr>
    <tr><td>🏗️ Coeff Impervious</td><td>{coeff_impervious}</td></tr>
    <tr><td>💧 Coeff Water Dist.</td><td>{coeff_water_dist}</td></tr>
  </table>
</div>

6. Add a Legend

  • Render a fixed-position L.control legend showing the LST colour ramp with labelled breakpoints so users can interpret the choropleth without hovering.

Full Reference Implementation

// ── Colour scale (blue → yellow → red, data-driven) ──────────────
function getColor(lst) {
    return lst > 38   ? '#a50026' :
           lst > 36.5 ? '#d73027' :
           lst > 35   ? '#f46d43' :
           lst > 33.5 ? '#fdae61' :
           lst > 32   ? '#ffffbf' :
           lst > 30.5 ? '#abd9e9' :
                        '#313695';
}

// ── Map initialisation (Ho Chi Minh City) ─────────────────────────
const map = L.map('map').setView([10.76, 106.69], 10);

L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
    maxZoom: 19,
    attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);

// ── GWR GeoJSON layer ─────────────────────────────────────────────
fetch('/api/data')
    .then(r => r.json())
    .then(data => {
        L.geoJSON(data, {
            style: feature => ({
                fillColor:   getColor(feature.properties.lst_predicted),
                fillOpacity: 0.75,
                color:       '#ffffff',
                weight:      1.5
            }),
            onEachFeature: (feature, layer) => {
                const p = feature.properties;
                layer.bindPopup(`
                    <div class="gwr-popup">
                        <h3>${p.district}</h3>
                        <table>
                            <tr><td>🌡️ Predicted LST</td><td><b>${p.lst_predicted} °C</b></td></tr>
                            <tr><td>📊 Local R²</td><td>${p.local_r2}</td></tr>
                            <tr><td>📐 Residual</td><td>${p.residual} °C</td></tr>
                            <tr><td>🌿 Coeff NDVI</td><td>${p.coeff_ndvi}</td></tr>
                            <tr><td>🏗️ Coeff Impervious</td><td>${p.coeff_impervious}</td></tr>
                            <tr><td>💧 Coeff Water Dist.</td><td>${p.coeff_water_dist}</td></tr>
                        </table>
                    </div>
                `);
                // Hover highlight
                layer.on('mouseover', () => layer.setStyle({ fillOpacity: 0.95, weight: 2.5 }));
                layer.on('mouseout',  () => layer.setStyle({ fillOpacity: 0.75, weight: 1.5 }));
            }
        }).addTo(map);
    })
    .catch(err => console.error('Error fetching GWR data:', err));

// ── Legend control ────────────────────────────────────────────────
const legend = L.control({ position: 'bottomright' });
legend.onAdd = function () {
    const div    = L.DomUtil.create('div', 'legend');
    const grades = [29, 30.5, 32, 33.5, 35, 36.5, 38];
    div.innerHTML = '<h4>LST (°C)</h4>';
    grades.forEach((g, i) => {
        div.innerHTML +=
            `<i style="background:${getColor(g + 0.1)}"></i>` +
            `${g}${grades[i + 1] ? '–' + grades[i + 1] : '+'}<br>`;
    });
    return div;
};
legend.addTo(map);

Legend CSS (add to <style>)

.legend { background: white; padding: 10px 14px; border-radius: 6px;
          line-height: 1.8; font-size: 13px; box-shadow: 0 1px 5px rgba(0,0,0,.3); }
.legend h4 { margin: 0 0 6px; font-size: 14px; }
.legend i  { width: 16px; height: 16px; display: inline-block;
             margin-right: 6px; border-radius: 2px; vertical-align: middle; }
.gwr-popup h3 { margin: 0 0 6px; font-size: 14px; color: #333; }
.gwr-popup table { border-collapse: collapse; font-size: 12px; }
.gwr-popup td { padding: 2px 6px; }
.gwr-popup td:first-child { color: #555; }
.gwr-popup td:last-child  { font-weight: 500; color: #111; }

Swapping in Your Real GWR File

When your real GWR output is ready, update the DATA_FILE path in multi_agent.py (inside DataAgent.execute):

# Change this line in DataAgent.execute():
DATA_FILE = r"C:\path\to\your\real_gwr_output.geojson"

The rest of the pipeline requires no further changes as long as the property names match the schema above.

Du fichier au premier essai

Le téléchargement contient exactement le contenu affiché sur cette fiche. Cette copie peut différer de la dernière version du dépôt source.

Consulter la source et ses fichiers annexes

Ce téléchargement contient uniquement SKILL.md. Les scripts, références, modèles et dépendances éventuels ne sont pas inclus. Récupérez les fichiers nécessaires depuis la source en conservant leur arborescence avant de poursuivre.

1. Télécharger le fichier

Télécharger SKILL.md

Depuis la racine d’un projet de test, enregistrez le fichier sous .skill-downloads/webgis-agent-for-gwr-mrx3xy77/SKILL.md, ou utilisez la commande suivante. Ce dossier sert à examiner la skill avant son installation.

Commande pour macOS/Linux ou WSL : un shell POSIX et curl sont nécessaires. Sous Windows sans WSL, utilisez le bouton de téléchargement et créez le dossier manuellement.

mkdir -p '.skill-downloads/webgis-agent-for-gwr-mrx3xy77' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/webgis-agent-for-gwr-mrx3xy77/download' --output '.skill-downloads/webgis-agent-for-gwr-mrx3xy77/SKILL.md.part' && mv '.skill-downloads/webgis-agent-for-gwr-mrx3xy77/SKILL.md.part' '.skill-downloads/webgis-agent-for-gwr-mrx3xy77/SKILL.md'

2. Vérifier les prérequis

Lisez SKILL.md avant de l’utiliser. Si le fichier cite des scripts ou services externes, examinez-les et préparez les accès nécessaires dans votre environnement de test.

Aucune section de prérequis reconnue dans ce fichier. Cela ne signifie pas qu’il est autonome : les bibliothèques, outils et accès peuvent être cités ailleurs dans le contenu ou dans le dépôt source.

Les plateformes de la fiche sont des indications du catalogue. Les chemins ci-dessous suivent la documentation des outils ; ils ne prouvent pas que cette skill y a été exécutée. Aucune version minimale de ces outils n’est attestée pour cette fiche.

3. Charger la skill

Après vérification, copiez le dossier complet dans le projet avec l’une des commandes ci-dessous, puis ouvrez une nouvelle session de l’outil. La commande s’arrête si un dossier du même nom existe déjà : comparez les fichiers avant de le remplacer.

Claude Code
test -f '.skill-downloads/webgis-agent-for-gwr-mrx3xy77/SKILL.md' && test -s '.skill-downloads/webgis-agent-for-gwr-mrx3xy77/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/webgis-agent' && cp -R '.skill-downloads/webgis-agent-for-gwr-mrx3xy77' '.claude/skills/webgis-agent'

Cursor
test -f '.skill-downloads/webgis-agent-for-gwr-mrx3xy77/SKILL.md' && test -s '.skill-downloads/webgis-agent-for-gwr-mrx3xy77/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/webgis-agent' && cp -R '.skill-downloads/webgis-agent-for-gwr-mrx3xy77' '.cursor/skills/webgis-agent'

Codex
test -f '.skill-downloads/webgis-agent-for-gwr-mrx3xy77/SKILL.md' && test -s '.skill-downloads/webgis-agent-for-gwr-mrx3xy77/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/webgis-agent' && cp -R '.skill-downloads/webgis-agent-for-gwr-mrx3xy77' '.agents/skills/webgis-agent'

OpenSkills

OpenSkills doit déjà être installé. La procédure locale install/read est contrôlée avec OpenSkills 1.5.0, qui exige Node.js ≥ 20.6.0. Aucun slug du catalogue n’est résolu automatiquement.

Installation officielle d’OpenSkills
openskills install './.skill-downloads/webgis-agent-for-gwr-mrx3xy77'

openskills read 'webgis-agent-for-gwr-mrx3xy77'

La lecture doit afficher le contenu du fichier installé et son dossier de base. Elle ne lance ni la skill ni ses dépendances.

Pour un agent qui lit AGENTS.md, synchronisez ensuite l’index. Cette commande modifie AGENTS.md : relisez le diff avant de l’utiliser.

openskills sync

Mode manuel ou autre outil : joignez SKILL.md à une conversation, ou ouvrez-le dans un agent capable de lire les fichiers. Ajoutez les ressources annexes nécessaires. Il n’existe pas de dossier universel reconnu par tous les outils.

4. Faire un premier essai

Utilisez une entrée courte et fictive : un endpoint d’API, un petit document ou un brief d’interface. Dans une nouvelle conversation, joignez le fichier ou donnez son chemin à l’agent, puis adaptez cette demande :

Lis .skill-downloads/webgis-agent-for-gwr-mrx3xy77/SKILL.md et applique ses instructions à cet exemple : [décrire une entrée de test]. Indique les fichiers, dépendances ou accès qui manquent. Produis le résultat demandé par la skill sans inventer de données ni exécuter de script non examiné.

Résultat attendu : une sortie correspondant aux instructions de la skill, ou une liste précise des prérequis manquants. Une simple confirmation de lecture ne valide pas le premier usage. Si une ressource externe est indisponible, ce parcours reste à tester.

Skills similaires