Skip to content

spTransform: unable to convert coordinates

4 messages · Martin Ivanov, Roger Bivand

#
Dear Prof. Bivand,
It is again me on the coordinate transformation problem. So far the 
transformation to the rotated grid has gone ok, as in the example
crds <- matrix(data=c(9.05, 48.52), ncol=2)
spPoint <- SpatialPoints(coords=crds, proj4string=CRS("+proj=ob_tran 
+o_proj=longlat +o_lon_p=-162 +o_lat_p=39.25 +lon_0=180 +ellps=sphere 
+no_defs"))
a <- spTransform(spPoint, CRS("+proj=longlat +ellps=sphere +no_defs"), 
use_ob_tran=TRUE)

However:
spTransform(a, CRS("+proj=ob_tran +o_proj=longlat +o_lon_p=-162 
+o_lat_p=39.25 +lon_0=180 +ellps=sphere +no_defs") , use_ob_tran=TRUE, 
inv=TRUE)
spTransform(a, CRS("+proj=ob_tran +o_proj=longlat +o_lon_p=-162 
+o_lat_p=39.25 +lon_0=180 +ellps=sphere +no_defs") , 
use_ob_tran=TRUE)@coords*180/pi

You can see that for the inverse transformation back to normal 
coordinates, things are not multiplied by 180/pi. There is a warning, 
though:
In spTransform(a, CRS("+proj=ob_tran +o_proj=longlat +o_lon_p=-162 
+o_lat_p=39.25 +lon_0=180 +ellps=sphere +no_defs"),  :
   project: use_ob_tran set FALSE

Best regards,
#
On Mon, 20 Aug 2012, Martin Ivanov wrote:

            
There is no inv= argument to spTransform() methods. I'll add the reverse 
for the target too - we should have checked this before I submitted rgdal 
yesterday. It will mean a change in the flags to show direction.

Roger

  
    
#
Dear Prof. Bivand,

Thank You very much for Your support. I will be looking forward to the 
new revision.

Best regards,
#
On Mon, 20 Aug 2012, Martin Ivanov wrote:

            
Revision 357 should fix the problem - note that both spTransform() and 
project() do the to/from reversal internally, so please read the help 
files to see how to assign the CRS to the objects (in standard order, not 
in reversed order).

Roger