Spaces:
Running
Running
undefined - Initial Deployment
Browse files- README.md +7 -5
- index.html +287 -19
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: heatmaps-composelink
|
| 3 |
+
emoji: 🐳
|
| 4 |
+
colorFrom: pink
|
| 5 |
+
colorTo: gray
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite
|
| 10 |
---
|
| 11 |
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
|
@@ -1,19 +1,287 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Facilities & Trash Bins Heatmap</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBybAUlzNzGZG6-eqpjCnLJWOBfNPsmNaU&libraries=visualization"></script>
|
| 9 |
+
<style>
|
| 10 |
+
.custom-radio input:checked + label {
|
| 11 |
+
background-color: #3b82f6;
|
| 12 |
+
color: white;
|
| 13 |
+
}
|
| 14 |
+
.heatmap-gradient {
|
| 15 |
+
background: linear-gradient(to right,
|
| 16 |
+
rgba(0, 0, 255, 0.5),
|
| 17 |
+
rgba(0, 255, 0, 0.5),
|
| 18 |
+
rgba(255, 255, 0, 0.5),
|
| 19 |
+
rgba(255, 165, 0, 0.5),
|
| 20 |
+
rgba(255, 0, 0, 0.5));
|
| 21 |
+
}
|
| 22 |
+
.map-container {
|
| 23 |
+
height: 70vh;
|
| 24 |
+
}
|
| 25 |
+
@media (max-width: 640px) {
|
| 26 |
+
.map-container {
|
| 27 |
+
height: 50vh;
|
| 28 |
+
}
|
| 29 |
+
}
|
| 30 |
+
</style>
|
| 31 |
+
</head>
|
| 32 |
+
<body class="bg-gray-100">
|
| 33 |
+
<div class="container mx-auto px-4 py-8">
|
| 34 |
+
<header class="mb-8 text-center">
|
| 35 |
+
<h1 class="text-3xl md:text-4xl font-bold text-blue-800 mb-2">Facilities & Trash Bins Heatmap</h1>
|
| 36 |
+
<p class="text-gray-600 max-w-2xl mx-auto">
|
| 37 |
+
Visualize the density of public facilities and trash bins in your area.
|
| 38 |
+
The heatmap shows concentrations with warmer colors indicating higher density.
|
| 39 |
+
</p>
|
| 40 |
+
</header>
|
| 41 |
+
|
| 42 |
+
<div class="bg-white rounded-xl shadow-lg overflow-hidden mb-8">
|
| 43 |
+
<div class="p-4 md:p-6 flex flex-col md:flex-row justify-between items-center gap-4">
|
| 44 |
+
<div class="flex-1">
|
| 45 |
+
<h2 class="text-xl font-semibold text-gray-800 mb-2">Map Controls</h2>
|
| 46 |
+
<div class="flex flex-wrap gap-4">
|
| 47 |
+
<div class="flex items-center space-x-2">
|
| 48 |
+
<div class="custom-radio">
|
| 49 |
+
<input type="radio" id="show-all" name="map-type" checked class="hidden">
|
| 50 |
+
<label for="show-all" class="px-3 py-1 rounded-full border border-blue-500 text-blue-500 cursor-pointer transition-colors">
|
| 51 |
+
Show All
|
| 52 |
+
</label>
|
| 53 |
+
</div>
|
| 54 |
+
<div class="custom-radio">
|
| 55 |
+
<input type="radio" id="show-facilities" name="map-type" class="hidden">
|
| 56 |
+
<label for="show-facilities" class="px-3 py-1 rounded-full border border-green-500 text-green-500 cursor-pointer transition-colors">
|
| 57 |
+
Facilities Only
|
| 58 |
+
</label>
|
| 59 |
+
</div>
|
| 60 |
+
<div class="custom-radio">
|
| 61 |
+
<input type="radio" id="show-trash" name="map-type" class="hidden">
|
| 62 |
+
<label for="show-trash" class="px-3 py-1 rounded-full border border-red-500 text-red-500 cursor-pointer transition-colors">
|
| 63 |
+
Trash Bins Only
|
| 64 |
+
</label>
|
| 65 |
+
</div>
|
| 66 |
+
</div>
|
| 67 |
+
</div>
|
| 68 |
+
</div>
|
| 69 |
+
|
| 70 |
+
<div class="flex items-center gap-2">
|
| 71 |
+
<div class="h-4 w-4 rounded-full bg-blue-500"></div>
|
| 72 |
+
<span class="text-sm text-gray-600">Facilities</span>
|
| 73 |
+
<div class="h-4 w-4 rounded-full bg-red-500 ml-2"></div>
|
| 74 |
+
<span class="text-sm text-gray-600">Trash Bins</span>
|
| 75 |
+
</div>
|
| 76 |
+
</div>
|
| 77 |
+
|
| 78 |
+
<div class="relative">
|
| 79 |
+
<div id="map" class="map-container w-full"></div>
|
| 80 |
+
<div class="absolute bottom-4 left-4 bg-white p-2 rounded-lg shadow-md">
|
| 81 |
+
<div class="flex items-center mb-1">
|
| 82 |
+
<span class="text-xs mr-2">Low</span>
|
| 83 |
+
<div class="heatmap-gradient w-32 h-4 rounded"></div>
|
| 84 |
+
<span class="text-xs ml-2">High</span>
|
| 85 |
+
</div>
|
| 86 |
+
<p class="text-xs text-gray-600">Heatmap intensity scale</p>
|
| 87 |
+
</div>
|
| 88 |
+
</div>
|
| 89 |
+
</div>
|
| 90 |
+
|
| 91 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-8">
|
| 92 |
+
<div class="bg-white p-6 rounded-xl shadow-lg">
|
| 93 |
+
<h3 class="text-xl font-semibold text-gray-800 mb-4">Facilities Density</h3>
|
| 94 |
+
<div class="h-64" id="facilities-chart"></div>
|
| 95 |
+
<p class="text-sm text-gray-600 mt-2">
|
| 96 |
+
This chart shows the distribution of public facilities across different areas.
|
| 97 |
+
</p>
|
| 98 |
+
</div>
|
| 99 |
+
<div class="bg-white p-6 rounded-xl shadow-lg">
|
| 100 |
+
<h3 class="text-xl font-semibold text-gray-800 mb-4">Trash Bins Density</h3>
|
| 101 |
+
<div class="h-64" id="trash-chart"></div>
|
| 102 |
+
<p class="text-sm text-gray-600 mt-2">
|
| 103 |
+
This chart shows the concentration of trash bins in different zones.
|
| 104 |
+
</p>
|
| 105 |
+
</div>
|
| 106 |
+
</div>
|
| 107 |
+
|
| 108 |
+
<div class="bg-white rounded-xl shadow-lg overflow-hidden">
|
| 109 |
+
<div class="p-6">
|
| 110 |
+
<h3 class="text-xl font-semibold text-gray-800 mb-4">Data Summary</h3>
|
| 111 |
+
<div class="overflow-x-auto">
|
| 112 |
+
<table class="min-w-full divide-y divide-gray-200">
|
| 113 |
+
<thead class="bg-gray-50">
|
| 114 |
+
<tr>
|
| 115 |
+
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Type</th>
|
| 116 |
+
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Count</th>
|
| 117 |
+
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Density</th>
|
| 118 |
+
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Area Coverage</th>
|
| 119 |
+
</tr>
|
| 120 |
+
</thead>
|
| 121 |
+
<tbody class="bg-white divide-y divide-gray-200">
|
| 122 |
+
<tr>
|
| 123 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">Public Facilities</td>
|
| 124 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">248</td>
|
| 125 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">High</td>
|
| 126 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">85%</td>
|
| 127 |
+
</tr>
|
| 128 |
+
<tr>
|
| 129 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">Trash Bins</td>
|
| 130 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">176</td>
|
| 131 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Medium</td>
|
| 132 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">72%</td>
|
| 133 |
+
</tr>
|
| 134 |
+
</tbody>
|
| 135 |
+
</table>
|
| 136 |
+
</div>
|
| 137 |
+
</div>
|
| 138 |
+
</div>
|
| 139 |
+
</div>
|
| 140 |
+
|
| 141 |
+
<script>
|
| 142 |
+
// Sample data - in a real app, this would come from an API
|
| 143 |
+
const facilitiesData = [
|
| 144 |
+
{lat: -6.2088, lng: 106.8456}, // Jakarta
|
| 145 |
+
{lat: -6.2088, lng: 106.8456},
|
| 146 |
+
{lat: -6.2188, lng: 106.8456},
|
| 147 |
+
{lat: -6.2288, lng: 106.8456},
|
| 148 |
+
{lat: -6.2088, lng: 106.8356},
|
| 149 |
+
{lat: -6.2088, lng: 106.8556},
|
| 150 |
+
{lat: -6.1988, lng: 106.8456},
|
| 151 |
+
{lat: -6.2188, lng: 106.8356},
|
| 152 |
+
{lat: -6.2188, lng: 106.8556},
|
| 153 |
+
{lat: -6.2288, lng: 106.8356},
|
| 154 |
+
{lat: -6.2288, lng: 106.8556},
|
| 155 |
+
{lat: -6.2388, lng: 106.8456},
|
| 156 |
+
{lat: -6.2488, lng: 106.8456},
|
| 157 |
+
{lat: -6.2588, lng: 106.8456},
|
| 158 |
+
{lat: -6.2688, lng: 106.8456},
|
| 159 |
+
{lat: -6.2088, lng: 106.8256},
|
| 160 |
+
{lat: -6.2088, lng: 106.8656},
|
| 161 |
+
{lat: -6.1888, lng: 106.8456},
|
| 162 |
+
{lat: -6.1788, lng: 106.8456},
|
| 163 |
+
{lat: -6.1688, lng: 106.8456},
|
| 164 |
+
];
|
| 165 |
+
|
| 166 |
+
const trashData = [
|
| 167 |
+
{lat: -6.2188, lng: 106.8356},
|
| 168 |
+
{lat: -6.2188, lng: 106.8456},
|
| 169 |
+
{lat: -6.2188, lng: 106.8556},
|
| 170 |
+
{lat: -6.2288, lng: 106.8356},
|
| 171 |
+
{lat: -6.2288, lng: 106.8456},
|
| 172 |
+
{lat: -6.2288, lng: 106.8556},
|
| 173 |
+
{lat: -6.2388, lng: 106.8356},
|
| 174 |
+
{lat: -6.2388, lng: 106.8456},
|
| 175 |
+
{lat: -6.2388, lng: 106.8556},
|
| 176 |
+
{lat: -6.2088, lng: 106.8256},
|
| 177 |
+
{lat: -6.2088, lng: 106.8356},
|
| 178 |
+
{lat: -6.2088, lng: 106.8556},
|
| 179 |
+
{lat: -6.2088, lng: 106.8656},
|
| 180 |
+
{lat: -6.1988, lng: 106.8356},
|
| 181 |
+
{lat: -6.1988, lng: 106.8456},
|
| 182 |
+
{lat: -6.1988, lng: 106.8556},
|
| 183 |
+
];
|
| 184 |
+
|
| 185 |
+
let map, facilitiesHeatmap, trashHeatmap;
|
| 186 |
+
let allHeatmapData = [...facilitiesData.map(p => new google.maps.LatLng(p.lat, p.lng)),
|
| 187 |
+
...trashData.map(p => new google.maps.LatLng(p.lat, p.lng))];
|
| 188 |
+
|
| 189 |
+
function initMap() {
|
| 190 |
+
map = new google.maps.Map(document.getElementById("map"), {
|
| 191 |
+
zoom: 13,
|
| 192 |
+
center: { lat: -6.2088, lng: 106.8456 },
|
| 193 |
+
mapTypeId: "roadmap",
|
| 194 |
+
styles: [
|
| 195 |
+
{
|
| 196 |
+
featureType: "poi",
|
| 197 |
+
elementType: "labels",
|
| 198 |
+
stylers: [{ visibility: "off" }]
|
| 199 |
+
}
|
| 200 |
+
]
|
| 201 |
+
});
|
| 202 |
+
|
| 203 |
+
// Create heatmap layers
|
| 204 |
+
facilitiesHeatmap = new google.maps.visualization.HeatmapLayer({
|
| 205 |
+
data: facilitiesData.map(p => new google.maps.LatLng(p.lat, p.lng)),
|
| 206 |
+
map: map,
|
| 207 |
+
radius: 30,
|
| 208 |
+
gradient: [
|
| 209 |
+
'rgba(0, 0, 255, 0)',
|
| 210 |
+
'rgba(0, 0, 255, 1)',
|
| 211 |
+
'rgba(0, 255, 255, 1)',
|
| 212 |
+
'rgba(0, 255, 0, 1)',
|
| 213 |
+
'rgba(255, 255, 0, 1)',
|
| 214 |
+
'rgba(255, 165, 0, 1)',
|
| 215 |
+
'rgba(255, 0, 0, 1)'
|
| 216 |
+
]
|
| 217 |
+
});
|
| 218 |
+
|
| 219 |
+
trashHeatmap = new google.maps.visualization.HeatmapLayer({
|
| 220 |
+
data: trashData.map(p => new google.maps.LatLng(p.lat, p.lng)),
|
| 221 |
+
map: map,
|
| 222 |
+
radius: 25,
|
| 223 |
+
gradient: [
|
| 224 |
+
'rgba(255, 0, 0, 0)',
|
| 225 |
+
'rgba(255, 0, 0, 0.5)',
|
| 226 |
+
'rgba(255, 69, 0, 0.8)',
|
| 227 |
+
'rgba(255, 140, 0, 1)',
|
| 228 |
+
'rgba(255, 165, 0, 1)'
|
| 229 |
+
]
|
| 230 |
+
});
|
| 231 |
+
|
| 232 |
+
// Set up radio button controls
|
| 233 |
+
document.getElementById('show-all').addEventListener('change', function() {
|
| 234 |
+
facilitiesHeatmap.setMap(map);
|
| 235 |
+
trashHeatmap.setMap(map);
|
| 236 |
+
});
|
| 237 |
+
|
| 238 |
+
document.getElementById('show-facilities').addEventListener('change', function() {
|
| 239 |
+
facilitiesHeatmap.setMap(map);
|
| 240 |
+
trashHeatmap.setMap(null);
|
| 241 |
+
});
|
| 242 |
+
|
| 243 |
+
document.getElementById('show-trash').addEventListener('change', function() {
|
| 244 |
+
facilitiesHeatmap.setMap(null);
|
| 245 |
+
trashHeatmap.setMap(map);
|
| 246 |
+
});
|
| 247 |
+
|
| 248 |
+
// Simple chart visualization
|
| 249 |
+
renderSimpleCharts();
|
| 250 |
+
}
|
| 251 |
+
|
| 252 |
+
function renderSimpleCharts() {
|
| 253 |
+
// This is a simplified chart - in a real app you'd use a charting library
|
| 254 |
+
const facilitiesChart = document.getElementById('facilities-chart');
|
| 255 |
+
const trashChart = document.getElementById('trash-chart');
|
| 256 |
+
|
| 257 |
+
// Create simple bar charts using divs
|
| 258 |
+
facilitiesChart.innerHTML = `
|
| 259 |
+
<div class="h-full flex items-end gap-1">
|
| 260 |
+
<div class="flex-1 bg-blue-500 rounded-t" style="height: 70%"></div>
|
| 261 |
+
<div class="flex-1 bg-blue-500 rounded-t" style="height: 85%"></div>
|
| 262 |
+
<div class="flex-1 bg-blue-500 rounded-t" style="height: 60%"></div>
|
| 263 |
+
<div class="flex-1 bg-blue-500 rounded-t" style="height: 45%"></div>
|
| 264 |
+
<div class="flex-1 bg-blue-500 rounded-t" style="height: 75%"></div>
|
| 265 |
+
<div class="flex-1 bg-blue-500 rounded-t" style="height: 90%"></div>
|
| 266 |
+
<div class="flex-1 bg-blue-500 rounded-t" style="height: 65%"></div>
|
| 267 |
+
</div>
|
| 268 |
+
`;
|
| 269 |
+
|
| 270 |
+
trashChart.innerHTML = `
|
| 271 |
+
<div class="h-full flex items-end gap-1">
|
| 272 |
+
<div class="flex-1 bg-red-500 rounded-t" style="height: 50%"></div>
|
| 273 |
+
<div class="flex-1 bg-red-500 rounded-t" style="height: 75%"></div>
|
| 274 |
+
<div class="flex-1 bg-red-500 rounded-t" style="height: 40%"></div>
|
| 275 |
+
<div class="flex-1 bg-red-500 rounded-t" style="height: 85%"></div>
|
| 276 |
+
<div class="flex-1 bg-red-500 rounded-t" style="height: 60%"></div>
|
| 277 |
+
<div class="flex-1 bg-red-500 rounded-t" style="height: 45%"></div>
|
| 278 |
+
<div class="flex-1 bg-red-500 rounded-t" style="height: 70%"></div>
|
| 279 |
+
</div>
|
| 280 |
+
`;
|
| 281 |
+
}
|
| 282 |
+
|
| 283 |
+
// Initialize the map when the window loads
|
| 284 |
+
window.onload = initMap;
|
| 285 |
+
</script>
|
| 286 |
+
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=sombochea/heatmaps-composelink" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 287 |
+
</html>
|