[OpenLayers-Users] kml file not showing markers

Christopher Schmidt crschmidt at metacarta.com
Tue Dec 2 11:18:16 EST 2008


On Tue, Dec 02, 2008 at 04:13:54PM -0000, M.E.Dodd wrote:
> 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.

Does the URL that this HTML page is accessible from start with:
  http://www.amanita-photolibrary.co.uk/

-- Chris  

> 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>
> 
>  
> 
> 

> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users


-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list