我繼承了一些與Bing Maps v6一起使用的代碼,所以我現在試圖在v8中重現功能。我做了以下初步嘗試,但即使這似乎並不奏效。 (我試圖按照https://social.technet.microsoft.com/wiki/contents/articles/34568.bing-maps-v6-3-to-v8-migration-guide.aspx以及我在網上找到的各種其他位,但是我在Bing地圖上沒有任何知識,所以我在顯然很重要的方面犯了錯誤,因爲這沒有結果。很高興爲指導。創建html來調用Bing Maps
我省略低於我們的兵關鍵,但除此之外,這是我嘗試使用的代碼。
<!DOCTYPE html>
<html>
<head>
<title>Title here</title>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
</head>
<body>
<div id='myMap' style='width: 100vw; height: 100vh;'></div>
<script type='text/javascript'>
var map;
function loadMap() {
map = new Microsoft.Maps.Map(document.getElementById('myMap'), {
credentials: 'BingKeyOmittedHereForSecurityPurposes'
});
map.Geocode('Jericho, VT', GeocodeCallback);
}
function GeocodeCallback(layer, results, places, hasMore, veErrorMessage) {
// no idea what should be here
}
</script>
<script type='text/javascript'
src='https://www.bing.com/api/maps/mapcontrol?callback=loadMap' async defer></script>
</body>
</html>
我將加入引腳和可能的方向,一旦我得到這個工作,但認爲我應該得到花哨之前的基礎工作。