【问题标题】:find road driving direction from GPS data从 GPS 数据中查找道路行驶方向
【发布时间】:2016-10-05 17:00:55
【问题描述】:

我有很多 GPS 数据,数据格式是:

纬度、经度、时间戳

我需要找路的方向吗?

请一目了然地查看附件照片。 enter image description here

【问题讨论】:

  • 你能解释一下你到底在寻找什么,尤其是“道路方向”这个词吗?在我看来,您有一系列固定时间间隔的点位置,并且您尝试找到每两个点之间的每个行程段方向?
  • 是的,我正在寻找那个。

标签: google-maps gps gis


【解决方案1】:

因此,根据您的问题和评论,您要查找的是经纬度两点之间的方位角,您将为路线的每一段重复此操作。

轴承的定义,https://en.wikipedia.org/wiki/Bearing_(navigation)

对于编码部分,获取方位和循环通过每个段非常简单:

var calcBearing = function(lat1,long1,lat2,long2) {
        var dLong = (long2-long1);
        var y = Math.sin(dLong) * Math.cos(lat2);
        var x = Math.cos(lat1)*Math.sin(lat2) -    Math.sin(lat1)*Math.cos(lat2)*Math.cos(dLong);
        var brng = this._toDeg(Math.atan2(y, x));
        return 360 - ((brng + 360) % 360);
    },
var toRad = function(deg) {
         return deg * Math.PI / 180;
    },
var toDeg = function(rad) {
        return rad * 180 / Math.PI;
    }`

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-01-21
    • 1970-01-01
    • 2019-04-29
    • 1970-01-01
    • 2022-01-20
    相关资源
    最近更新 更多