SuperMap IClient for Leaflet 加载高斯克吕格投影三度分带CGCS2000大地坐标系WMTS服务
难点所在
Leaflet加载WMTS服务(球面)的是很简单的,但是加载投影坐标系的一直以来比较迷惑,故此,写出来最常用的情况。
关于数据的说明:
采用的数据是江苏片区的影像数据;
关于版本的说明:
SuperMap IClient for Leaflet 10 i http://iclient.supermap.io/examples/leaflet/examples.html
加大带号高斯克吕格投影三度分带CGCS2000大地坐标系
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>wmts</title>
<link href="leaflet2/css/leaflet.css" rel="stylesheet">
<script type="text/javascript" src="../js/include-web.js"></script>
<script type="text/javascript" src="../../dist/leaflet/include-leaflet.js"></script>
<script type="text/javascript" src="../js/proj4leaflet.js"></script>
<style>
html,body{
height: 100%;
width: 100%;
}
#map{
height: 100%;
width: 100%;
}
</style>
</head>
<body>
<div id="map">
</div>
<script>
var res = [];
for (var i = 0; i < 17; i++) {
res.push(52.91666666666665 / (Math.pow(2, i)));
}
// Proj4js.defs("EPSG:4528","+proj=tmerc +lat_0=0 +lon_0=120 +k=1 +x_0=40500000 +y_0=0 +ellps=GRS80 +units=m +no_defs");
var map = L.map('map', {
center: [31.79,119.45],
maxZoom: 6,
zoom: 1,
crs: new L.Proj.CRS("EPSG:4528","+proj=tmerc +lat_0=0 +lon_0=120 +k=1 +x_0=40500000 +y_0=0 +ellps=GRS80 +units=m +no_defs",
{
origin: [40444190.4, 3523180.2],
resolutions: res,
bounds: L.bounds([40444190.4,3515218.5], [40456694.1,3523180.2])
})
});
L.supermap.wmtsLayer("http://192.168.60.45:8099/iserver/services/map-ugcv5-JTclip03gk/wmts100",
{
layer: "JT_clip_03_gk",
style: "default",
tilematrixSet: "Custom_JT_clip_03_gk",
format: "image/png",
requestEncoding: 'REST'
}
).addTo(map);
</script>
</body>
</html>
不加大带号高斯克吕格投影三度分带CGCS2000大地坐标系
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>wmts</title>
<link href="leaflet2/css/leaflet.css" rel="stylesheet">
<script type="text/javascript" src="../js/include-web.js"></script>
<script type="text/javascript" src="../../dist/leaflet/include-leaflet.js"></script>
<script type="text/javascript" src="../js/proj4leaflet.js"></script>
<style>
html,body{
height: 100%;
width: 100%;
}
#map{
height: 100%;
width: 100%;
}
</style>
</head>
<body>
<div id="map">
</div>
<script>
var res = [];
for (var i = 0; i < 7; i++) {
res.push(52.91666666666665 / (Math.pow(2, i)));
}
// proj4.defs("EPSG:4549","+proj=tmerc +lat_0=0 +lon_0=120 +k=1 +x_0=500000 +y_0=0 +ellps=GRS80 +units=m +no_defs");
var map = L.map('map', {
center: [31.75844328613281,119.41046761484614],
maxZoom: 6,
zoom: 0,
crs: new L.Proj.CRS("EPSG:4549","+proj=tmerc +lat_0=0 +lon_0=120 +k=1 +x_0=500000 +y_0=0 +ellps=GRS80 +units=m +no_defs",
{
origin: [444190.4,3523180.2],
resolutions: res,
bounds: L.bounds([444190.4,3515218.5], [456694.1,3523180.2]),
dpi:90.7142857142857
})
});
L.supermap.wmtsLayer("http://192.168.60.45:8099/iserver/services/map-ugcv5-JTclip03gkndh/wmts100",
{
layer: "JT_clip_03_gk_ndh",
style: "default",
tilematrixSet: "Custom_JT_clip_03_gk_ndh",
format: "image/png",
requestEncoding: 'REST'
}
).addTo(map);
</script>
</body>
</html>