[英]Convert a gps coordinate to an lat lng format?
This SO question has returned a coordinate like this: 48 52m 0.0s N, 2 21m 0.0s E
. 这个SO问题返回了一个这样的坐标:
48 52m 0.0s N, 2 21m 0.0s E
But I want it something like 37.783333, -122.416667
. 但是我想要类似
37.783333, -122.416667
东西。
ie: 即:
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?
Also, I don't know the terminology. 另外,我不知道该术语。 I think the coordinates I want are in 4236, but I don't know what
48 52m 0.0s N, 2 21m 0.0s E
is called. 我认为我想要的坐标是4236,但是我不知道叫
48 52m 0.0s N, 2 21m 0.0s E
是什么。
I am sorry for not being able to provide you with the correct terminology :[ However, here is a possible solution for the code: 很抱歉无法为您提供正确的术语:[但是,以下是该代码的可能解决方案:
x = d.destination(point=start, bearing=0)
print(x.latitude, x.longitude)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.