Hi Arnd,<br><br>The Google Maps base layer is in spherical mercator. <br>The kml is of course in EPSG:4326, but since i am defining its projection, OL should still be able to overlay it, right?<br><br>FYI, I created the kml from a shapefile using ogr2ogr - it opens fine in Google Earth. <br>
<br>So far i've been thinking its a proxy host problem.<br><br>The only other thing i can think of is from the Crowdmap mailing list:- on Crowdmap, if there is no style and icon size attribute in the kml, then that kml will not show at all. By adding these tags to 2 or 3 of the 472 points in my kml, i was able to see it on Crowdmap.<br>
<br>The default ogr2ogr conversion from shp to kml does not populate the kml with style and icon size tags.<br><br>Could this be the problem - does anybody have that experience with OL?<br>Vishal<br><br><br><div class="gmail_quote">
On Wed, Apr 13, 2011 at 11:11 AM, Arnd Wippermann <span dir="ltr"><<a href="mailto:arnd.wippermann@web.de">arnd.wippermann@web.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">Hi,</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">if your page and kml comes from the same location
like:</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"><a href="http://yourserver/somepage.html" target="_blank">http://yourserver/somepage.html</a></font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"><a href="http://yourserver/data/somevectors.kml" target="_blank">http:<u>//yourserver/data/somevectors.kml</u></a></font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">you don't need a proxy script to get the
kml.</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">If it is so, then your script should work. The kml file (<font color="#000000" face="Times New Roman" size="3">url: "borewells.kml"</font>) is
searched at the location of your page and there is no need of a proxy script.
There have to be an other reason, why you kml file isn't displayed. Are you
sure, that the coordinates in EPSG:4326 or that the coordinates are lay in the
viewport?</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">Arnd</font></span></div><br>
<div dir="ltr" align="left" lang="de">
<hr>
<font face="Tahoma" size="2"><b>Von:</b> <a href="mailto:openlayers-users-bounces@lists.osgeo.org" target="_blank">openlayers-users-bounces@lists.osgeo.org</a>
[mailto:<a href="mailto:openlayers-users-bounces@lists.osgeo.org" target="_blank">openlayers-users-bounces@lists.osgeo.org</a>] <b>Im Auftrag von </b>Vishal
Mehta<br><b>Gesendet:</b> Mittwoch, 13. April 2011 00:17<br><b>An:</b>
<a href="mailto:users@openlayers.org" target="_blank">users@openlayers.org</a><br><b>Betreff:</b> [OpenLayers-Users] trouble adding local
kml file to OL<br></font><br></div><div><div></div><div class="h5">
<div></div>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><a href="http://osgeo-org.1803224.n2.nabble.com/adding-KML-file-td6003583.html" target="_blank">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>- 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></span></div><span><br><br><html><br><head><br> <title>OpenLayers
Example</title><br> <script src="<a href="http://openlayers.org/api/OpenLayers.js" target="_blank">http://openlayers.org/api/OpenLayers.js</a>"></script><br>
<script src="<a href="http://maps.google.com/maps/api/js?sensor=false" target="_blank">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" target="_blank">www.sei-us.org</a><br></div></div></div>
</blockquote></div><br><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>