edzer / sp

Classes and methods for spatial data
http://edzer.github.io/sp/
127 stars 27 forks source link

warning by `CRS()` #102

Open edzer opened 3 years ago

edzer commented 3 years ago

I am trying to understand why

> crs = CRS(SRS_string = 'EPSG:28992')
Warning message:
In showSRID(SRS_string, format = "PROJ", multiline = "NO", prefer_proj = prefer_proj) :
  Discarded datum Amersfoort in Proj4 definition

still emits a warning. What should we do to get rid of this warning? I'm not trying to show the SRID by way of a PROJ4 string, right?

edzer commented 3 years ago

While at it, I'm also still struggling to understand this difference:

> pt = SpatialPoints(matrix(c(200000,500000),1), proj4string = CRS(SRS_string="EPSG:28992"))
Warning message:
In showSRID(SRS_string, format = "PROJ", multiline = "NO", prefer_proj = prefer_proj) :
  Discarded datum Amersfoort in Proj4 definition
> spTransform(pt, CRS("+proj=longlat"))
SpatialPoints:
     coords.x1 coords.x2
[1,]  6.049692  52.48586
Coordinate Reference System (CRS) arguments: +proj=longlat +datum=WGS84
+no_defs 
> spTransform(pt, CRS("+proj=longlat +ellps=WGS84"))
SpatialPoints:
     coords.x1 coords.x2
[1,]  6.050224  52.48689
Coordinate Reference System (CRS) arguments: +proj=longlat +ellps=WGS84
+no_defs 
Warning message:
In showSRID(uprojargs, format = "PROJ", multiline = "NO", prefer_proj = prefer_proj) :
  Discarded datum Unknown based on WGS84 ellipsoid in Proj4 definition
mercelsantos commented 3 years ago

Hey Edzer,

Have you ever find an explanation for that warning? I've got the same warning using CRS() function.