Google Maps api with KML layer

I’ve got this code by following an example from Google maps api and I create my own kml files, but the stringline appear with no markers for start and end. How would I go about adding markers to these two points ?

I’ve been looking at finding the first and last entry in the array of locations, but are there a different way ?

      var map;
      var src = '<?php echo $data[0][kmlFile]; ?>';

      function initMap() {
        map = new google.maps.Map(document.getElementById('map'), {
          center: new google.maps.LatLng(-19.257753, 146.823688),
          zoom: 3,
          mapTypeId: 'terrain'

        var kmlLayer = new google.maps.KmlLayer(src, {
          suppressInfoWindows: true,
          preserveViewport: false,
          map: map
        kmlLayer.addListener('click', function(event) {
          var content = event.featureData.infoWindowHtml;
          var testimonial = document.getElementById('capture');
          testimonial.innerHTML = content;
    <script async defer

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.