[OpenLayers-Users] Accessing user defined data from a OpenLayers application

Gery . gamejihou at hotmail.com
Sat May 25 03:46:15 PDT 2013


it looks good to me, probably modifying your code like this?:

new OpenLayers.Layer.Vector("KML", {
            strategies: [new OpenLayers.Strategy.Fixed()],
            protocol: new OpenLayers.Protocol.HTTP({
                url: "kml/YOUR-KML.kml",
                format: new OpenLayers.Format.KML({
                    extractStyles: true, 
                    extractAttributes: true,
                    maxDepth: 2
})
            })
        })



__________________________________________________________________________________________
Piensa en el medio ambiente - mantenlo en la pantalla. NO lo imprimas si NO es necesario.
Think green - keep it on the screen. Do NOT print if it is NOT necessary.
Denken Sie an die Umwelt - bewahren Sie es auf dem Bildschirm. Drucken Sie es NICHT, wenn es NICHT notwendig ist.


Date: Sat, 25 May 2013 14:24:47 +0530
Subject: Re: [OpenLayers-Users] Accessing user defined data from a OpenLayers application
From: nipuni880917 at gmail.com
To: gamejihou at hotmail.com
CC: p.scadden at gns.cri.nz; openlayers-users at lists.osgeo.org

This is the KML file I am using. I have tried with some other KML files, but still it does not work. 

Thanks,
Nipuni



On Sat, May 25, 2013 at 2:07 PM, Gery . <gamejihou at hotmail.com> wrote:

Probably the kml structure is wrong, is it?

Sent from my iRon
On May 25, 2013, at 9:14, "Nipuni Perera" <nipuni880917 at gmail.com> wrote:


Hi,

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. 


This is my vector layer instantiation for retrieving KML data. 

vector_layer = new OpenLayers.Layer.Vector('KML Data',
{ projection:new OpenLayers.Projection('EPSG:4326'),


protocol:new OpenLayers.Protocol.HTTP({url:'flicker_data.kml', format:new OpenLayers.Format.KML({extractAttributes:true})})
,stratagies:new OpenLayers.Strategy.Fixed()});

Thanks,


Nipuni
    




On Thu, May 9, 2013 at 10:34 AM, Phil Scadden <p.scadden at gns.cri.nz> wrote:


>If so (correct me if my approach incorrect), where should I put the data that I need to access from the OpenLayers application?.



>Do I need to save data in a file or does the data need to be available from a server?.



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).



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.











Notice: This email and any attachments are confidential.

If received in error please destroy and immediately notify us.

Do not copy or disclose the contents.



_______________________________________________

Users mailing list

Users at lists.osgeo.org

http://lists.osgeo.org/mailman/listinfo/openlayers-users



-- 
Nipuni Piyabasi PereraUndergraduateDepartment of Computer Science And EngineeringUniversity of Moratuwa

Sri Lanka

_______________________________________________
Users mailing list
Users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users



-- 
Nipuni Piyabasi PereraUndergraduateDepartment of Computer Science And EngineeringUniversity of Moratuwa
Sri Lanka
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20130525/93867d7e/attachment-0001.html>


More information about the Users mailing list