matildabrown/rWCVP

Persistent warnings in `generate_checklist`

Closed this issue · 2 comments

This chunk in checklist.Rmd throws the following warning messages:

Warning messages:
1: In st_is_longlat(x) :
  bounding box has potentially an invalid value range for longlat data
2: In st_point_on_surface.sfc(sf::st_zm(x)) :
  st_point_on_surface may not give correct results for longitude/latitude data

As shown below, I've tried suppressing them at all levels and in multiple ways. It's definitely this section - I reran with options(warn=2) and it threw an error at these lines.
I could suppressWarnings at the render call, but would rather not if possible.

{r warning=FALSE, fig.asp=0.4822878, results="hide", message=FALSE}
shp <- rWCVPdata::wgsprd3
shp$fillcol <- as.numeric(shp$LEVEL3_COD %in% input.area)+1
if(identical(input.area,"global")) shp$fillcol <- 2

suppressMessages({
suppressWarnings({
  ggplot2::ggplot(shp) +
  ggplot2::geom_sf(fill=c("gray80","#ad2b00")[shp$fillcol], col="gray80")+
  ggplot2::stat_sf_coordinates(col=c("gray80","#ad2b00")[shp$fillcol])+
  ggplot2::theme_void()+
  ggplot2::coord_sf(expand=FALSE)
  })
})

Possibly solved by: 3fd0501
Needs testing.

Not the most elegant solution but it works - closing issue for now.