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'
})
})
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
Thank you very much for answer
ol.source.KML
has a method getFeatures() which gives you all features in your KML. Then you can use getProperties() or get() on the feature to read the properties.
(Partial) solution:
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) );
});
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?
Please still help ;)