-1

We are using the Google JavaScript API to display Google My Maps via a KML file. The markers on the map are showing white markers and not the custom logo's we have got on My Maps. Does KML not support custom logos for the markers?

enter image description here

<style type="text/css">

html,
body,
#map_canvas {
height: 100%;
width: 100%;
margin: 0px;
padding: 0px
}

</style>
<script src="https://maps.googleapis.com/maps/api/js? 
key=Your_API_kEY" type="text/javascript"> 
</script>

<script>

var geocoder;
var map;

function initialize() {
var map = new google.maps.Map(
document.getElementById("map_canvas"), {
mapTypeId: google.maps.MapTypeId.ROADMAP
});
var layer = new google.maps.KmlLayer({
suppressInfoWindows: false,
url: "http://www.linktodata/data.kml",
map: map
})

}

google.maps.event.addDomListener(window, "load", initialize);

</script>
Tig7r
  • 525
  • 1
  • 4
  • 21
  • Please provide a [mcve]. I don't see your issue: [fiddle with KmlLayer from MyMaps with custom icons](https://jsfiddle.net/geocodezip/jar079dL/) – geocodezip Sep 06 '18 at 15:24
  • I found the problem. The URL was linking to the actual .kml file. I think a .kml has limited support for custom icons. You have to link to the MyMaps link if I am not mistaken. – Tig7r Sep 07 '18 at 08:07
  • Both KML and KMZ have support for custom icons, might be the export for MyMaps doesn't (I believe it does say something in the share dialog about that) – geocodezip Sep 07 '18 at 16:32

1 Answers1

0

The URL: http://www.linktodata/data.kml is wrong. It needs to go to the link within the .kml file.

Tig7r
  • 525
  • 1
  • 4
  • 21