[R-sig-Geo] Inverse Distance Weighting (IDW) with DEM

Helen Chen hc10024 at gmail.com
Sat Jul 11 20:54:27 CEST 2015


Hi,

I would like to perform the IDW method with DEM for my rainfall data. I got
the error message that my DEM data and rainfall stations are in different
coordinates system.

I have tried to transform the projection for my rainfall gauge

Here is my code:

library(sp)
library(maptools)
sites <- readShapePoints("test2")
proj4string(sites)=CRS("+init=EPSG:3498")
library(raster)
DEM=raster("all_ok_Projec.tif")
library(gstat)
grd.elv=idw(sites$S3~1,sites,DEM)

the error message is this:

Error in predict.gstat(g, newdata = newdata, block = block, nsim = nsim,  :
  var1 : data item in gstat object and newdata have different coordinate
reference systems

this link is my data: https://dl.dropboxusercontent.com/u/16666204/data.zip

Could anyone help me to figure out transform the DEM into the same
coordinates with points data?

I have tried to transform the points data to DEM coordinates,but it showed
the same results.

Many thanks in advance.

Best,

Helen

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list