Skip to content
Prev 308386 / 398506 Next

spTransform longlat to utm

r-sig-geo is a better place to ask this question.

There doesn't appear to be anything wrong with how you are using
spTransform().


  "x" should be longitude
  "y" should be latitude

More precisely, the first column of your matrix
  matrix(c(x,y), ncol=2)
should be longitude, the second column latitude. So you had it right the
first time.

The most likely explanation is that you have your CRS string wrong. That
is, it would be something other than
  "+proj=merc +zone=32u +datum=WGS84"

When I search the proj.4 codes in QGIS, I don't find any with "32u". Try
UTM zone 32 (32N):
SpatialPoints:
     coords.x1 coords.x2
[1,]  497734.1   5478009
Coordinate Reference System (CRS) arguments: +proj=utm +zone=32
+ellps=WGS84 +datum=WGS84 +units=m +no_defs +towgs84=0,0,0

I think this at least shows that you had your x,y correct the first time.

-Don