[R-sig-Geo] reading shapefiles in geoR

Roger Bivand Roger.Bivand at nhh.no
Tue Feb 13 09:03:55 CET 2007


On Mon, 12 Feb 2007, Igor Viveiros wrote:

> Dear all,
> 
> I need some help. I have some data from brazilian cities and I want to do a
> spacial interpolation for these cities using models implement by geoR.
> I have shapefiles for these locations but I can't use then to construct the
> polygons for cities borders and for the counties.
> Could you help me?

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

> 
> Thanks,
> Igor.
> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no




More information about the R-sig-Geo mailing list