[OpenLayers-Users] kml example
Christopher Schmidt
crschmidt at metacarta.com
Wed Sep 3 09:41:32 EDT 2008
On Wed, Sep 03, 2008 at 09:38:55AM -0400, Jeremy Jackson wrote:
> Hi everyone,
>
> I'm new to the openlayers emailing list. Just wanted to introduce myself.
>
> I have a question about the kml sundials
> example<http://openlayers.org/dev/examples/kml-layer.html>.
> In line 43 of the code, you get what I've copied below:
>
> map.addLayer(new OpenLayers.Layer.GML("KML", "kml/sundials.kml",
> {
> format: OpenLayers.Format.KML,
> projection: map.displayProjection,
> formatOptions: {
> extractStyles: true,
> extractAttributes: true
> }
> }));
>
> My question is this: How does it know where to find the file called in line
> 43 of the code - " kml/sundials.kml" ? If I wanted to change the code so
> that it would call a file I've saved either on the web or on my computer,
> what steps would I have to take? I've tried simply putting the
> http://address of my kml files in there but it doesn't work that way.
> Any
> suggestions?
That's a URL. In this case, it's a relative URL: if you make your URLs
always relative, you'll never run into the 'same origin policy', which
prevents accessing files on different domains.
http://faq.openlayers.org/proxyhost/all/ has more information about the
same origin policy, how it affects OpenLayers, and how to get around it.
Regards,
--
Christopher Schmidt
MetaCarta
More information about the Users
mailing list