leaflet加载自定义投影瓦片

leaflet自定义了4种投影,分别是

其中leaflet默认使用第一种方式来加载地图,切图比例尺也都遵循Googlemap的,因此如何加载利用arcgis server自定义投影的瓦片呢?

leaflet提供了esri-leaflet插件用来加载arcgis tile和服务,利用该插件可加载如下图所示类型的瓦片图

如上图所示,esri-leaflet只能加载EPSG=3857的瓦片图,如何加载自定义投影的瓦片图?下面引用另一个第三方插件proj4leaflet,该插件能自定义任意投影的地图,

var origin = [-20037700, 33711400];//图层起点坐标
var resolutions = [
    8466.6836000338681, // Level 0
    4233.341800016934, // Level 1
    2116.670900008467, // Level 2
    1058.3354500042335, // Level 3
    529.16772500211675, // Level 4
    264.58386250105838,
    132.29193125052919
];
var crs = new L.Proj.CRS(
”, 
//’+proj=cea +lon_0=0 +lat_ts=0 +x_0=0 +y_0=0 +ellps=WGS84 +units=m +no_defs’, {
‘+proj=cea +lon_0=0 +lat_ts=0 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs’ , {
origin:  origin, 
resolutions: resolutions 
}
);
      
var map = L.map(‘map’,{
crs: crs,
continuousWorld: true,
worldCopyJump: false
}).setView([23.39552, 113.308189], 4);
   
// Create a new TiledMapLayer from esri-leaflet
basemap = new L.esri.TiledMapLayer(‘http://localhost:8399/arcgis/rest/services/china/MapServer’, {
maxZoom: resolutions.length – 1,
minZoom: 0,
continuousWorld: true
}).addTo(map);

上述代码加载地理坐标系为WGS84,投影为等经纬投影的地图

转载自:https://blog.csdn.net/u014269043/article/details/38927995

You may also like...