<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Add_tianditu_3857</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.4.1/mapmost-webgl-min.js"></script>
</head>
<body>
<div id="map"></div>
<script>
let vecUrl = "http://t0.tianditu.com/vec_w/wmts?tk="+ '<your 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 stylejson = {
version: 8,
sources: {
tianditu: {
type: 'raster',
tiles: [tdtW],
tileSize: 256
}
},
layers: [
{
id: 'tianditu',
type: 'raster',
source: 'tianditu'
}
]
};
let map = new mapmost.Map({
container: 'map',
style: stylejson,
center: [120.74603465203592, 31.30605899929158],
zoom: 10,
userId: '***',
});
</script>
</body>
</html>