0

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 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.

1 Answer 1

2

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!)

2
  • BEFORE loading rgdal library is crucial ;-)
    – Christoph
    Commented Aug 23, 2020 at 15:26
  • Could you have a look here? There is a lot of useful information in the comments, but for me it is really unclear what this means, to somebody who is "just using" packages without deep knowledge of the GIS-foundations (yet). Thanks a lot!
    – Christoph
    Commented Sep 1, 2020 at 7:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.