OpenLayer 3中的POI [英] POI in OpenLayer 3
本文介绍了OpenLayer 3中的POI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果加载点从KML文件指向矢量层
If load points from KML file to vetor layer
var layerPOI = new ol.layer.Vector({
source: new ol.source.KML({
projection: projection,
url: 'data/KML/mydata.kml'
})
})
如何完整列出所有已加载点(POI)和已加载属性(来自data/KML/mydata.kml)?我认为,例如,进入表格-在地图视图(显示层)中我已经可以了
How can I do a complete listing of all loaded points (POIs) and loaded properties (from data/KML/mydata.kml)? I think, for example, into the table - in map view (display layer) I can is already
非常感谢您的回答
推荐答案
(部分)解决方案:
allPOIs = layerPOI.getSource().getFeatures();
// or if define a source separatly
// allPOIs = sourcePOI.getFeatures();
onePOI = allPOIs[0]; // first element in Array
propertiesOfOnePOI = onePOI.getKeys();
propertiesOfOnePOI.forEach(function (elementName, elementIndex){
console.log( "element index: " + elementIndex + " | element name: " + elementName + " | element value: " + onePOI.get(elementName) );
});
但是元素GEOMTERY
返回Object.
我尝试获取有关点的其他信息,但我不能-
还有来自KML文件的更多标签-例如,点样式-如何确定显示的图标?
But the element GEOMTERY
returns Object.
I try to getting additional information about point yet but I can not -
Also more tags from KML file - For example, point style - how to determine the displayed icon?
请仍然帮助;)
这篇关于OpenLayer 3中的POI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文