我比较喜欢地图,最近在研究微软bing的地图,感觉蛮好的,提供比较强大的API。支持两种方法使用bing地图,本人比较喜欢ajax,就用了ajax这种方法来调用bing地图吧。从今天开始我会做一个bing地图使用的连载,如果哪里用的不好,还请大家多多批评啊,呵呵 谢谢!
今天我们先做一些简单的准备工作,首先呢,我们需要下载bing地图的API,是英文的。不喜欢英文的朋友,可以看微软在线的帮助文档,是中文的。不过我感觉英文看着比较过瘾,原滋原味,我还是喜欢英文的,呵呵。
首先简单介绍一下bing地图的功能,可以在地图上根据经纬度画线,画多边形,画图钉等功能,其他功能正在学习中。呵呵。好,我们首先和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=6.2"></script>
<script type="text/javascript">
var map = null;
var LA = new VELatLong(34.0540, -118.2370);
var pinPoint = null;
var pinPixel = null;
function GetMap()
{
map = new VEMap('myMap');
map.LoadMap(LA, 14, VEMapStyle.Road, false, VEMapMode.Mode2D, true, 1);
AddPin();
}
function getInfo()
{
var info;
if (map.IsBirdseyeAvailable())
{
var be = map.GetBirdseyeScene();
info = "ID: " + be.GetID() + "\n";
info += "orientation: " + be.GetOrientation()+ "\n";
info += "height: " + be.GetHeight() + "\n";
info += "width: " + be.GetWidth() + "\n";
var pixel = be.LatLongToPixel(map.GetCenter(), map.GetZoomLevel());
info += "LatLongToPixel: " + pixel.x + ", " + pixel.y + "\n";
// Check to see if the current birdseye view contains the pushpin pixel point.
info += "contains pixel " + pinPixel.x + ", " + pinPixel.y + ": " +
be.ContainsPixel(pinPixel.x, pinPixel.y, map.GetZoomLevel()) + "\n";
// Check to see if the current view contains the pushpin LatLong.
info += "contains latlong " + pinPoint + ": " + be.ContainsLatLong(pinPoint) + "\n";
// This method may return null, depending on the selected view and map style.
info += "latlong: " + map.PixelToLatLong(pixel);
alert(info);
}
else
{
var center = map.GetCenter();
info = "Zoom level:\t" + map.GetZoomLevel() + "\n";
info += "Latitude:\t" + center.Latitude + "\n";
info += "Longitude:\t" + center.Longitude;
alert(info);
}
}
function AddPin()
{
// Add a new pushpin to the center of the map.
pinPoint = map.GetCenter();
pinPixel = map.LatLongToPixel(pinPoint);
map.AddPushpin(pinPoint);
}
</script>
</head>
<body onload="GetMap();">
<div id='myMap' style="position:relative; width:400px; height:400px;"></div>
<input id="btnGetInfo" type="button" value="Get Scene Information" name="getinfo" onclick="getInfo();">
<br/>
(zoom out 5 clicks to get latitude/longitude and zoom level)
</body>
</html>
如果你运行上面的代码,将可以看到一个英文的bing地图,不要失望,我们下次就把这个地图汉化,并且将它指向一个你想指向的地方。好,朋友们下次见!天天开心!
分享到:
相关推荐
jQuery微软Bing搜索引擎应用实例。
windows phone 调用bing地图的手机客户端
Windows 8下开发Bing地图的程序例子
[Apress] 微软 地图开发 (Bing Maps & C# 实现) (英文版) [Apress] Microsoft Mapping Geospatial Development with Bing Maps and C# (E-Book) ☆ 图书概要:☆ Geospatial mapping applications have become ...
微软bing必应壁纸下载工具,C++开发,不需要任何依赖
微软Bing突然无需等待人人可用
Silverlight_Bing_Maps地图插件安装-CSDN
微软bing也可以用ChatGPT插件了
微软的新搜索引擎Bing每天都会更新一副精美的背景图片,如果能将每幅图片统统收集起来,简直就是一巨大的图片资料库,往后必有用到之处。但是Bing只能显示当天的背景图片,以往用过的图片就无法找到,而且背景图片...
微软Bing突然无需等待人人可用.zip
Bing_Maps地图插件MapCruncher(Bing Maps & C# 实现)-CSDN
微软Bing突然爆炸级更新!无需等待人人可用
在wpf中使用bing地图控件
google地图、bing地图、QQ地图、天地图等地图数据--下载系统软件之源代码,给识货的人,java源代码,前面所述数据源需自行编制数据源配置文件,这个只是下载系统的源代码,根据扩展可以下载任何网络地图。
微软 New Bing 完美聊天机器人源码,支持 ChatGPT 提示词,拥有一致的 UI 体验,国内可用,基本兼容微软 Bing AI 所有功能 这款聊天机器人不仅能够支持现有的开源提示词库,而且可以通过部署服务器直接连接微软的 ...
Bing API SDK 是微软提供的 Bing 服务的 API 开发包,包含搜索、广告发布、站长工具和地图交互功能。