I've got a map with earthquake infos on different KML layers.
There's a tooltip that shows up the infos of a specific place if you "hover" with the mouse on it.
Eg.
I move my mouse over "PUNTA CANA", there should be a tooltip with:
- NAME: Punta Cana
- MAGNITUDE: 2.2
- LATITUDE: xxx
- LONGITUDE: yyy
- TIME: dd/mm/YY, hh:ii
NB: In my KML, as you can see, I have all these infos:
<Folder>
<Placemark id="placemark54021">
<name> Punta Cana</name>
<lat>38.89</lat>
<longitudo>15.78</longitudo>
<magnitudo>2.1</magnitudo>
<profondita>109</profondita>
<data_intera>18/01/2019</data_intera>
<orario>09:10</orario>
<styleUrl>#simbolo_last_0_1</styleUrl>
<Point>
<coordinates>15.78,38.89</coordinates>
</Point>
</Placemark>
</Folder>
However, If I try to get the properties, I manage to read only the "name" property:
e.g.
map.on(select, function(event) {
var feature = map.forEachFeatureAtPixel(event.pixel,
function(feature, layer) {
var values = feature.values_;
var coordinate = event.coordinate;
var hdms = ol.coordinate.toStringHDMS(ol.proj.toLonLat(coordinate));
content.innerHTML = '<p style="font-weight: 800">'+ values.name +' - ' + '02/02/2002' + ' - ore 06:00</p>' +
'<p><span style="font-weight: bold; color: red;">Magnitudo: 2.2</span> - ' +
'<b>Lat:</b> 42.00 - <b>Long</b>: 32.00 - <b>Profondità</b>: 9km</p>';
overlay.setPosition(coordinate);
}, {
hitTolerance: 5
});
});
I'm correctly reading the property name using values.name. However, If I try the same way to read other properties. E.g.: - values.lat - values.longitudo etc... it doesn't work!
How can I collect the other properties from the KML? Am I missing something?
Thank you!