Getting a line layer id by clicking on it

I want my users to be able to select/unselect streets by clicking on the map. A select draws the street path and an unselect hides the path. I have the path coordinates of the streets so what I basically need is to get a path line layer id when the user clicks on it. How can I do that ?
Thanks for your hekp,

For me it sounds like you can try with:

  • for each street that you have coordinates: create a polygon with opacity set to 0
  • once a user click on a street (invisible polygon) then opacity goes to 1

There is an example that could help: Map examples | Maps SDK Web JS v6 - Map layers / Styled road lines

Thank you. I have the street polygons too, so I will use them and do as you suggest.

Best regards,