Closed JacHansel closed 7 years ago
Did you try addOSMSearch()
?
Thanks for your quick reply.
I just tried it, do I have to install something for it? And can it be used in R?
You don't have to install anything besides leaflet.extras package. What happens when you call addOSMSearch()
.
I get the following error message: could not find function "addOSMSearch"
Sorry the function name is addSearchOSM
If you've not already installed leaflet.extras and loaded it, do the following.
devtools::install_github('rstudio/leaflet')
devtools::install_github('bhaskarvk/leaflet.extras')
library(leaflet.extras)
Thanks, it is working now and this is exactly what I was looking for! Is there any documentation available for this function?
https://bhaskarvk.github.io/leaflet.extras/search.html. TBH there is not much to document about this function. It doesn't take any arguments or anything.
All leaflet.extras functions are properly documented and you can access the help using R's ?
operator. e.g. ?addSearchOSM
.
For online ref. see https://bhaskarvk.github.io/leaflet.extras/reference.html
Thank you so much for all your help!
When using the function locally, it is working fine, but when I deploy my app (I am using Shiny), the function is not working anymore. Do you have any idea what the reason for this could be?
To shinyapps.io ? or any other shiny server ? I'll try to replicate it on my side, but any error or warning messages you can provide will be helpful.
Yes, I want to deploy the app to shinyapps.io. Sorry for being imprecise.
I use the following code, which is working fine when I run it locally:
output$map <- renderLeaflet({
leaflet() %>%
addSearchOSM(options = searchOSMOptions(zoom=15, position = 'topleft')) %>%
addTiles()
})
However, when I deploy it to shinyapps.io, the addSearchOSM()-function is not working anymore (see https://streetnaturescore.shinyapps.io/shiny_app/). I don't get any warning or error message. The search box still shows up in the app, but when you type in an address, it seems like it is not searching.
ok cool I will debug it at my end.
I fixed the issue please retest.
Hi,
Would just like to report the reverse. When attempting to use the search function on a locally saved map, the search box still shows up in the app, but when you type in an address, it seems like it is not searching.
However, when i use the old url: "url = 'http://nominatim.openstreetmap.org/search?format=json&q={s}'", the function works when saved locally.
Hope this helps. Great work on the extra functions. They are very helpful!
Yes we have that issue with the OSM tiles added via addTiles()
too. Nothing much we can do about it but properly document it, I guess. Thanks for reporting, I will add that to the help text.
Hi,
I would like to do geocoding using Leaflet-search in R (something like this: http://labs.easyblog.it/maps/leaflet-search/examples/nominatim.html).
However, I couldn't find anything like this in the R-examples (only in JS).
Could you help me with this issue?
Thanks!