zoukankan      html  css  js  c++  java
  • vue中openlayers 加载离线瓦片地图

    记录下,直接贴代码吧

    let roadLayer = new Group({
    layers: [
    new TileLayer({
    source: new XYZ({
    //url : 'http://mt3.google.cn/vt/lyrs=m&hl=zh-CN&gl=cn&x={x}&y={y}&z={z}', //这是加载线上谷歌地图
    tileUrlFunction: ($xyz) => { //引入离线瓦片
    return require('@/assets/google/'+$xyz[0]+'/'+$xyz[1]+'/'+$xyz[2]+'.png');
    },
    minZoom : 17, 
    maxZoom : 17 
    })
    }),
    ]
    });
    this.mapObj.view = new View({
    projection: "EPSG:4326", //使用这个坐标系
    center: this.mapObj.center,//[116.72429, 39.90468],//
    extent: [116.74,39.9,117,39.89],// this.mapObj.extent, //[116.2, 35, 117.9999, 42.99]
    zoom: this.mapObj.zoom,
    minZoom: 17,
    maxZoom: 17
    });
    this.map = new Map({
    target: "map",
    layers: [ roadLayer ],
    overlays: [],
    view: this.mapObj.view
    });
  • 相关阅读:
    Vue-嵌套路由
    Vue-详解设置路由导航的两种方法: <router-link :to="..."> 和router.push(...)
    Python
    windows和linux下 Python2,Python3 的环境及安装
    Python那点事
    Linux
    Linux
    Django
    Redis
    Django
  • 原文地址:https://www.cnblogs.com/fmixue/p/12919361.html
Copyright © 2011-2022 走看看