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

vue使用天地圖、openlayers實(shí)現(xiàn)多個(gè)底圖疊加顯示效果

 更新時(shí)間:2022年04月14日 15:43:21   作者:船長(zhǎng)在船上  
這篇文章主要介紹了vue使用天地圖、openlayers實(shí)現(xiàn)多個(gè)底圖疊加顯示,根據(jù)返回的經(jīng)緯度列表通過(guò)天地圖、openlayers實(shí)現(xiàn)底圖添加,本文通過(guò)示例代碼給大家介紹的非常詳細(xì),需要的朋友參考下吧

實(shí)現(xiàn)效果:

需求:根據(jù)返回的經(jīng)緯度列表通過(guò)天地圖、openlayers實(shí)現(xiàn)底圖添加(航道圖層、線圖層、水深圖層

tk:自己申請(qǐng)的密鑰

安裝opelayers

cnpm i -S ol
#或者
npm install ol
<script>
    // openlayers地圖
import "ol/ol.css";
import {
  Icon,
  Style,
  Stroke
} from "ol/style";
import 'ol/ol.css'
import Map from "ol/Map";
import View from "ol/View";
import TileLayer from "ol/layer/Tile";
import XYZ from "ol/source/XYZ";
import { get as getProjection } from "ol/proj.js";
import { getBottomLeft, getTopRight } from 'ol/extent.js'
import { Vector as SourceVec } from 'ol/source';
import { Vector as LayerVec } from 'ol/layer';
import Overlay from "ol/Overlay";//彈窗
import {Point} from "ol/geom";
import {Feature} from "ol";
import { defaults as defaultControls } from "ol/control";//默認(rèn)縮放
import {FullScreen,ScaleLine} from "ol/control";//全屏,比例尺控件
import TileGrid from 'ol/tilegrid/TileGrid';
import { LineString, Polygon } from 'ol/geom.js'
import { setTimeout } from 'timers';
import {Polyline} from "ol/format";
// import { vectorContext } from "ol/render";
import { getVectorContext } from "ol/render";
import {defaults as defaultInteractions} from 'ol/interaction';//旋轉(zhuǎn)
 
export default {
        data(){
            tk:"密鑰",
            center:{
                longitude:"",
                latitude:""
            },
            map:null,
        },
        methods:{
            initMap() {
              let defaultsMap = {
                tileUrl1:"圖層地址1",
                tileUrl2:"圖層地址2",
                tileUrl3:"圖層地址3",
                origin: [-400, 400],
                zoom: 5,
                resolutions: [
                      //根據(jù)項(xiàng)目需要設(shè)置
                ],
                fullExtent: [
                          //根據(jù)項(xiàng)目需要設(shè)置
                ],
                inters: [1000, 100],
                center: [this.center.longitude, this.center.latitude],
                projection: getProjection("EPSG:4326")
              };
              // let projection = getProjection('EPSG:4326');
 
              // 底圖天地圖注記  cta——道路+中文注記
              let baseLayer = new TileLayer({
                title: "天地圖",
                source: new XYZ({
                  url:"http://t4.tianditu.com/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=" +this.tk
                 }),
                  zIndex: 2
          });
      //天地圖路網(wǎng)
              let roadLayer = new TileLayer({
                    title: "天地圖路網(wǎng)",
                    source: new XYZ({
                        projection: defaultsMap.projection,
                        url:"http://t4.tianditu.com/DataServer?T=vec_c&x={x}&y={y}&l={z}&tk=" +this.tk
                    }),
                    zIndex: 1
              });
      
 
              // 加載地圖層mapservice
 
              let tileGrid = new TileGrid({
                tileSize: 256,
                origin: defaultsMap.origin,
                extent: defaultsMap.fullExtent,
                resolutions: defaultsMap.resolutions
              });
 
              // 航道圖層
              let cjinobeaconMap = new TileLayer({
                  source: new XYZ({
                      tileGrid: tileGrid,
                      projection: defaultsMap.projection,
                      url: defaultsMap.tileUrl1
                    }),
                    zIndex: 9
              });
              // 線圖層
              let framesMap = new TileLayer({
                    source: new XYZ({
                      tileGrid: tileGrid,
                      projection: defaultsMap.projection,
                      url: defaultsMap.tileUrl2
                    }),
                    zIndex: 10
              });
 
              // 水深圖層
              let soundgMap = new TileLayer({
                    source: new XYZ({
                      tileGrid: tileGrid,
                      projection: defaultsMap.projection,
                      url: defaultsMap.tileUrl3
                    }),
                    zIndex: 11
              });
 
 
              // 加載地圖
              this.map = new Map({
                    target: "trajecttoryMap",
                    controls: defaultControls().extend([
                      new FullScreen(),
                      new ScaleLine({
                        units: "metric"
                      })
                  // new ZoomSlider()
                ]),
                interactions: defaultInteractions({
                  pinchRotate: false // 移動(dòng)端禁止地圖旋轉(zhuǎn)
                }),
                loadTilesWhileAnimating: true,
                layers: [baseLayer, roadLayer, cjinobeaconMap, framesMap, soundgMap],
                //overlays: [this.overlay], // 把彈窗加入地圖
                view: new View({
                      projection: defaultsMap.projection,
                      center: defaultsMap.center,
                      extent: defaultsMap.fullExtent,
                      // resolutions: defaultsMap.resolutions,
                      zoom: 14,
                      minZoom: 7,
                      maxZoom:17
                })
              });
      
            },
        },
        mounted(){
            this.initMap();
        }
}
</script>

到此這篇關(guān)于vue使用天地圖、openlayers實(shí)現(xiàn)多個(gè)底圖疊加顯示的文章就介紹到這了,更多相關(guān)vue天地圖openlayers內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • vue-router 基于后端permissions動(dòng)態(tài)生成導(dǎo)航菜單的示例代碼

    vue-router 基于后端permissions動(dòng)態(tài)生成導(dǎo)航菜單的示例代碼

    本文主要介紹了vue-router 基于后端permissions動(dòng)態(tài)生成導(dǎo)航菜單的示例代碼,文中通過(guò)示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2021-09-09
  • Vue Object 的變化偵測(cè)實(shí)現(xiàn)代碼

    Vue Object 的變化偵測(cè)實(shí)現(xiàn)代碼

    這篇文章主要介紹了Vue Object的變化偵測(cè)實(shí)現(xiàn),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2020-04-04
  • vue-cli3打包時(shí)圖片壓縮處理方式

    vue-cli3打包時(shí)圖片壓縮處理方式

    這篇文章主要介紹了vue-cli3打包時(shí)圖片壓縮處理方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2022-03-03
  • vue原生方法自定義右鍵菜單

    vue原生方法自定義右鍵菜單

    這篇文章主要為大家詳細(xì)介紹了vue原生方法自定義右鍵菜單,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2022-04-04
  • 解決antd 下拉框 input [defaultValue] 的值的問(wèn)題

    解決antd 下拉框 input [defaultValue] 的值的問(wèn)題

    這篇文章主要介紹了解決antd 下拉框 input [defaultValue] 的值的問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧
    2020-10-10
  • vue升級(jí)之路之vue-router的使用教程

    vue升級(jí)之路之vue-router的使用教程

    自動(dòng)安裝的vue-router,會(huì)在src 文件夾下有個(gè)一個(gè) router -> index.js 文件 在 index.js 中創(chuàng)建 routers 對(duì)象,引入所需的組件并配置路徑。這篇文章主要介紹了vue-router的使用,需要的朋友可以參考下
    2018-08-08
  • vue 添加vux的代碼講解

    vue 添加vux的代碼講解

    通過(guò)命令npm install vux --save添加vux,在相關(guān)配置文件中配置信息,具體代碼添加方法,大家參考下本文
    2017-11-11
  • vuex的數(shù)據(jù)渲染與修改淺析

    vuex的數(shù)據(jù)渲染與修改淺析

    這篇文章主要給大家介紹了關(guān)于vuex的數(shù)據(jù)渲染與修改的相關(guān)資料,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2020-11-11
  • Vue實(shí)現(xiàn)仿iPhone懸浮球的示例代碼

    Vue實(shí)現(xiàn)仿iPhone懸浮球的示例代碼

    這篇文章主要介紹了Vue實(shí)現(xiàn)仿iPhone懸浮球的示例代碼,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2020-03-03
  • vue項(xiàng)目刷新當(dāng)前頁(yè)面的三種方法

    vue項(xiàng)目刷新當(dāng)前頁(yè)面的三種方法

    這篇文章主要介紹了vue項(xiàng)目刷新當(dāng)前頁(yè)面的三種方法,本文圖文并茂給大家介紹的非常不錯(cuò),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2018-12-12

最新評(píng)論

吉林省| 金沙县| 湖南省| 右玉县| 新龙县| 青海省| 湘潭县| 澄迈县| 特克斯县| 德昌县| 牙克石市| 蚌埠市| 光山县| 长葛市| 南昌县| 汤原县| 微山县| 临澧县| 磴口县| 祁连县| 乾安县| 辽源市| 柞水县| 台北县| 竹山县| 平和县| 普安县| 林甸县| 新巴尔虎左旗| 汉沽区| 宜章县| 得荣县| 莎车县| 仲巴县| 瑞昌市| 红桥区| 渝北区| 青州市| 凤山市| 泰和县| 鲁甸县|