<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'><font style="font-size:10pt;" color="#366092" face="Arial" size="2"><br id="FontBreak"></font>it looks good to me, probably modifying your code like this?:<br><br><pre style="" class="default prettyprint prettyprinted"><code><span class="pln"></span><span class="kwd">new</span><span class="pln"> </span><span class="typ">OpenLayers</span><span class="pun">.</span><span class="typ">Layer</span><span class="pun">.</span><span class="typ">Vector</span><span class="pun">(</span><span class="str">"KML"</span><span class="pun">,</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
strategies</span><span class="pun">:</span><span class="pln"> </span><span class="pun">[</span><span class="kwd">new</span><span class="pln"> </span><span class="typ">OpenLayers</span><span class="pun">.</span><span class="typ">Strategy</span><span class="pun">.</span><span class="typ">Fixed</span><span class="pun">()],</span><span class="pln">
protocol</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">OpenLayers</span><span class="pun">.</span><span class="typ">Protocol</span><span class="pun">.</span><span class="pln">HTTP</span><span class="pun">({</span><span class="pln">
url</span><span class="pun">:</span><span class="pln"> </span><span class="str">"kml/YOUR-KML.kml"</span><span class="pun">,</span><span class="pln">
format</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">OpenLayers</span><span class="pun">.</span><span class="typ">Format</span><span class="pun">.</span><span class="pln">KML</span><span class="pun">({</span><span class="pln">
extractStyles</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">true</span><span class="pun">,</span><span class="pln">
extractAttributes</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">true</span><span class="pun">,</span><span class="pln">
maxDepth</span><span class="pun">:</span><span class="pln"> </span><span class="lit">2</span></code><code><span class="pun"><br>})</span><span class="pln">
</span><span class="pun">})</span><span class="pln">
</span><span class="pun">})</span></code><br></pre><br><br><font style="font-size:10pt" color="#1F497D" face="Arial" size="2"><br>__________________________________________________________________________________________<br>Piensa en el medio ambie<font style="" face="Arial">nte - mantenlo en la pantalla. NO lo imprimas si NO es necesario.</font></font><font style="font-size:10pt" color="#1F497D" face="Arial" size="2"><br></font><font style="font-size:10pt" color="#1F497D" face="Arial" size="2">Think green - keep it on the screen. Do NOT print if it is NOT necessary.</font><font style="font-size:10pt" color="#1F497D" face="Arial" size="2"><br></font><font style="font-size:10pt" color="#1F497D" face="Arial" size="2"><span id="ecxresult_box" class="ecxshort_text" lang="de"><span class="ecxhps">Denken Sie an</span> <span class="ecxhps">die Umwelt</span></span></font><font style="font-size:10pt" color="#1F497D" face="Arial" size="2"><span id="ecxresult_box" lang="de"><span class="ecxhps"></span> <span class="ecxhps">-</span> <span class="ecxhps">bewahren Sie es</span> <span class="ecxhps">auf dem Bildschirm.</span> <span class="ecxhps">Drucken Sie es NICHT</span><span>, wenn</span> <span class="ecxhps">es NICHT notwendig ist</span><span>.</span></span></font><br><br><br><div><hr id="stopSpelling">Date: Sat, 25 May 2013 14:24:47 +0530<br>Subject: Re: [OpenLayers-Users] Accessing user defined data from a OpenLayers application<br>From: nipuni880917@gmail.com<br>To: gamejihou@hotmail.com<br>CC: p.scadden@gns.cri.nz; openlayers-users@lists.osgeo.org<br><br><div dir="ltr"><div><div>This is the KML file I am using. I have tried with some other KML files, but still it does not work. <br><br></div>Thanks,<br></div>Nipuni<br></div><div class="ecxgmail_extra"><br><br><div class="ecxgmail_quote">
On Sat, May 25, 2013 at 2:07 PM, Gery . <span dir="ltr"><<a href="mailto:gamejihou@hotmail.com" target="_blank">gamejihou@hotmail.com</a>></span> wrote:<br><blockquote class="ecxgmail_quote" style="border-left:1px #ccc solid;padding-left:1ex;">
<div dir="auto"><div>Probably the kml structure is wrong, is it?<br><br>Sent from my iRon</div><div><div class="h5"><div><br>On May 25, 2013, at 9:14, "Nipuni Perera" <<a href="mailto:nipuni880917@gmail.com" target="_blank">nipuni880917@gmail.com</a>> wrote:<br>
<br></div><div><div dir="ltr"><div><div>Hi,<br><br></div>I have tried displaying data from GeoJSON file which worked fine with both localhost and local file location. But when I tried to get data from a KML file it does not show data on the vector layer, only the base layers is visible. <br>
</div>This is my vector layer instantiation for retrieving KML data. <br><div><br><span style="font-family:courier new,monospace;">vector_layer = new OpenLayers.Layer.Vector('KML Data',<br>{ projection:new OpenLayers.Projection('EPSG:4326'),<br>
protocol:new OpenLayers.Protocol.HTTP({url:'flicker_data.kml', format:new OpenLayers.Format.KML({extractAttributes:true})})<br>,stratagies:new OpenLayers.Strategy.Fixed()});<br><br></span></div><div><span style="font-family:courier new,monospace;"><span style="font-family:arial,helvetica,sans-serif;">Thanks</span>,<br>
</span></div><div><span style="font-family:courier new,monospace;"><span style="font-family:arial,helvetica,sans-serif;">Nipuni</span><br></span></div><div><span style="font-family:courier new,monospace;"> </span> <br></div>
</div><div class="ecxgmail_extra"><br><br><div class="ecxgmail_quote">On Thu, May 9, 2013 at 10:34 AM, Phil Scadden <span dir="ltr"><<a href="mailto:p.scadden@gns.cri.nz" target="_blank">p.scadden@gns.cri.nz</a>></span> wrote:<br>
<blockquote class="ecxgmail_quote" style="border-left:1px #ccc solid;padding-left:1ex;"><div>>If so (correct me if my approach incorrect), where should I put the data that I need to access from the OpenLayers application?.<br>
>Do I need to save data in a file or does the data need to be available from a server?.<br>
<br></div>
I am assuming that your application will run off a server? If so, then no problem putting the data as xml file on that server and using http to access it (eg, that is how you normally fetch GML).<br>
<br>
If you are working "server-less" then its a whole different ball game. For starters you will need to use a script protocol to get around browser security restrictions on local files. To make your life easier, if at all possible use a server. If you can feed your data to a spatial database like PostGIS and extract with WMS/WFS server like geoserver or mapserver, then it will be easier still.<br>
<br>
<br>
<br>
<br>
Notice: This email and any attachments are confidential.<br>
If received in error please destroy and immediately notify us.<br>
Do not copy or disclose the contents.<div><div><br>
<br>
______________________________<u></u>_________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.osgeo.org" target="_blank">Users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/openlayers-users" target="_blank">http://lists.osgeo.org/<u></u>mailman/listinfo/openlayers-<u></u>users</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div><span>Nipuni Piyabasi Perera</span></div><span>Undergraduate</span><div>Department of Computer Science And Engineering</div><div>University of Moratuwa<div>
Sri Lanka</div></div>
</div>
</div><div><span>_______________________________________________</span><br><span>Users mailing list</span><br><span><a href="mailto:Users@lists.osgeo.org" target="_blank">Users@lists.osgeo.org</a></span><br><span><a href="http://lists.osgeo.org/mailman/listinfo/openlayers-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/openlayers-users</a></span><br>
</div></div></div></div></blockquote></div><br><br clear="all"><br>-- <br><div><span>Nipuni Piyabasi Perera</span></div><span>Undergraduate</span><div>Department of Computer Science And Engineering</div><div>University of Moratuwa<div>
Sri Lanka</div></div>
</div></div> </div></body>
</html>