Skip to content

st_as_sf faithfully uses "+proj=longlat +ellps=WGS84" instead of conversion to "+proj=longlat +datum=WGS84" #363

Closed
@charliejhadley

Description

Currently I use geosphere to sample great circles as I can't figure out how to do it with sf directly, which looks as follows:

library("geosphere")
library("sf")
library("leaflet")
sp_thing <- gcIntermediate(
  p1 = c(13.96013, 50.97178),
  p2 = c(-74.00594, 40.71278),
  n = 50,
  addStartEnd = TRUE,
  sp = TRUE
)
sf_thing <- st_as_sf(sp_thing)
leaflet() %>%
  addPolylines(data = sf_thing)
## Warning message:
## sf layer has inconsistent datum (+proj=longlat +ellps=WGS84 +no_defs).
## Need '+proj=longlat +datum=WGS84' 

Should st_as_sf faithfully take

sp_thing@proj4string
## CRS arguments: +proj=longlat +ellps=WGS84 

Or should it be clever and coerce it to "+proj=longlat +datum=WGS84" silently?

Please note - I recognise this is a little bit of a Rube Goldberg machine and that this issue might be closed as such, if so thanks for reading anyhow

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions