Calculate GPS coordinates to form a radius of given size

后端 未结 3 2013
眼角桃花
眼角桃花 2020-12-28 22:13

I\'ve come up with a method that takes a coordinate and a range (in miles) and return a list of coordinates that form a circle around the origin. I seem to have made some p

相关标签:
3条回答
  • 2020-12-28 22:59

    have a look at this (includes example code): http://www.movable-type.co.uk/scripts/latlong.html

    the "Spherical Law of Cosines" gives you the distance between two coordinates. it should be possible to modify this to give you the coordinates around a specified center and a specified radius (distance).

    0 讨论(0)
  • 2020-12-28 22:59

    Do your calculations in a spherical coordinate space and then convert them to latitude/longitude.

    0 讨论(0)
  • 2020-12-28 23:08

    Rather than defining LONG_MILE as a constant, you should calculate it inside your GetRadius function: LONG_MILE = LAT_MILE / cos(OriginLatitude*PI/180.0)

    Also, it looks a little weird that you're taking sin() and cos() of your integer index i. If your intention is to generate points at 1 radian intervals surrounding the center point, it'll work. But I suspect you might want something more like

    angle_radians = i * 2.0*PI/Points; 
    

    and substitute sin(angle_radians) for sin(i), etc.

    0 讨论(0)
提交回复
热议问题