[英]OpenLayers getFeatures() access properties
我有一些具有許多功能的關卡。 每個特征都有屬性,例如值(是一個數組)。 但我無法訪問此屬性。
當我嘗試訪問這樣的屬性時
layer.getSource().getFeatures()[0].values
我得到一個未定義的異常。 我嘗試訪問它
layer.getSource().getFeatures().get('values')
這個 function 不存在嗎?
我必須做什么? 如何訪問我所需的值?
您可以使用
layer.getSource().getFeatures()[0].getProperties().values
或者
layer.getSource().getFeatures()[0].get('values')
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.