Reputation: 11
I'm writing an application with the google API that loads a kml file from my local server. But the file is not displayed and the map "moves" to an unspecified location. To test this i'm just trying the kml example from the google API reference:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<title>Google Maps JavaScript API v3 Example: KmlLayer KML</title>
<link href="http://code.google.com/apis/maps/documentation/javascript/examples/default.css" rel="stylesheet" type="text/css" />
<script src="http://maps.googleapis.com/maps/api/js?key=AIzaSyAWcYJaMe2mN1u2NYz4ztmffINxGcEpB64&sensor=false&language=he"></script>
<script>
function initialize() {
var chicago = new google.maps.LatLng(41.875696,-87.624207);
var mapOptions = {
zoom: 11,
center: chicago,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions);
//var ctaLayer = new google.maps.KmlLayer('http://gmaps-samples.googlecode.com/svn/trunk/ggeoxml/cta.kml');
var ctaLayer = new google.maps.KmlLayer('http://www.pgl.co.il/maps/testlyr/cta.kml');
ctaLayer.setMap(map);
}
</script>
</head>
<body onload="initialize()">
<div id="map_canvas"></div>
</body>
</html>
when the file is located in the Google server it works fine, but when the file is in my server (windows, iis 5.1) the html runs but the map does not display the kml file. I've defined the mime type in the header section of the iis.
What's wrong? thanks for your help!
Upvotes: 1
Views: 809
Reputation: 161334
The file can't be accessed by Google's servers.
If I put the URL in your code into Google Maps, it says:
File not found at http://www.pgl.co.il/maps/t....
Suggestions:
- Make sure the URL is spelled correctly.
- Make sure the file exists.
As does http://www.feedvalidator.org:
Server returned timed out [help]
Sorry
An error occurred while trying to validate this feed.
Possible causes:
- The address may be incorrect. Make sure the address is spelled correctly. Try loading the feed directly in your browser to make sure a feed exists at that address.
- The feed may be temporarily unavailable. The server may be down, or too slow. Try again later.
- The validator may be busted. If the feed exists, the server is fine, and the problem is reproducible, let us know on the feedvalidator-users mailing list.
Are you sure that:
Upvotes: 3