[R] merge maps from shapefile to lattice

Roger Bivand Roger.Bivand at nhh.no
Mon Sep 26 15:06:44 CEST 2005


On Mon, 26 Sep 2005, Toni Viúdez wrote:

> Hi everybody:
> Could anybody help how I solve the next problem?.
> I'm doing interpolation maps of tropospheric ozone of my region, and after 
> create it using IDW, and kriging methods, I want from shapefiles (*.shx, 
> *.shp, *.dbf, *.sbx & *.sbn ) create contour over the interpolation maps.
> Could anybody tell me how do it?.

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.


> Thanks in advance.
> 
> ######################################
> Antonio Viudez Mora
> Departamento de Dinámica
>  de Contaminantes
> Fundación CEAM
> Paterna (Valencia)
> tel: 961318190. ext: 216
> e-mail:toni at ceam.es
> ######################################
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> 

-- 
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-help mailing list