跳到主要内容
版本:9.0.0

栅格服务请求范围设置

show
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Add_rasterExtent</title>
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no"/>
<style>
body {
margin: 0;
padding: 0;
}

#map {
position: absolute;
top: 0;
bottom: 0;
width: 100%;
}
</style>
<script src="https://delivery.mapmost.com/cdn/sdk/webgl/v9.0.0/mapmost-webgl-min.js"></script>
</head>
<body>
<div id="map"></div>
<script>
let map = new mapmost.Map({
container: 'map',
style: {
version: 8,
sources: {},
layers: []
},
center: [120.55808460501783, 31.27289020857674],
zoom: 12,
pitch: 0,
userId: '***', // 授权码
});

map.on('load', function () {

let vecUrl = "http://t0.tianditu.com/vec_w/wmts?tk="+"<your token>"; // 替换为你的token
const tdtW = vecUrl + "&SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=vec&STYLE=default&TILEMATRIXSET=w&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&FORMAT=tiles"

let wmts_tianditu = {
'id': 'wmts_tianditu-layer',
'project': '3857',
'source': {
'tiles': [tdtW],
'tileSize': 256
}
}
map.addRasterLayer2(wmts_tianditu)

let wmts_option = {
'id': 'wmts-test-layer',
'project': '4528',
'source': {
'tiles': [
'IP/shishanmap/arcgis/rest/services/ssjd_yx_test2/MapServer/tile/{z}/{y}/{x}'
],
origin: [-5273200, 7202100],
tileSize: 256,
resolutions: [
156367.78906250003,
78183.89453125001,
39091.94726562501,
19545.973632812504,
9772.986816406252,
4886.493408203126,
2443.246704101563,
1221.6233520507815,
610.8116760253907,
305.40583801269537,
152.70291900634768,
76.35145950317384,
38.17572975158692,
19.08786487579346,
9.54393243789673,
4.771966218948365,
2.3859831094741826,
1.1929915547370913,
0.5964957773685456,
0.2982478886842728,
0.1491239443421364
],
extent: [4.05490535e7, 3455645.5, 4.05563065e7, 3465809.5],
}
}
map.addRasterLayer2(wmts_option)

})
</script>
</body>
</html>