Python根据google地图上的坐标得到度数和米之间的比率

2024-10-01 11:29:29 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图在地图上找到挡住一个圆(a,b,R)的点,问题是地图上使用的坐标会随着经度的变化而转换成不同的度量值。 我知道这和弧度有关。 这是缺少部分的代码:

class Circle(object):
    def __init__(self,x,y,R):   
        self.x = x #Degrees
        self.y = y #Degrees
        self.R = R #meters

    def getRatio(self,x,y):     
        #This is where the magic happens...
        return latRatio, LatRatio


    def getBlockingSquareCords(self):
        latRation, lonRatio = getLonRatio(x,y)
        latD = self.R/latRatio
        lonD = self.R/lonRatio

        x1 = self.x+latD
        y1 = self.y+lonD

        x2 = self.x-latD
        y2 = self.y-lonD

        return (x1,y1,x2,y2)

下面这个问题对答案有一些提示,但我想不通-Calculate distance between two latitude-longitude points? (Haversine formula)


Tags: selfreturn度量def地图x1x2degrees