I am not a GIS expert, and this change caused quite some errors in our analysis. So my question is, why this was changed: From rgdal 1.4.8 to 1.5.16, the +towgs84=0,0,0
disappeard in the output of sp::CRS
.
I hope for an answer, which is comprehensive to a non-GIS-expert.
Reproducible example if you have NO sp and NO rgdal package installed:
packageurl <- "http://cran.r-project.org/src/contrib/Archive/sp/sp_1.4-1.tar.gz"
install.packages(packageurl, repos=NULL, type="source")
packageurl <- "http://cran.r-project.org/src/contrib/Archive/rgdal/rgdal_1.4-8.tar.gz"
install.packages(packageurl, repos=NULL, type="source")
packageVersion("sp")
# [1] ‘1.4.1’
packageVersion("rgdal")
# [1] ‘1.4.8’
sp::CRS("+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs")
# CRS arguments:
# +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs +towgs84=0,0,0
So everything works, that is in our case
spdf <- sp::SpatialPointsDataFrame(
coords = mission_coords[, c(2,1)],
data = mission_coords,
proj4string = sp::CRS(
"+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs"))
df_in <- sp::over(spdf , departement_boundaries , fn = NULL)
are ok. (I have problem to make a small reproducible example - the departement_boundaries
from Zurich are open source, but its a huge string from dput.)
Now, update both packages
install.packages("rgdal")
# also installing the dependency ‘sp’
packageVersion("sp")
# [1] ‘1.4.2’
packageVersion("rgdal")
# [1] ‘1.5.16’
and in any case +towgs84=0,0,0 is missing now:
sp::CRS("+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs",
doCheckCRSArgs = TRUE)
# CRS arguments: +proj=longlat +datum=WGS84 +no_defs
sp::CRS("+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs",
doCheckCRSArgs = FALSE) # ... +ellps=WGS84 is added...(?)
# CRS arguments: +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs
Any ideas for an explanation to a GIS-newbie?
@EdzerPebesma’s answer helped me find R spatial follows GDAL and PROJ development to get information:
x <- sp::CRS("+init=epsg:4326")
cat(comment(x), "\n")
One comment from that site is really unclear to me (perhaps how this relates to +towgs84=
?):
- rgdal generates many warnings about discarded PROJ string keys,
-> See e.g. Warnung in showSRID(uprojargs, format = "PROJ", multiline = "NO") Discarded datum WGS_1984 in CRS definition, but +towgs84= values preserved from here? - intended to alert package maintainers and script authors to the need to review code.
-> To me it is not clear, what I have to do, see the link above. - It is particularly egregious to assign to the CRS object projargs slot directly,
and this is unfortunately seem in much code in packages.
-> Again, what should I do instead?