Vue Arcgis叠加天地图
转载<template>
<div style="width: 100%;
height: 100%">
<div id="viewDiv" style="width: 100%;
height: 100%;
margin: 0;
padding: 0;
overflow: hidden;
position: absolute;
top: 0;
left: 0;">
</div>
</div>
</template>
<script>
import { loadCss, setDefaultOptions, loadModules } from "esri-loader";
export default {
name: "Data",
mounted() {
loadModules(
["esri/layers/WebTileLayer", "esri/Map", "esri/views/SceneView"],
{
url: "http://localhost:8081/arcgis_js_api/4.18/init.js"
}
)
.then(([WebTileLayer, Map, SceneView]) => {
var tiandituBaseUrl = "http://{subDomain}.tianditu.gov.cn"; //天地图服务地址
var token = "7baeffb96bf61861b302d0f963cfda66"; //天地图token
var map = new Map({
ground: "world-elevation"
});
var view = new SceneView({
container: "viewDiv",
map: map,
scale: 123456789,
center: [120.75, 30.75]
});
//矢量地图(球面墨卡托投影)
var tiledLayer = new WebTileLayer({
urlTemplate:
tiandituBaseUrl +
"/img_w/wmts?SERVICE=WMTS&VERSION=1.0.0&REQUEST=GetTile&LAYER=img&STYLE=default&FORMAT=tiles&TILEMATRIXSET=w&TILEMATRIX={level}&TILEROW={row}&TILECOL={col}&tk=" +
token,
subDomains: ["t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7"]
});
//矢量注记(球面墨卡托投影)
var tiledLayerAnno = new WebTileLayer({
urlTemplate:
tiandituBaseUrl +
"/cia_w/wmts?SERVICE=WMTS&VERSION=1.0.0&REQUEST=GetTile&LAYER=cia&STYLE=default&FORMAT=tiles&TILEMATRIXSET=w&TILEMATRIX={level}&TILEROW={row}&TILECOL={col}&tk=" +
token,
subDomains: ["t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7"]
});
map.add(tiledLayer);
map.add(tiledLayerAnno);
})
.catch(err => {
console.log(err);
});
}
};
</script>
</style>
本文章为转载内容,我们尊重原作者对文章享有的著作权。如有内容错误或侵权问题,欢迎原作者联系我们进行内容更正或删除文章。
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
Vue3 整合 Pinia 存储数据
Vue3 整合 Pinia 存储数据
vue Pinia