Calculate GPS coordinates to form a radius of given size

后端 未结 3 2018
眼角桃花
眼角桃花 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 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.

提交回复
热议问题