AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Transbigdata Traj

skill-ni1o1-claude-skill-transbigdata-transbigdata-traj · by ni1o1

使用 TransBigData 进行轨迹数据处理。适用于轨迹清洗(漂移、冗余)、平滑、分段、停留识别、路网匹配、轨迹密化稀疏化等任务。

No reviews yet
0 installs
16 views
0.0% view→install

Install

$ agentstack add skill-ni1o1-claude-skill-transbigdata-transbigdata-traj

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-ni1o1-claude-skill-transbigdata-transbigdata-traj)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
7mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Transbigdata Traj? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

TransBigData 轨迹处理指南

安装

pip install transbigdata

核心函数

1. 轨迹漂移清洗 - traj_clean_drift()

删除速度/距离/角度异常的漂移点。

import transbigdata as tbd

# 清洗漂移数据
data_clean = tbd.traj_clean_drift(
    data,
    col=['VehicleNum', 'Time', 'Lng', 'Lat'],
    speedlimit=80,      # 速度上限 km/h
    dislimit=1000,      # 距离上限 m
    anglelimit=30       # 角度变化上限(度)
)

2. 冗余数据清洗 - traj_clean_redundant()

删除重复或冗余的轨迹点。

data_clean = tbd.traj_clean_redundant(
    data,
    col=['VehicleNum', 'Time', 'Lng', 'Lat']
)

3. 轨迹平滑 - traj_smooth()

使用卡尔曼滤波平滑轨迹。

data_smooth = tbd.traj_smooth(
    data,
    col=['id', 'time', 'lon', 'lat'],
    process_noise_std=0.1,
    measurement_noise_std=1
)

4. 轨迹分段 - traj_segment()

根据时间间隔分割轨迹,返回每段起终点信息。

segments = tbd.traj_segment(
    data,
    col=['VehicleNum', 'Time', 'Lng', 'Lat'],
    groupby_col=['VehicleNum'],
    retain_col=['Lng', 'Lat']
)

5. 轨迹切片 - traj_slice()

根据给定的时间段切割轨迹。

# 已知移动段信息
sliced = tbd.traj_slice(
    data,
    move,  # 包含 stime, etime 的 DataFrame
    traj_col=['VehicleNum', 'Time'],
    slice_col=['VehicleNum', 'stime', 'etime', 'tripid']
)

6. 停留与移动识别 - traj_stay_move()

识别轨迹中的停留点和移动段。

stay, move = tbd.traj_stay_move(
    data,
    params,              # 栅格参数
    col=['VehicleNum', 'Time', 'Lng', 'Lat'],
    activitytime=1800    # 停留判定时间阈值(秒)
)

7. 轨迹密化 - traj_densify()

在轨迹点之间插值生成更密集的点。

data_dense = tbd.traj_densify(
    data,
    col=['VehicleNum', 'Time', 'Lng', 'Lat'],
    timegap=15  # 目标时间间隔(秒)
)

8. 轨迹稀疏化 - traj_sparsify()

降低轨迹采样频率。

data_sparse = tbd.traj_sparsify(
    data,
    col=['VehicleNum', 'Time', 'Lng', 'Lat'],
    timegap=60,              # 目标时间间隔(秒)
    method='subsample'       # 'subsample' 或 'interpolate'
)

9. 轨迹转线 - traj_to_linestring()

将轨迹点转换为 GeoDataFrame 线几何。

traj_gdf = tbd.traj_to_linestring(
    data,
    col=['VehicleNum', 'Lng', 'Lat'],
    timecol='Time'
)

10. 路网匹配 - traj_mapmatch()

将轨迹匹配到路网。

import osmnx as ox

# 获取路网
G = ox.graph_from_place('Shenzhen, China', network_type='drive')

# 路网匹配
matched = tbd.traj_mapmatch(
    data,
    G,
    col=['VehicleNum', 'Time', 'Lng', 'Lat']
)

11. 轨迹长度计算 - traj_length()

计算轨迹总长度(米)。

data_with_length = tbd.traj_length(
    data,
    col=['VehicleNum', 'Time', 'Lng', 'Lat'],
    method='Haversine'  # 或 'Euclidean'
)

完整示例:出租车轨迹处理流程

import pandas as pd
import transbigdata as tbd

# 1. 加载数据
data = pd.read_csv('taxi_gps.csv')
data['Time'] = pd.to_datetime(data['Time'])

# 2. 数据清洗
data = tbd.traj_clean_redundant(data, col=['VehicleNum', 'Time', 'Lng', 'Lat'])
data = tbd.traj_clean_drift(data, col=['VehicleNum', 'Time', 'Lng', 'Lat'],
                            speedlimit=100, dislimit=1000)

# 3. 轨迹平滑
data = tbd.traj_smooth(data, col=['VehicleNum', 'Time', 'Lng', 'Lat'])

# 4. 生成栅格参数(500米)
bounds = [113.75, 22.4, 114.62, 22.86]
params = tbd.area_to_params(bounds, accuracy=500)

# 5. 停留移动识别
stay, move = tbd.traj_stay_move(data, params,
                                col=['VehicleNum', 'Time', 'Lng', 'Lat'],
                                activitytime=1800)

# 6. 转换为轨迹线
traj_gdf = tbd.traj_to_linestring(data, col=['VehicleNum', 'Lng', 'Lat'],
                                  timecol='Time')

# 7. 可视化
traj_gdf.plot(figsize=(10, 10))

使用建议

  1. 清洗顺序: 先去冗余,再去漂移
  2. 停留识别: activitytime 通常设为 1800 秒(30分钟)
  3. 路网匹配: 需要先用 OSMnx 获取路网数据
  4. 密化/稀疏化: 根据分析需求调整 timegap

参考文档

完整文档: https://transbigdata.readthedocs.io/en/latest/traj.html

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.