最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Vue+ ArcGIS JavaScript APi詳解

 更新時間:2022年11月04日 14:50:06   作者:安迪小寶  
這篇文章主要介紹了Vue+ ArcGIS JavaScript APi,文中需要注意ArcGIS JavaScript3.x 和ArcGIS JavaScript 4.x框架差異較大,本文從環(huán)境搭建開始到測試運行給大家講解的非常詳細(xì),需要的朋友可以參考下

版本

Vue 2

ArcGIS JavaScript 4.22

注意 ArcGIS JavaScript3.x 和ArcGIS JavaScript 4.x框架差異較大

環(huán)境搭建

新建vue

可以使用vue ui創(chuàng)建項目

增加ArcGIS JavaScript 包引用

package.json

 "dependencies": {
    "core-js": "^3.8.3",
    "vue": "^2.6.14",   
    "@arcgis/core":"4.22.2",
    "ncp":"^2.0.0"
  },
  "devDependencies": {
    "@babel/core": "^7.12.16",
    "@babel/eslint-parser": "^7.12.16",
    "@vue/cli-plugin-babel": "~5.0.0",
    "@vue/cli-plugin-eslint": "~5.0.0",
    "@vue/cli-service": "~5.0.0",
    "eslint": "^6.8.0",
    "eslint-plugin-vue": "^5.2.3",    
    "vue-template-compiler": "^2.6.14"  
  },

ncp: 主要用于拷貝資源信息

@arcgis/core 是arcgis_js倉庫

拷貝資源信息

package.json中配置copy命令

 "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint",
    "copy": "ncp ./node_modules/@arcgis/core/assets ./public/assets"
  },

安裝完依賴后運行 copy命令

yarn 
yarn copy
yarn serve
-------------------
npm i
npm run copy
npm run serve

運行完copy命令后,會將arcgis相關(guān)資源拷貝到public/assets目錄下

全局引入

main.js

import '@arcgis/core/assets/esri/themes/light/main.css'
import esriConfig from '@arcgis/core/config.js'
esriConfig.assetsPath = './assets'

頁面測試

helloworld.vue

<template>
  <div class="hello">
    <div id="map" class="map" v-show="flag == 'map'">
    </div>
    <div id="earth" class="map" v-show="flag == 'earth'"></div>
  </div>
</template>

<script>
import Map from '@arcgis/core/Map'
import MapView from '@arcgis/core/views/MapView'
import MapImageLayer from '@arcgis/core/layers/MapImageLayer'
import ElevationLayer from '@arcgis/core/layers/ElevationLayer'
import BaseElevationLayer from '@arcgis/core/layers/BaseElevationLayer'
import SpatialReference from '@arcgis/core/geometry/SpatialReference'
import SceneView from '@arcgis/core/views/SceneView'
import Basemap from '@arcgis/core/Basemap'
import TileLayer from '@arcgis/core/layers/TileLayer'

