[R-sig-Geo] starting with Rmap

Roger Bivand Roger.Bivand at nhh.no
Mon May 14 12:30:00 CEST 2007


On Mon, 14 May 2007, Laurence Amilhat wrote:

> Hello,
> 
> I am a beginner in R programming, so sorry for the low level of this post...

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

> 
> I would like to create a Europe map and plot some Informations on it, 
> using lat/long coordinates.
> I've seen the Rmap project, which seems to do what I want.
> The thing is that I can't get started.
> I download the packages: maps, mapdata, spmaps, shapefiles
> I have a text file for the europe continent downloaded from the World 
> data bank, but I don't know how to create a database that can be used by 
> Rmap.
> So I tried with shapefiles, I have a shapefile for Europe, as is it 
> noticed in the tutorial http://www.maths.lancs.ac.uk/Software/Rmap/
> i tried:
>  >europe <- shapefile("europe.shp")
> Erreur : impossible de trouver la fonction "shapefiles"
> = The function shapefile was not found.
> 
> Do someone have an idea on what I am doing wrong, or know a good 
> tutorial that can be helpfull for what I what to do.
> 
> Many thanks,
> 
> 
> Laurence Amihat
> 
> _______________________________________________
> 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