Hi everyone, I am new to doing this kind of thing in R, but I have been trying to perform co-kriging for a set of datapoints in relation to climate from the worldclim project based on a previous example I found using the meuse shp.
This is my code, and at the end of it, you can see the error I get: identicalCRS(x, y) is not TRUE after using the over() command. I would appreciate if anybody could help me out this this. Best Ángel #Let's first create a prediction grid for the interpolation, starting from the shape file setwd(“*") data<-read.table(“/*",header=T) coordinates(data)=~long+lat proj4string(data)=CRS("+proj=longlat +ellps=WGS84 +datum=WGS84") border0<-readOGR("country.shp","country") border <- spTransform(border0, CRS("+proj=longlat +ellps=WGS84 +datum=WGS84")) proj4string(border)=CRS("+proj=longlat +ellps=WGS84 +datum=WGS84") bio <- getData("worldclim", var="bio", res=10) # this will download global data on minimum temperature at 10 min resolution # can also get other climatic data, elevation, administrative boundaries, etc bio1 <- raster(“*/wc10/bio1.bil") # Tmin for January fromDisk(bio1) # values are stored on disk instead of memory! (useful for bio1 <-bio1/10 # Worldclim temperature data come in decimal degrees bio1 proj4string(bio1)=CRS("+proj=longlat +ellps=WGS84 +datum=WGS84") data <- spTransform(data, CRS("+proj=longlat +ellps=GRS80")) border <- spTransform(border, CRS("+proj=longlat +ellps=GRS80")) vals <-border@bbox deltaLong <- as.integer((vals[1,2] - vals[1,1]) + 1.5) deltaLat <- as.integer((vals[2,2] - vals[2,1]) + 1.5) gridRes <-20 #change this value to change the grid size (in metres) gridSizeX <- deltaLong / gridRes gridSizeY <- deltaLat / gridRes grd <- GridTopology(vals[,1],c(gridRes,gridRes),c(gridSizeX,gridSizeY)) pts <- SpatialPoints(coordinates(grd)) pts1 <- SpatialPointsDataFrame(as.data.frame(pts), data=as.data.frame(rep(1,nrow(as.data.frame(pts))))) Over=over(pts1,border) pts$border=Over espinete<-na.exclude(as.data.frame(pts1)) coordinates(nona)=~x+y gridded(espinete) <- TRUE proj4string(espinete)=CRS("+proj=longlat +ellps=GRS80") writeAsciiGrid(nona,"prediction_grid.asc") When I run the Over=over(pts1,border) command, I get this error: Error: identicalCRS(x, y) is not TRUE _______________________________________________ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo