美文网首页开源
openlayers 谷歌地图源

openlayers 谷歌地图源

作者: 少年眼蓝不及海 | 来源:发表于2020-12-24 17:01 被阅读0次

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);
}
  • 路线图

http://mt0.google.com/vt/lyrs=m&hl=zh-CN&x={x}&y={y}&z={z}

  • 地形

http://mt0.google.com/vt/lyrs=p&hl=zh-CN&x={x}&y={y}&z={z}

  • 路线图已更改

http://mt0.google.com/vt/lyrs=r&hl=zh-CN&x={x}&y={y}&z={z}

  • 仅卫星

http://mt0.google.com/vt/lyrs=s&hl=zh-CN&x={x}&y={y}&z={z}

  • 仅地形

http://mt0.google.com/vt/lyrs=t&hl=zh-CN&x={x}&y={y}&z={z}

  • 杂种

http://mt0.google.com/vt/lyrs=y&hl=zh-CN&x={x}&y={y}&z={z}

相关文章

网友评论

    本文标题:openlayers 谷歌地图源

    本文链接:https://www.haomeiwen.com/subject/uawmnktx.html