【问题标题】:Matching locations/coordinates in VBAVBA中的匹配位置/坐标
【发布时间】:2012-06-12 09:31:44
【问题描述】:

我正在寻找一些 VBA 代码(算法)以将 GPS 位置列表(在本例中为船舶轨迹)与给定的 GPS 位置相匹配。也就是说,列表中所有位于该位置周围给定半径的圆内的位置。

见图:所以只有“绿色位置”匹配所有位置。抱歉图片不佳,用 Windows Paint 手工制作 ;-)

所有位置均以纬度 + 经度的形式给出,例如 52.24782、4.12082。

【问题讨论】:

    标签: vba gps coordinates coordinate-systems


    【解决方案1】:

    函数

    Public Function CheckCoords(x#, y#, radius#) As String
        ' x^2 + y^2 = r^2
        ' ==> results true if (p,q) fall outside of the circle
        CheckCoords = IIf((x ^ 2 + y ^ 2) < radius ^ 2, "outside circle", "inside circle")
    End Function
    

    实际实施所需的单位转换

    【讨论】:

    • 谢谢。但这是勾股定理,我如何根据 GPS 坐标计算 x 和 y?
    【解决方案2】:

    找到这个:http://www.movable-type.co.uk/scripts/latlong.html

    我只需要将代码重写为VBA代码并与@Cylian的代码结合起来

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-01-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-01-02
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多