开源免费瓦片地图下载器MapDownload

Required Node.JS >= v16.13
Required npm >= v8.1

map-download

项目地址:https://github.com/Hxy1992/MapDownload
软件下载地址:https://github.com/Hxy1992/MapDownload/releases
基于electron和maptalks实现高德地图、百度地图(包括百度自定义地图)、腾讯地图、OpenStreetMap、CartoDb、ArcGIS在线地图、天地图(需Key)、MapBox(需Key)的下载

Build Setup

# 安装依赖(依赖较大,使用国内镜像)
npm install

# 热更新服务
npm run watch

# 构建web
npm run build

# 构建应用
npm run compile


下载瓦片加载方式

Cesium

// 非百度地图
viewer.imageryLayers.addImageryProvider(new Cesium.UrlTemplateImageryProvider({
  url: 'http://localhost:7099/{z}/{x}/{y}.png'
}))
// 百度地图(需自定义BaiduImageryProvider),可参考cesium-helper目录下代码
import BaiduImageryProvider from './cesium-helper/BaiduImageryProvider/BaiduImageryProvider.js'
viewer.imageryLayers.addImageryProvider(new BaiduImageryProvider({
  url: 'http://localhost:7099/{z}/{x}/{y}.png'
}))

openlayers

// 非百度地图
const baseMap = new ol.layer.Tile({
  source: new ol.source.XYZ({
    url: 'http://localhost:7099/{z}/{x}/{y}.png',
    projection: 'EPSG:3857',
  }),
});
const map = new ol.Map({
  layers: [baseMap],
  target: 'map',
  view: new ol.View({
    center: ol.proj.transform([105.08052356963802, 36.04231948670001], 'EPSG:4326', 'EPSG:3857'),
    zoom: 5,
  }),
});

maptalks

// 非百度地图
var map = new maptalks.Map('map', {
  center: [105.08052356963802, 36.04231948670001],
  zoom: 5,
  minZoom:1,
  maxZoom:19,
  baseLayer: new maptalks.TileLayer('base', {
    'urlTemplate' : 'http://localhost:7099/{z}/{x}/{y}.png'
  })
});
//百度地图
var map = new maptalks.Map('map', {
  center: [105.08052356963802, 36.04231948670001],
  zoom: 5,
  minZoom:1,
  maxZoom:19,
  spatialReference:{
    projection : 'baidu',
  },
  baseLayer: new maptalks.TileLayer('base', {
    'urlTemplate' : 'http://localhost:7099/{z}/{x}/{y}.png'
  })
});

注:软件仅作为学习交流使用

posted @ 2021-12-23 15:48  Hxxxxxxyyyyyy  阅读(9036)  评论(2编辑  收藏  举报