8

Context: I want to store the TIFF data to use it for running a linear regression model later on. Ultimate goal: Create a carbon map using field data as a basis.

Libraries:

library(sp)
library(raster)
library(tidyverse)
library(rgdal)

plotcoord <- SpatialPointsDataFrame(AGCplot[,3:4], AGCplot[,1:2],proj4string=CRS('+proj=longlat')) 
pspcoord<-spTransform(plotcoord, CRS('+proj=utm +zone=21')) #Omzetten naar UTM21N (= S1)
plot(pspcoord)

s1 <- stack('Some.tif')

colnamen = c("plotid","AGC","B2","B3","B4","B5","B6","B7","B8","B8A","B11","B12","NDVI","NDWI","MMRI","IRECI","MASI","VV","VH")

s1_e <- extract(s1,pspcoord,method='bilinear')

Upon extraction I get the following message:

Warning message:
In proj4string(x) : CRS object has comment, which is lost in output
4
  • Can you make this reproducible? We can't run this without your data or something similar, there's some odd triple-backticks in there, and you don't use half the packages you load with library. The more minimal code you can use to illustrate the problem, the more people will help.
    – Spacedman
    Commented Jun 11, 2020 at 18:39
  • 1
    rdocumentation.org/packages/sp/versions/1.4-2/topics/CRS-class I think gives some background
    – nmtoken
    Commented Jun 11, 2020 at 18:42
  • 1
    see also rgdal.r-forge.r-project.org/articles/PROJ6_GDAL3.html
    – nmtoken
    Commented Jun 11, 2020 at 18:42
  • 1
    Also show the versions of packages loaded, and any output that is printed. library(rgdal) will show the GDAL and PROJ version numbers.
    – Spacedman
    Commented Jun 11, 2020 at 18:46

1 Answer 1

11

This is not related to R 4.0.1 but to rgdal 1.5-8 and the migration to gdal 3 and proj 6. This is a very long and complex process that impact hundreds maybe thouthands of packages. All the packages are not yet up-to-date with what is coming.

You can have a look to ?rgdal::set_thin_PROJ6_warnings() to eliminate those warnings.

Edit after Roger's comment: See also

1
  • 5
    Please refer to r-spatial.org/r/2020/03/17/wkt.html and rgdal.r-forge.r-project.org/articles/… to understand that everybody needs to understand that proper representation of coordinate reference systems matters crucially for all spatial work, unless you will never need accuracy of greater than a degree. Relating one data source to another means that all should be registered correctly. The warnings are indicating that your work may be affected by the change introduced with PROJ 6 (and GDAL 3), adopted by R-spatial and rspatial. Commented Jul 14, 2020 at 12:30

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