Rshiny应用程序中的openmap发生jcall和tryJava错误

时间:2019-06-26 09:53:57

标签: java r shiny openstreetmap rjava

我正在尝试将一部分openstreetmap显示为R Shiny应用程序中的输出。

我已经安装了OpenStreetMap,rgdal,rJava和所有需要的软件包。 该代码已经可以在静态表单上运行(它可以在如下所示的简单R代码上运行)

library(OpenStreetMap)
library(rgdal)
library(OSMscale)
latlon <- 40
map <- openmap(c(latlon-0.005,latlon-0.005),c(latlon+0.005,latlon+0.005),type='osm')
plot(map)

将所有组件放到R Shiny架构上时都会出现问题。

那是我的简单应用文件

library(OpenStreetMap)
library(rgdal)
library(OSMscale)
library(shiny)

ui <- fluidPage(

   sidebarLayout(
      sidebarPanel(
         sliderInput("latlon",
                     "latlon value:",
                     min = 1,
                     max = 50,
                     value = 30)
      ),

      mainPanel(
         plotOutput("mapPlot")
      )
   )
)

server <- function(input, output) {

   output$mapPlot <- renderPlot({
     map <- openmap(c(input$latlon - 0.005,input$latlon - 0.005 ),c(input$latlon + 0.005,input$latlon+0.005),type='osm')
     plot(map)
   })
}

# Run the application 
shinyApp(ui = ui, server = server)

那是我收到的错误消息

  RcallMethod: cannot determine object class
Error in .jfindClass(as.character(class)) : 
  Java Exception <no description because toString() failed>.jfindClass(as.character(class))new("jobjRef", jobj = <pointer: 0x1f032700>, jclass = "java/lang/Throwable")
Warning: Error in .tryJava: Java classes could not be loaded. Most likely because Java is not set up with your R installation.
Here are some trouble shooting tips:

1. Install Java (for mac consider installing java 1.6 from https://support.apple.com/kb/DL1572?locale=en_US )
2. Run 
    R CMD javareconf
in the terminal. If you are using Mac OS X >= 10.7 you may want to try
    R CMD javareconf JAVA_CPPFLAGS=-I/System/Library/Frameworks/JavaVM.framework/Headers
instead.

  170: stop
  169: .tryJava
  168: openmap
  167: renderPlot [*/TEST/app.R#26]
  165: func
  125: drawPlot
  111: <reactive:plotObj>
   95: drawReactive
   82: origRenderFunc
   81: output$mapPlot
    1: runApp

0 个答案:

没有答案