【vue3+ArcGIS5】web开发中的地图功能从入门到实战一:显示一个基础的地图

ArcGIS是一个比较专业的地图插件了,可以帮助实现很多的2d,3d的可视化效果。使用范围还相当的广泛,这个专题我们来研究下它的一些使用方法。

实现效果

实现步骤

  1. 新建一个新的vite+vue3项目,工程结构如下
  2. 在index.html中引入依赖的插件js
js 复制代码
<script type="module" src="https://js.arcgis.com/5.0/"></script>
  1. 在component文件中新建一个组件来显示我们的地图组件
html 复制代码
<script setup>
    
</script>

<template>
    <h2>ArcGIS Maps SDK for JavaScript Tutorials: Display a map</h2>
    <div class="container">
        <arcgis-map basemap="arcgis/topographic" center="-118.805, 34.020" zoom="13">
            <arcgis-zoom slot="top-left"></arcgis-zoom>
        </arcgis-map>
    </div>
</template>

<style>
   .container {
      height: 100%;
      margin: 0;
    }
</style>
  1. 清空App.vue中的默认信息,引入我们的组件
html 复制代码
<script setup>
import HelloWorld from './components/HelloWorld.vue'
import ArcGisComp from './components/ArcGisComp/second.vue'
</script>

<template>
  <HelloWorld />
  <ArcGisComp />
</template>
  1. 启动项目
bash 复制代码
pnpm dev

最后就可以看到我们的地图显示效果。

相关推荐
何忆清风7 分钟前
Easy Agent Pilot - Rust实现的开源桌面Agent软件
ai·rust·vue·agent·tauri·开发工具
码界筑梦坊2 小时前
361-基于Python的空气质量气候数据分析预测系统
python·信息可视化·数据分析·flask·vue·毕业设计
我叫张小白。3 小时前
劳动力招聘管理系统:全栈实战(Vue3+FastAPI+WebSocket+Dify)
websocket·vue·毕业设计·状态模式·fastapi·dify·智能体
白嫖叫上我1 天前
Vue3+iconfont图标选择器封装
前端·vue
是梦终空4 天前
计算机源码273—基于SpringBoot+Vue3停车场管理系统带支沙箱支付(源代码+数据库)
数据库·spring boot·vue·mybatis·停车场管理系统·沙箱支付·毕设设计
_Twink1e4 天前
基于Vue的纯前端的库存销售系统
前端·vue.js·vue·web
灵魂学者4 天前
使用 Electron 打包项目构建 .EXE 桌面应用程序(简)
electron·node.js·vue·build·桌面应用程序
Zephyr_04 天前
SQL,MyBatis-Plus,maven,Spring与VUE3
sql·spring·vue·maven·mybatis
:mnong5 天前
附图报价系统设计分析5
electron·pdf·vue·cad·dwg·定额