[英]is it possible to change zindex of vector layer on hover on vector layer in openlayers?
[英]Is there any way to access the locations for a vector layer in OpenLayers?
我使用 GeoJSON 文件在 OpenLayers 中創建了一個名為“locationGeoJSON”的矢量圖層,我正在嘗試使用.getSource()
方法來訪問該層的位置數據。 我目前正在使用一種解決方法,我可以使用locationGeoJSON.getSource().Uu
訪問位置數據。 但我覺得有一些 get 方法可以用來以更合適的方式檢索數據。 我試過使用locationGeoJSON.getSource().getFeatures()
,但我只是得到一個空數組作為回報。 任何人都可以深入了解這個問題嗎? 這是我在矢量圖層上使用 .getSource() 后的控制台 output。 如何訪問“Uu”屬性?
locationGeoJSON.getSource().getFeatures()
是正確的,但您可能必須等待 geojson 文件加載后再調用它。
locationGeoJSON.getSource().on('featuresloadend', function (evt) {
console.log(evt.target.getFeatures());
});
控制台 output 中的 object 已經具有這些功能,因為它鏈接到原始 object 並在其 state 更改時刷新。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.