Skip to content
Prev 2063 / 29559 Next

starting with Rmap

On Mon, 14 May 2007, Laurence Amilhat wrote:

            
That's OK, everyone begins sometime ...

Perhaps you would find the information in the CRAN "Spatial" Task View 
useful.

To read and plot a shapefile, I think that you may find the examples in 
the help page of readShapePoly() in the maptools package helpful. This 
package depends on the sp package, which provides classes for spatial 
data. In your case:

list.files(pattern="shp$")
# will tell you if your shapefile is in the working directory
getinfo.shape("europe.shp")
# will tell you what kind of shapefile it is
europe <- readShapePoly("europe.shp", proj4string=CRS("+proj=longlat"))
# will read it
plot(europe)
# will plot it

Some of the work in the original Rmap package is now in the rgdal package, 
so that if you need to project the data, you can go on to that package 
later.

To plot information, simply overplot the outline map with you choice of 
base graphics functions.

Roger