繁体   English   中英

OL3是否在WebGL上支持矢量切片?

[英]Does OL3 support Vector Tiles on WebGL?

OpenLayers 3是否在WebGL上支持LineString和Polygon渲染? 我已将渲染器设置为“ webgl”,并尝试渲染TopoJSON格式的Vector Tile,但出现以下错误:“未捕获的TypeError:vectorSource.loadFeatures不是函数”。

仅当我从地图属性中删除“ renderer”属性,以便使用HTML5画布绘制地图时,OL3网站的以下示例才有效: var map = new ol.Map({ renderer: 'webgl', layers: [ new ol.layer.VectorTile({ source: new ol.source.VectorTile({ attributions: [new ol.Attribution({ html: '© Mapbox ' + '© ' + 'OpenStreetMap contributors ' })], format: new ol.format.MVT(), tileGrid: ol.tilegrid.createXYZ({maxZoom: 22}), tilePixelRatio: 16, url: 'http://{ad}.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 }) });

仅画布渲染器支持带有ol.layer.VectorTile矢量切片。

如前所述,WebGL渲染目前仅支持点,但是似乎确实希望将其扩展到线和面。 有了VectorTile支持(仅限授权画布),我无法想象他们不包括完整的WebGL。

去年有一个代码冲刺,他们在那里进行了概念验证。 有很多限制,但事实证明这是可能的。 http://www.camptocamp.com/en/actualite/openlayers-3-towards-drawing-lines-and-polygons-with-webgl/

renderer    ol.renderer.Type | Array.<ol.renderer.Type> | undefined 

渲染器。 默认情况下,将按顺序测试Canvas和WebGL渲染器的支持情况,并使用第一个受支持的方法。 在此处指定ol.renderer.Type以使用特定的渲染器。 请注意,Canvas渲染器完全支持矢量数据,但是WebGL只能渲染Point几何。

http://openlayers.org/en/latest/apidoc/ol.Map.html

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM