[R-sig-Geo] spplot with two rasters

Roger Bivand Roger.Bivand at nhh.no
Thu Mar 13 21:39:36 CET 2008


On Thu, 13 Mar 2008, hadley wickham wrote:

>> > In the trellis panel functions, or in the direct plot/image/lines etc
>> > functions, you plot in data coordinates. The main thing that the plot
>> > and spplot methods in package sp control is the aspect ratio. How else
>> > do data coordinates differ from geographical coordinates when it comes
>> > to plotting?
>>
>>  Exactly. In fact I think that a grid panel might make it possible to
>>  insert an image backdrop behind spplot(), which was the original question
>>  from Dylan - it would make a nice student project in visualisation.
>>  Something like an sp.image() for sp.layout=, but using its own palette and
>>  being painted over by the "real" data.
>
> Another approach would be to develop a better interface between
> spatial data and ggplot2, which provides much better support for layer
> compositing (and in general for modifying a plot after you have
> created it).  There are some simple examples at
> http://had.co.nz/ggplot2/geom_polygon.html and
> http://had.co.nz/ggplot2/coord_map.html, but I don't know enough about
> the problems of spatial data to be able to do it all myself.

Maybe, but as Wilkinson says, his proposal is not a GIS either. I'm sorry 
nobody replied to your question earlier about using mapproj. Even the way 
Wilkinson addresses things isn't going to deliver unless the data and the 
graphics stay very close together.

This is the mapproj problem, the projected coordinates are an eclectic 
rendering, not something that can be used for anything else than display. 
Over thousands of km, the problems are not so clear, but over a couple of 
km they are showstoppers.

It looks as though Simon Urbanek has been trying to "do it his way" for 
iplots by publishing a limited interface to PROJ.4 on CRAN as a proj4 
package, presumably because there are real issues in providing proper 
support on OSX, and on Windows (I don't imagine that he didn't know that 
PROJ.4 is interfaced in rgdal, because I have asked for his help in 
finding a mechanism for producing rgdal binaries for OSX with minimal 
intervention). The Windows issues are fully addressed by rgdal (but not in 
proj4, there is no PROJ.4 share/), which he could have used, but chose not 
to. Perhaps I should ask again whether he could help automate the 
production of rgdal binaries for OSX?

Yes, you are right that this needs doing in concert between people who 
understand both sides, the graphics side, and crucially the spatial data 
side, because the layering fails unless the data are correctly aligned. 
This constrains the ways the data can be represented, and the S data model 
of a two-column matrix with NAs to separate geometric entities is simply 
not sufficiently robust.

Roger

>
> Hadley
>
>
>

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