私のデータは、緯度と経度を度、分、秒の形式で投影したものです。これは、テキスト形式で保存されています ( character-class
、 は無視してrow.names
ください)。
> pasaporte
Latitud Longitud
4 13°50¨52" sur 73°45¨12" oeste
36 13°01¨ sur 75°05¨ oeste
46 13°09¨26" sur 74°13¨22" oeste
メーリングリストで提供された回答により、データを10進数形式に変換しました...
> pasaporte
Latitud Longitud
4 13.84778 73.75333
36 13.01667 75.08333
46 13.15722 74.22278
その後、 をオブジェクトに変換しdata.frame
ました。SpatialPoints
xy <- data.frame(cbind(round(pasaporte[, 'Longitud'], 5), round(pasaporte[, 'Latitud'], 5))) #Rounded the decimals out of doubt of it interfering later
xy <- SpatialPoints(coords = xy,
proj4string = CRS('+proj=longlat +south +ellps=WGS84 +datum=WGS84 +units=m +no_defs'))
次に、次の方法で投影を変換しましたspTransform
xy_utm <- spTransform(xy, CRS('+proj=utm +south +ellps=WGS84 +datum=WGS84 +units=m +no_defs +towgs84:0,0,0'))
この Web サイトを使用して、例の最初の座標を変換し(座標は南と西を指すため、負の値を指定するようにしてください)、次の座標を提供します: 633726.46 mE 8468757.51 mN Zone 18L、これは正しいです。対照的sp
に、変換後のオブジェクトは次のとおりです。
SpatialPoints:
X1 X2
[1,] 12051333 14804033
[2,] 12569894 14792671
[3,] 12301330 14684870
Coordinate Reference System (CRS) arguments: +proj=utm +south +ellps=WGS84 +datum=WGS84 +units=m +no_defs +towgs84=0,0,0
マニュアルではspTransform
、メタデータを正しく提供する必要があると具体的に述べています。私のデータは WGS84 楕円体を使用しており、18L ゾーンにあります。より正確にはepsg:32718です。どこが間違っているのですか?