map / app /templates /heatmap.html
atsuga's picture
Upload 40 files
6f10462 verified
<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Heatmap GeoPandas - Jawa Timur</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
padding: 20px;
min-height: 100vh;
}
.container {
max-width: 1400px;
margin: 0 auto;
background: white;
border-radius: 15px;
box-shadow: 0 10px 40px rgba(0,0,0,0.3);
overflow: hidden;
}
.header {
background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
color: white;
padding: 30px;
text-align: center;
}
.header h1 {
font-size: 2.5em;
margin-bottom: 10px;
text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}
.header p {
font-size: 1.2em;
opacity: 0.9;
}
.nav-buttons {
padding: 20px 30px;
background: #f8f9fa;
border-bottom: 2px solid #dee2e6;
display: flex;
gap: 15px;
flex-wrap: wrap;
}
.btn {
padding: 12px 24px;
border: none;
border-radius: 8px;
font-size: 16px;
cursor: pointer;
text-decoration: none;
display: inline-block;
transition: all 0.3s ease;
font-weight: 600;
}
.btn-primary {
background: #4CAF50;
color: white;
}
.btn-primary:hover {
background: #45a049;
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}
.btn-secondary {
background: #2196F3;
color: white;
}
.btn-secondary:hover {
background: #0b7dda;
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(33, 150, 243, 0.4);
}
.btn-info {
background: #FF9800;
color: white;
}
.btn-info:hover {
background: #e68900;
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(255, 152, 0, 0.4);
}
.content {
padding: 30px;
}
.info-box {
background: #e3f2fd;
border-left: 4px solid #2196F3;
padding: 15px 20px;
margin-bottom: 25px;
border-radius: 5px;
}
.info-box h3 {
color: #1976d2;
margin-bottom: 10px;
}
.info-box ul {
list-style: none;
padding-left: 0;
}
.info-box li {
padding: 5px 0;
color: #0d47a1;
}
.info-box li:before {
content: "✓ ";
color: #4CAF50;
font-weight: bold;
margin-right: 5px;
}
.map-image-container {
text-align: center;
background: #f5f5f5;
padding: 20px;
border-radius: 10px;
margin-top: 20px;
}
.map-image {
max-width: 100%;
height: auto;
border: 3px solid #333;
border-radius: 8px;
box-shadow: 0 8px 24px rgba(0,0,0,0.2);
cursor: pointer;
transition: transform 0.3s ease;
}
.map-image:hover {
transform: scale(1.02);
}
.caption {
margin-top: 15px;
font-size: 14px;
color: #666;
font-style: italic;
}
.stats {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 20px;
margin-top: 20px;
}
.stat-card {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 20px;
border-radius: 10px;
text-align: center;
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.stat-card h4 {
font-size: 14px;
opacity: 0.9;
margin-bottom: 10px;
text-transform: uppercase;
letter-spacing: 1px;
}
.stat-card .number {
font-size: 32px;
font-weight: bold;
}
.footer {
background: #263238;
color: white;
padding: 20px;
text-align: center;
margin-top: 30px;
}
/* Modal for fullscreen image */
.modal {
display: none;
position: fixed;
z-index: 1000;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: rgba(0,0,0,0.9);
padding: 20px;
}
.modal-content {
max-width: 95%;
max-height: 95%;
margin: auto;
display: block;
position: relative;
top: 50%;
transform: translateY(-50%);
}
.close {
position: absolute;
top: 30px;
right: 40px;
color: #f1f1f1;
font-size: 50px;
font-weight: bold;
cursor: pointer;
z-index: 1001;
}
.close:hover {
color: #ff5252;
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<h1>🗺️ Geographic Heatmap Jawa Timur</h1>
<p>Peta Choropleth 38 Kabupaten/Kota - Dibuat dengan GeoPandas</p>
</div>
<div class="nav-buttons">
<a href="/" class="btn btn-secondary">🏠 Home</a>
<a href="/map-folium" class="btn btn-info">🗺️ Peta Folium Interactive</a>
<button onclick="location.reload()" class="btn btn-info">🔄 Refresh Heatmap</button>
<button onclick="generateNewHeatmap()" class="btn btn-primary">🎨 Generate Ulang</button>
</div>
<div class="content">
<div class="info-box">
</div>
<div class="stats">
<div class="stat-card">
<h4>Total Wilayah</h4>
<div class="number">38</div>
</div>
<div class="stat-card">
<h4>Provinsi</h4>
<div class="number">Jawa Timur</div>
</div>
<div class="stat-card">
<h4>Teknologi</h4>
<div class="number">GeoPandas</div>
</div>
</div>
<div class="map-image-container">
<img src="{{ url_for('static', filename='img/heatmap_jatim.png') }}"
alt="Heatmap Jawa Timur"
class="map-image"
onclick="openModal(this)"
id="heatmapImage">
<p class="caption">Klik gambar untuk melihat dalam ukuran penuh</p>
</div>
</div>
<div class="footer">
<p>&copy; 2025 Pemetaan Hukum Jawa Timur </p>
</div>
</div>
<!-- Modal for fullscreen -->
<div id="imageModal" class="modal" onclick="closeModal()">
<span class="close">&times;</span>
<img class="modal-content" id="modalImage">
</div>
<script>
function openModal(img) {
const modal = document.getElementById('imageModal');
const modalImg = document.getElementById('modalImage');
modal.style.display = 'block';
modalImg.src = img.src;
}
function closeModal() {
document.getElementById('imageModal').style.display = 'none';
}
function generateNewHeatmap() {
if (confirm('Generate heatmap baru dengan data random? Proses ini memerlukan beberapa detik.')) {
// Show loading
const img = document.getElementById('heatmapImage');
img.style.opacity = '0.5';
// Call API to regenerate
fetch('/generate-heatmap', {method: 'POST'})
.then(response => response.json())
.then(data => {
if (data.success) {
// Reload image with cache busting
img.src = data.image_url + '?t=' + new Date().getTime();
img.style.opacity = '1';
alert('Heatmap berhasil di-generate ulang!');
} else {
alert('Gagal generate heatmap: ' + data.error);
img.style.opacity = '1';
}
})
.catch(error => {
alert('Error: ' + error);
img.style.opacity = '1';
});
}
}
// Keyboard shortcut: ESC to close modal
document.addEventListener('keydown', function(event) {
if (event.key === 'Escape') {
closeModal();
}
});
</script>
</body>
</html>