feature: sebaran lokasi project pariwisata
This commit is contained in:
@@ -76,10 +76,38 @@ document.addEventListener("DOMContentLoaded", async function () {
|
||||
|
||||
updatePieChart(dataSeriesPieChart, labelsPieChart);
|
||||
|
||||
// Load all location
|
||||
// Load all Tourism location
|
||||
const allLocation = await getAllLocation();
|
||||
console.log(allLocation);
|
||||
|
||||
// Filter hanya data yang memiliki angka valid
|
||||
let validLocations = allLocation.dataLocation.filter(loc => {
|
||||
return !isNaN(parseFloat(loc.longitude)) && !isNaN(parseFloat(loc.latitude));
|
||||
});
|
||||
|
||||
// Ubah string ke float
|
||||
validLocations = validLocations.map(loc => ({
|
||||
name: loc.project_name,
|
||||
longitude: parseFloat(loc.longitude),
|
||||
latitude: parseFloat(loc.latitude)
|
||||
}));
|
||||
|
||||
console.log(validLocations.name)
|
||||
|
||||
// Inisialisasi peta
|
||||
var map = L.map('map').setView([-7.0230, 107.5275], 10);
|
||||
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
attribution: '© OpenStreetMap contributors'
|
||||
}).addTo(map);
|
||||
|
||||
// Tambahkan marker ke peta
|
||||
validLocations.forEach(function(loc) {
|
||||
L.marker([loc.latitude, loc.longitude])
|
||||
.addTo(map)
|
||||
.bindPopup(`<b>${loc.name}</b>`) // Popup saat diklik
|
||||
.bindTooltip(loc.name, { permanent: false, direction: "top" }); // Tooltip saat di-hover
|
||||
});
|
||||
|
||||
// Realisasi terbit PBG
|
||||
const totalRealisasiTerbitPBG = document.getElementById("realisasi-terbit-pbg");
|
||||
if (!totalRealisasiTerbitPBG) return;
|
||||
|
||||
Reference in New Issue
Block a user