Integrating iNaturalist in R+Shiny project

Hi folks,

I’m currently working on a Shiny project where one of the main functionalities is displaying the occurrences in a given location informed by the users. It works well when I put this directly in the fluidPage but doesn’t show the occurrences when reacted.

Using CRTL+SHIFT+J on the browser it seems that the problem is the asynchronicity but I have no idea what exactly it means and how to handle that. It says:“Failed to execute ‘write’ on ‘Document’: It isn’t possible to write into a document from an asynchronously-loaded external script unless it is explicitly opened.”

output example

Error message example

I have made the same question on Stackoverflow with a minimum reproducible example:
https://stackoverflow.com/questions/73080794/integrating-inaturalist-to-rshiny

Thanks in advance for any suggestions,
Cheers

why use R+Shiny? if you’re trying to get stuff into a web browser, isn’t it simpler just to do a simple web page? it looks like you just need 2 iframes and an embedded video, plus maybe an input box for a place.

As I understand it, the iNat widget script will not work when you load it asynchronously because the script contains document.write(). With this generic description of the issue, you should be able to find more information on stack overflow. Seconding pisum, the R+Shiny approach seems a rather long way 'round?

Hi @woodillj and @pisum thanks for your comments. Actually, this request is a piece of a more complex app I’m building. The idea is that ones can select a protected area in Brazil by a point-click map and check a couple of statics about the evolution of anthropogenic impact on it. Plus, I’m wanting to provide a widget of the iNaturalist records on each selected protected area.

You can check a Beta version of the project at https://ecosantos.shinyapps.io/Footprint/. iNat’s widgets will be placed in the bottom right corner. Just below are the statics about the protected areas. So, this is the reason for the Shiny app and I’m not sure if I can just leave widgets out of rendering but thank you very much for your suggestions. I’ll definitely check the document.write() function.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.