[Rspatial-devel] proj4string<-

Edzer Pebesma edzer.pebesma at uni-muenster.de
Tue Mar 27 15:21:39 CEST 2012



On 03/27/2012 02:41 PM, Roger Bivand wrote:
> On Tue, 27 Mar 2012, Edzer Pebesma wrote:
> 
>> I discovered today than a student assumed that in the following sequence:
>>
>> xx = readOGR('whatever shapefile')
>> proj4string(xx) = "new proj4 string"
>>
>> would project to the new projection. The logic is that of
>>
>> coordinates(meuse) = c("x", "y")
>>
>> It doesn't, but also doesn't say it doesn't.
>>
>> https://stat.ethz.ch/pipermail/r-sig-geo/2012-March/014666.html
>>
>> is another case of the same assumption.
>>
>> I suggest to modify proj4string<- such that when it is called with a
>> CRS, and the object already has a (non-NA) CRS, a message is printed
>> that sais sth like:
>>
>> "A new CRS was assigned to an object with an existing CRS, without
>> reprojecting. For reprojection, use function spTransform in package
>> rgdal".
> 
> Yes, that would make sense, but should it be a warning, or a message
> controlled by an option? I do it often with GRASS because rasters and
> vectors get different renderings of the same PROJ.4 string. So some
> users could turn off the warning; maybe a flag could be set to show the
> message once only too?

Sounds good, but I don't know how to realize that.

> 
> Roger
> 
>>
> 

-- 
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of Münster
Weseler Straße 253, 48151 Münster, Germany. Phone: +49 251
8333081, Fax: +49 251 8339763  http://ifgi.uni-muenster.de
http://www.52north.org/geostatistics      e.pebesma at wwu.de


More information about the Rspatial-devel mailing list