Skip to content
Prev 2964 / 29559 Next

delete region from shapefile / map only certain regions

On Sat, 5 Jan 2008, stefan lhachimi wrote:

            
If you use readShapePoly() in maptools, they will be read into a 
SpatialPolygonsDataFrame object. You subset it using "[" as other data 
frame objects - see the examples in ?readShapePoly, and more class 
documentation in the sp package. Create a logical vector to do the 
subsetting.
Either subset in the same way (counties in a land, for example), or use 
the xlim= and ylim= arguments to the plot() or spplot() methods for the 
class, depending on what you need. For plot(), you need to set the class 
intervals for colour filling yourself, for spplot() you can set up a 
legend and class intervals automatically.

Hope this helps,

Roger