fire-prediction / harita.html
Bntuhan's picture
Update harita.html
ba976e1 verified
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Wildfire Map</title>
<link
rel="stylesheet"
href="https://unpkg.com/leaflet/dist/leaflet.css"
/>
<script src="https://unpkg.com/leaflet/dist/leaflet.js"></script>
<script src="https://unpkg.com/html2canvas@1.4.1/dist/html2canvas.min.js"></script>
</head>
<body>
<div id="map" style="width:100%; height:600px;"></div>
<button onclick="capture()">📸 Alanı Al</button>
<script>
const map = L.map('map').setView([39.0, 35.0], 6);
const osm = L.tileLayer(
'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'
).addTo(map);
const esri = L.tileLayer(
'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}'
);
const layers = {
"OSM": osm,
"Uydu": esri
};
L.control.layers(layers).addTo(map);
function capture() {
html2canvas(document.getElementById("map")).then(canvas => {
const base64 = canvas.toDataURL("image/png");
window.parent.postMessage(base64, "*");
});
}
</script>
</body>
</html>