[R-sig-Geo] spTransform / SpatialPixelsDataFrame

twah at gmx.ch twah at gmx.ch
Thu Apr 21 13:10:35 CEST 2016


I would like to reproject a SpatialPixelsDataFrame, changing the CRS. I 
am trying to use the command "spTransform" from the package "sp". 
Unfortunately, the command results in a SpatialPointsDataFrame, which is 
not desired. My SpatialPixelsDataFrame has proj4string

+init=epsg:21781 +proj=somerc +lat_0=46.95240555555556
+lon_0=7.439583333333333 +k_0=1 +x_0=600000 +y_0=200000 +ellps=bessel 
+units=m +no_defs

The command which results in a SpatialPointsDataFrame is:

SPDF2<-spTransform(SPDF1,CRS("+proj=longlat +datum=WGS84 +ellps=WGS84 

An object transformation through


results in an error, possibly since in the underlying problem the SPDF2 
is a subset for a particular layer, so it is not a full grid.

Can someone help?


More information about the R-sig-Geo mailing list