for (int i = 0; i <= X; i++) { for (int j = 0; j <= Y; j++) {
string url = String.Format(@"http://online0.map.bdimg.com/onlinelabel/?qt=tile&x={0}&y={1}&z={2}&styles=pl&udt=20160719&scaler=1&p=0", i, j, Z); string localPath = String.Format("E:\{0}\{1}\", Z, i);// zxy string fileName = String.Format("{0}.png", j); System.Net.WebClient wc = new System.Net.WebClient(); if (File.Exists(localPath + fileName)) { File.Delete(localPath + fileName); } if (Directory.Exists(localPath) == false) { Directory.CreateDirectory(localPath); } wc.DownloadFile(url + fileName, localPath + fileName); Console.WriteLine("E:\{0}\{1}\{2}", Z, i, j); } }
那个链接加载个百度地图F12查看下,日期估计是地图版本
代码临时只是临时写了下,因为只用到7,8层,后面的图片估计比较多,可以自己加多线程什么的去跑。
还有X Y Z的范围,Z是层级,XY是经纬度。