I'm trying to make a displayable google map that has the ability to update without changing its link. I have a map.kmz file uploaded to a site. I have a display.html file also uploaded to the site. The map.kmz map file I have the ability to delete and replace with another file of the same name. The display.html (shown below) points to and displays the map.kmz file via a link to it.
My issue is: After the first time it loads and displays the map from the link, it won't change its mind on how that map looks. I can even delete the map (creating a dead link), but because the link is still the same, Google remembers that it's already made the map and won't re-make it. How do I make Google forget and re-load my map?
display.html:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<title>KML Click Capture Sample</title>
<style>
html, body {
height: 370px;
padding: 0;
margin: 0;
}
#map {
height: 360px;
width: 300px;
overflow: hidden;
float: left;
border: thin solid #333;
}
#capture {
height: 360px;
width: 480px;
overflow: hidden;
float: left;
background-color: #ECECFB;
border: thin solid #333;
border-left: none;
}
</style>
</head>
<body>
<div id="map"></div>
<div id="capture"></div>
<script>
var map;
var src = '[LINK TO MY map.kmz FILE]';
function initMap() {
map = new google.maps.Map(document.getElementById('map'), {
center: new google.maps.LatLng(-19.257753, 146.823688),
zoom: 2,
mapTypeId: 'roadmap'
});
var kmlLayer = new google.maps.KmlLayer(src, {
suppressInfoWindows: false,
preserveViewport: false,
map: map
});
kmlLayer.addListener('click', function(event) {
var content = event.featureData.infoWindowHtml;
var testimonial = document.getElementById('capture');
testimonial.innerHTML = content;
});
}
</script>
<script async defer
src="http://ift.tt/2rKw6Gm API KEY]&callback=initMap">
</script>
</body>
</html>
Aucun commentaire:
Enregistrer un commentaire