我写了一个shinyApp,它做一些计算并根据结果创建一些地图。在我的 Rstudio 中,一切正常,没有任何错误。我尝试在 Digital Ocean 上部署该应用程序并且该应用程序正在运行,但是我没有显示地图,而是收到此错误:
Warning in CPL_transform(x, crs, aoi, pipeline, reverse, desired_accuracy, :
GDAL Error 1: No PROJ.4 translation for source SRS, coordinate transformation initialization has failed.
Warning: Error in CPL_transform: OGRCreateCoordinateTransformation() returned NULL: PROJ available?
地图的代码是下一个。我只需要澄清 ggplot 数据中的帽子“世界”是我在应用程序中读取的一个 .rds 对象,它代表我正在处理的区域。
ggplot(data = world) +
geom_tile(data = catch_week,mapping = aes(lon, lat, fill = pred_weight_t)) +
scale_fill_viridis_c(option = "B", direction = -1) +
geom_sf(fill= "black") +
ggspatial::annotation_scale(location = "br", width_hint = 0.5) +
ggspatial::annotation_north_arrow(location = "br", which_north = "true",
pad_x = unit(0.75, "in"), pad_y = unit(0.5, "in"),
style = north_arrow_fancy_orienteering) +
coord_sf(xlim = range(catch_week$lon), ylim = range(catch_week$lat), expand = FALSE) +
ggtitle(label = paste(paste(title_chunk ,my_i," -- ",week),
paste("CAPTURE TOTALE = ",tot_catch," (t)",sep = " "),sep = "\n"),
subtitle = "Espèce: Maquereau") +
xlab("Longitude") + ylab("Latitude") +
labs(fill = fill_chunk) +
theme(panel.grid.major = element_line(color = gray(.5), linetype = "dashed", size = 0.5),
panel.background = element_rect(fill = "aliceblue"))