Error trying to publish leaflet app

126 views
Skip to first unread message

John Goldin

unread,
Jun 22, 2016, 8:12:30 PM6/22/16
to Shiny - Web Framework for R
I have a an app that displays a Leaflet map. On my local machine it works perfectly. When I try to publish it to my shinyapps.io server it publishes successfully. But in the browser it does not display the map and shows the following error in red:

path[1]="/Library/Frameworks/R.framework/Versions/3.3/Resources/library/leaflet/htmlwidgets/lib/leaflet-providers": No such file or directory

The error message actually appears in red in my browser (and not in any field that I set up). I upgraded R to 3.3, upgraded RStudio, and reinstalled packages (including leaflet). But I still get this error.

 I took the basic Leaflet example and I can run and publish that  on shinyapps.io with no problem..

The provider code that does the map tiles in Leaflet is:
      addProviderTiles("Thunderforest.Landscape", group = "Topographical") %>%
      addProviderTiles("OpenStreetMap.Mapnik", group = "Road map") %>%
      addProviderTiles("Esri.WorldImagery", group = "Satellite")


I sent through and changed all cases of addProviderTiles  so that they match the Leaflet example:
      addProviderTiles("Stamen.TonerLite",
                       options = providerTileOptions(noWrap = TRUE))

I've stripped lots out of my processing. I basically add one GPS trace to the map:
   m <-  addPolylines(m, data=track, group='Hiking routes', color = color)

When I run the published app in the browser I get the same error shown above.

I create the maps in a separate R script and then save the map object. In the server app, I load in the saved object.

It all works fine when I run the app on my local machine. It's only when I run the published app on shinyapps.io that I have the error message.

This project was modelled on a blog post and earlier I did a version of these maps that I posted at http://rpubs.com/JohnGoldin/149745 (don't mind the broken camera icons). I thought Shiny was a better way to display the various trips so I converted it to Shiny. The results looks great on my local screen so I hope I can figure out how to publish it.

I have been trying to isolate the problem by throwing things overboard from my existing app. Next I'll start with the Leaflet example app (which I can publish without problem) and start adding things until it breaks.

Any suggestions?

Joe Cheng

unread,
Jun 22, 2016, 8:16:03 PM6/22/16
to John Goldin, Shiny - Web Framework for R
Sorry but the leaflet objects can't be persisted and used elsewhere, as they contain paths that are specific to your machine. Create the leaflet objects in the Shiny app. You can persist the underlying spatial data or data frame, though.

--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/shiny-discuss/5a7bbe5b-735e-4819-9e67-6e54e6b40811%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

John Goldin

unread,
Jun 22, 2016, 8:22:17 PM6/22/16
to Shiny - Web Framework for R, johnr...@gmail.com
Wow, what a fast response. This is very helpful. I can figure out how to rearrange things to make this work. I just have to accumulate all the GPS data separately before loading it into a leaflet map.

John Goldin

unread,
Jun 29, 2016, 9:46:42 PM6/29/16
to Shiny - Web Framework for R, johnr...@gmail.com
After rearranging the geo data and the leaflet map, I am able to publish my site:  https://goldin.shinyapps.io/Walks/

Now I see a new minor problem: I have two selectInput menus. One on the right is right above the legend on the Leaflet map. When the menu drops down, it appears behind the Leaflet legend rather than in front.

Plus I may need to do some searching on how to make my Leaflet map faster (and I already have some tips). But all in all I'm making progress.
Reply all
Reply to author
Forward
0 new messages