Dear list,
I've used R for simple statistics in the past, but this is my first attempt at 
manipulating spatial data. The transition is frustrating and I'd appreciate any 
advice you can give me on the problem below. 
 
I'm creating interpolated surfaces of PCA loadings extracted from some 
precipitation data in Oregon/WA USA. I'm using the package fields. I can create 
the interpolated surface, but I need to use the data from the interpolated 
surface, either extracting values from the surface for specific x,y locations, 
or exporting the surface to an ascii grid file, or some format that I can 
either access via another R package (rgdal??) or ArcGIS, which I've used in the 
past. 
 
I'd be very grateful for suggestions and/or a snippet of example code telling 
me how to make the interpolated surface created below, into a spatial object 
that I can analyze further. 
 
Thanks in advance,
 
Zack
 
#######################################################
require(fields)
require(maptools)
require(sp)

data <- readShapePoints("C:/climate_data/pnw_data/climate_PNW_PCLOAD.shp",   # 
read in shapefile with X,Y and PC loadings for climate 
stationsproj4string=CRS(as.character(NA)), verbose=FALSE)
 data <- as.data.frame(data)   long <- x[,1] # longitude column lat <- x[,2]   
# latitude column minlat <- min(lat)  maxlat <- max(lat) minlong<- min(long) 
maxlong <- max(long)  grid.l<- list( X1= seq( minlong,maxlong,,100), 
X3=seq(minlat,maxlat,,100))  # create grid.list object using ranges of Long. 
and Lat.  make.surface.grid(grid.l)  y <- data$pc1                   # Princ. 
Comp. loading I want to interpolate LL <- cbind(long,lat)           # combine 
Lat and Long fit = Krig(LL,y, theta = 10)   # fit Princ. comp. 1 to Lat long.  
surface( fit, grid.list=grid.l)   # create interpolated surface based on Krig 
object
####################################################
        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to