MapDownload软件说明
基于electron和maptalks实现高德地图、百度地图(包括百度自定义地图)、腾讯地图、OpenStreetMap、CartoDb、ArcGIS在线地图、天地图、MapBox的下载
支持卫星遥感影像和标注合并
支持行政区划瓦片下载,裁切边界
支持下载瓦片格式jpeg、png、webp
项目地址 https://github.com/Hxy1992/MapDownload
下载链接 https://github.com/Hxy1992/MapDownload/releases
下载项目、安装依赖等请自行参照作者md文件
本人使用的baidu地图,baidu地图给出的地图层级数为19个级别
Example
使用软件下载层级为13的地图示例
目录如下
-------13(根目录)
-------1410-------(文件夹)
-------13_1410_431.png
-------13_1410_432.png
........
-------13_1410_437.png
-------13_1410_438.png
-------1411-------
-------13_1411_431.png
-------13_1410_432.png
........
........
-------1416-------
-------1417-------
上图为文件夹,下图为1410文件夹中的具体内容
拼接代码如下
import cv2
import numpy as np
import os
import sys
def get_xy_layer(root_dir):
if not os.path.exists(root_dir):
print("路径不存在")
sys.exit(1)
imgs = []
y_coor = []
for root, dirs, files in os.walk(root_dir):
for file in files:
file_name = os.path.join(root, file)
img = cv2.imdecode(np.fromfile(os.path.join(file_name), dtype=np.uint8), -1)
imgs.append(img)
name = file.split('.')
mark = name[0].split('_')
y_coor.append(int(mark[2]))
y_coor = list(set( y_coor))
return root, imgs, y_coor
def map_splicing(root_dir):
root, imgs, ys =get_xy_layer(root_dir)
v_lines = []
for i in range(0, len(imgs), len(ys)):
v_line = tuple(imgs[i:i + len(ys)])
v_line = v_line[::-1]
v_tuple = np.vstack(v_line)
v_lines.append(v_tuple)
v_tuple = tuple(v_lines)
mat = np.hstack(v_tuple)
cv2.imwrite(root + "map_splicing.jpg", mat)
if __name__ == '__main__':
root_dir=r"G:\map\chengdu\13" #替换为你的根目录
map_splicing(root_dir)
拼接结果如下图所示
不清楚其他的地图是不是也是这样的,嗷呜~