Giter VIP home page Giter VIP logo

route-correction's Introduction

Point 坐标点类

字段 类型 描述
lng Number 经度
lat Number 纬度

Segment 路径线段类

字段 类型 描述
p0 Point 起始点
p1 Point 结束点
length Number 路径线段长度(米)
distance Number p0点距离路径起始点的距离
direction Number 路径朝向(弧度)
directionInDegree Number 路径朝向(角度)

Route 路线类

字段 类型 描述
points [Point] 折线点
segments [Segment] 路径线段
totalDistance Number 总长度(米)
maxLng / minLng Number 最大最小经度
maxLat / minLat Number 最大最小纬度
centerLng / centerLat Number 包围盒中心经纬度
RADIUS Number 地球半径(包围盒做梯形正畸后近似)

成员方法

correct 方法

const res = correct(point); 将输入点位纠偏到路线的最近点位,并返回纠偏后点位相关信息

入参
字段 类型 描述
point Point 计算 point 点到当前路径的最近点位
返回值

返回值 res 为一个对象,其中各属性如下

字段 类型 描述
point Point 最近点
point.r Number 最近点在线段上的位置,范围 0~1。0 代表最近点位于 p0,1 代表最近点位于 p1, 0.5 代表位于线段中点
point.lng / point.lat Number 最近点的经纬度
point.distance Number 最近点距离线段 p0 点的距离(米)
segment Segment 最近点所在线段
index Number 最近点所在线段在 segments 数组中的下标
distance Number 最近点距离路径起始点的距离(米)

pointAt 方法

const point = pointAt(distance) 查询沿路线行进指定距离后的所在点位,并返回点位相关信息

入参
字段 类型 描述
distance Number 距离路径起始点的距离(米)
返回值
字段 类型 描述
point Point 查询结果所在点位
point.lng / point.lat Number 所在点的经纬度
point.distance Number 实际距离(限定 0~路径总长)
direction Number 所在点路径朝向(弧度)
directionInDegree Number 所在点路径朝向(角度)

route-correction's People

Contributors

upupzealot avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.