[R-sig-Geo] spTransform problem

stephen sefick ssefick at gmail.com
Thu Jul 22 20:55:00 CEST 2010


I am having problems with spTransform in packages rgdal.  If this is
not enought information please let me know and I will send whatever
you need.  It doesn't seem like it is avaliable.

library(rgdal)
w <- (new("SpatialPoints"
    , coords = structure(c(33.31665, 33.31834, 33.3239, 33.37435, 33.36018,
33.23301, 33.23423, 33.17796, 33.18121, 33.1949, 33.31868, 33.30408,
33.29747, 33.17787, 33.29818, 33.29995, 33.22684, 35.1132, 35.17292,
35.17181, 35.06247, 35.11168, 35.13462, 33.29927, 33.29815, 33.29678,
33.22417, 35.18823, 35.18498, 35.11643, 35.01896, 32.50986, 32.49736,
33.31731, 33.3194, 33.3244, 33.37333, 33.36077, 33.2325, 33.23349,
33.1781, 33.18051, 33.19357, 33.31922, 33.30454, 33.29836, 33.17613,
33.2981, 33.36369, 33.30074, 33.22576, 35.1132, 35.17424, 35.17208,
35.06282, 35.11102, 35.13354, 33.30036, 33.29896, 33.29789, 33.22353,
35.18748, 35.1838, 35.11509, 35.01986, 32.51054, 32.49748, -81.59802,
-81.59618, -81.60159, -81.55044, -81.55657, -81.6235, -81.63911,
-81.56433, -81.56165, -81.57855, -81.57896, -81.62487, -81.63039,
-81.58159, -81.62553, -81.58714, -81.63564, -79.33718, -79.1805,
-79.22391, -79.30669, -79.35294, -79.34676, -81.66629, -81.67698,
-81.68295, -81.5105, -79.0738, -79.09837, -79.32681, -79.51664,
-84.64703, -84.70618, -81.59759, -81.59619, -81.60101, -81.54981,
-81.55763, -81.62424, -81.63809, -81.5657, -81.56335, -81.5788,
-81.58011, -81.6263, -81.62959, -81.58174, -81.62629, -81.55806,
-81.5868, -81.6357, -79.33718, -79.18026, -79.23305, -79.30483,
-79.35168, -79.34534, -81.66618, -81.6779, -81.68343, -81.50894,
-79.07469, -79.09892, -79.32548, -79.51553, -84.64841, -84.70769
), .Dim = c(67L, 2L), .Dimnames = list(NULL, c("lat", "long")))
    , bbox = structure(c(32.49736, -84.70769, 35.18823, -79.0738), .Dim = c(2L,
2L), .Dimnames = list(c("lat", "long"), c("min", "max")))
    , proj4string = new("CRS"
    , projargs = "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs"
)
))


str(w)
Formal class 'SpatialPoints' [package "sp"] with 3 slots
  ..@ coords     : num [1:67, 1:2] 33.3 33.3 33.3 33.4 33.4 ...
  .. ..- attr(*, "dimnames")=List of 2
  .. .. ..$ : NULL
  .. .. ..$ : chr [1:2] "lat" "long"
  ..@ bbox       : num [1:2, 1:2] 32.5 -84.7 35.2 -79.1
  .. ..- attr(*, "dimnames")=List of 2
  .. .. ..$ : chr [1:2] "lat" "long"
  .. .. ..$ : chr [1:2] "min" "max"
  ..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slots
  .. .. ..@ projargs: chr "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs"


w.utm <- spTransform(y, CRS=CRS("+proj=utm +zone=17 +ellps=GRS80
+datum=NAD83 +units=m +no_defs"))
Error: could not find function "spTransform"

sessionInfo()
R version 2.11.1 (2010-05-31)
x86_64-unknown-linux-gnu

locale:
 [1] LC_CTYPE=en_US.utf8       LC_NUMERIC=C
 [3] LC_TIME=en_US.utf8        LC_COLLATE=en_US.utf8
 [5] LC_MONETARY=C             LC_MESSAGES=en_US.utf8
 [7] LC_PAPER=en_US.utf8       LC_NAME=C
 [9] LC_ADDRESS=C              LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.utf8 LC_IDENTIFICATION=C

attached base packages:
[1] graphics  grDevices utils     datasets  stats     grid      methods
[8] base

other attached packages:
 [1] gpclib_1.5-1            RPostgreSQL_0.1-6       DBI_0.2-5
 [4] StreamMetabolism_0.03-3 maptools_0.7-34         lattice_0.18-8
 [7] sp_0.9-65               foreign_0.8-40          chron_2.3-35
[10] zoo_1.6-4               vegan_1.17-3            ggplot2_0.8.8
[13] proto_0.3-8             reshape_0.8.3           plyr_1.0.3

loaded via a namespace (and not attached):
[1] tools_2.11.1


-- 
Stephen Sefick
____________________________________
| Auburn University                                   |
| Department of Biological Sciences           |
| 331 Funchess Hall                                  |
| Auburn, Alabama                                   |
| 36849                                                    |
|___________________________________|
| sas0025 at auburn.edu                             |
| http://www.auburn.edu/~sas0025             |
|___________________________________|

Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods.  We are mammals, and have not exhausted the
annoying little problems of being mammals.

                                -K. Mullis



More information about the R-sig-Geo mailing list