kml阻止提升服务

时间:2012-10-17 17:38:16

标签: google-maps kml infowindow elevation

我有一个谷歌地图升级服务(对于我的宾夕法尼亚州地理学生),只需点击谷歌的底图即可正常工作。我想添加一个显示PA县的kml图层。当我添加它时,不再显示高程信息窗口。有没有办法添加kml但抑制其点击响应,以便高程响应显示?

当前代码(部分):

function initialize() {
var mapOptions = {
    zoom: 7,
    center: centerOfPA,
    mapTypeId: 'roadmap'
}

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

var paCounties = new google.maps.KmlLayer('http://mapmaker.millersville.edu/arcgis/services/PAcounties/MapServer/KmlServer', {suppressInfoWindows: true});
paCounties.setMap(map);

  // Create an ElevationService
elevator = new google.maps.ElevationService();

  // Add a listener for the click event and call getElevation on that location
google.maps.event.addListener(map, 'click', getElevation);
}

1 个答案:

答案 0 :(得分:1)

抑制KmlLayer上的点击事件(可点击:false)或处理点击事件并调用提升服务(使用来自click event的latLng)。

Here is a working example