I need to overlay KML polygons on basic map in OpenLayers. I need that KML is visible on every zoom level. I did some coding, but my KML is not showing up. What am I doing wrong?
<!DOCTYPE html>
<html>
<head>
<title>OpenLayers Tutorial - Basic Map Setup</title>
<script src="http://openlayers.org/api/OpenLayers.js"></script>
<script type="text/javascript">
var map, baseLayer;
function init(){
map = new OpenLayers.Map('map');
baseLayer = new OpenLayers.Layer.WMS("OpenLayers WMS", "http://labs.metacarta.com/wms/vmap0", {layers:"basic"});
map.addLayer(baseLayer);
kml1 = new OpenLayers.Layer.Vector("KML", {
strategies: [new OpenLayers.Strategy.Fixed()],
protocol: new OpenLayers.Protocol.HTTP({
url: "kmls/MobileCoverage.kml",
format: new OpenLayers.Format.KML({
extractStyles: true,
extractAttributes: true,
maxDepth: 2
})
})
});
map.addLayer(kml1);
map.zoomToMaxExtent();
}
</script>
<style>
@media screen
{
#map{width: 800px; height:500px; border: 2px solid black;}
}
</style>
</head>
<body onload="init()">
<h3>OpenLayers Testing</h3>
<div id="map"></div>
</body>
</html>