Adding Kml Layer to google map
Solution 1
Solved the problem in the end. The problem was that this was all being done on a dev server and I learnt that for google to access the KML files they need to be on a live site!
Temporarily put them on another live site to reference while I'm still working on development.
Thanks for help :)
Solution 2
Does your layer display at http://maps.google.com?q=http://your.site/your.kml ?
If not, there's probably something wrong with your KML. Perhaps, for example, all the features are set to visibility being off. A link to your KML would help troubleshooting.
Ross Coulbeck
Updated on June 07, 2022Comments
-
Ross Coulbeck almost 2 years
I'm trying to add a couple of KML layers to a map. This is the code I have:
var myKmlOptions = { preserveViewport: true, suppressInfoWindows: true } var kmlLayer_1 = new google.maps.KmlLayer("Layers/layer1.kml", myKmlOptions); var kmlLayer_2 = new google.maps.KmlLayer("Layers/layer2.kml", myKmlOptions); kmlLayer_1.setMap(map); kmlLayer_2.setMap(map);
Something is definately working because if I change preserveViewport to false, the map zooms closer into the area defined by the KML Layer.
But nothing is showing up, the layer its self is missing :/
Any ideas?