// 地图地址
let url =
"http://10.163.204.4:32636//portalproxy/iserver/services/TJVMap_Darkblue/rest/maps/TJVMap_Darkblue?key=1bNC0jAVEfAesGAAsJohliBb";
// 范围
let start = L.latLng(116.62, 38.5);
let end = L.latLng(118.15, 40.25);
let bounds = L.latLngBounds(start, end);
// 自定义坐标系
proj4.defs("EPSG:4490", "+proj=longlat +ellps=GRS80 +no_defs");
let CRS4490 = L.Proj.CRS(
"EPSG:4490",
// "+proj=longlat +ellps=GRS80 +no_defs",
{
resolutions: [
1.40625, //如果是天地图,0级的影像分辨率可以写任意数值
0.703125,
0.3515625,
0.17578125,
],
origin: [-180, 90],
}
);
let map = L.map("map", {
crs: CRS4490,
// crs: L.CRS.EPSG3857,
zoom: 0,
attributionControl: false,
zoomControl: false,
// preferCanvas: true, //使用canvas模式渲染矢量图形
center: [39.38, 117.38], // 中心点
bounds: bounds,
});
L.tileLayer
.wms(url, {
// layers: "China", // 060601 资源名称
format: "image/png",
transparent: true,
crs: CRS4490,
})
.addTo(map);