【问题标题】:Convert a gps coordinate to an lat lng format?将 gps 坐标转换为 lat lng 格式?
【发布时间】:2016-07-28 14:41:57
【问题描述】:

这个SO question 已返回如下坐标:48 52m 0.0s N, 2 21m 0.0s E

但我想要类似37.783333, -122.416667

即:

import geopy
import geopy.distance

# Define starting point.
start = geopy.Point(48.853, 2.349)

# Define a general distance object, initialized with a distance of 1 km.
d = geopy.distance.VincentyDistance(kilometers = 1)

# Use the `destination` method with a bearing of 0 degrees (which is north)
# in order to go from point `start` 1 km to north.
print d.destination(point=start, bearing=0)

# ^^^ That prints "48 52m 0.0s N, 2 21m 0.0s E"
# How to get it to lat lng?

另外,我不知道术语。我想我要的坐标在4236,但是不知道48 52m 0.0s N, 2 21m 0.0s E叫什么。

【问题讨论】:

  • x = d.destination(point=start, bearing=0) print(x.latitude, x.longitude) 怎么样?
  • @JesperFreesbug 这行得通。如果你回答,我会标记它是正确的。虽然有些术语也很好,所以下次我可以更具体!

标签: python python-2.7 gps coordinates geopy


【解决方案1】:

很抱歉无法为您提供正确的术语:[但是,这里有一个可能的代码解决方案:

x = d.destination(point=start, bearing=0) 
print(x.latitude, x.longitude)

【讨论】:

    猜你喜欢
    • 2010-11-12
    • 2023-04-07
    • 2018-11-12
    • 2020-01-20
    • 2017-09-06
    • 2019-10-10
    • 1970-01-01
    • 1970-01-01
    • 2018-02-19
    相关资源
    最近更新 更多