我继承了一些与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>
我将加入引脚和可能的方向,一旦我得到这个工作,但认为我应该得到花哨之前的基础工作。