0
点赞
收藏
分享

微信扫一扫

openlayers 谷歌地图源

登高且赋 2021-09-21 阅读 60

https://github.com/openlayers/openlayers/issues/9900

import Map from 'ol/Map';
import View from 'ol/View';
import TileLayer from 'ol/layer/Tile';
import XYZ from 'ol/source/XYZ';

new Map({
  target: 'map',
  layers: [
    new TileLayer({
      source: new XYZ({
        url: 'http://mt{0-3}.google.com/vt/lyrs=r&hl=en&x={x}&y={y}&z={z}'
      })
    })
  ],
  view: new View({
    center: [0, 0],
    zoom: 2
  })
});
layers: [
    new TileLayer({
      source: new XYZ({
        url: "http://mt{0-3}.google.com/vt/lyrs=m&x={x}&y={y}&z={z}"
      })
    }),
    new VectorLayer({
      source: this.vectorSource
    })
  ]
});
this.map.setLayerGroup(layer);
}
  • 路线图
  • 地形
  • 路线图已更改
  • 仅卫星
  • 仅地形
  • 杂种
举报

相关推荐

0 条评论