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

Nipuni Perera nipuni880917 at gmail.com
Tue Jun 4 04:37:58 PDT 2013


I have added

OpenLayers.ProxyHost = 'C:/Server/Apache2/cgi-bin/proxy.cgi?url=';

to the script and the URL 'api.flickr.com' was added in the proxy.cgi
script which is in the above location. But the data is not loaded.

Thanks,
Nipuni


On Tue, Jun 4, 2013 at 4:22 PM, Nipuni Perera <nipuni880917 at gmail.com>wrote:

> Hi,
>
> I am trying to read a KML file from a URL, instead of a local file. Below
> is my code for initializing the vector layer. But it does not work.
> (Reading from the local file worked fine)
>
> vector_layer = new OpenLayers.Layer.Vector("KML", {
>
>                 strategies: [new OpenLayers.Strategy.Fixed()],
>                 protocol: new OpenLayers.Protocol.HTTP({
>                     url: "http://api.flickr.com/services/feeds/geo/",
>                     params:{'format':'kml','tags':'bird'},
>
>                     format: new OpenLayers.Format.KML({
>                         extractStyles: true,
>                         extractAttributes: true,
>                         maxDepth: 2
>                     })
>                 })
>             });
>
> Thanks,
> Nipuni
>
>
> On Sat, May 25, 2013 at 6:11 PM, Nipuni Perera <nipuni880917 at gmail.com>wrote:
>
>> Hi Grey,
>>
>> It works fine, Thanks
>>
>> Thanks,
>> Nipuni
>>
>>
>> On Sat, May 25, 2013 at 5:32 PM, Nipuni Perera <nipuni880917 at gmail.com>wrote:
>>
>>> Hi,
>>>
>>> This is also not working, it may be an issue with my server. Thanks
>>>
>>> Thanks,
>>> Nipuni
>>>
>>>
>>> On Sat, May 25, 2013 at 4:16 PM, Gery . <gamejihou at hotmail.com> wrote:
>>>
>>>>
>>>> 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<http://lists.osgeo.org/mailman/listinfo/openlayers-users>
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Nipuni Piyabasi Perera
>>>> Undergraduate
>>>> Department of Computer Science And Engineering
>>>> University of Moratuwa
>>>> Sri Lanka
>>>>  _______________________________________________
>>>> Users mailing list
>>>> Users at lists.osgeo.org
>>>> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Nipuni Piyabasi Perera
>>>> Undergraduate
>>>> Department of Computer Science And Engineering
>>>> University of Moratuwa
>>>> Sri Lanka
>>>>
>>>
>>>
>>>
>>> --
>>> Nipuni Piyabasi Perera
>>> Undergraduate
>>> Department of Computer Science And Engineering
>>> University of Moratuwa
>>> Sri Lanka
>>>
>>
>>
>>
>> --
>> Nipuni Piyabasi Perera
>> Undergraduate
>> Department of Computer Science And Engineering
>> University of Moratuwa
>> Sri Lanka
>>
>
>
>
> --
> Nipuni Piyabasi Perera
> Undergraduate
> Department of Computer Science And Engineering
> University of Moratuwa
> Sri Lanka
>



-- 
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/20130604/ba774c35/attachment.html>


More information about the Users mailing list