edzer / sp

Classes and methods for spatial data

Home Page:http://edzer.github.io/sp/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug in identicalCRS()?

choisy opened this issue · comments

Let's consider the example below:

m <- matrix(c(0, 0, 1, 1), ncol = 2, dimnames = list(NULL, c("min", "max")))
crs1 <- CRS("+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0")
crs2 <- CRS("+init=epsg:4326 +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0")
S1 <- Spatial(bbox = m, proj4string = crs1)
S2 <- Spatial(bbox = m, proj4string = crs2)

Shouldn't the call identicalCRS(S1, S2) return TRUE instead of FALSE?
Thanks for help.

Yes, this can be considered a false negative. sf uses a different mechanism:

> st_crs("+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0") == st_crs("+init=epsg:4326 +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0")
[1] TRUE

If you need it, you may consider backporting that.

No, no worries, thanks!