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:
- I have problems to make a small reproducible example - the departement_boundaries from Zurich are open source, but its a huge string from dput.
- The docs
?sp::over
discuss the data.frame casesx = "SpatialPointsDataFrame", y = "SpatialPolygons"
andx = "SpatialPoints", y = "SpatialPolygonsDataFrame"
but this code ran with previous versions of sp and rgdal (see link above in this question) without errors or warnings.