0

I have plotted some marker point according to my dataset[lang, lat,asset_id]. The objective is to, when clicking on the marker points, input$layput_marker_click should return the corresponding asset_id from the data set. But the problem is when plotted, the marker points are too close to each other that I am not able to separate them for click even after reaching the highest zoom level.

So, is there any way to click on the closely located object precisely and get the corresponding value?

Dark Star
  • 43
  • 9
  • Can you provide a simple reproductible example showing your current problem? it would be easier to solve the problem. For now i can only tell that markerCluster() seems to be the solution, however it only works with addMarkers() and not addCirclesMarkers(), you should start with that – Oscar Jnn Jan 27 '20 at 10:30
  • Yes, I used the cluster option and the result is horrible. If I use the cluster option then I could able to separate the marker point for the click but when I click ton he first item the return is ok but when I click another item then the error in the red (shown in the second picture) is coming. Another thing is that If I use cluster then the input$marker_click is not returning the exact value (lat, long) of the corresponding marker point. – Dark Star Jan 28 '20 at 10:52

1 Answers1

1

try this link Multiple markers on same coordinate, looks like you might want to incorporate the jitter() function on your points

Daniel_j_iii
  • 3,041
  • 2
  • 11
  • 27
  • Thanks for your answer Daniel. Do you have much more clear example with jitter(). Not clear how coordinates(Data) <- ~ lon + lat and proj4string(Data) <- "+init=epsg:4326" is working here.I have to separate the overlapped marker points well enough so that my input$layer_marker_click can distinguish the points. – Dark Star Jan 27 '20 at 14:11
  • no, I do not know enough about your code without a reprex. Looks like you might be using ggmap? have you looked into the clusteroption of leaflet? – Daniel_j_iii Jan 28 '20 at 01:36
  • Yes, I used the clusteroption and the result is horrible. If I use the clusteroption then I could able to separate the marker point for the click but when I click ton he first item the return is ok but when I click another item then the error in the red (shown in second picture) is coming. Another thing is that If I use cluster then the input$marker_click is not return the exact value (lat,long) of the corresponding marker point. – Dark Star Jan 28 '20 at 07:45
  • 1
    Finally, I solved the issue with another technique. I used slider input on the map panel which can remove the overlapped marker points and alow me to select the marker points of my interest. In this way I can able to click on the exact marker point. – Dark Star Jan 28 '20 at 14:16
  • 1
    That's great, I was hoping by talking with you about your problem it would help you think the problem through! One tip I read about shiny sliders is that they are good, but also you may want to have it be a drop down menu, for easier user interaction. But I am glad you got this figured out – Daniel_j_iii Jan 28 '20 at 14:24