I am new to using R and leaflet.I have created a map using tmap_leaflet. I am satisfied with the map but I think it will even better if I add a search box function to allow users to search their cities.
I have looked around seen people suggest leaflet-custom-searchbox and other plugin.
It seems like some are using html code and others. I am wondering if it is possible to add a search bar to my map using R.
I would like to export html file from R and eventually embed the map on a website. My hope is that when people use the search bar that is on the map (on the website), they will be able to get the same results you get on google maps.
This is the code for my map
OCmap <- tm_shape(map)+ tm_fill( alpha = 0.4 )+ tm_shape(districtsg)+ tm_borders(col = "white") # Map 1 OCmap %>% tmap_leaflet() %>% setView(lng = -1.0232,lat=7.9465,zoom = 6) %>% #lat and long of my district addProviderTiles('Esri.WorldGrayCanvas', group='Grayscale Map') %>% addProviderTiles('OpenStreetMap', group='Street Map')
I'd appreciate input on how to achieve the result I want.Thanks in advance.