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

Transbigdata Visualize

skill-ni1o1-claude-skill-transbigdata-transbigdata-visualize · by ni1o1

使用 TransBigData 进行交通数据可视化。适用于点分布热力图、轨迹动画、OD流向图、底图加载、活动时空图等可视化任务。

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

Install

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

✓ 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-visualize)

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 Visualize? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

TransBigData 可视化指南

安装

pip install transbigdata keplergl matplotlib geopandas

Kepler 交互式可视化

需要安装 KeplerGl: pip install keplergl

1. 点分布可视化 - visualization_data()

import transbigdata as tbd

map = tbd.visualization_data(
    data,
    col=['Lng', 'Lat'],       # 或 ['Lng', 'Lat', 'count'] 带权重
    accuracy=500,              # 聚合精度
    height=500,                # 地图高度
    maptype='point'            # 'point' 或 'heatmap'
)
# 在 Jupyter 中显示
map

2. 轨迹可视化 - visualization_trip()

map = tbd.visualization_trip(
    trajdata,
    col=['Lng', 'Lat', 'VehicleNum', 'Time'],
    height=500
)

3. OD 可视化 - visualization_od()

map = tbd.visualization_od(
    oddata,
    col=['slon', 'slat', 'elon', 'elat'],  # 或加 'count'
    accuracy=500,        # OD 聚合精度
    mincount=0           # 最小流量阈值
)

Matplotlib 静态可视化

4. 加载底图 - plot_map()

import matplotlib.pyplot as plt
import transbigdata as tbd

# 设置 Mapbox token(可选,获取更好的底图)
# tbd.set_mapboxtoken('your_token')
# tbd.set_imgsavepath('./map_cache/')  # 缓存路径

bounds = [113.6, 22.4, 114.8, 22.9]  # 深圳范围

fig, ax = plt.subplots(1, 1, figsize=(12, 10))
tbd.plot_map(plt, bounds, zoom=12, style=4)

# style 选项: 0-12 或自定义 URL

底图样式:

  • 0-6: 不同风格的街道图
  • 7-12: 卫星图/混合图

5. 添加指北针和比例尺 - plotscale()

tbd.plotscale(
    ax,
    bounds=bounds,
    textsize=10,
    compasssize=1,
    accuracy=2000,      # 比例尺长度(米)
    rect=[0.06, 0.03]   # 位置
)

活动分析可视化

6. 活动时空图 - plot_activity()

绘制个体活动的时空分布。

tbd.plot_activity(
    stay_data,
    col=['stime', 'etime', 'group'],  # 开始时间、结束时间、分组
    figsize=(10, 5)
)

7. 置信椭圆 - ellipse_params() & ellipse_plot()

分析活动空间分布。

# 计算 95% 置信椭圆参数
ellip_params = tbd.ellipse_params(
    data,
    col=['lon', 'lat'],
    confidence=95,
    epsg=None  # 可选投影坐标系
)
# 返回: [中心坐标, 长轴, 短轴, 旋转角, 面积, 扁率]

# 绑定绘制椭圆
tbd.ellipse_plot(ellip_params, ax, edgecolor='red', facecolor='none')

8. 熵值分析 - entropy() & entropy_rate()

# 信息熵
h = tbd.entropy(data['location_sequence'])

# 熵率
hr = tbd.entropy_rate(data['location_sequence'])

完整示例

示例 1: 出租车热力图

import pandas as pd
import matplotlib.pyplot as plt
import geopandas as gpd
import transbigdata as tbd

# 加载数据
data = pd.read_csv('taxi_gps.csv')

# 500米栅格聚合
bounds = [113.75, 22.4, 114.62, 22.86]
params = tbd.area_to_params(bounds, accuracy=500)

data['LONCOL'], data['LATCOL'] = tbd.GPS_to_grid(
    data['Lng'], data['Lat'], params
)

grid_count = data.groupby(['LONCOL', 'LATCOL']).size().reset_index(name='count')
grid_count['geometry'] = tbd.grid_to_polygon(
    [grid_count['LONCOL'], grid_count['LATCOL']], params
)

gdf = gpd.GeoDataFrame(grid_count, geometry='geometry', crs='EPSG:4326')

# 可视化
fig, ax = plt.subplots(1, 1, figsize=(12, 10))
tbd.plot_map(plt, bounds, zoom=12, style=4)
gdf.plot(ax=ax, column='count', cmap='YlOrRd', alpha=0.7, legend=True)
tbd.plotscale(ax, bounds=bounds, textsize=10)
plt.title('出租车轨迹点密度 (500m栅格)')
plt.show()

示例 2: OD 流向图

import pandas as pd
import transbigdata as tbd

# 加载 OD 数据
od_data = pd.read_csv('taxi_od.csv')

# Kepler 可视化(Jupyter 环境)
map = tbd.visualization_od(
    od_data,
    col=['slon', 'slat', 'elon', 'elat'],
    accuracy=1000,  # 1公里聚合
    mincount=5      # 至少5条 OD
)
map

使用建议

  1. 底图缓存: 首次使用 plot_map 会下载底图,建议设置 set_imgsavepath()
  2. Mapbox Token: 获取更高质量底图需注册 Mapbox 并设置 token
  3. 聚合精度: 可视化时聚合精度通常设为 500m 或 1km
  4. Kepler 可视化: 在 Jupyter 中效果最佳,支持交互式操作

参考文档

  • 可视化: https://transbigdata.readthedocs.io/en/latest/visualization.html
  • 底图: https://transbigdata.readthedocs.io/en/latest/plot_map.html
  • 活动分析: https://transbigdata.readthedocs.io/en/latest/activity.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.