首页 > 代码库 > C# GMap下提供一个高德地图
C# GMap下提供一个高德地图
using System;using GMap.NET.Internals;using GMap.NET.Projections;namespace GMap.NET.MapProviders{ public class AMapProvider : AMapProviderBase { private readonly string name = "AMap"; private readonly string language = "zh_cn"; private readonly Guid id = new Guid("F81F5FB4-0902-4686-BF5B-B2B1E4D47922"); public static readonly AMapProvider Instance; private Random ran = new Random(); private static string UrlFormat = "http://webrd0{0}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&style=7&x={1}&y={2}&z={3}&scale=1<ype=3"; public string Caption { get { return "高德地图"; } } public override Guid Id { get { return this.id; } } public override string Name { get { return this.name; } } static AMapProvider() { Instance = new AMapProvider(); } public AMapProvider() { } public override PureImage GetTileImage(GPoint pos, int zoom) { string url = MakeTileImageUrl(pos, zoom, language); return GetTileImageUsingHttp(url); } //http://wprd0{0}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&style=7&x={1}&y={2}&z={3}&scl=2<ype=3 private string MakeTileImageUrl(GPoint pos, int zoom, string language) { int serverID = ran.Next(1, 5);//1-4 return string.Format(UrlFormat, 4, pos.X, pos.Y, zoom); } } public abstract class AMapProviderBase : GMapProvider { protected GMapProvider[] overlays; public AMapProviderBase() { RefererUrl = "http://www.amap.com/"; Copyright = string.Format("©{0} 高德地图 GPRS(@{0})", DateTime.Today.Year); MinZoom = 1; MaxZoom = 20; } public override GMapProvider[] Overlays { get { if (overlays == null) { overlays = new GMapProvider[] { this }; } return overlays; } } public override PureProjection Projection { get { return MercatorProjection.Instance; } } }}
C# GMap下提供一个高德地图
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。