整合Bing Maps
目前的地图服务主要微软的virtual earth,google的google earth和yahoo的map service.从开发上来说,微软的virtual earth是最方便的。不过论地图的精准性还是google的强大,毕竟它做的比较早。微软已经将virtual earth改成Bing maps,将地图服务整合到Bing(必应)搜索中。而微软的live service又包含bing service和Windows Azure Platform,live service本身就是架构在windows Azure平台上面 。扯到这里已经扯的很远了。
一般Map service有以下应用场合:
l 网站地理定位。比如你可以把你的商店,资产设备,公司机构形象化的显示在地图上。可以便利的使用鸟瞰图进行map漫游和特定搜索。
l 信息门户。基于地图的门户搜索,将地图信息与相关信息进行整合便于地图搜索。
l 旅行门户– 提供虚拟路线和路线中的信息如路线中经过的商店,银行,宾馆等。
l 移动定位服务 .
l 实时航线和路线预测追踪
在微软开发领域,整合Google earth可以用其提供的COM api进行整合。COM api或和google的service进行交互。同时COM sdk提供了地图客户端的操作模型。
下面重点谈谈如何整合Bing Maps. 整合Bing Maps有二种方式
1 Meshup
l Ajax control
Example:
<script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2"></script>
<script type="text/javascript">
var map = null;
function GetMap()
{
map = new VEMap('myMap');
map.LoadMap();
}
</script>
</head>
<body onload="GetMap();">
<div id='myMap' style="position:relative; width:400px; height:400px;"></div>
</body>
</html>
l Silverlight control
<UserControl x:Class="MapControlInteractiveSdk.Tutorials.Modes.TutorialFadingLabels"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:m="clr-namespace:Microsoft.Maps.MapControl;assembly=Microsoft.Maps.MapControl">
<Grid x:Name="LayoutRoot" Background="White">
<m:Map CredentialsProvider="{StaticResource MyCredentials}" Center="37.806029,-122.407007" ZoomLevel="16">
<m:Map.Mode>
<m:AerialMode Labels="True" FadingLabels="True" />
</m:Map.Mode>
</m:Map>
<Border VerticalAlignment="Top" HorizontalAlignment="Right" Background="White" Opacity="0.7" CornerRadius="5" Padding="10">
<TextBlock Text="Labels fade after a few seconds when mouse remains still." />
</Border>
</Grid>
</UserControl>
l Asp.net control还没有推出,马上推出
2 server-side integration
有两种地图web service可供选择。
l Bing Maps Web Services. Bing Maps Web Services (BMWS) provides SOAP/XML Web service access to static map images (.gif, .jpeg, and .png), direct map tile access, one-box search functionality, geocoding, reverse geocoding, and routing. These services also integrate with features in the Bing Maps Silverlight Control to provide a complete Web mapping application feature set.
l MapPoint Web Service. The MapPoint Web Service (MWS) uses industry-proven Web services available from Microsoft since 2002. The MWS core strength includes the ability to use customer-specific data to perform proximity and route searching and line drive maps.
其他整合方式:
某些第三方组件公司如ComponentOne提供了Map control for silverlight,map Control for asp.net,可以设定data source为google earth或virtual earth,可以更方便的API去控制地图。在GE项目中我们就是用了这种方式
1. Virtual earth API主要功能:
2. 显示地图
3. 使用图层,(图钉图层,shape图层)
4. 加入元素(可以按比例缩放),加入元素按照坐标
5. 加入map 事件
6. 自定义地图标题图层
7. 调用bing maps web service做业务逻辑自定义
8. 自定义形状或导航
9. 数据绑定
10. 其他
下图是GE 项目的截图