Hello everyone:

I'm sure that this is a goofy question but here goes:

I am analyzing some spatio-temporal data on cities in Texas (over time).

I want to have a spatial grid for krigeST.  However, I want my grid to be in the shape of Texas.  Here is what I have done:


> tmp <- map("state","Texas",fill=TRUE,plot=FALSE)
> texas.boundary <- map2SpatialPolygons(tmp, IDs=tmp$names, proj4string=CRS("+proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0"))
> plot(texas.boundary)
> str(texas.boundary)
Formal class 'SpatialPolygons' [package "sp"] with 4 slots
  ..@ polygons   :List of 1
  .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
  .. .. .. ..@ Polygons :List of 1
  .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
  .. .. .. .. .. .. ..@ labpt  : num [1:2] -99.4 31.5
  .. .. .. .. .. .. ..@ area   : num 64.9
  .. .. .. .. .. .. ..@ hole   : logi FALSE
  .. .. .. .. .. .. ..@ ringDir: int 1
  .. .. .. .. .. .. ..@ coords : num [1:1088, 1:2] -94.5 -94.5 -94.5 -94.5 -94.5 ...
  .. .. .. ..@ plotOrder: int 1
  .. .. .. ..@ labpt    : num [1:2] -99.4 31.5
  .. .. .. ..@ ID       : chr "texas"
  .. .. .. ..@ area     : num 64.9
  ..@ plotOrder  : int 1
  ..@ bbox       : num [1:2, 1:2] -106.7 25.9 -93.5 36.5
  .. ..- attr(*, "dimnames")=List of 2
  .. .. ..$ : chr [1:2] "x" "y"
  .. .. ..$ : chr [1:2] "min" "max"
  ..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slots
  .. .. ..@ projargs: chr " +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0"
> texas1.boundary <- spTransform(texas.boundary,CRS("+proj=aea +lat_1=27.5 +lat_2=35 +lat_0=18 +lon_0=-100 +x_0=1500000 +y_0=6000000 +ellps=GRS80 +datum=NAD83 +units=m +no_defs")
+ )
> plot(texas1.boundary)
> grd <- SpatialPixels(SpatialPoints(makegrid(texas1.boundary,n=300)),
+ proj4string=proj4string(texas1.boundary))
> plot(grd)

I have tried all kinds of things with "crop" and "overlay", but to no avail.

Any suggestions would be much appreciated.

Sincerely,
Erin


	[[alternative HTML version deleted]]

