Map Simple

by Wolf

HTML

<div id="map"></div>
<!-- Replace the value of the key parameter with your own API key. -->
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCkUOdZ5y7hMm0yrcCQoCvLwzdM6M8s5qk&callback=initMap" async defer></script>

CSS

/* Always set the map height explicitly to define the size of the div
 * element that contains the map. */

#map {
  height: 100%;
}


/* Optional: Makes the sample page fill the window. */

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
}

JavaScript

var map;

function initMap() {
  var myLatlng = new google.maps.LatLng(54.44532, 25.91814);

  var myOptions = {
    zoom: 16,
    center: myLatlng,
    mapTypeId: google.maps.MapTypeId.ROADMAP,
  };

  var map = new google.maps.Map(document.getElementById("map"), myOptions);

//  var kmlUrl = 'http://geo.bergenheim.net/kml/kml_hotspot_fraction.kml';
  var kmlUrl = 'http://geo.bergenheim.net/kml/kml_hotspot_pixel.kml';

  var markersKML = new google.maps.KmlLayer(kmlUrl, {
    preserveViewport: true
  });

  markersKML.setMap(map);

  // marker

  var markerImage = new google.maps.MarkerImage(
    'http://maps.gstatic.com/mapfiles/ms2/micons/gas.png',
    new google.maps.Size(32, 32), //size
    new google.maps.Point(0, 0), //origin
    new google.maps.Point(16, 16) //anchor
  );


  var marker = new google.maps.Marker({
    map: map,
    icon: markerImage,
    position: myLatlng
  });
}