Skip to content
Prev 77845 / 398502 Next

merge maps from shapefile to lattice

On Mon, 26 Sep 2005, Toni Vi??dez wrote:

            
In replies off-list, I've suggested that using base graphics is simpler 
because you can build things up bit by bit with add=TRUE. However, using 
the maptools and sp packages, you can look at the example in ?meuse.riv:

     spplot(meuse.grid, col.regions=bpy.colors(), main = "meuse.grid",
       sp.layout=list(
             list("sp.polygons", meuse.sr),
             list("sp.points", meuse, pch="+", col="black")
       )
     )

which plots a grid of data (your interpolations would need to be converted
to this format) over polygons but under points, where "meuse.sr"  is a
SpatialPolygons object. You would then do:

my_polys <- readShapePoly("my_polys.shp")
spplot(meuse.grid, sp.layout=list("sp.polygons", my_polys))

to get something similar. Note that the polygons seem to be plotted under 
the image in the example.