簡體   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