[OpenLayers-Users] kml file not showing markers

M.E.Dodd M.E.Dodd at open.ac.uk
Tue Dec 2 11:13:54 EST 2008


I am new to openlayers, trying to display a .kml file that works fine in
google earth on an openlayers web page.  The code is shown below.  The
map itself comes up fine but not showing any of the markers, there is no
error message.

The code is a copy of one of the example web pages but with my own .kml
added. 

Thanks for any suggestions, Mike.

 

<html xmlns="http://www.w3.org/1999/xhtml">

  <head>

    <link rel="stylesheet" href="../theme/default/style.css"
type="text/css" />

    <link rel="stylesheet" href="style.css" type="text/css" />

    <script src="http://www.openlayers.org/api/OpenLayers.js"></script>

    <script type="text/javascript">

        var lon = 5;

        var lat = 40;

        var zoom = 5;

        var map, layer;

 

        function init(){

            map = new OpenLayers.Map('map');

            layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",

                    "http://labs.metacarta.com/wms/vmap0", {layers:
'basic'} );

            map.addLayer(layer);

            map.addLayer(new OpenLayers.Layer.GML("KML", 

 
"http://www.amanita-photolibrary.co.uk/all_info2s.kml",

            {

                format: OpenLayers.Format.KML, 

                formatOptions: {

                  extractStyles: true, 

                  extractAttributes: true

                  }

                }));

            map.zoomToExtent(new OpenLayers.Bounds(-10,49,5,60));

        }

    </script>

  </head>

  <body onload="init()">

 

      <h1 id="title">KML Layer Example</h1>

 

      <div id="tags"></div>

 

      <p id="shortdesc">

          Demonstrates loading and displaying a KML file on top of a
basemap.

    </p>

 

    <div id="map" class="smallmap"></div>

 

    <div id="docs"></div>

 

  <DIV>&nbsp;</DIV><br>---------------------------------<br>The Open University is incorporated by Royal Charter (RC 000391), an exempt charity in England & Wales and a charity registered in Scotland (SC 038302).</body>

</html>

 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20081202/cb61871c/attachment.html


More information about the Users mailing list