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

Nipuni Perera nipuni880917 at gmail.com
Sat May 25 00:14:31 PDT 2013


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<http://lists.osgeo.org/mailman/listinfo/openlayers-users>
>



-- 
Nipuni Piyabasi Perera
Undergraduate
Department of Computer Science And Engineering
University of Moratuwa
Sri Lanka
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20130525/b3960813/attachment.html>


More information about the Users mailing list