Gmap.NET 区域下载

WinForm Gmap.NET 使用

1.下载GMap.NET<span style="font-size:14px;"> </span>
   引用 GMap.NET.Core.dll
        GMap.NET.WinidowsForms.dd 
2.初始化地图

        readonly GMapOverlay top = new GMapOverlay();
        internal readonly GMapOverlay objects = new GMapOverlay("objects");
        internal readonly GMapOverlay routes = new GMapOverlay("routes");
        internal readonly GMapOverlay polygons = new GMapOverlay("polygons");
        internal readonly GMapOverlay TempPolygons = new GMapOverlay("TempPolygons");<span style="font-size:14px;"> </span>
        public MapForm()
        {
            InitializeComponent();
            if (!GMapControl.IsDesignerHosted)
            {
                if (!Stuff.PingNetwork("pingtest.com"))
                {
                    gmapControl.Manager.Mode = AccessMode.CacheOnly;
                    MessageBox.Show("No internet connection available, going to CacheOnly mode.", "GMap.NET - Demo.WindowsForms", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                //设置 Prividers   
                gmapControl.MapProvider = GMapProviders.GoogleChinaMap;
                //设置地图中心点 
                gmapControl2.Position = new PointLatLng(22.5545, 114.4415588378906);
                //设置地图最小Zoom
                gmapControl.MinZoom = 5;
                //设置地图最大Zoom
                gmapControl.MaxZoom = 18;
                //设置地图当前Zoom
                gmapControl.Zoom = 10;
                //左键拖拽地图
                gmapControl.DragButton = MouseButtons.Left;
                this.gmapControl.ShowCenter = false;//不显示十字中心 


                //配置 位置 读取位置
                var pointsStr = "114.204151, 22.55858;114.230408, 22.558209;114.238782, 22.547406;114.254208, 22.556746;114.287354, 22.568487;114.344335, 22.571743;114.445384, 22.565132;114.466412, 22.548422;114.466199, 22.472177;114.480932, 22.439975;114.505021, 22.42381;114.513321, 22.421695;114.525647, 22.421381;114.568872, 22.436284;114.58705, 22.46293;114.614548, 22.486369;114.625887, 22.493892;114.648818, 22.501014;114.658659, 22.527048;114.657763, 22.532449;114.632741, 22.55358;114.61727, 22.577062;114.616553, 22.625445;114.607499, 22.6575;114.598459, 22.667838;114.591416, 22.67325;114.580023, 22.673651;114.549605, 22.664231;114.526387, 22.663895;114.512966, 22.674818;114.498343, 22.675678;114.488683, 22.674148;114.483151, 22.668419;114.477598, 22.672773;114.459553, 22.674802;114.456077, 22.671105;114.438659, 22.667;114.43449, 22.680602;114.448052, 22.688129;114.451101, 22.699057;114.446573, 22.705463;114.432597, 22.708326;114.418764, 22.718793;114.411699, 22.729716;114.41353, 22.735419;114.428138, 22.749058;114.429715, 22.75923;114.424539, 22.766267;114.424505, 22.774281;114.409812, 22.784664;114.402376, 22.781695;114.40028, 22.766226;114.38898, 22.765863;114.373028, 22.771323;114.367218, 22.778365;114.351307, 22.786766;114.350878, 22.790002;114.358073, 22.795455;114.357222, 22.804794;114.359903, 22.80731;114.359472, 22.811497;114.353688, 22.815048;114.343958, 22.811338;114.327336, 22.813521;114.308393, 22.804644;114.299087, 22.80997;114.294754, 22.807311;114.294357, 22.801401;114.281054, 22.800288;114.267293, 22.787588;114.257365, 22.789587;114.249703, 22.797621;114.241246, 22.800442;114.236259, 22.815473;114.216219, 22.795831;114.192654, 22.788583;114.19559, 22.774785;114.207121, 22.767605;114.220991, 22.743088;114.214091, 22.731504;114.216392, 22.722775;114.204325, 22.71681;114.205844, 22.699472;114.198891, 22.693261;114.185264, 22.661484;114.162997, 22.66756;114.161741, 22.672732;114.170178, 22.676054;114.174126, 22.685435;114.158268, 22.696263;114.159587, 22.702453;114.149828, 22.708201;114.14728, 22.722351;114.140491, 22.718419;114.134691, 22.723224;114.13017, 22.721509;114.124784, 22.727983;114.117326, 22.727155;114.108111, 22.739044;114.106395, 22.747544;114.098323, 22.751574;114.084996, 22.753782;114.080466, 22.747169;114.072539, 22.763837;114.059539, 22.761654;114.047152, 22.769052;114.028642, 22.76568;114.009012, 22.770248;114.002808, 22.777409;113.995636, 22.80674;113.984701, 22.809241;113.97863, 22.817777;113.967204, 22.82016;113.944255, 22.833765;113.945146, 22.845123;113.935012, 22.848424;113.912232, 22.848021;113.893209, 22.857826;113.884552, 22.850042;113.881669, 22.84166;113.867071, 22.838869;113.856805, 22.842913;113.848808, 22.838597;113.848432, 22.817843;113.844592, 22.807118;113.831136, 22.798712;113.820972, 22.79716;113.82107, 22.790862;113.817114, 22.787828;113.807005, 22.789617;113.807751, 22.782751;113.798487, 22.77558;113.79979, 22.762082;113.776022, 22.749145;113.763063, 22.734136;113.729528, 22.733648;113.715946, 22.728106;113.68352, 22.726393;113.701844, 22.697177;113.723603, 22.649396;113.747556, 22.540348;113.74414, 22.533659;113.731719, 22.526829;113.692399, 22.520582;113.699814, 22.447412;113.722692, 22.416114;113.764399, 22.398465;113.79039, 22.371004;113.802364, 22.347731;113.813838, 22.290004;113.837116, 22.240159;113.850441, 22.270685;113.858777, 22.276198;113.880412, 22.336642;113.880408, 22.432119;113.959233, 22.475107;114.006482, 22.513987;114.024001, 22.503929;114.035254, 22.511034;114.063616, 22.505174;114.075536, 22.519415;114.083843, 22.521347;114.088923, 22.518334;114.094455, 22.522133;114.096798, 22.527082;114.090079, 22.533194;114.100488, 22.53966;114.11498, 22.538816;114.115212, 22.535079;114.120853, 22.540188;114.12383, 22.533236;114.142217, 22.545383;114.159906, 22.544838;114.163618, 22.557917;114.168209, 22.558096;114.172756, 22.564797;114.175418, 22.561995;114.188472, 22.562595;114.192358, 22.556788;114.204151, 22.55858";

                List<PointLatLng> pListArrarList = new List<PointLatLng>();
                foreach (var item in pointsStr.Split(';'))
                {
                    string[] arr = item.Split(',');
                    PointLatLng p = new PointLatLng();
                    p.Lat = Convert.ToDouble(arr[1].Trim());
                    p.Lng = Convert.ToDouble(arr[0].Trim());
                    pListArrarList.Add(p);
                }

                GMapRoute  maproute  = new GMapRoute(pListArrarList, "Area");
                top.Routes.Add(maproute); 

               //添加覆盖物到地图 上

               this.gmapControl.Overlays.Add(top);

            }
      }







  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值