[R-sig-Geo] Map projectin for Europe...

Roger Bivand Roger.Bivand at nhh.no
Sat Apr 21 02:26:11 CEST 2007


On Fri, 20 Apr 2007, Takatsugu Kobayashi wrote:

> Dr. Bivand:
> 
> For clipping the countries I need for my project, I am not very familiar 
> with class/object structure in R... So I borrowed "S programming" from 
> the school library and started to read it to know more about it.
> 
> Eventually I would like to export the resulting European map into .shp. 
> To do that,
> 
> # import world map into R
> wmap<-load("world_countries_24.rda")

load("world_countries_24.rda")

loads the object world_countries, your wmap just contains its name as a 
text string.

> 
> # clip the European countries I need one by one
> spain<-wmap[[64]]

library(rgdal)
names(world_countries)
world_countries$names
spain <- world_countries[world_countries$names == "SPAIN", ]
plot(spain)
writeOGR(spain, dsn=".", layer="spain", driver="ESRI Shapefile")

should get you there - since the "[[" operator has a slightly different 
meaning. The spatial objects were described in a note written with Edzer 
Pebesma in R News in 2005, so now a little dated. Getting just mainland 
Spain is also possible.

Roger

> ....
> ....
> 
> Then, as I mentioned previously, I am at a loss at this moment for not knowing how to clip countries under class/object structure...
> 
> Sorry for this R-geo newbie question....
> 
> Thank you very much while you must be busy at AAG.
> 
> Best regards,
> 
> Taka
> 
> Roger Bivand wrote:
> > On Fri, 20 Apr 2007, Takatsugu Kobayashi wrote:
> >
> >   
> >> Hi,
> >>
> >> I has a meteorology project in which I have to map average wind speeds 
> >> over EU, as well as European countries' boundary. I have been looking 
> >> online for free European maps like the one I can find on US Census for 
> >> N. America. But it seems like google doesn't hit anything useful. I 
> >> wonder if some Rusers from Europe might know where I could find free EU 
> >> map with each country's boundary.
> >>
> >>     
> >
> > Here is a link to the world map with country boundaries which was 
> > discussed on the list in September last year, updated for R >= 2.4.
> >
> > http://spatial.nhh.no/R/etc/world_countries_24.rda
> >
> > load("world_countries_24.rda")
> >
> > You'll need to subset the object to choose the countries of Europe that 
> > you require, then use the spTransform() method in rgdal to go to the 
> > standard EU Lambert AEA:
> >
> > CRS("+init=epsg:3035")
> >
> > Hope this helps,
> >
> > Roger
> >
> >
> >   
> >> Just a few quick questions:
> >>
> >> About the best or appropriate projection for Europe, I am thinking to 
> >> use lambert conformal conic or lambert azimuthal equal area. Are these 
> >> good for Europe? My colleague uses the latter lambert for N. America 
> >> mapping.
> >>
> >> About plotting a map boundary, if I do not rely on mapproj and shapefile 
> >> library, simply using plot() or xyplot() gave me a disatrerous map, 
> >> where points are not sequentially connected at all.. I believe I would 
> >> have to add some kinds of flags to the boundary dataset.
> >>
> >> Could anyone kindly give me advice on these problems although I have 
> >> never changed map projections in R, but I will look into mapproj library 
> >> as a start?
> >>
> >> Thanks in advance.
> >>
> >> taka
> >>
> >> _______________________________________________
> >> 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