使用 equirectangular 投影将 3d 坐标映射到 2d 坐标

时间:2021-02-01 06:09:17

标签: python math mapping gis projection

我目前正在研究脑电信号,所以这里基本上我们有电极放在一个人的头上,我们得到每个电极的 3d 坐标,所以基本上我试图从这些 3d 坐标中找到 2d 坐标,但在帮助下equirectangular 投影(与我们在平面纸上投影地球的方式相同)。 这里有几个链接可以更好地理解: https://www.earthdatascience.org/courses/use-data-open-source-python/intro-vector-data-python/spatial-data-vector-shapefiles/geographic-vs-projected-coordinate-reference-systems-python/

https://www.coursera.org/lecture/introduction-gis-mapping/associating-points-from-3d-to-2d-y7kIx

https://mathworld.wolfram.com/MercatorProjection.html

1 个答案:

答案 0 :(得分:0)

我认为应该是以下内容,但也许您可以确认这是否正确:

import math

def cartesian_to_spherical(x,y,z):
    r=math.sqrt(x**2+y**2+z**2)
    theta=math.acos(z/r)
    phi=math.atan(y/x)
    return r,theta,phi

def spherical_to_mercator(r,theta,phi):
    x=theta
    y=0.5*math.log((1+math.sin(phi))/(1-math.sin(phi)))
    return x,y


r,theta,phi=cartesian_to_spherical(2,3,1) # fill in your x,y,z here
x,y=spherical_to_mercator(r,theta,phi)
print("x = ",x," y = ",y)