[R-sig-Geo] image in a projected map

Roger Bivand Roger.Bivand at nhh.no
Mon Nov 7 18:45:16 CET 2005


On Mon, 7 Nov 2005, José Agustín García García wrote:

> Hi all, I am working on some climate data and I 
> need to make some projected maps of the results 
> of climate models. These results are given in a 
> gridded format (lon,lat, z).  I have no problem 
> at making contourlines using the package sp and 
> spproj, but my problem arise when I am going to 
> do an image plot of the data, because the grid is 
> regular in lat-long coordinates but not in the 
> projected map.  Also, I have problems trying to 
> label meridians and parallels.  Any help is 
> wellcome.

This will depend on your number of grid cells. If the number isn't large, 
say a couple of thousand, then look at:

?as.SpatialPolygons.GridTopology

in sp, which makes the regular grid cells into polygons, which can then be 
projected, and plotted with border="transparent". If there are many cells, 
this will be very time-consuming. The projection only needs doing once, 
but you need to check that the data are being plugged into the correct 
rows to the data frame. The alternative is to export the longlat grid, for 
example as an Arc ASCII grid, add a *.prj file, and use gdalwarp to warp 
to a projected regular grid, but I guess your prefered representation is 
to show the original grid cells projected, not new projected cells.

> 
> Sorry for my english

No problem, thinking through how to do this is not easy anyway.

Roger

> 
> Agustin
> 

-- 
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