【问题标题】:How to get all the latitude and longitude points using a central lat, long point with a radius of 1 km?如何使用半径为 1 公里的中心经纬度点获取所有经纬度点?
【发布时间】:2018-01-05 07:44:50
【问题描述】:

我有一个中心纬度,长点,半径为 1 公里。我想获取 1 公里内的所有经纬度点。

从输出列表中,我想将值与另一个 lat、long 值进行比较以检查它是否匹配?

例如,如果我有一个点是 (51.42337159689999, -0.562302811958012)。我想获取半径 1 公里内的所有点。

执行此操作的更好方法是什么?谁能帮我这个?

【问题讨论】:

    标签: python location coordinates latitude-longitude area


    【解决方案1】:

    这是我的粗略尝试...希望这有助于让您的大脑畅通无阻?

    import math
    
    def findpoints(lon, lat):
        radius = 1
        N = 360 
    
        # generate points
        circlePoints = []
        for k in range(N):
            angle = math.pi*2*k/N
            dx = radius*math.cos(angle)
            dy = radius*math.sin(angle)
            point = {}
            point['lat']= lat + (180/math.pi)*(dy/6371) #Earth Radius
            point['lon']= lon + (180/math.pi)*(dx/6371)/math.cos(lon*math.pi/180) #Earth Radius
            # add to list
            circlePoints.append(point)
    
        return circlePoints
    

    【讨论】:

      猜你喜欢
      • 2015-09-15
      • 1970-01-01
      • 2011-02-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-12-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多