Closed Ammar-K closed 5 years ago
If the leaflet is hosted on a local machine, you can use a fully defined local path.
Something like file:///full/path/to/file/here/plot.PNG
. If you open the image in the browser, you can copy the fully defined path from the location bar.
thank you @schloerke for your help i have tried the full path url='file:///C:/Users/Cloud/Documents/R/DOW_FEI/plot.PNG', but it didn't work, I have used forward slash since I'm on a windows machine.
I adjusted your code to use a local image file and it works on my machine 😕 .
Where are you doing this? (FF, IE11, RStudio?) (Mine was mac, chrome)
Assuming in a browser... Can you please right click and choose "inspect element". Once the debugger is open, can you refresh the page and report what errors are being displayed?
I'm wondering if it can't find the image, or if the file
protocol is not allowed.
@schloerke many thanks I'm using windows, chrome you are right i get this error when inspecting it in chrome "Not allowed to load local resource: file:///C:/Users/Cloud/Documents/R/DOW_FEI/plot.PNG" I think this error not related to leaflet anymore, but any help will be appreciated. cool pic by the way :)
Ok, I have tried saving it as an HTML and it worked. sorry for the troubles.
Thanks!
Just to be sure, your leaflet object is opening a local file, correct? What is the url for your leaflet image? A local file should be able to open a local file. (An http or https protocol will not be able to open a local file.)
Hi Ammar-K, could you clarify what you mean by "tried saving it as an HTML" ?? Are you referring to saving the shiny app as HTML or the image itself as HTML? I'm stuck with the same problem for a while now and would really appreciate some help. Thank you .
Hi @nonlinear1234 in my case I didn't use Shiny, it was a simple HTML widget (you can check the code in the first post), and yeah by saving to HTML I meant to export the output from the code to local html (by simply clicking export and select "Save as web page" in Rstudio)
Thank you for your response and clarification. I have been trying to quite unsuccessfully do the same in a reactive context on a leaflet - shiny application. I am able to display a single image but it doesn't work when Shiny has to select an image based on user input. Does the package enable that @schloerke ??
Thank you again @Ammar-K
@nonlinear1234 Can you open a new issue with a reprex? It will help me help you much faster.
@schloerke , I am unsure of whether it's a Leaflet issue, Shiny issue or that of leafpop/mapview. Would it be okay to open an issue under here? Thank you.
https://github.com/rstudio/leaflet/issues/new works great
Hi, thank you for the great package.
I was able to use ImageOverlay to show overlay image as a background. the only issue i have is that ImageOverlay show the image only if it's hosted online, i can't use a local image as the background
I'm using the following code for that
Created on 2019-06-05 by the reprex package (v0.3.0)
by simply changing the url to local file I'm getting a question mark in the background. like here
Created on 2019-06-05 by the reprex package (v0.3.0)
I want to use a local image instead of URL, please help. many thanks