Skip to content
Prev 1742 / 29559 Next

reading shapefiles in geoR

On Mon, 12 Feb 2007, Igor Viveiros wrote:

            
I think that you would like to use the border= argument to mask the 
interpolations. The examples in the package do not include the use of 
SpatialPolygons objects as borders, but this is permitted in the code. 
Using either readShapePoly() in the maptools package or readOGR() in the 
rgdal package, you can get to a SpatialPolygons object from a shapefile:

SPobj <- as(readShapePoly(<myfile>), "SpatialPolygons")

but passing the input SpatialPolygonsDataFrame object should also be OK, 
the attribute data will be ignored. To give more advice, more details of 
what you are trying to do will be needed. Since this code is fairly new, 
documenting your experience will be useful for others - having access to 
example data sets including the point observations (possibly a shapefile), 
the prediction mask polygon(s) as a shapefile, and the prediction grid 
parameters.

Roger