您好我已经分类了如何将当前位置映射到bing
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0"></script>
<script type="text/javascript">
var map;
function GetMap()
{
// Set the map options
var mapOptions = {credentials:"xxxxxxx"};
// Initialize the map
map = new Microsoft.Maps.Map(document.getElementById("mapDiv"), mapOptions);
// Initialize the location provider
var geoLocationProvider = new Microsoft.Maps.GeoLocationProvider(map);
// Get the user's current location
geoLocationProvider.getCurrentPosition({successCallback:displayCenter});
}
function displayCenter(args)
{
// Display the user location when the geo location request returns
alert("The user's location is " + args.center);
}
</script>
</head>
<body onload="GetMap();">
<div id='mapDiv' style="position:relative; width:400px; height:400px;"></div>
</body>
</html>
我还指定了当我指定开始/结束坐标时如何让计算路线工作
<cfhttp timeout="10000" url="http://dev.virtualearth.net/REST/V1/Routes/Walking?wp.0=-27.491030,153.095764&wp.1=-27.476757,153.040493&o=xml&key=xxxxxxxxxxxxxx">
我想要做的是能够组合上面的2,以便我首先运行当前位置,然后将得到的坐标传递给计算路线,以便wp.0 =#current location coordinates#
答案 0 :(得分:0)
您可以在JavaScript中轻松使用Bing Maps REST服务:http://msdn.microsoft.com/en-us/library/gg427607.aspx。虽然不需要它,因为Bing Maps V7控件有一个包含服务的路线模块:http://msdn.microsoft.com/en-us/library/hh312802.aspx
要对您的应用程序进行路由调用,只需更新displayCenter功能即可使用REST或路线管理器来使用路由服务。您还可以在此处找到在交互式SDK中使用Bing地图的路线模块的示例:http://www.bingmapsportal.com/ISDK/AjaxV7#DirectionsModule4