<!DOCTYPE html>
src="https://maps.googleapis.com/maps/api/js?key=Klucz_API&callback=initMap"
async
defer
<div id="map" style="height: 500px; width: 100%;"></div>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> function initMap() {
var peaks = [
{ name: "Babia Góra", lat: 49.5736, lng: 19.3497, height: 1725 },
{ name: "Wielka Rycerzowa", lat: 49.4563, lng: 19.1666, height: 1257 },
{ name: "Wielka Racza", lat: 49.4264, lng: 18.8614, height: 1236 },
// itd.
];
var map = new google.maps.Map(document.getElementById("map"), {
zoom: 10,
center: { lat: 49.5, lng: 19.2 },
});
for (var i = 0; i < peaks.length; i++) {
var peak = peaks[i];
var marker = new google.maps.Marker({
position: { lat: peak.lat, lng: peak.lng },
map: map,
title: peak.name + " - " + peak.height + " m n.p.m.",
});
// Add click listener to display info window with peak details
marker.addListener("click", function () {
var infoWindow = new google.maps.InfoWindow({
content: "<h3>" + this.title + "
</h3>",
});
infoWindow.open(map, this);
});
}
// Add legend to display peak names and heights
var legend = document.getElementById("legend");
var legendContent = "
<h2>Szczyty Małej Korony Beskidów
</h2>";
peaks.sort(function (a, b) {
return b.height - a.height;
});
for (var i = 0; i < peaks.length; i++) {
var peak = peaks[i];
legendContent +=
"<p>" +
(i + 1) +
". " +
peak.name +
" - " +
peak.height +
" m n.p.m. (data wejścia: XX.XX.XXXX)" +
}
legend.innerHTML = legendContent;
}
DemoDalej już chyba sobie poradzisz... klucz api znajdziesz na google console