export default {
  name: 'HelloWorld',
  data() {
    return {
      mapView: null,
      map: null,
      map3d: null,
      flag: 'earth'
    }
  },

  mounted() {
    this.initBasemap()
  },
  methods: {
    initBasemap() {
      const self = this
      //二維
      const mapImageLayer = new MapImageLayer({
        url: "http://192.168.3.156:6080/arcgis/rest/services/xiangyang/jichang/MapServer"
      })

      this.map = new Map({
        // basemap: basemap,
        layers: [mapImageLayer]
      })

      this.mapView = new MapView({
        container: 'map',
        map: self.map,
        spatialReference: new SpatialReference({
          wkid: 3857
        }),
        rotation: 41.2,
        zoom: 3
      })


      // 三維地形
      const ExaggeratedElevationLayer = BaseElevationLayer.createSubclass({      
        properties: {
          exaggeration: 10
        },
        load: function () {
          // TopoBathy3D contains elevation values for both land and ocean ground
          this._elevation = new ElevationLayer({
            url: "https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/TopoBathy3D/ImageServer"
          });

         
          this.addResolvingPromise(
            this._elevation.load().then(() => {
            
              this.tileInfo = this._elevation.tileInfo;
              this.spatialReference = this._elevation.spatialReference;
              this.fullExtent = this._elevation.fullExtent;
            })
          );

          return this;
        },

        // Fetches the tile(s) visible in the view
        fetchTile: function (level, row, col, options) {
          // calls fetchTile() on the elevationlayer for the tiles
          // visible in the view
          return this._elevation.fetchTile(level, row, col, options).then(
            function (data) {
              const exaggeration = this.exaggeration;

              for (let i = 0; i < data.values.length; i++) {
                // Multiply the given pixel value
                // by the exaggeration value
                data.values[i] = data.values[i] * exaggeration;
              }
              return data;
            }.bind(this)
          );
        }
      });


      const basemap = new Basemap({
        baseLayers: [
          new TileLayer({
            url: "https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer"
          }),
          new TileLayer({
            url:
              "https://tiles.arcgis.com/tiles/nGt4QxSblgDfeJn9/arcgis/rest/services/terrain_with_heavy_bathymetry/MapServer"
          }),

        ]
      });

      const elevationLayer = new ExaggeratedElevationLayer();

      
      this.map3d = new Map({
        basemap: basemap,
        ground: {
          layers: [elevationLayer]
        }
      });

      const view = new SceneView({
        container: "earth",
        map: this.map3d,
        alphaCompositingEnabled: true,
        qualityProfile: "high",
        camera: {
          position: [-55.039, 14.948, 19921223.3],
          heading: 2.03,
          tilt: 0.13
        },
        environment: {
          background: {
            type: "color",
            color: [255, 252, 244, 0]
          },
          starsEnabled: true,
          atmosphereEnabled: true,
          lighting: {
            type: "virtual"
          }
        },


      });


      this.map3d.ground = {
        layers: [elevationLayer]
      };

    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
.hello {
  width: 100%;
  height: 100%;
}

.map {
  width: 100%;
  height: 100%;
}
</style>

demo地址

https://gitee.com/wolf_pro/vue_arcgis4.22.git

到此這篇關(guān)于Vue+ ArcGIS JavaScript APi的文章就介紹到這了,更多相關(guān)Vue+ ArcGIS JavaScript APi內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • Vue3響應(yīng)式高階用法之markRaw()的使用

    Vue3響應(yīng)式高階用法之markRaw()的使用

    在Vue3中,markRaw()用于防止對象被轉(zhuǎn)換為響應(yīng)式,適用于管理大型庫對象或靜態(tài)數(shù)據(jù),有助于優(yōu)化性能和防止不必要的修改,本文就來詳細(xì)的介紹一下,感興趣的可以了解一下
    2024-09-09
  • 解決pycharm雙擊但是無法打開的情況

    解決pycharm雙擊但是無法打開的情況

    這篇文章主要介紹了解決pycharm雙擊但是無法打開的情況,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2020-10-10
  • vue3?tailwindcss的使用教程

    vue3?tailwindcss的使用教程

    Tailwind是由Adam Wathan領(lǐng)導(dǎo)的TailwindLabs開發(fā)的 CSS 框架,這篇文章主要介紹了vue3?tailwindcss的使用,需要的朋友可以參考下
    2023-08-08
  • Vue通過axios異步請求后端接口的方法

    Vue通過axios異步請求后端接口的方法

    在現(xiàn)代Web開發(fā)中,前端與后端的數(shù)據(jù)交互至關(guān)重要,Vue.js作為一款流行的前端框架,結(jié)合Axios庫能夠高效地實現(xiàn)HTTP請求與數(shù)據(jù)處理,本文將詳細(xì)講解如何在Vue 3中使用Axios,并通過實際案例展示其用法,需要的朋友可以參考下
    2024-12-12
  • Vue中@click.stop和@click.prevent實例詳解

    Vue中@click.stop和@click.prevent實例詳解

    當(dāng)我們使用Vue.js開發(fā)前端應(yīng)用時,經(jīng)常會在模版中使用@click指令來響應(yīng)用戶的點擊事件,這篇文章主要給大家介紹了關(guān)于Vue中@click.stop和@click.prevent的相關(guān)資料,需要的朋友可以參考下
    2024-04-04
  • vue在.js文件中如何進(jìn)行路由跳轉(zhuǎn)

    vue在.js文件中如何進(jìn)行路由跳轉(zhuǎn)

    這篇文章主要介紹了vue在.js文件中如何進(jìn)行路由跳轉(zhuǎn),具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2022-12-12
  • vue input輸入框關(guān)鍵字篩選檢索列表數(shù)據(jù)展示

    vue input輸入框關(guān)鍵字篩選檢索列表數(shù)據(jù)展示

    這篇文章主要為大家詳細(xì)介紹了vue input輸入框關(guān)鍵字篩選檢索列表數(shù)據(jù)展示,文中示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2019-05-05
  • vue3一個元素如何綁定兩個或多個事件

    vue3一個元素如何綁定兩個或多個事件

    這篇文章主要介紹了vue3一個元素如何綁定兩個或多個事件問題,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教
    2023-11-11
  • Vue+jsPlumb實現(xiàn)連線效果(支持滑動連線和點擊連線)

    Vue+jsPlumb實現(xiàn)連線效果(支持滑動連線和點擊連線)

    jsPlumb 是一個比較強大的繪圖組件,它提供了一種方法,主要用于連接網(wǎng)頁上的元素。本文將利用jsPlumb實現(xiàn)連線效果,同時支持滑動連線和點擊連線,感興趣的可以了解一下
    2023-01-01
  • vue中獲取滾動table的可視頁面寬度調(diào)整表頭與列對齊(每列寬度不都相同)

    vue中獲取滾動table的可視頁面寬度調(diào)整表頭與列對齊(每列寬度不都相同)

    這篇文章主要介紹了vue中獲取滾動table的可視頁面寬度,調(diào)整表頭與列對齊(每列寬度不都相同),需要的朋友可以參考下
    2019-08-08

最新評論

东莞市| 花莲县| 襄垣县| 噶尔县| 文水县| 杨浦区| 治县。| 中宁县| 宁河县| 扬中市| 木兰县| 彭泽县| 缙云县| 铜川市| 黑山县| 伊金霍洛旗| 达州市| 通城县| 丹棱县| 广州市| 永福县| 灵山县| 石泉县| 镇康县| 绥德县| 丹棱县| 手游| 黔江区| 佛冈县| 西城区| 井冈山市| 萝北县| 秭归县| 界首市| 新化县| 肃南| 渝北区| 东乌| 东台市| 正宁县| 永安市|