I have a kml file:
<Placemark>
<name>Ab Kettleby, Leics, 6, 9cwt, Wed</name>
<description><![CDATA[<b>County:</b> Leics<br/><b>Bells:</b> 6<br/><b>Tenor:</b> 8cwt - 2qr - 22lb<br/><b>Practice:</b> Wed<br/><b>Grid Ref:</b> SK724229<br/><a href="https://dove.cccbr.org.uk/detail.php?DoveID=AB KETTLEB">Dove Website</a><br/><a href="http://www.abkettlebybells.co.uk/">Tower Website</a>]]></description>
<styleUrl>#Dove60</styleUrl>
<Point>
<coordinates>-0.92747,52.79858000000001,0</coordinates>
</Point>
</Placemark>
<Placemark>
<name>Ab Kettleby (SatNav), Leics, 6, 9cwt, Wed</name>
<description><![CDATA[<b>County:</b> Leics<br/><b>Bells:</b> 6<br/><b>Tenor:</b> 8cwt - 2qr - 22lb<br/><b>Practice:</b> Wed<br/><b>Grid Ref:</b> SK724229<br/><a href="https://dove.cccbr.org.uk/detail.php?DoveID=AB KETTLEB">Dove Website</a><br/><a href="http://www.abkettlebybells.co.uk/">Tower Website</a>]]></description>
<styleUrl>#DovePKG0</styleUrl>
<Point>
<coordinates>-0.92635,52.79968,0</coordinates>
</Point>
</Placemark>
<Placemark>
<name>Abbess Roding, Essex, 3 U/R, 4cwt</name>
<description><![CDATA[<b>County:</b> Essex<br/><b>Bells:</b> 3 <span style="color:#CC3333;">U/R</span> <br/><b>Tenor:</b> 4cwt<br/><b>Grid Ref:</b> TL571114<br/><a href="https://dove.cccbr.org.uk/detail.php?DoveID=ABBESS ROD">Dove Website</a><br/>]]></description>
<styleUrl>#DoveUR0</styleUrl>
<Point>
<coordinates>0.2769,51.77958,0</coordinates>
</Point>
</Placemark>
I want to show the contents of name in a bubble beside each marker (without using an event: i.e. automatically).
At present I have the following code which shows the kml layer and allows an info bubble to be shown on an event click.
let reader = new H.data.kml.Reader('Dove.kml');
reader.parse();
kml = reader.getLayer();
map.addLayer(kml);
kml.getProvider().addEventListener('tap', function(ev) {
const info = ev.target.getData();
let content = '<b>' + info.name + '</b><br/>';
content += info.description;
let bubble = new H.ui.InfoBubble(ev.target.getGeometry(), {
content: content
});
ui.addBubble(bubble);
});
An example of the map can be seen at https://wcsb.nz/wellringers/Example/kmltest.php.
question from:
https://stackoverflow.com/questions/65912811/show-info-bubble-beside-markers-from-kml-file-in-here-maps 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…