在VB.NET中用纬度和经度计算边界框

时间:2014-06-11 21:07:28

标签: .net vb.net google-maps geometry coordinates

我需要在纬度和经度附近获得距离为xx KM的边界框。

This point o................^
           .                |
           .              100km
           .                |
            <---100km--- lat/lng ---100km--->
                            |               .
                           100km            .
                            |               .
                            V...............o This point

所以我认为我做了这样的功能

Function latlngToBox(lat As Double, lng As Double, km As Double) As boundingBox

    ' angle per km = 360 / (2 * pi * 6378) = 0.0089833458 (Found this fomula on the web
    Dim angle As Double = km * 0.0089833458
    Dim box As boundingBox = New boundingBox
    box.minLat = lat - angle
    box.minLng = lng - angle
    box.maxLat = lat + angle
    box.maxLng = lng + angle

    Return box

End Function

然而,当我把点放在地图上时,我得到了这个 这更像是一个矩形。 所以我觉得公式错了。

enter image description here

0 个答案:

没有答案