2

I wanted to know if there is any way to set an HTML ID for an icon in OpenLayers. For example, If I set an icon with HTML ID "icon1", I want to be able to access it using document.getElementById("icon1");

2
  • What do you mean by "icon"? There is no such displayable element in OpenLayers, just icon style for vector features. If you create your icon through overlay, then it's possible. It would help if you describe what you want to do, not how you decided to do it.
    – TomazicM
    Feb 9, 2020 at 9:42
  • The Graphics Canvas element documentation says: The <canvas> element on its own is just a bitmap and does not provide information about any drawn objects. Canvas content is not exposed to accessibility tools as semantic HTML is. Therefore, if you mean a marker rendered to canvas, you cannot set HTML id for that icon (marker). Feb 9, 2020 at 17:26

0

Browse other questions tagged or ask your own question.