openlayers加载bing地图
目录
openlayers加载bing地图
注:需要bingmap网站提供的许可key,注册微软账号就有了,https://www.bingmapsportal.com/Application#
new ol.source.BingMaps(options)api说明
| Name | Type | Description | |||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Bing Maps options.
|
||||||||||||||||||||||||||||||||||
var styles = [//图层样式
'Road',
'RoadOnDemand',
'Aerial',
'AerialWithLabels',
'collinsBart',
'ordnanceSurvey'
];
//初始化bing地图
var bingMapLayer=new ol.layer.Tile({
visible: false,
preload: Infinity,
source: new ol.source.BingMaps({
key: 'bingmap key',
imagerySet: 'Road'//图层样式。
}) }));
//初始化地图
var map = new ol.Map({
layers: bingMapLayer,
// Improve user experience by loading tiles while dragging/zooming. Will make
// zooming choppy on mobile or slow devices.
loadTilesWhileInteracting: true,
target: 'map',
view: new ol.View({
center: [-6655.5402445057125, 6709968.258934638],
zoom: 13
})
});