2023-12-01 21:27:00 +01:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
|
|
|
<head>
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
<title>UPlanet _UMAP_ _SERVICE_ Data</title>
|
|
|
|
<link rel="stylesheet" href="http://127.0.0.1:8080/ipfs/QmUBL1cAkKbwnkxCcjvN6B9ydgoNgYGt1sYBqij8Wy2AjS/leaflet.css" />
|
|
|
|
<style>
|
|
|
|
body {
|
|
|
|
margin: 0;
|
|
|
|
padding: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#map {
|
|
|
|
height: calc(100vh - 30px); /* Adjusted height to make space for rolling text */
|
|
|
|
z-index: 1; /* Ensure the map is behind the rolling text */
|
|
|
|
}
|
|
|
|
|
|
|
|
.rolling-text-container {
|
|
|
|
position: fixed;
|
2024-01-07 22:05:47 +01:00
|
|
|
top: 0;
|
|
|
|
left: 50;
|
2023-12-01 21:27:00 +01:00
|
|
|
width: 100%;
|
|
|
|
background-color: #333;
|
|
|
|
color: #fff;
|
|
|
|
padding: 10px;
|
|
|
|
text-align: center;
|
2024-01-07 22:05:47 +01:00
|
|
|
font-size: 18px;
|
2023-12-01 21:27:00 +01:00
|
|
|
overflow: hidden;
|
|
|
|
z-index: 2; /* Ensure the rolling text is above the map */
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div id="map"></div>
|
|
|
|
<div id="rollingText" class="rolling-text-container"></div>
|
|
|
|
<script src="http://127.0.0.1:8080/ipfs/QmUBL1cAkKbwnkxCcjvN6B9ydgoNgYGt1sYBqij8Wy2AjS/leaflet.js"></script>
|
|
|
|
<script src="http://127.0.0.1:8080/ipfs/QmUBL1cAkKbwnkxCcjvN6B9ydgoNgYGt1sYBqij8Wy2AjS/axios.min.js"></script>
|
|
|
|
<script>
|
|
|
|
// Initialize the map
|
|
|
|
// const map = L.map('map').setView([0.00, 0.00], 11);
|
|
|
|
const map = L.map('map').setView([43.2218, 1.3977], 11);
|
|
|
|
|
|
|
|
// Add OpenStreetMap layer
|
|
|
|
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
|
|
|
attribution: '© OpenStreetMap contributors'
|
|
|
|
}).addTo(map);
|
|
|
|
|
2024-02-24 01:16:47 +01:00
|
|
|
// Fetch wallets data
|
|
|
|
axios.get('./wallets.json')
|
2023-12-01 21:27:00 +01:00
|
|
|
.then(response => {
|
|
|
|
const places = response.data;
|
|
|
|
|
2024-02-24 01:16:47 +01:00
|
|
|
// Initialize Leaflet map
|
|
|
|
const map = L.map('map').setView([0, 0], 2); // Set initial view and zoom level
|
|
|
|
|
|
|
|
// Add a tile layer to the map (you can choose your preferred tile layer)
|
|
|
|
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
|
|
|
attribution: '© OpenStreetMap contributors'
|
|
|
|
}).addTo(map);
|
|
|
|
|
|
|
|
// Iterate through JSON
|
2023-12-01 21:27:00 +01:00
|
|
|
places.forEach(place => {
|
2024-02-24 01:16:47 +01:00
|
|
|
const { geoPoint, title, description, socials } = place;
|
|
|
|
const { lat, lon } = geoPoint;
|
|
|
|
|
|
|
|
// Create a marker on the map
|
|
|
|
const marker = L.marker([lat, lon]).addTo(map);
|
2023-12-01 21:27:00 +01:00
|
|
|
|
2024-02-24 01:16:47 +01:00
|
|
|
// Create a popup content
|
|
|
|
const popupContent = `
|
|
|
|
<b>${title}</b><br>
|
|
|
|
${description}<br>
|
|
|
|
<a href="${socials[0].url}" target="_blank">Visit Website</a>
|
|
|
|
`;
|
|
|
|
|
|
|
|
// Bind popup to the marker
|
|
|
|
marker.bindPopup(popupContent);
|
2023-12-01 21:27:00 +01:00
|
|
|
});
|
|
|
|
})
|
|
|
|
.catch(error => {
|
|
|
|
console.error('Error fetching JSON data:', error);
|
|
|
|
});
|
|
|
|
|
2024-02-24 01:16:47 +01:00
|
|
|
// Fetch p4n data
|
|
|
|
axios.get('./p4n.json')
|
|
|
|
.then(response => {
|
|
|
|
const p4nPlaces = response.data;
|
|
|
|
|
|
|
|
// Iterate through p4n data
|
|
|
|
p4nPlaces.forEach(place => {
|
|
|
|
const { lat, lng, title_short, description, services, activities } = place;
|
|
|
|
const marker = L.marker([lat, lng]).addTo(map);
|
|
|
|
|
|
|
|
// Create a popup content
|
|
|
|
const popupContent = `
|
|
|
|
<b>${title_short}</b><br>
|
|
|
|
${description}<br>
|
|
|
|
<b>Services:</b> ${services.join(', ')}<br>
|
|
|
|
<b>Activities:</b> ${activities.join(', ')}<br>
|
|
|
|
<a href="#" onclick="goToLocation(${lat}, ${lng})">Zoom In</a>
|
|
|
|
`;
|
|
|
|
|
|
|
|
// Bind popup to the marker
|
|
|
|
marker.bindPopup(popupContent);
|
|
|
|
});
|
|
|
|
})
|
|
|
|
.catch(error => {
|
|
|
|
console.error('Error fetching p4n JSON data:', error);
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2023-12-01 21:27:00 +01:00
|
|
|
function goToLocation(lat, lng) {
|
|
|
|
// Switch to ArcGIS World Imagery basemap
|
|
|
|
L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
|
|
|
|
attribution: '© Esri'
|
|
|
|
}).addTo(map);
|
|
|
|
|
|
|
|
// Set the map view to the specified GPS position
|
2023-12-01 21:56:07 +01:00
|
|
|
map.setView([lat, lng], 18); // Adjust the zoom level as needed
|
2023-12-01 21:27:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Fetch JSON data for rolling text
|
|
|
|
axios.get('gchange50.json')
|
|
|
|
.then(response => {
|
2024-02-24 01:16:47 +01:00
|
|
|
const ids = response.data.hits.hits.map(hit => hit._id);
|
|
|
|
//
|
2023-12-01 21:27:00 +01:00
|
|
|
const titles = response.data.hits.hits.map(hit => hit._source.title);
|
2024-02-24 01:16:47 +01:00
|
|
|
displayRollingText(titles, ids);
|
2023-12-01 21:27:00 +01:00
|
|
|
})
|
|
|
|
.catch(error => {
|
|
|
|
console.error('Error fetching rolling text JSON data:', error);
|
|
|
|
});
|
|
|
|
|
2024-02-24 01:16:47 +01:00
|
|
|
function displayRollingText(titles, ids) {
|
2023-12-01 21:27:00 +01:00
|
|
|
const rollingTextContainer = document.getElementById('rollingText');
|
|
|
|
let currentIndex = 0;
|
|
|
|
|
|
|
|
function updateText() {
|
2024-02-24 01:16:47 +01:00
|
|
|
rollingTextContainer.innerHTML = `<a href="https://data.gchange.fr/market/record/${ids[currentIndex]}/_share">${titles[currentIndex]}</a>`;
|
|
|
|
currentIndex = (currentIndex + 1) % titles.length;
|
2023-12-01 21:27:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
setInterval(updateText, 3000); // Change text every 3 seconds (adjust as needed)
|
|
|
|
updateText(); // Initial display
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|