Skip to content

Instantly share code, notes, and snippets.

@erikbern
Created July 6, 2017 12:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erikbern/82e0da684285ec2900fbccc8c6332a10 to your computer and use it in GitHub Desktop.
Save erikbern/82e0da684285ec2900fbccc8c6332a10 to your computer and use it in GitHub Desktop.
def ll_to_3d(lat, lon):
lat *= math.pi / 180
lon *= math.pi / 180
x = math.cos(lat) * math.cos(lon)
z = math.cos(lat) * math.sin(lon)
y = math.sin(lat)
return numpy.array([x, y, z])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment