Visualising results¶
cluster_points returns GeoJSON. That's a universal pivot — every
mapping toolchain understands it.
QGIS¶
- Save the response to
clusters.geojson. - Drag the file onto the QGIS canvas (or use Layer Add Layer Add Vector Layer).
- Style by
point_countfor a heat-style choropleth, orradius_metersfor an "uncertainty" feel.
geojson.io¶
The fastest way to eyeball output. Paste the JSON straight in:
Leaflet¶
<div id="map" style="height: 480px"></div>
<script>
const map = L.map('map').setView([-26.2, 28.0], 6);
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(map);
fetch('clusters.geojson')
.then(r => r.json())
.then(data => L.geoJSON(data, {
style: f => ({
color: '#54A2CC', // Kartoza Blue
weight: 2,
fillColor: '#54A2CC',
fillOpacity: 0.15,
}),
onEachFeature: (f, l) => l.bindPopup(
`Cluster ${f.properties.cluster_id} — ${f.properties.point_count} points`
),
}).addTo(map));
</script>
Mapbox GL¶
map.addSource('clusters', { type: 'geojson', data: 'clusters.geojson' });
map.addLayer({
id: 'clusters-fill',
type: 'fill',
source: 'clusters',
paint: {
'fill-color': '#54A2CC',
'fill-opacity': 0.18,
},
});
map.addLayer({
id: 'clusters-stroke',
type: 'line',
source: 'clusters',
paint: { 'line-color': '#54A2CC', 'line-width': 2 },
});
Felt¶
Drop clusters.geojson into a Felt map — it'll auto-style and let you share
a link with collaborators.
Brand colours
Want a Kartoza-aligned palette? Use #54A2CC (Kartoza Blue) for
primary strokes and fills, #EEB348 (Kartoza Amber) to highlight
flagged clusters, and #383939 (Charcoal) for labels. The full
token sheet lives at About Design.