Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rgdal package lat/long -> UTM

Tags:

r

gis

Can someone see what's wrong with this:

library(rgdal)

# Make a two-column matrix, col1 = long, col2 = lat
xy <- cbind(c(-107), c(26))
# Convert it to UTM coordinates (in units of meters)
project(xy, "+proj=utm +zone=51 ellps=WGS84")

I understand that Latitude greater than 84 and smaller than 80 are invalid but why do I get:

In project(xy, "+proj=utm +zone=51 ellps=WGS84") :
  1 projected point(s) not finite

Thanks!

like image 356
cs0815 Avatar asked Nov 02 '11 12:11

cs0815


1 Answers

use positive number for longitude (107, instead of -107). negative is for western hemisphere

like image 188
yosukesabai Avatar answered Oct 19 '22 15:10

yosukesabai