npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

route-correction

v0.1.1

Published

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

Downloads

8

Readme

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 | 所在点路径朝向(角度) |