1

I need to get the boundingbox around a latitude and longitude with a distance of xx KM.

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

So I thought I do a function like this

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

However when I put the points on a map I get this which is more like a rectangle. So I think the formula is wrong.

enter image description here

NLAnaconda
  • 1,534
  • 3
  • 14
  • 38
  • possible duplicate of [Simple calculations for working with lat/lon + km distance?](http://stackoverflow.com/questions/1253499/simple-calculations-for-working-with-lat-lon-km-distance) – pmcoltrane Jun 11 '14 at 21:11
  • Crap you're good and fast. Have Googled half a hour for this. I'm going to check it out. – NLAnaconda Jun 11 '14 at 21:14

0 Answers0