Tell me more ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Recently I posted this question KML file seems to load in Openlayers without error but doesn't show vectors because I was having trouble getting KML vector data to show up. After searching around a bit it seems there is an issue with loading KML files locally.

I am developing a stand alone Application that will run on the desktop or on IOS. I am running openlayers via a WebKit view. I am loading my openlayers page from the local file system witch is part of the applications files when it's installed.

My guess is there is some sort of issue loading local files. Is there a way around this? I would even consider converting all my KML files if needed. Ideally I would like to be able to point to either a local file or a remote kml file and load it.

Here is the code I am using. It's from the Openlayers kml example that's online. The only difference is I am trying to load locally without running the html page on any sort of server.

var map = new OpenLayers.Map({
    div: "map",
    layers: [
        new OpenLayers.Layer.WMS(
            "WMS", "http://vmap0.tiles.osgeo.org/wms/vmap0",
            {layers: "basic"}
        ),
        new OpenLayers.Layer.Vector("KML", {
            strategies: [new OpenLayers.Strategy.Fixed()],
            protocol: new OpenLayers.Protocol.HTTP({
                url: "kml-files/lines.kml",
                format: new OpenLayers.Format.KML({
                    extractStyles: true, 
                    extractAttributes: true,
                    maxDepth: 2
                })
            })
        })
    ],
    center: new OpenLayers.LonLat(-112.169, 36.099),
    zoom: 11
}); 
share|improve this question
Looks like you are hitting this issue: stackoverflow.com/questions/7331997/… – BradHards Jan 26 at 1:44

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.