ArcGIS API for JavaScript系列文章汇总:【ArcGIS API】汇总篇-CSDN博客
前言:需要安装好Arcgis包,参考文章:【ArcGIS API】Vue3+Vite+ArcGIS API for JavaScript——加载二维地图为例-CSDN博客
效果
具体代码
<template>
<div id="viewDiv" class="viewDiv"></div>
</template>
<script setup>
import { onMounted } from 'vue'
import Map from '@arcgis/core/Map'
import SceneView from '@arcgis/core/views/SceneView'
onMounted(() => {
var map = new Map({
basemap: 'streets', //其他基础地图:satellite, hybrid, topo, gray, dark-gray, oceans, osm, national-geographic
})
var view = new SceneView({
container: 'viewDiv', // Reference to the scene div created in step 5
map: map, // Reference to the map object created before the scene
scale: 50000000, // Sets the initial scale to 1:50,000,000
center: [-101.17, 21.78], // Sets the center point of view with lon/lat
})
})
</script>
<style scoped>
.viewDiv {
height: 100vh;
width: 100vw;
}
</style>
解释
view视图分为二维和三维视图,其中MapView代表二维视图,SceneView代表三维视图