三 打造地图拼接利器图源配置

内置了74个地图图源,清单如下:
ArcGIS_DarbAE_Q2_2011_NAVTQ_Eng_V5_MapProvider ArcGIS_DarbAE_Q2_2011_NAVTQ_Eng_V5_Map;ArcGIS_Imagery_World_2D_MapProvider ArcGIS_Imagery_World_2D_Map;ArcGIS_ShadedRelief_World_2D_MapProvider ArcGIS_ShadedRelief_World_2D_Map;ArcGIS_StreetMap_World_2D_MapProvider ArcGIS_StreetMap_World_2D_Map;ArcGIS_Topo_US_2D_MapProvider ArcGIS_Topo_US_2D_Map;ArcGIS_World_Physical_MapProvider ArcGIS_World_Physical_Map;ArcGIS_World_Shaded_Relief_MapProvider ArcGIS_World_Shaded_Relief_Map;ArcGIS_World_Street_MapProvider ArcGIS_World_Street_Map;ArcGIS_World_Terrain_Base_MapProvider ArcGIS_World_Terrain_Base_Map;ArcGIS_World_Topo_MapProvider ArcGIS_World_Topo_Map;BingHybridMapProvider BingHybridMap;BingMapProvider BingMap;BingSatelliteMapProvider BingSatelliteMap;CloudMadeMapProvider CloudMadeMap;CzechGeographicMapProvider CzechGeographicMap;CzechHistoryMapProvider CzechHistoryMap;CzechHistoryMapProviderOld CzechHistoryOldMap;CzechHybridMapProvider CzechHybridMap;CzechHybridMapProviderOld CzechHybridOldMap;CzechMapProvider CzechMap;CzechMapProviderOld CzechOldMap;CzechSatelliteMapProvider CzechSatelliteMap;CzechSatelliteMapProviderOld CzechSatelliteOldMap;CzechTuristMapProvider CzechTuristMap;CzechTuristMapProviderOld CzechTuristOldMap;CzechTuristWinterMapProvider CzechTuristWinterMap;EmptyProvider EmptyProvider;GoogleChinaHybridMapProvider GoogleChinaHybridMap;GoogleChinaMapProvider GoogleChinaMap;GoogleChinaSatelliteMapProvider GoogleChinaSatelliteMap;GoogleChinaTerrainMapProvider GoogleChinaTerrainMap;GoogleHybridMapProvider GoogleHybridMap;GoogleKoreaHybridMapProvider GoogleKoreaHybridMap;GoogleKoreaMapProvider GoogleKoreaMap;GoogleKoreaSatelliteMapProvider GoogleKoreaSatelliteMap;GoogleMapProvider GoogleMap;GoogleSatelliteMapProvider GoogleSatelliteMap;GoogleTerrainMapProvider GoogleTerrainMap;LatviaMapProvider LatviaMap;Lithuania3dMapProvider Lithuania3dMap;LithuaniaHybridMapProvider LithuaniaHybridMap;LithuaniaHybridOldMapProvider LithuaniaHybridOldMap;LithuaniaMapProvider LithuaniaMap;LithuaniaOrtoFotoMapProvider LithuaniaOrtoFotoMap;LithuaniaOrtoFotoOldMapProvider LithuaniaOrtoFotoOldMap;LithuaniaReliefMapProvider LithuaniaReliefMap;LithuaniaTOP50 LithuaniaTOP50Map;MapBenderWMSProvider MapBenderWMSdemoMap;NearHybridMapProvider NearHybridMap;NearMapProvider NearMap;NearSatelliteMapProvider NearSatelliteMap;OpenCycleLandscapeMapProvider OpenCycleLandscapeMap;OpenCycleMapProvider OpenCycleMap;OpenCycleTransportMapProvider OpenCycleTransportMap;OpenSeaMapHybridProvider OpenSeaMapHybrid;OpenStreet4UMapProvider OpenStreet4UMap;OpenStreetMapProvider OpenStreetMap;OpenStreetMapQuestProvider OpenStreetMapQuest;OpenStreetMapQuestHybridProvider OpenStreetMapQuestHybrid;OpenStreetMapQuestSatteliteProvider OpenStreetMapQuestSattelite;OviHybridMapProvider OviHybridMap;OviMapProvider OviMap;OviSatelliteMapProvider OviSatelliteMap;OviTerrainMapProvider OviTerrainMap;SpainMapProvider SpainMap;SwedenMapProvider SwedenMap;TurkeyMapProvider TurkeyMap;WikiMapiaMapProvider WikiMapiaMap;YahooHybridMapProvider YahooHybridMap;YahooMapProvider YahooMap;YahooSatelliteMapProvider YahooSatelliteMap;YandexHybridMapProvider YandexHybridMap;YandexMapProvider YandexMap;YandexSatelliteMapProvider YandexSatelliteMap;
但在实际使用中,大部分都因一些未知因素而无法访问,特别是国外的地图,大部分对我国边境标绘错误,需谨慎使用 。而且这些地图中,鲜有国内地图商的地址 。
为便于使用国内地图,我们需要写一些访问国内地图数据的代码,还好,开源,我们可以照猫画虎,写一个通用的 。
在解决方案资源管理器中建一个文件夹,名为Utils 。
要是用自定义,首先建一个基类,让他继承自,并重写2个方法 。
using GMap.NET;using GMap.NET.MapProviders;using GMap.NET.Projections;using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace Mapmeger{public abstract class TmsProviderBase : GMapProvider{public TmsProviderBase(){MaxZoom = null;RefererUrl = "";}public override PureProjection Projection{get { return MercatorProjection.Instance; }}GMapProvider[] overlays;public override GMapProvider[] Overlays{get{if (overlays == null){overlays = new GMapProvider[] { this };}return overlays;}}}}