[R-sig-Geo] suppress projection string in rgdal "project"

Roger Bivand Roger.Bivand at nhh.no
Wed Mar 22 09:40:11 CET 2006


On Wed, 22 Mar 2006, Michael Sumner wrote:

> Hello, I was delighted to find that the PROJ.4 functionality comes 
> embedded right into the rgdal package on the Windows platform.
> 
> R 2.2.1, rgdal  0.4-3

Right, rgdal is definitely on vitamins, now including the old rgdal, 
spGDAL, spproj, and Rmap, and a regular Windows online install. The 
changes are noted on the Rgeo website, but I hadn't announced here yet to 
see if bugs emerged in my use in teaching. There are some rough edges, 
like the debugging code you found.

> 
> I'm using it to convert back and forth from lon/lat to projected 
> coordinates - basically I want to sample points from the projected 
> coordinate space, but I need to perform calculations using lon/lat - so 
> I can't save up the coordinates for one big conversion etc.
> 
> I'd like to suppress the printing of the PROJ.4 string when calling 
> project(), I guess it's due to this line in projectit.c
> 
> Rprintf("%s\n", pj_get_def(pj, 0));
> 
> My question is, what's the easiest way to suppress the printing of the 
> string in each call?  (Apart from editing and recompiling from source 
> myself, that is). 
> 
> Is this a simple and sensible feature request?
> 

Absolutely, the print out from C will be removed at the next release, but 
until then maybe capture.output() can help:

rubbish <- capture.output(res <- project(cbind(state.center$x, 
    state.center$y), "+proj=lcc +lat_1=48 +lat_2=33 +lon_0=-100"))

seems to suppress the message.

Other suggestions for changes needed for a next release are very welcome!

Roger

> Cheers, Mike.
> 
> _______________________________________________
> 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