views:

207

answers:

1

this is my google-map code:

<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd"&gt;
<html xmlns="http://www.w3.org/1999/xhtml" >
    <head> 
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
        <meta name="viewport" content="width=device-width,minimum-scale=0.3,maximum-scale=5.0,user-scalable=yes">

    </head>
<body onload="initialize()" onunload="GUnload()">

<style type="text/css">
*{
    margin:0;
    padding:0;
    }
</style>
<!--<div style="width:100px;height:100px;background:blue;"> </div>-->
<div id="map_canvas" style="width: 500px; height: 300px;"></div>


<script src="http://maps.google.com/maps?file=api&amp;amp;v=2&amp;amp;key=ABQIAAAA-7cuV3vqp7w6zUNiN_F4uBRi_j0U6kJrkFvY4-OX2XYmEAa76BSNz0ifabgugotzJgrxyodPDmheRA&amp;sensor=false"type="text/javascript"&gt;&lt;/script&gt;

<script type="text/javascript">
var aFn;
//**********
function initialize() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map_canvas"));
        var g = new GGeoXml("b.kml");
                map.addOverlay(g);
                var center=new GLatLng(37.42228990140251,-122.0822035425683);
        map.setCenter(center, 0);

}
}
//*************



</script>
</body>
</html>

and this is my b.kml file:

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2"&gt;
  <Placemark>
    <name>Simple placemark</name>
    <description>Attached to the ground. Intelligently places itself 
       at the height of the underlying terrain.</description>
    <Point>
      <coordinates>-122.0822035425683,37.42228990140251,0</coordinates>
    </Point>
  </Placemark>
</kml>

why cann't show the point ..

thanks

A: 

My first thought is that you were missing <Document></Document> -- but looking at the docs I'm not sure that's right.

Is b.kml being served with the mime type application/vnd.google-earth.kml+xml? Looking at the documentation, it seems like that's a requirement: http://code.google.com/apis/kml/documentation/kml_tut.html#kml_server

other thoughts:

  • give the full url to b.kml in the new GGeoXml("b.kml") call
  • fire up firebug and see if there's a successful request to b.kml
ariddell