2014-09-19 37 views
1

我試圖在OpenLayers 3中繪製矢量圖塊,並且我想測試圖像矢量的性能,因爲我擁有的卷對於瀏覽器來說太多了處理。什麼樣的來源支持ol.source.ImageVector在OpenLayers 3

這是ImageVector類

ol.source.ImageVector

一種圖像源其圖像的成矢量 特徵從一個矢量源讀畫布元素(ol.source該文檔.Vector)被繪製。一個 ol.source.ImageVector對象將被用作圖像源 圖層(ol.layer.Image)。

根據這一點,ol.source.Vector類型的所有源應該工作。三該類如下:

ol.source.Vector 
|_ ol.source.Cluster 
|_ ol.source.FormatVector 
    |__ ol.source.ServerVector 
    |__ ol.source.StaticVector 
    | |__ ol.source.GeoJSON 
    | |__ ol.source.GPX 
    | |__ ol.source.IGC 
    | |__ ol.source.KML 
    | |__ ol.source.OSMXML 
    | |__ ol.source.TopoJSON 
    |__ ol.source.TileVector 

所以,我的理解,我應該能夠使用任何這些來源爲ImageVector源。所以,我正在嘗試類似以下內容,但沒有成功。

var waterVectorSource = new ol.source.TileVector({ 
     format: new ol.format.TopoJSON(), 
     projection: 'EPSG:3857', 
     tileGrid: new ol.tilegrid.XYZ({ 
      maxZoom: 19 
     }), 
     url: 'http://{a-c}.tile.openstreetmap.us/' + 
      'vectiles-water-areas/{z}/{x}/{y}.topojson' 
    }) 

    var imageVectorSource = new ol.source.ImageVector({ 
     source:waterVectorSource 
    }); 

    var imageLayer = new ol.layer.Image({ 
     source:imageVectorSource 
    }); 
    var map = new ol.Map({ 
     target: 'map', 
     layers: [ 
      /*new ol.layer.Tile({source: new ol.source.MapQuest({layer: 'sat'})}),*/ 
      imageLayer 
     ], 
     view: new ol.View({     
      zoom: 13 
     }) 
    }); 

嘗試使用ServerVector而不是TileVector,但它們不起作用。沒有功能執行(前者)或網絡電話(後者)。我見過的ImageVector類(like this one)的唯一示例使用了StaticVector類的子類。

有沒有人有一個什麼樣的數據源可以用於ImageVector類的想法?

感謝

回答

1

取得聯繫與開發商後,我與一個解決方案結束。結果發現ImageVector類有一個錯誤,它阻止它調用loadFeatures函數。他們修復了開發者版本,並創建了PR。

查看this thread in Google Groups瞭解更多詳情

相關問題