arcgisJs之底圖切換插件

arcgisJs之底圖切換插件ui

底圖切換插件在arcgis中有兩種表現,以下:this

1.兩張底圖切換spa

2.多張底圖切換插件

1、兩張地圖切換code

let basemapToggle = new BasemapToggle({
        view: this.view,
        nextBasemap: customBasemap
      })
this.view.ui.add(basemapToggle, 'top-right')

2、多張地圖切換對象

var basemapGallery = new BasemapGallery({
        source: [ customBasemap, customBasemap1 ],
        view: this.view
      })
this.view.ui.add(basemapGallery, { position: 'top-right' })

注意:blog

1.切換插件上的圖片顯示不出來圖片

緣由:未給底圖對象設置圖片路徑  (thumbnailUrl)it

import Basemapthumbnail from '../../assets/map_images/Basemapthumbnail.png'
import Basemapthumbnail1 from '../../assets/map_images/Basemapthumbnail1.png'
 let customBasemap = new Basemap({
        baseLayers: [tdtylayer1, layerProvince, tdtylayer2],
        title: '影像地圖',
        id: 'myBasemap',
        thumbnailUrl: Basemapthumbnail
      })
let customBasemap1 = new Basemap({
        baseLayers: [tdtylayer, layerProvince, tdtylayer3],
        title: '矢量底圖',
        id: 'myBasemap1',
        thumbnailUrl: Basemapthumbnail1
      })

 

 

鑽研不易,轉載請註明出處。。。。。。io

相關文章
相關標籤/搜索