【发布时间】:2016-06-19 06:18:28
【问题描述】:
OpenLayers 3 是否支持 WebGL 上的 LineString 和 Polygon 渲染?我已将渲染器设置为 'webgl' 并尝试渲染 TopoJSON 格式的 Vector Tile,但出现以下错误:“Uncaught TypeError: vectorSource.loadFeatures is not a function”。
以下来自 OL3 网站的示例仅在我从地图属性中删除“渲染器”属性时才有效,以便使用 HTML5 画布渲染地图:
var map = new ol.Map({
renderer: 'webgl',
layers: [
new ol.layer.VectorTile({
source: new ol.source.VectorTile({
attributions: [new ol.Attribution({
html: '© @987654321@ ' +
'© @987654322@'
})],
format: new ol.format.MVT(),
tileGrid: ol.tilegrid.createXYZ({maxZoom: 22}),
tilePixelRatio: 16,
url: 'http://{a-d}.tiles.mapbox.com/v4/mapbox.mapbox-streets-v6/' +
'{z}/{x}/{y}.vector.pbf?access_token=' + key
})
})
],
target: 'map',
view: new ol.View({
center: [0, 0],
zoom: 2
})
});
【问题讨论】:
-
你检查过github wiki entry这个吗?
-
另外添加一些示例代码。
-
并针对
ol-debug.js(而不是缩小的ol.js)运行您的代码,这会为您提供更易读的错误消息 -
@rbaleksandar 该信息写于 2013 年 2 月 5 日,似乎是初步设计文件。
-
@rbaleksandar 示例已添加。
标签: webgl openlayers-3