Geographic Information Systems Asked on January 4, 2021
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=
?):
The underlying library, PROJ, has changed dramatically over the past few years, and this is a consequence. The time has come to stop using proj.4 strings. See also this blog post https://www.r-spatial.org/r/2020/03/17/wkt.html which announced upcoming changes to r-spatial.
Correct answer by Edzer Pebesma on January 4, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP