0

I have loaded this code (see below) into my Weebly web page and placed my .kml file on another server and added the mime type .kml. But all I get on my web page is the display of the map without the kml stuff on it. It is like the .kml data is not being accessed??

I don't know what to expect... but when I try the url to the kml file direct in a browser I get "the page can not be found."

What next to try? Is my code faulty? Thanks! Bob

<!DOCTYPE html>
<html>
  <head>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
    <meta charset="utf-8">
    <title>KML Layers</title>
    <style>
#map-canvas { width:500px; height:300px; }
    .layer-wizard-search-label { font-family: sans-serif };
    </style>
    <script src="https://maps.googleapis.com/maps/api/js?    v=3.exp&sensor=false"></script>
    <script>
function initialize() {
  var world = new google.maps.LatLng(24.174513811778894, 6.083308984374969);
  var mapOptions = {
    zoom: 1,
    center: world
  }

  var map = new google.maps.Map(document.getElementById('map-canvas'),   mapOptions);

  var ctaLayer = new google.maps.KmlLayer({
    url: 'http://www.godanddeaf.org/HisHands/kml/HHR- STARTEDtranslationof1742WORDS.kml'
  });
  ctaLayer.setMap(map);
}

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

    </script>
  </head>
  <body>
    <div id="map-canvas"></div>
  </body>
</html>`
Bob Achgill
  • 9
  • 1
  • 4
  • I'm getting a 404 at that URL. Are you sure you have the right location for that file? – Michael Todd Apr 24 '14 at 22:19
  • Yes, I have asked my site provider to check it. And they said they will get back to me soon. – Bob Achgill Apr 24 '14 at 22:45
  • The site provided fixed the mime problem so now the .kml file is accessible. But when the .kml file loads using the code above the zoom, center of the code is not being used. And the icons are not showing. I know the .kml does work to show icons and popup data tables for each icon when I load it into Google Fusion table environment. So I guess it is a problem with the above code?? – Bob Achgill Apr 25 '14 at 18:15
  • To add to the last comment... the zoom and center seem to be defaulting to the two icons that are in the .kml – Bob Achgill Apr 25 '14 at 18:23
  • Check [this question](http://stackoverflow.com/questions/8187837/google-maps-zoom-gets-overriden-when-using-a-kml-file) to resolve the zoom issue. As for the other problem, I dont know enough to answer to that. – Michael Todd Apr 25 '14 at 19:29
  • This is how the code above with that .kml renders in the browser... www.godanddeaf.org/HisHands/kml/HHR-STARTEDtranslationof1742WORDS.kml – Bob Achgill Apr 25 '14 at 21:15
  • Sorry, this is how it renders in the browser... http://hishandsreadertest1.weebly.com/volunteers.html – Bob Achgill Apr 25 '14 at 21:30

0 Answers0