Hi all,<br><br>I;m having some trouble adding a kml file to openlayers. The script is at bottom, and i've followed this thread without solving the problem: <br><span class="gI"><a href="http://osgeo-org.1803224.n2.nabble.com/adding-KML-file-td6003583.html">http://osgeo-org.1803224.n2.nabble.com/adding-KML-file-td6003583.html</a><br>
<br>note that <br>(a) i have apache running (but no proxy host configured- i tried to do it but it broke my web server, i'm not an expert at troubleshooting it.<br>(b) webserver is back on - i use it for an application with php and postgis (which i actually want to link to an OL application)<br>
(c) i am new to OL<br><br>1. with both the html and kml file on the webserver, <br></span><div style="margin-left: 40px;"><span class="gI">- i get only the google map displayed</span>, no kml file displayed<br>- no error message<br>
- no kml file displayed<br></div><br>2. with the html on local folder and kml file on webserver<br><div style="margin-left: 40px;">- i get only the google map displayed<br>- error message Access to URL denied" code" 1012<br>
<br></div>3. with both html and kml files in local folder<br> - same response as 1 above<br> - although i dont know if i shoulde be using url to point to the file in this case<br><br>The code is below. Any help appreciated!!<br>
Also, do i absolutely need proxy hosting or is there some way i can use my existing webserver and working postgis as is?<br>Thanks,<br>Vishal<br><div style="margin-left: 40px;"><span class="gI"></span></div><span class="gI"><br>
<br><html><br><head><br> <title>OpenLayers Example</title><br> <script src="<a href="http://openlayers.org/api/OpenLayers.js">http://openlayers.org/api/OpenLayers.js</a>"></script><br>
<script src="<a href="http://maps.google.com/maps/api/js?sensor=false">http://maps.google.com/maps/api/js?sensor=false</a>"></script><br> </head><br> <body><br> <div style="width:100%; height:100%" id="map"></div><br>
var map = new OpenLayers.Map('map');<br> <br> var googlemap = new OpenLayers.Layer.Google('Google Layer');<br> map.addLayer(googlemap);<br> map.setCenter(<br> new OpenLayers.LonLat(77.6, 13).transform(<br>
new OpenLayers.Projection("EPSG:4326"),<br> map.getProjectionObject()<br> ), 12);<br> console.log(map.getProjection());<br> var vector_layer = new OpenLayers.Layer.Vector('borewells',<br>
{<br> projection: new OpenLayers.Projection('EPSG:4326'),<br> protocol: new OpenLayers.Protocol.HTTP({<br> url: "borewells.kml",<br> format: new OpenLayers.Format.KML({<br>
extractAttributes: true<br> })<br> }),<br> strategies: [new OpenLayers.Strategy.Fixed()]<br> }<br> );<br> //add it to the map<br> map.addLayer(vector_layer);<br>
console.log('got here');<br> </script> <br></body><br></html><br><br></span><br clear="all"><br>-- <br>Vishal K. Mehta, PhD<br>Scientist<br>Stockholm Environment Institute - US<br>133 D St Suite F<br>
Davis CA 95616<br><a href="http://www.sei-us.org">www.sei-us.org</a><br>