Google maps api v3:infowindow内容放错了位置

时间:2013-03-18 11:57:39

标签: google-maps google-maps-api-3 google-maps-markers infowindow geoxml3

我使用geoxml3来解析kml点文件。点击标记后,将打开一个信息窗口,其中包含一些描述。问题是信息显示错位,并且信息窗口中还添加了两个链接,我想删除。

我是如何删除链接并正确放置信息的?

这是信息窗口的屏幕截图:

enter code here

以下是我正在使用的代码:

function initialize() { 
    directionsDisplay = new google.maps.DirectionsRenderer();

    var mapOptions = {
        center: new google.maps.LatLng(35.898737028438, 14.5133403246687),
        zoom: 17,
        mapTypeId: google.maps.MapTypeId.ROADMAP
    };

    map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
    directionsDisplay.setMap(map);

    elevator = new google.maps.ElevationService();

    google.maps.event.addListener(map, 'click', function(event) {
        placeMarker(event.latLng);     
    });

    google.maps.event.addListener(map, 'click', getElevation);

}

function displayKml() {
    initialize();
    parser = new geoXML3.parser({
        map: map,
        processStyles: true,
        createMarker: addMyMarker,
        createOverlay: addMyOverlay
    });          
    parser.parse("Uploads/" + document.getElementById('<%= text2.ClientID %>').value); 
}

function addMyMarker(placemark) {
   parser.createMarker(placemark);
}

function addMyOverlay(groundOverlay) {
   parser.createOverlay(groundOverlay);
}

kml文件结构如下:

<?xml version="1.0" encoding="utf-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
  <Document>
    <name>route</name>
    <Placemark>
      <name>210</name>
      <description>St james cavalier,Exhibitions centre</description>
      <Point>
        <coordinates>14.5107742,35.8955498</coordinates>
      </Point>
    </Placemark>
  </Document>
</kml>

1 个答案:

答案 0 :(得分:1)