如何在R特例非洲中将UTM坐标转换为经纬度 [英] How to convert UTM coordinates to lat and long in R special case Africa

查看:81
本文介绍了如何在R特例非洲中将UTM坐标转换为经纬度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我在这里尝试过此代码

Hello I tried this code from here How to convert UTM coordinates to lat and long in R like this

   SP <- SpatialPoints(cbind(457500, 9347500))
   sputm <- SpatialPoints(SP, proj4string=CRS("+proj=utm +zone=35M +datum=WGS84")) 
   spgeo <- spTransform(sputm, CRS("+proj=longlat +datum=WGS84"))

有了这个结果

   spgeo
   #SpatialPoints:
   #     coords.x1 coords.x2
   #[1,]  23.25527  84.16145
   #Coordinate Reference System (CRS) arguments: +proj=longlat +datum=WGS84 +no_defs 

但这是错误的.结果应为lat = -5.90303 long = 26.616044

But this is wrong. the result should be lat=-5.90303 long=26.616044

此代码出了什么问题,导致结果如此不同.谢谢您的帮助.

what is wrong in this code that the result is so different Thank you for any help.

推荐答案

您必须使用 + zone = 35 + south 而不是 + zone = 35M .

You have to use +zone=35 +south instead of +zone=35M.

library(rgdal)
SP <- SpatialPoints(cbind(457500, 9347500))
sputm <- SpatialPoints(SP, proj4string=CRS("+proj=utm +zone=35 +south +datum=WGS84"))
spTransform(sputm, CRS("+proj=longlat +datum=WGS84"))
#SpatialPoints:
#     coords.x1 coords.x2
#[1,]  26.61604  -5.90303
#Coordinate Reference System (CRS) arguments: +proj=longlat +datum=WGS84
#+ellps=WGS84 +towgs84=0,0,0 

这篇关于如何在R特例非洲中将UTM坐标转换为经纬度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