Template:Map: Difference between revisions
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
<div id="map" style="height: 400px;"></div> | <div id="map" style="height: 400px;"></div> | ||
< | <pre> | ||
<script> | <script> | ||
function initMap() { | function initMap() { | ||
| Line 22: | Line 22: | ||
</script> | </script> | ||
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBIrgq5dZQ8haJIfKHbGco90OpDwYLiXwA&callback=initMap" async defer></script> | <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBIrgq5dZQ8haJIfKHbGco90OpDwYLiXwA&callback=initMap" async defer></script> | ||
</ | </pre> | ||
Revision as of 19:01, 19 February 2024
<script>
function initMap() {
var coordinates = '{{{GPS}}}';
coordinates = coordinates.split(',').map(function(coord) {
return parseFloat(coord.trim());
});
var mapOptions = {
center: { lat: coordinates[0], lng: coordinates[1] },
zoom: 15
};
var map = new google.maps.Map(document.getElementById('map'), mapOptions);
var marker = new google.maps.Marker({
position: { lat: coordinates[0], lng: coordinates[1] },
map: map,
title: 'Marker Title'
});
}
</script>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBIrgq5dZQ8haJIfKHbGco90OpDwYLiXwA&callback=initMap" async defer></script>