如何将经度,纬度,高程转换为笛卡尔坐标? [英] How to convert Longitude,Latitude, Elevation to Cartesian coordinates?

查看:573
本文介绍了如何将经度,纬度,高程转换为笛卡尔坐标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我下载了天气数据,它具有经度(以十进制表示),纬度(以十进制表示)和海拔(以m表示)值。没有有关使用的坐标系的信息。如何将其转换为笛卡尔坐标?我的尝试如下。但是,我的问题是找到正确的公式

I downloaded weather data and it has longitude (in decimal), latitude (in decimal), and elevation (in m) values. There is no information about the coordinate system used. How I can convert it to cartesian coordinates ?. My attempts are below. But, my problem is to find the right formulas

def cartesian(self,longitude,latitude, elevation):
    R = 6378137.0 + elevation  # relative to centre of the earth
    X = R * math.cos(longitude) * math.sin(latitude)
    Y = R * math.sin(longitude) * math.sin(latitude)
    Z = R * math.cos(latitude)

def cartesian3(self,longitude,latitude, elevation):

    X = longitude * 60 * 1852 * math.cos(latitude)
    Y = latitude * 60 * 1852

    Z = elevation

    return X,Y,Z

答案使用了不同的公式。但是,它不使用高程。
如果有人能消除我的困惑,我是否会感激,是否应该在从long / lat转换时使用海拔?正确的公式是什么?我试图通过以下方式在
网站上比较我的代码结果使用特定的long,lat,elev。我上面两种方法的结果都与从网站获得的结果相去甚远

An answer here by Daphna Shezaf uses different formulas. However, it does not use elevations. I would appreciate if someone could clear my confusion, should elevation be used in converting from long/lat or not ?. What are the right formulas ?. I have tried to compare the result of my codes on this website by using specific long, lat, elev. My both methods above have results that are far from the obtained result from the website

我想分享我的问题的解决方案。我已经通过此处在python中。它允许将弧度经度,纬度和海拔(以米为单位的高度)转换为笛卡尔。我只需要将纬度和经度转换为弧度(如果它们是十进制),就可以:

I would like to share the solution to my problem. I have implemented lla2ecef function from Matlab as here in python. It allows to convert radian longitude, latitude, and elevation (height in m) to cartesian. I only need to convert latitude and longitude to radian iff they are in decimal by :

latitude = (lat * math.pi) / 180  #latitude in radian, and lat in decimal

验证我的计算。我将转换结果与上述网站(网站)和< a href = http://www.oc.nps.edu/oc2902w/coord/llhxyz.htm rel = nofollow noreferrer>这也是一个。两者都给我几乎相同的结果。

To verify my calculations. I compared the conversion result to the website above (website) and this one as well. Both give me almost same result.

注意:如果为简单起见,地球是球面,则可以使用 def笛卡尔(我更新了它;感谢Sasha的纠正)。如果您认为地球是椭球体(WGS 84大地测量系统),则可以像 lla2ecef 中那样实现转换。 def笛卡尔坐标用于制图投影(感谢rodrigo)

Note: If you consider for simplicity earth is sphere, you can use def cartesian (I updated it; thanks to Sasha for correction). If you consider earth is ellipsoid (WGS 84 Geodetic System), you can implement the conversion as in lla2ecef. def cartesian is for cartographic projection (Thanks for rodrigo)

推荐答案

高程是从海平面测量的。半径将地球中心连接到您的地理位置。这意味着R = 6371 km +高程。该固定点可能会有所不同,确切值应由数据提供者指定。您的第一个函数似乎是正确的,只需替换R计算即可。

Elevation is measured from sealevel. Radius connects the center of the earth to you geographic location. This means that R = 6371km + elevation. This fixed point can vary and the exact value should be specified by the data provider. Your first function seems to be correct, just replace the R calculation.

直言不讳:没有半径(高程),就不可能从球面坐标转换为笛卡尔坐标。至少可以使用海平面高度,但这只会为您提供一个理想球体上的坐标。

To be blunt: Without radius (elevation), it is not possible to convert from spherical to cartesian coordinates. Least you could do is use the "sea level height", but this will only give you the coordinates on a planet which is a perfect sphere. Which Earth isn't.

例如,在您提供的网站上,您可以选择椭圆形。对于WGS 84标准,我在维基百科中找到以下内容:

For example, on the website you provided, you can select the ellipsoid. For WGS 84 standard, I found the following in wikipedia;


WGS 84基准面是扁球形(椭圆形),主(赤道)形)在赤道处的半径a = 6378137 m,展平f = 1 / 298.257223563。[6]极地次近轴b等于一个时间(1-f),即6356752.3142 m

The WGS 84 datum surface is an oblate spheroid (ellipsoid) with major (equatorial) radius a = 6378137 m at the equator and flattening f = 1/298.257223563.[6] The polar semi-minor axis b then equals a times (1−f), or 6356752.3142 m

这篇关于如何将经度,纬度,高程转换为笛卡尔坐标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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