根据经度/纬度确定UTM区域(进行转换) [英] Determining UTM zone (to convert) from longitude/latitude

查看:339
本文介绍了根据经度/纬度确定UTM区域(进行转换)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个程序,该程序需要一些纬度/经度,然后将其内部转换为UTM,以便以米为单位进行一些计算.

经纬度本身的范围很小-大约200m x 200m.几乎总是可以将它们依靠在单个UTM区域内(除非您很不幸并且越过该区域的边界).

但是,纬度/经度所在的区域不受限制.有一天,该计划可能会为澳大利亚的人们运行(哦,哪怕一个州横跨多少个区域,已经给我造成了多大的痛苦……),而另一天则是为墨西哥的人们运行的. >

我的问题是-有没有一种方法可以确定特定的长/低线位于哪个区域,以便可以将其馈送到转换库中(我目前使用proj4以及R包rgdal).

我的语言是R,但答案不一定是-也许只是简单的计算,或者我可以将系统调用嵌入到proj可执行文件.

欢呼.

解决方案

编辑:针对适用于地球上所有非极性区域的(非R)代码,请参见此处.


除非您要处理几个特殊领域的数据(斯瓦尔巴特群岛和挪威的部分地区),这是一个非常简单的计算,您也可以自己在R中完成.这是 Wikipedia的经度与UTM区域号的关系的说明:

UTM系统将80°S和84°N纬度之间的地球表面划分为60个区域,每个区域的经度为6°.区域1的经度为180°至174°W;区域编号向东增加到覆盖东经174至180的区域60.

因此,假设您在 Prime Meridian 以西的数据经度中编码为从-180度到0度,这是上面的R代码版本:

long2UTM <- function(long) {
    (floor((long + 180)/6) %% 60) + 1
}

# Trying it out for San Francisco, clearly in UTM Zone 10 
# in the figure in the Wikipedia article linked above
SFlong <- -122.4192
long2UTM(SFlong)
# [1] 10

该表达显然可以简化一些,但是我认为以这种形式构建其基础的逻辑是最清楚的. %% 60位在其中,以防万一您的某些经度大于180或小于-180.

I'm writing a program which expects a number of lat/long points, and I convert them internally to UTM in order to do some calculations in metres.

The range of the lat/long points themselves is quite small -- about 200m x 200m. They can be relied on almost always to be within a single UTM zone (unless you get unlucky and are across the border of a zone).

However, the zone that the lat/longs are in is unrestricted. One day the program might be run for people in Australia (and oh, how many zones does even a single state lie across, and how much pain has that caused me already...), and another day for people in Mexico.

My question is -- is there a way to determine which zone a particular long/lat is in so that it may be fed into a conversion library (I currently use proj4 and also the R package rgdal).

My language is R, but the answer doesn't have to be -- maybe it's just a simple calculation, or maybe I can embed a system call to the proj exectuable.

cheers.

解决方案

Edit: For (non-R) code that works for all non-polar areas on earth, see here or here.


Unless you are dealing with data from a couple of exceptional areas (Svalbard and parts of Norway), this is a simple enough calculation that you might as well just do it yourself in R. Here is Wikipedia's description of how longitude relates to UTM Zone number:

The UTM system divides the surface of Earth between 80°S and 84°N latitude into 60 zones, each 6° of longitude in width. Zone 1 covers longitude 180° to 174° W; zone numbering increases eastward to zone 60 that covers longitude 174 to 180 East.

So, assuming that in your data longitudes to the west of the Prime Meridian are encoded as running from -180 to 0 degrees, here's an R-code version of the above:

long2UTM <- function(long) {
    (floor((long + 180)/6) %% 60) + 1
}

# Trying it out for San Francisco, clearly in UTM Zone 10 
# in the figure in the Wikipedia article linked above
SFlong <- -122.4192
long2UTM(SFlong)
# [1] 10

That expression could obviously be simplified a bit, but I think in this form the logic underlying its construction is most clear. The %% 60 bit is in there just in case some of your longitudes are greater than 180 or less than -180.

这篇关于根据经度/纬度确定UTM区域(进行转换)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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