En Febrero de 2015 Google Maps eliminó la posibilidad de cargar KML externos en Google Maps, del modo que veníamos haciéndolo hasta ahora:
Como ver un KMZ o KML en Google Maps
Sin embargo, hay otras formas de hacerlo, aunque mas complicadas y se necesita una KEY de la API de Google Maps.
El código siguiente es un ejemplo (JAVASCRIPTJAVASCRIPT + HTML):
developers.google.com/ .../layer-kml
Code:: |
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0">
<meta charset="utf-8">
<title>KML Layers</title>
<style>
html, body {
height: 100%;
margin: 0;
padding: 0;
}
#map {
height: 100%;
}
</style>
</head>
<body>
<div id="map"></div>
<script>
Function initMap() {
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 11,
center: {lat: 41.876, lng: -87.624}
});
var ctaLayer = new google.maps.KmlLayer({
url: 'http://googlemaps.github.io/js-v2-samples/ggeoxml/cta.kml',
map: map
});
}
</script>
<script async defer
src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&signed_in=true&callback=initMap">
</script>
</body>
</html>
|