Skip to content

Commit 09bdf2b

Browse files
committed
leaflet对接 超图云 天地图
1 parent c1468eb commit 09bdf2b

File tree

8 files changed

+787
-645
lines changed

8 files changed

+787
-645
lines changed

build/deps.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,11 @@ var deps = {
9393
"Baidu": {
9494
"name": "百度图层",
9595
"src": ['./src/Leaflet/mapping/BaiduTileLayer.js']
96+
},
97+
"Cloud": {
98+
"name": "SuperMap 云图层",
99+
"src": ['./src/Leaflet/mapping/CloudTileLayer.js']
96100
}
97-
98101
},
99102
"SuperMap": {
100103
"title": "SuperMap",

dist/iclient9-leaflet.js

Lines changed: 681 additions & 644 deletions
Large diffs are not rendered by default.

examples/leaflet/cloudLayer.html

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>超图云</title>
6+
<link href="http://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
7+
<link rel="stylesheet" href="http://cdn.bootcss.com/leaflet/1.0.3/leaflet.css">
8+
</head>
9+
<body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">
10+
<div id="map" style="margin:0 auto;width: 100%;height: 100%;border: 1px solid #dddddd"></div>
11+
<script type="text/javascript" src="../../node_modules/leaflet/dist/leaflet-src.js"></script>
12+
<script type="text/javascript" src="../../dist/iclient9-leaflet.js"></script>
13+
14+
</body>
15+
<script type="text/javascript">
16+
var map = L.map('map', {
17+
center: [39.92, 116.46],
18+
crs: L.CRS.EPSG3857,
19+
zoom: 3
20+
});
21+
L.supermap.cloudTileLayer("http://t2.supermapcloud.com/FileService/image").addTo(map);
22+
</script>
23+
</html>

examples/leaflet/config.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,22 @@ var exampleConfig = {
357357
thumbnail: "l_baiduLayer.png",
358358
fileName: "baiduLayer"
359359
}]
360+
},
361+
"Tianditu": {
362+
name: "",
363+
content: [{
364+
name: "天地图",
365+
thumbnail: "l_tiandituLayer.png",
366+
fileName: "tiandituLayer"
367+
}]
368+
},
369+
"cloud": {
370+
name: "",
371+
content: [{
372+
name: "超图云地图",
373+
thumbnail: "l_cloudLayer.png",
374+
fileName: "cloudLayer"
375+
}]
360376
}
361377
}
362378
}
107 KB
Loading
440 KB
Loading
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>天地图</title>
6+
<link href="http://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
7+
<link rel="stylesheet" href="http://cdn.bootcss.com/leaflet/1.0.3/leaflet.css">
8+
</head>
9+
<body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">
10+
<div id="map" style="margin:0 auto;width: 100%;height: 100%;border: 1px solid #dddddd"></div>
11+
<script type="text/javascript" src="../../node_modules/leaflet/dist/leaflet-src.js"></script>
12+
<script type="text/javascript" src="../../dist/iclient9-leaflet.js"></script>
13+
14+
</body>
15+
<script type="text/javascript">
16+
var map = L.map('map', {
17+
center: [0, 0],
18+
maxZoom: 20,
19+
minZoom: 1,
20+
zoom: 1,
21+
crs: L.CRS.TianDiTu_WGS84
22+
});
23+
L.tileLayer.wmts("http://t{s}.tianditu.com/img_c/wmts?",
24+
{
25+
layer: "img",
26+
style: "default",
27+
tilematrixSet: "c",
28+
format: "tiles",
29+
subdomains:[0,1,2,3,4,5,6,7]
30+
}
31+
).addTo(map);
32+
</script>
33+
</html>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
CloudTileLayer = L.TileLayer.extend({
2+
defaultURL: 'http://t2.supermapcloud.com/FileService/image',
3+
options: {
4+
/**
5+
* APIProperty: mapName
6+
* {String} 地图名称,默认为 quanguo。
7+
*/
8+
mapName: "quanguo",
9+
/**
10+
* Property: type
11+
* {String} 地图投影。
12+
*/
13+
type: "web",
14+
minZoom: 3,
15+
maxZoom: 18
16+
17+
},
18+
initialize: function (url, options) {
19+
L.setOptions(this, options);
20+
var cloudURL = url || this.defaultURL;
21+
this._url = cloudURL + "?map=" + this.options.mapName + "&type=" + this.options.type + "&x={x}&y={y}&z={z}";
22+
L.stamp(this);
23+
}
24+
})
25+
L.supermap = L.supermap || {};
26+
L.supermap.cloudTileLayer = function (url, options) {
27+
return new CloudTileLayer(url, options);
28+
};
29+
30+
module.exports = L.supermap.cloudTileLayer;

0 commit comments

Comments
 (0)