JavaScript How do I add a KML to an OpenLayers map from a local source? openlayers local tiles,openlayers local tiles example,openlayers local map,

I am looking at this example from openlayers themselves. You can see the source by clicking on the "kml-layer.js" link at the bottom. The source code when i do this looks like this:

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/lines.kml",
                format: new OpenLayers.Format.KML({
                    extractStyles: true, 
                    extractAttributes: true,
                    maxDepth: 2
                })
            })
        })
    ],
    center: new OpenLayers.LonLat(-112.169, 36.099),
    zoom: 11
});

It seems that this will only work if sourcing a kml via HTTP, but what if I want to source it from my own hard drive while I work on the map itself? I can't seem to find much documentation on how to do this, can someone help out?

Thanks

Answer:1

Important edit : I can't use filter - the purpose is pedagogic. I have an array in which I would want to count the number of its elements that verify a boolean, using only map and reduce. Count of ...

Important edit : I can't use filter - the purpose is pedagogic. I have an array in which I would want to count the number of its elements that verify a boolean, using only map and reduce. Count of ...

Clicking #input multiple times will upload a file each time. Clicking #button which in turn triggers #input will only upload a file the first time (and not at all if #input was first clicked). I ...

Clicking #input multiple times will upload a file each time. Clicking #button which in turn triggers #input will only upload a file the first time (and not at all if #input was first clicked). I ...

  1. jquery trigger only once
  2. jquery trigger only one time
  3. jquery trigger only works once
  4. jquery trigger only one event
  5. jquery fire only once
  6. jquery trigger click only once
  7. jquery trigger event only once
  8. jquery trigger function only once
  9. jquery trigger change only once
  10. jquery trigger click only works once
  11. jquery only fire event once
  12. jquery trigger change event only once

I'm using the request library in node.js, which downloads an HTML body response, but does so in chunks. Currently I'm just concatenating them into a dataChunks variable and using a hacked-together ...

I'm using the request library in node.js, which downloads an HTML body response, but does so in chunks. Currently I'm just concatenating them into a dataChunks variable and using a hacked-together ...

  1. nodejs convert http to https

i have form that's announcing user for error, warning or new content on my site. I have three buttons on class ann-right and each button have its color. When i click the button, the button input on ...

i have form that's announcing user for error, warning or new content on my site. I have three buttons on class ann-right and each button have its color. When i click the button, the button input on ...