silverlight调用bing地图 和 显示中文地图
bing地图sdk: https://msdn.microsoft.com/en-us/library/ff428643.aspx
引用dll:https://www.microsoft.com/en-us/download/details.aspx?id=2949 (安装软件)
简单入门:http://pietschsoft.com/post/2009/11/12/Getting_Started_Bing_Maps_Silverlight_Control_Version_1_RTW
开发sdk:https://msdn.microsoft.com/en-us/library/ee681890.aspx
不加设置的话直接显示的地图为 拼音形式的 英文地图
using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Shapes; using Microsoft.Maps.MapControl; using Microsoft.Maps.MapControl.Core; namespace SilverlightTest { public partial class MainPage : UserControl { public MainPage() { InitializeComponent(); MapTileLayer tileLayer = new MapTileLayer(); ChinaTileSource gts = new ChinaTileSource(); tileLayer.TileSources.Add(gts.GetChinaTileSource()); myMap.Children.Add(tileLayer); } } public class ChinaTileSource { /// <summary> /// 加载中国地图系统 /// http://r2.tiles.ditu.live.com/tiles/r{quadkey}.png?g=41中国地图系统 /// </summary> /// <returns>TileSource</returns> public TileSource GetChinaTileSource() { UriBuilder tileSourceUri = new UriBuilder("http://r2.tiles.ditu.live.com/tiles/r{quadkey}.png?g=41"); MapTileLayer tileLayer = new MapTileLayer(); LocationRectTileSource tileSource = new LocationRectTileSource(tileSourceUri.Uri.ToString() , new LocationRect(new Location(60, 60), new Location(13, 140)), new Range<double>(1, 16)); return tileSource; } } }
结果图
<m:Map x:Name="myMap" CredentialsProvider="AvHCAx5M3rKrzF-3b_DpRotDCe5Bs53FsqmGhg6i4t0ISDPjadyZsCke61VGacfd"></m:Map>
网上找到的调用百度地图的方法:链接:http://pan.baidu.com/s/1dDqE8al 密码:44jo