find next postion knowing lat/lon/heading/speed

前端 未结 2 1315
轮回少年
轮回少年 2021-01-19 17:01

knowing a decimal latitude, decimal longitude, speed (km/h), heading how to find the next positio

相关标签:
2条回答
  • 2021-01-19 17:18


    I've found more accurate formula
    This code work for me :
    1. First we have to count the distance ( speed * time ).
    2. In my program, i convert the distance to KM because I use earth radius in KM too.
    const double radiusEarthKilometres = 6371.01f;

                kmDistance = kmSpeed * (timer1.Interval / 1000f) / 3600f;
    
                var distRatio = kmDistance / radiusEarthKilometres;
                var distRatioSine = Math.Sin(distRatio);
                var distRatioCosine = Math.Cos(distRatio);
    
                var startLatRad = deg2rad(lat0);
                var startLonRad = deg2rad(lon0);
    
                var startLatCos = Math.Cos(startLatRad);
                var startLatSin = Math.Sin(startLatRad);
    
                var endLatRads = Math.Asin((startLatSin * distRatioCosine) + (startLatCos * distRatioSine * Math.Cos(angleRadHeading)));
    
                var endLonRads = startLonRad
                    + Math.Atan2(Math.Sin(angleRadHeading) * distRatioSine * startLatCos,
                        distRatioCosine - startLatSin * Math.Sin(endLatRads));
    
                newLat = rad2deg(endLatRads);
                newLong = rad2deg(endLonRads);
    
    0 讨论(0)
  • 2021-01-19 17:19

    This might help:

    distance_traveled = speed * time
    

    Then, calculate x and y components of speed using heading as angle (trigonometry):

    speed_x=distance_traveled * Math.Cos(heading/180*Math.PI)
    speed_y=distance_traveled * Math.Sin(heading/180*Math.PI)
    

    Next, see how to map lat/long into some form of x/y coordinates, add speed_x and speed_y, and convert to lat/long again.

    This last one is a tricky one, look here: http://www.movable-type.co.uk/scripts/latlong.html

    In fact, you'll find everything within that article!

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