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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@caoguo/maplibre-transport

v0.0.7

Published

草果地图交通网组件包 - 路网 / 交通流 / 拥堵预测 / 事件响应

Readme

@caoguo/maplibre-transport

草果地图交通网组件包 — 路网 / 交通流 / 拥堵预测 / 事件响应

npm version license

安装

npm install @caoguo/maplibre-transport

Peer:maplibre-gl@^4.7.1

功能模块

| 模块 | 导出 | 说明 | |------|------|------| | 路网 | RoadNetwork | 路网编辑器(图编辑 + 道路等级配色) | | 交通流 | TrafficFlow (trafficCore) | 实时交通流 + 拥堵预测 | | 事件 | IncidentMap (incidentCore) | 事件响应(影响范围 + 附近资源 + 绕行方案) | | NLPG | transportNlp | 交通查询意图识别 | | 图算法 | 图邻接表 + BFS + Dijkstra + 缓冲查询 | | | 样式 | transportTheme / ROAD_LEVEL_COLORS / transportLegend | 道路等级/速度/状态/事件配色 | | 数据 | RoadNode / RoadEdge / Incident / RoadSpeedRecord | 数据模型 |

快速开始

拥堵预测

import { TrafficFlow } from '@caoguo/maplibre-transport/traffic';

const flow = new TrafficFlow({ dataset });
const prediction = flow.predictCongestion({
  horizonMinutes: 30,
  edgeIds: ['E001', 'E002'],
});
console.log('30 分钟拥堵指数', prediction.byEdge);

事件响应

import { IncidentMap } from '@caoguo/maplibre-transport/incident';

const inc = new IncidentMap({ dataset });
const impact = inc.analyze({
  type: 'accident',
  location: { lng: 114.3, lat: 30.6 },
  severity: 3,
});
console.log('影响路段', impact.affectedRoads);
console.log('推荐绕行', impact.detour);

NLPG 查询意图识别

import { transportNlp } from '@caoguo/maplibre-transport/nlpg';

const intent = transportNlp.recognize('查一下二环堵不堵');
console.log(intent.intent, intent.entities);

子入口

@caoguo/maplibre-transport/graph
@caoguo/maplibre-transport/road
@caoguo/maplibre-transport/traffic
@caoguo/maplibre-transport/incident
@caoguo/maplibre-transport/nlpg
@caoguo/maplibre-transport/style
@caoguo/maplibre-transport/types

设计原则

  1. 算法纯函数:拥堵预测、事件分析、图遍历均为纯函数。
  2. 可插拔:每个组件独立可用。
  3. 离线友好:所有计算在前端完成。

浏览器 / 环境要求

  • 现代浏览器(Chrome 90+)
  • 核心算法在 Node.js 可测(已含 19 个 vitest 用例)

许可

Apache-2.0