哇,膜拜一下易语言大佬,还用的ys盘,一下好多回忆都回来了,果然这种需求是求不来成品软件的,只能手搓,感谢大佬
如果基本符合要求,请采纳答案
感谢手搓软件帮忙解决,只是没有地名搜索功能,使用上还挺麻烦的,而且GPS信息能直接写入照片就更好了,我想再等等其他的再选定解决方案,非常感谢!!
不太懂 ntfs,上传网络之后数据还在不?
1、ntfs是磁盘格式名称,在当前,基本上是磁盘的默认格式,但也有极少数还是fat32或者其他少见格式。
2、ntfs支持每个文件有多个附加数据流,简称ads。附加数据流使用资源管理器无法查看,由系统负责维护。文件更名、编辑、拷贝、移动,不影响附加数据流。
3、ads需要ntfs支持,离开ntfs后,ads就自动消失了,所以上传网络后,例如各种云盘后,附加数据流信息就丢失了。
4、可以使用winrar打包压缩包含ads的图片,勾选相关选项,可以包含ads一起进行压缩。压缩后的包可以随意拷贝到其他电脑上或者上传云盘备份。只是无法即时展示图片内容了。
5、关于本问题,其实除了将坐标信息存储在ads中外,类似于我开发的DTE,也可以将坐标信息存储于descript.ion等数据文件中,只要做好地图和坐标数据之间的沟通衔接工作,一样可以满足提问者的要求。
能直接写入照片么?
我不会啊,得去找资料从头学。
加油。光在win上估计不行
无所谓了,只是好心想帮助一下求助人,不满意的话就再等待其他人的解决方案吧。
嗯,只是想再多等等其他方案,再过段时间没人提供肯定优先选择您的解决方案呀
估计需要使用命令行的外部工具了,比如 Exiftool
今天又抽点时间,对原方案做了一点优化。版本升级到了1.1
现在已经可以把经纬度信息直接写到文件本身了,这样文件随便拷贝上云,不影响经纬度数据。
不过我是直接把经纬度信息写在了文件尾,而不是元数据中,所以图片中的经纬度信息只有我的程序能够读取,其他程序无法读取。
还有一些其他易用性方面的调整,我就懒得一一写出来了。
现在,唯一剩下的问题就是地图不能直接按地名搜索了。
更新下载地址:dangerace.ysepan.com
已实现写入文件
非常感谢花费时间更新软件,不过GPS信息写入照片的原本目的就是给别的软件读取呀,只是写入文件尾,是不是与不写入照片没有区别呢?
大佬如果有兴趣的话,能否考虑一下调用外部程序 EXIFtool 来实现GPS写入元数据呢,感谢:
exiftool -P -GPSLongitudeRef=E -GPSLongitude=111.123456 -GPSLatitudeRef=N -GPSLatitude=33.23456 -GPSAltitudeRef=Above -GPSAltitude=357 E:\images\000022.jpg
GeoSetter 4.0 beta增加了自定义地图的功能,程序不再内置地图服务,而是调用了 map.html 和 leaflet js扩展,这给自定义地图服务提供了可能性。
国内地图相对于国外地图都对坐标系进行了调整,无法直接给leaflet js调用,高德、腾讯、天地图、智图等还算简单,只需纠偏,百度稍微麻烦了一些。
程序原版的 map.html 也没法满足国内地图的纠偏,必须进行修改才能使用。所以操作起来主要分为以下几大步:
一、在软件中添加 Map Layers;
二、补充所需的js脚本,修改map.html;
三、修改js脚本;
一、在软件中添加 Map Layers 参数:
自定义地图主要思路就是在软件界-设置-地图 中,指定显示地图的html文件,并在 Map Layers 中添加各个地图对应的参数。
高德地图:
Layer URL:
http://webrd0{s}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}
Options:
{type:'GaoDe.Normal.Map', minZoom:1, maxZoom:18, subdomains:['1','2','3','4'], attribution: '© <a href="https://lbs.amap.com/api/javascript-api-v2/getting-started">高德地图</a>'}
高德卫星图:
Layer URL:
http://webst0{s}.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}
Options:
{type:'GaoDe.Satellite.Map', minZoom:1, maxZoom:18, subdomains:['1','2','3','4'], attribution: '© <a href="https://lbs.amap.com/api/javascript-api-v2/getting-started">高德地图</a>'}
高德卫星图(含路网):
Layer URL:
http://webst0{s}.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}
Options:
{type:'GaoDe.Satellite.Annotion', minZoom:1, maxZoom:18, subdomains:['1','2','3','4'], annotion:'http://webst0{s}.is.autonavi.com/appmaptile?style=8&x={x}&y={y}&z={z}', attribution: '© <a href="https://lbs.amap.com/api/javascript-api-v2/getting-started">高德地图</a>'}
腾讯地图:
Layer URL:
http://rt{s}.map.gtimg.com/tile?z={z}&x={x}&y={-y}&type=vector&styleid=1
Options:
{type:'Tencent.Normal.Map', minZoom:3, maxZoom:18, subdomains:['0','1','2','3'], attribution: '© <a href="https://lbs.qq.com/webApi/javascriptGL/glDoc/docIndexMap">腾讯地图</a>'}
腾讯地形图:
Layer URL:
http://p{s}.map.gtimg.com/demTiles/{z}/{sx}/{sy}/{x}_{-y}.jpg
Options:
{type:'Tencent.Terrain.Map', minZoom:3, maxZoom:15, subdomains:['0','1','2','3'], attribution: '© <a href="https://lbs.qq.com/webApi/javascriptGL/glDoc/docIndexMap">腾讯地图</a>'}
腾讯卫星图:
Layer URL:
http://p{s}.map.gtimg.com/sateTiles/{z}/{sx}/{sy}/{x}_{-y}.jpg
Options:
{type:'Tencent.Satellite.Map', minZoom:3, maxZoom:18, subdomains:['0','1','2','3'], attribution: '© <a href="https://lbs.qq.com/webApi/javascriptGL/glDoc/docIndexMap">腾讯地图</a>'}
天地图:
(注意要用自己的 api key)
Layer URL:
http://t{s}.tianditu.com/DataServer?T=vec_w&X={x}&Y={y}&L={z}&tk={key}
Options:
{type:'TianDiTu.Normal.Annotion', minZoom:1, maxZoom:18, subdomains:['0','1','2','3','4','5','6','7'], key:'自己的key', annotion:'http://t{s}.tianditu.gov.cn/DataServer?T=cva_w&X={x}&Y={y}&L={z}&tk={key}', attribution: '© <a href="http://lbs.tianditu.gov.cn/api/js4.0/guide.html">天地图</a>'}
智图GeoQ(水系):
Layer URL:
http://thematic.geoq.cn/arcgis/rest/services/ThematicMaps/WorldHydroMap/MapServer/tile/{z}/{y}/{x}
Options:
{type:'GeoQ.Theme.Hydro', minZoom:3, maxZoom:13, attribution: '© <a href="https://www.geoq.cn">智图GeoQ</a>'}
百度地图:
百度地图特殊一点,它的纠偏算法和别的地图不太一样,得在地图加载时就定义好,而不是加载图层的时候,js代码上也能处理,但是懒得弄了,就另起一套map.html 了。
百度地图:
Layer URL:
http://online{s}.map.bdimg.com/onlinelabel/?qt=tile&x={x}&y={y}&z={z}&styles=pl&scaler=1&p=1
Options:
{type:'Baidu.Normal.Map', minZoom:5, maxZoom:18, subdomains:'0123456789', tms:true, attribution: '© <a href="https://lbs.baidu.com/index.php?title=jspopularGL/guide/helloworld">百度地图</a>'}
百度卫星图:
Layer URL:
http://shangetu{s}.map.bdimg.com/it/u=x={x};y={y};z={z};v=009;type=sate&fm=46
Options:
{type:'Baidu.Satellite.Map', minZoom:5, maxZoom:18, subdomains:'0123456789', tms:true, attribution: '© <a href="https://lbs.baidu.com/index.php?title=jspopularGL/guide/helloworld">百度地图</a>'}
百度卫星图(含路网):
Layer URL:
http://shangetu{s}.map.bdimg.com/it/u=x={x};y={y};z={z};v=009;type=sate&fm=46
Options:
{type:'Baidu.Satellite.Annotion', minZoom:5, maxZoom:18, subdomains:'0123456789', tms:true, annotion:'http://online{s}.map.bdimg.com/tile/?qt=tile&x={x}&y={y}&z={z}&styles=sl&v=020', attribution: '© <a href="https://lbs.baidu.com/index.php?title=jspopularGL/guide/helloworld">百度地图</a>'}
二、补充所需的js脚本,修改map.html;
1.下载所需的js脚本:
2.这两个脚本下载后将 leaflet.ChineseTmsProviders.js 和 leaflet.mapCorrection.js 分别放进:
map\inc\leaflet\plugins\Leaflet.ChineseTmsProviders
map\inc\leaflet\plugins\Leaflet.InternetMapCorrection
两个目录中,
3.然后将 map\inc\leaflet\plugins\Leaflet.InternetMapCorrection/examples/lib/plugins/ 中的 js文件都放到:
map\inc\leaflet\plugins\Proj4Leaflet 中。
4.用编辑器打开 map.html,
在头部加上这几个引用:
<script src="./inc/leaflet/plugins/Proj4Leaflet/proj4.js"></script>
<script src="./inc/leaflet/plugins/Proj4Leaflet/proj4leaflet.min.js"></script>
<!-- 引入互联网地图插件 -->
<script src="./inc/leaflet/plugins/Leaflet.ChineseTmsProviders/leaflet.ChineseTmsProviders.js"></script>
<!-- 引入互联网地图纠偏插件 -->
<script src="./inc/leaflet/plugins/Leaflet.InternetMapCorrection/leaflet.mapCorrection.js"></script>
5.复制一份 map.html,重命名为 map_baidu.html,作为百度地图专用,然后将
<script src="./map.js"></script>
这一行改为:
<script src="./map_baidu.js"></script>
作为百度地图专用。
三、修改js脚本:
打开 map.js:
1.在30行后添加一行:
_mainLayerAnnotion: null, // 专用标志图层
2.将这一段:
setMainLayer: function (id, name, url, options) {
if (this._mainLayer) {
this._map.removeLayer(this._mainLayer);
}
this._mainLayerId = id;
this._mainLayer = L.tileLayer(url, options).addTo(this._map);
this._adjustAttributionLinks();
if (options.maxZoom) {
this._map.setMaxZoom(options.maxZoom);
}
this._mainLayer.bringToBack();
this._updateStatusElements();
},
改为:
setMainLayer: function (id, name, url, options) {
// 清理图层
if (this._mainLayer) {
this._map.removeLayer(this._mainLayer);
}
// 清理专用标志图层
if (this._mainLayerAnnotion !=null) {
this._map.removeLayer(this._mainLayerAnnotion);
}
this._mainLayerId = id;
if (options.type !=null) {
// 加载中国纠偏图层
this._mainLayer = L.tileLayer.chinaProvider(options.type, url, options).addTo(this._map);
} else {
// 加载原版图层
this._mainLayer = L.tileLayer(url, options).addTo(this._map);
}
// 加载专用标志图层
if (options.annotion !=null) {
this._mainLayerAnnotion = L.tileLayer.chinaProvider(options.type, options.annotion, options).addTo(this._map);
}
this._adjustAttributionLinks();
if (options.maxZoom) {
this._map.setMaxZoom(options.maxZoom);
}
this._mainLayer.bringToBack();
this._updateStatusElements();
},
3.复制一份 map.js,改名为 map_baidu.js,将这一行
this._map = L.map(container, { maxZoom: 22 }).setView([coord.lat, coord.lng], zoomLevel);
改为:
this._map = L.map(container, { maxZoom: 22, crs: L.CRS.Baidu }).setView([coord.lat, coord.lng], zoomLevel);
作为百度地图专用。
4. 修改 leaflet.mapCorrection.js,改后完整的代码:
//坐标转换
L.CoordConver = function () {
/**百度转84*/
this.bd09_To_gps84 = function(lng, lat) {
var gcj02 = this.bd09_To_gcj02(lng, lat);
var map84 = this.gcj02_To_gps84(gcj02.lng, gcj02.lat);
return map84;
}
/**84转百度*/
this.gps84_To_bd09 = function (lng, lat) {
var gcj02 = this.gps84_To_gcj02(lng, lat);
var bd09 = this.gcj02_To_bd09(gcj02.lng, gcj02.lat);
return bd09;
}
/**84转火星*/
this.gps84_To_gcj02 = function (lng, lat) {
var dLat = transformLat(lng - 105.0, lat - 35.0);
var dLng = transformLng(lng - 105.0, lat - 35.0);
var radLat = lat / 180.0 * pi;
var magic = Math.sin(radLat);
magic = 1 - ee * magic * magic;
var sqrtMagic = Math.sqrt(magic);
dLat = (dLat * 180.0) / ((a * (1 - ee)) / (magic * sqrtMagic) * pi);
dLng = (dLng * 180.0) / (a / sqrtMagic * Math.cos(radLat) * pi);
var mgLat = lat + dLat;
var mgLng = lng + dLng;
var newCoord = {
lng: mgLng,
lat: mgLat
};
return newCoord;
}
/**火星转84*/
this.gcj02_To_gps84 = function (lng, lat) {
var coord = transform(lng, lat);
var lontitude = lng * 2 - coord.lng;
var latitude = lat * 2 - coord.lat;
var newCoord = {
lng: lontitude,
lat: latitude
};
return newCoord;
}
/**火星转百度*/
this.gcj02_To_bd09 = function (x, y) {
var z = Math.sqrt(x * x + y * y) + 0.00002 * Math.sin(y * x_pi);
var theta = Math.atan2(y, x) + 0.000003 * Math.cos(x * x_pi);
var bd_lng = z * Math.cos(theta) + 0.0065;
var bd_lat = z * Math.sin(theta) + 0.006;
var newCoord = {
lng: bd_lng,
lat: bd_lat
};
return newCoord;
}
/**百度转火星*/
this.bd09_To_gcj02 = function (bd_lng, bd_lat) {
var x = bd_lng - 0.0065;
var y = bd_lat - 0.006;
var z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * x_pi);
var theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * x_pi);
var gg_lng = z * Math.cos(theta);
var gg_lat = z * Math.sin(theta);
var newCoord = {
lng: gg_lng,
lat: gg_lat
};
return newCoord;
}
var pi = 3.1415926535897932384626;
var a = 6378245.0;
var ee = 0.00669342162296594323;
var x_pi = pi * 3000.0 / 180.0;
var R = 6378137;
function transform(lng, lat) {
var dLat = transformLat(lng - 105.0, lat - 35.0);
var dLng = transformLng(lng - 105.0, lat - 35.0);
var radLat = lat / 180.0 * pi;
var magic = Math.sin(radLat);
magic = 1 - ee * magic * magic;
var sqrtMagic = Math.sqrt(magic);
dLat = (dLat * 180.0) / ((a * (1 - ee)) / (magic * sqrtMagic) * pi);
dLng = (dLng * 180.0) / (a / sqrtMagic * Math.cos(radLat) * pi);
var mgLat = lat + dLat;
var mgLng = lng + dLng;
var newCoord = {
lng: mgLng,
lat: mgLat
};
return newCoord;
}
function transformLat(x, y) {
var ret = -100.0 + 2.0 * x + 3.0 * y + 0.2 * y * y + 0.1 * x * y + 0.2 * Math.sqrt(Math.abs(x));
ret += (20.0 * Math.sin(6.0 * x * pi) + 20.0 * Math.sin(2.0 * x * pi)) * 2.0 / 3.0;
ret += (20.0 * Math.sin(y * pi) + 40.0 * Math.sin(y / 3.0 * pi)) * 2.0 / 3.0;
ret += (160.0 * Math.sin(y / 12.0 * pi) + 320 * Math.sin(y * pi / 30.0)) * 2.0 / 3.0;
return ret;
}
function transformLng(x, y) {
var ret = 300.0 + x + 2.0 * y + 0.1 * x * x + 0.1 * x * y + 0.1 * Math.sqrt(Math.abs(x));
ret += (20.0 * Math.sin(6.0 * x * pi) + 20.0 * Math.sin(2.0 * x * pi)) * 2.0 / 3.0;
ret += (20.0 * Math.sin(x * pi) + 40.0 * Math.sin(x / 3.0 * pi)) * 2.0 / 3.0;
ret += (150.0 * Math.sin(x / 12.0 * pi) + 300.0 * Math.sin(x / 30.0 * pi)) * 2.0 / 3.0;
return ret;
}
}
L.coordConver = function () {
return new L.CoordConver()
}
L.tileLayer.chinaProvider = function (type, url, options) {
options = options || {}
options.corrdType = getCorrdType(type);
return new L.TileLayer.ChinaProvider(type, url, options);
//获取坐标类型
function getCorrdType(type) {
var parts = type.split('.');
var providerName = parts[0];
var zbName = "wgs84"
switch (providerName) {
case "Geoq":
case "GaoDe":
case "Google":
zbName = "gcj02";
break;
case "Baidu":
zbName = "bd09";
break;
case "OSM":
case "TianDiTu":
zbName = "wgs84";
break;
case "Tencent":
zbName = "gcj02";
break;
}
return zbName;
}
};
L.GridLayer.include({
_setZoomTransform: function (level, _center, zoom) {
var center = _center;
if (center != undefined && this.options) {
if (this.options.corrdType == 'gcj02') {
center = L.coordConver().gps84_To_gcj02(_center.lng, _center.lat);
} else if (this.options.corrdType == 'bd09') {
center = L.coordConver().gps84_To_bd09(_center.lng, _center.lat);
}
}
var scale = this._map.getZoomScale(zoom, level.zoom),
translate = level.origin.multiplyBy(scale)
.subtract(this._map._getNewPixelOrigin(center, zoom)).round();
if (L.Browser.any3d) {
L.DomUtil.setTransform(level.el, translate, scale);
} else {
L.DomUtil.setPosition(level.el, translate);
}
},
_getTiledPixelBounds: function (_center) {
var center = _center;
if (center != undefined && this.options) {
if (this.options.corrdType == 'gcj02') {
center = L.coordConver().gps84_To_gcj02(_center.lng, _center.lat);
} else if (this.options.corrdType == 'bd09') {
center = L.coordConver().gps84_To_bd09(_center.lng, _center.lat);
}
}
var map = this._map,
mapZoom = map._animatingZoom ? Math.max(map._animateToZoom, map.getZoom()) : map.getZoom(),
scale = map.getZoomScale(mapZoom, this._tileZoom),
pixelCenter = map.project(center, this._tileZoom).floor(),
halfSize = map.getSize().divideBy(scale * 2);
return new L.Bounds(pixelCenter.subtract(halfSize), pixelCenter.add(halfSize));
}
})
5.修改 leaflet.ChineseTmsProviders.js,改后完整的代码:
// this L.CRS.Baidu from https://github.com/muyao1987/leaflet-tileLayer-baidugaode/blob/master/src/tileLayer.baidu.js
// https://github.com/htoooth/Leaflet.ChineseTmsProviders
if (L.Proj) {
L.CRS.Baidu = new L.Proj.CRS('EPSG:900913', '+proj=merc +a=6378206 +b=6356584.314245179 +lat_ts=0.0 +lon_0=0.0 +x_0=0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs', {
resolutions: function () {
var level = 19
var res = [];
res[0] = Math.pow(2, 18);
for (var i = 1; i < level; i++) {
res[i] = Math.pow(2, (18 - i))
}
return res;
}(),
origin: [0, 0],
bounds: L.bounds([20037508.342789244, 0], [0, 20037508.342789244])
});
}
L.TileLayer.ChinaProvider = L.TileLayer.extend({
initialize: function(type, url, options) { // (type, Object)
var providers = L.TileLayer.ChinaProvider.providers;
//options = options || {}
var parts = type.split('.');
var providerName = parts[0];
var mapName = parts[1];
var mapType = parts[2];
//var url = providers[providerName][mapName][mapType];
//options.subdomains = providers[providerName].subdomains;
//options.key = options.key || providers[providerName].key;
//if ('tms' in providers[providerName]) {
// options.tms = providers[providerName]['tms']
//}
//options.crs = L.CRS.Baidu;
L.TileLayer.prototype.initialize.call(this, url, options);
},
getTileUrl: function (coords) {
var data = {
s: this._getSubdomain(coords),
x: coords.x,
y: coords.y,
z: this._getZoomForUrl(),
};
if (this._map && !this._map.options.crs.infinite) {
var invertedY = this._globalTileRange.max.y - coords.y;
if (this.options.tms) {
data['y'] = invertedY;
}
data['-y'] = invertedY;
}
data.sx = data.x >> 4
data.sy = (( 1 << data.z) - data.y) >> 4
return L.Util.template(this._url, L.Util.extend(data, this.options));
},
});
L.TileLayer.ChinaProvider.providers = {
Baidu: {
Normal: {
//Map: 'http://online{s}.map.bdimg.com/onlinelabel/?qt=tile&x={x}&y={y}&z={z}&styles=pl&scaler=1&p=1'
//Map: 'http://maponline{s}.bdimg.com/tile/?qt=vtile&x={x}&y={y}&z={z}&styles=pl&scaler=2&udt=20230105&from=jsapi2_0'
//Map: 'http://maponline{s}.bdimg.com/tile/?qt=vtile&x={x}&y={y}&z={z}&styles=pl&scaler=2'
},
Satellite: {
//Map: 'http://shangetu{s}.map.bdimg.com/it/u=x={x};y={y};z={z};v=009;type=sate&fm=46',
//Annotion: 'http://online{s}.map.bdimg.com/tile/?qt=tile&x={x}&y={y}&z={z}&styles=sl&v=020'
}//,
//subdomains: ['0', '1', '2', '3'],
//tms: true
//center: [31.245414, 121.506379], // The initial center(baidu BD-09 format) of map
//zoom: 15, // initial zoom of map
},
GaoDe: {
Normal: {
//Map: 'http://webrd0{s}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}'
//Map: 'http://webst0{s}.is.autonavi.com/appmaptile?style=9&x={x}&y={y}&z={z}'
},
Satellite: {
//Map: 'http://webst0{s}.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}',
//Annotion: 'http://webst0{s}.is.autonavi.com/appmaptile?style=8&x={x}&y={y}&z={z}'
}//,
//subdomains: ['1', '2', '3', '4']
},
Tencent: {
Normal: {
//Map: "http://rt{s}.map.gtimg.com/tile?z={z}&x={x}&y={-y}&type=vector&styleid=1",
},
Satellite: {
//Map: "http://p{s}.map.gtimg.com/sateTiles/{z}/{sx}/{sy}/{x}_{-y}.jpg",
},
Terrain: {
//Map: "http://p{s}.map.gtimg.com/demTiles/{z}/{sx}/{sy}/{x}_{-y}.jpg"
},
//subdomains: ['0', '1', '2', '3']
},
TianDiTu: {
Normal: {
//Map: "http://t{s}.tianditu.gov.cn/DataServer?T=vec_w&X={x}&Y={y}&L={z}&tk={key}",
//Annotion: "http://t{s}.tianditu.gov.cn/DataServer?T=cva_w&X={x}&Y={y}&L={z}&tk={key}"
},
Satellite: {
//Map: "http://t{s}.tianditu.gov.cn/DataServer?T=img_w&X={x}&Y={y}&L={z}&tk={key}",
//Annotion: "http://t{s}.tianditu.gov.cn/DataServer?T=cia_w&X={x}&Y={y}&L={z}&tk={key}"
},
Terrain: {
//Map: "http://t{s}.tianditu.gov.cn/DataServer?T=ter_w&X={x}&Y={y}&L={z}&tk={key}",
//Annotion: "http://t{s}.tianditu.gov.cn/DataServer?T=cta_w&X={x}&Y={y}&L={z}&tk={key}"
},
//subdomains: ['0', '1', '2', '3', '4', '5', '6', '7']
},
GeoQ: {
Normal: {
//Map: "http://map.geoq.cn/ArcGIS/rest/services/ChinaOnlineCommunity/MapServer/tile/{z}/{y}/{x}",
//PurplishBlue: "http://map.geoq.cn/ArcGIS/rest/services/ChinaOnlineStreetPurplishBlue/MapServer/tile/{z}/{y}/{x}",
//Gray: "http://map.geoq.cn/ArcGIS/rest/services/ChinaOnlineStreetGray/MapServer/tile/{z}/{y}/{x}",
//Warm: "http://map.geoq.cn/ArcGIS/rest/services/ChinaOnlineStreetWarm/MapServer/tile/{z}/{y}/{x}",
},
Theme: {
//Hydro: "http://thematic.geoq.cn/arcgis/rest/services/ThematicMaps/WorldHydroMap/MapServer/tile/{z}/{y}/{x}"
}//,
//subdomains: []
}
/*
OSM: {
Normal: {
Map: "http://{s}.tile.osm.org/{z}/{x}/{y}.png",
},
subdomains: ['a', 'b', 'c']
},
Google: {
Normal: {
Map: "http://www.google.cn/maps/vt?lyrs=m@189&gl=cn&x={x}&y={y}&z={z}"
},
Satellite: {
Map: "http://www.google.cn/maps/vt?lyrs=s@189&gl=cn&x={x}&y={y}&z={z}",
Annotion: "http://www.google.cn/maps/vt?lyrs=y@189&gl=cn&x={x}&y={y}&z={z}"
},
subdomains: []
}
*/
};
L.tileLayer.chinaProvider = function(type, url, options) {
return new L.TileLayer.ChinaProvider(type, url, options);
};
至此,修改工作全部完成,除了百度地图需要切换 map_baidu.html 外,其他地图只需要在界面上切换图层即可正常显示。
四、打包
懒得修改的同学们直接下载这个打包好的文件覆盖原程序吧(唯一要注意的是天地图的option参数里要放入你自己的key):
https://pan.baidu.com/s/1KtXhWhGci1NGmcUyoGuLZg?pwd=tjgf