现在我正在尝试将Google地球迁移到OpenLayers 3(版本3.11.1)
我使用KML文件,在使用GE查看时,图标是彩色的,但是使用OL3时,颜色不会显示
以下是我发布此KML文件的代码段:
var projection = ol.proj.get('EPSG:3857');
var raster = new ol.layer.Tile({
source: new ol.source.BingMaps({
imagerySet: 'Aerial',
key: 'Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3'
})
});
var vector = new ol.layer.Vector({
source: new ol.source.Vector({
url: '/UsersFiles/KMLTest.kml',
format: new ol.format.KML({ extractStyles: true })
})
});
var map = new ol.Map({
layers: [raster, vector],
target: document.getElementById('map4'),
view: new ol.View({
center: [0 ,0],
projection: projection,
zoom: 0
})
});
结果如下图所示: