[R-sig-Geo] spTransform: unable to convert coordinates
Roger Bivand
Roger.Bivand at nhh.no
Mon Aug 20 14:22:07 CEST 2012
On Mon, 20 Aug 2012, Martin Ivanov wrote:
> 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)
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
> 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,
>
>
--
Roger Bivand
Department of Economics, NHH Norwegian School of Economics,
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