Geographic Information Systems Asked on February 20, 2021
Take the latest versions as described here:
install.packages("rgdal")
# also installing the dependency ‘sp’
packageVersion("sp")
# [1] ‘1.4.2’
packageVersion("rgdal")
# [1] ‘1.5.16’
In this case, the over
function returns many warnings which we don’t understand:
# Warnung in showSRID(uprojargs, format = "PROJ", multiline = "NO")
# Discarded datum WGS_1984 in CRS definition,
# but +towgs84= values preserved
Details:
class(spdf)
# [1] "SpatialPointsDataFrame"
# attr(,"package")
# [1] "sp"
class(departement_boundaries)
# [1] "SpatialPolygonsDataFrame"
# attr(,"package")
# [1] "sp"
raster::crs(spdf)
# CRS arguments:
# +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs +towgs84=0,0,0
raster::crs(departement_boundaries)
# CRS arguments:
# +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs +towgs84=0,0,0
So everything seems ok to me, but:
df_in <- sp::over(spdf , departement_boundaries , fn = NULL)
# Warnung in showSRID(uprojargs, format = "PROJ", multiline = "NO")
# Discarded datum WGS_1984 in CRS definition,
# but +towgs84= values preserved
# Warnung in showSRID(uprojargs, format = "PROJ", multiline = "NO")
# Discarded datum WGS_1984 in CRS definition,
# but +towgs84= values preserved
# Warnung in showSRID(uprojargs, format = "PROJ", multiline = "NO")
# Discarded datum WGS_1984 in CRS definition,
# but +towgs84= values preserved
# Warnung in showSRID(uprojargs, format = "PROJ", multiline = "NO")
# Discarded datum WGS_1984 in CRS definition,
# but +towgs84= values preserved
Comments:
?sp::over
discuss the data.frame cases x = "SpatialPointsDataFrame", y = "SpatialPolygons"
and x = "SpatialPoints", y = "SpatialPolygonsDataFrame"
but this code ran with previous versions of sp and rgdal (see link above in this question) without errors or warnings.You don't get errors, you get warnings. When you load rgdal
, it prints a message
To mute warnings of possible GDAL/OSR exportToProj4() degradation,
use options("rgdal_show_exportToProj4_warnings"="none") before loading rgdal.
when you want to get rid of the warnings, follow that advice, and try setting
options("rgdal_show_exportToProj4_warnings"="none")
(in absence of a reproducible example this is a guess, really - let me know if it worked!)
Correct answer by Edzer Pebesma on February 20, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP