shapely-compute by parcadei/continuous-claude-v3
npx skills add https://github.com/parcadei/continuous-claude-v3 --skill shapely-compute| 我想... | 命令 | 示例 |
|---|---|---|
| 创建几何体 | create | create polygon --coords "0,0 1,0 1,1 0,1" |
| 求交集 | op intersection | op intersection --g1 "POLYGON(...)" --g2 "POLYGON(...)" |
| 检查包含关系 |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
pred contains |
pred contains --g1 "POLYGON(...)" --g2 "POINT(0.5 0.5)" |
| 计算面积 | measure area | measure area --geom "POLYGON(...)" |
| 计算距离 | distance | distance --g1 "POINT(0 0)" --g2 "POINT(3 4)" |
| 变换 | transform translate | transform translate --geom "..." --params "1,2" |
| 验证 | validate | validate --geom "POLYGON(...)" |
根据坐标创建几何对象。
# 点
uv run python scripts/shapely_compute.py create point --coords "1,2"
# 线(2个及以上点)
uv run python scripts/shapely_compute.py create line --coords "0,0 1,1 2,0"
# 多边形(3个及以上点,自动闭合)
uv run python scripts/shapely_compute.py create polygon --coords "0,0 1,0 1,1 0,1"
# 带孔洞的多边形
uv run python scripts/shapely_compute.py create polygon --coords "0,0 10,0 10,10 0,10" --holes "2,2 8,2 8,8 2,8"
# 多点
uv run python scripts/shapely_compute.py create multipoint --coords "0,0 1,1 2,2"
# 多线串(竖线分隔的线)
uv run python scripts/shapely_compute.py create multilinestring --coords "0,0 1,1|2,2 3,3"
# 多多边形(竖线分隔的多边形)
uv run python scripts/shapely_compute.py create multipolygon --coords "0,0 1,0 1,1 0,1|2,2 3,2 3,3 2,3"
几何布尔运算。
# 两个多边形的交集
uv run python scripts/shapely_compute.py op intersection \
--g1 "POLYGON((0 0,2 0,2 2,0 2,0 0))" \
--g2 "POLYGON((1 1,3 1,3 3,1 3,1 1))"
# 并集
uv run python scripts/shapely_compute.py op union --g1 "POLYGON(...)" --g2 "POLYGON(...)"
# 差集 (g1 - g2)
uv run python scripts/shapely_compute.py op difference --g1 "POLYGON(...)" --g2 "POLYGON(...)"
# 对称差集 (XOR)
uv run python scripts/shapely_compute.py op symmetric_difference --g1 "..." --g2 "..."
# 缓冲区(扩展/侵蚀)
uv run python scripts/shapely_compute.py op buffer --g1 "POINT(0 0)" --g2 "1.5"
# 凸包
uv run python scripts/shapely_compute.py op convex_hull --g1 "MULTIPOINT((0 0),(1 1),(0 2),(2 0))"
# 外包矩形(边界框)
uv run python scripts/shapely_compute.py op envelope --g1 "POLYGON(...)"
# 简化(减少点数)
uv run python scripts/shapely_compute.py op simplify --g1 "LINESTRING(...)" --g2 "0.5"
空间关系测试(返回布尔值)。
# 多边形是否包含点?
uv run python scripts/shapely_compute.py pred contains \
--g1 "POLYGON((0 0,2 0,2 2,0 2,0 0))" \
--g2 "POINT(1 1)"
# 几何体是否相交?
uv run python scripts/shapely_compute.py pred intersects --g1 "..." --g2 "..."
# g1 是否在 g2 内部?
uv run python scripts/shapely_compute.py pred within --g1 "POINT(1 1)" --g2 "POLYGON(...)"
# 几何体是否接触(共享边界)?
uv run python scripts/shapely_compute.py pred touches --g1 "..." --g2 "..."
# 几何体是否交叉?
uv run python scripts/shapely_compute.py pred crosses --g1 "LINESTRING(...)" --g2 "LINESTRING(...)"
# 几何体是否不相交(无交集)?
uv run python scripts/shapely_compute.py pred disjoint --g1 "..." --g2 "..."
# 几何体是否重叠?
uv run python scripts/shapely_compute.py pred overlaps --g1 "..." --g2 "..."
# 几何体是否相等?
uv run python scripts/shapely_compute.py pred equals --g1 "..." --g2 "..."
# g1 是否覆盖 g2?
uv run python scripts/shapely_compute.py pred covers --g1 "..." --g2 "..."
# g1 是否被 g2 覆盖?
uv run python scripts/shapely_compute.py pred covered_by --g1 "..." --g2 "..."
几何测量。
# 面积(多边形)
uv run python scripts/shapely_compute.py measure area --geom "POLYGON((0 0,1 0,1 1,0 1,0 0))"
# 长度(线、多边形周长)
uv run python scripts/shapely_compute.py measure length --geom "LINESTRING(0 0,3 4)"
# 质心
uv run python scripts/shapely_compute.py measure centroid --geom "POLYGON((0 0,2 0,2 2,0 2,0 0))"
# 边界(minx, miny, maxx, maxy)
uv run python scripts/shapely_compute.py measure bounds --geom "POLYGON(...)"
# 外环(仅多边形)
uv run python scripts/shapely_compute.py measure exterior_ring --geom "POLYGON(...)"
# 一次性获取所有测量值
uv run python scripts/shapely_compute.py measure all --geom "POLYGON((0 0,2 0,2 2,0 2,0 0))"
几何体之间的距离。
uv run python scripts/shapely_compute.py distance --g1 "POINT(0 0)" --g2 "POINT(3 4)"
# 返回: {"distance": 5.0, "g1_type": "Point", "g2_type": "Point"}
仿射变换。
# 平移(移动)
uv run python scripts/shapely_compute.py transform translate \
--geom "POLYGON((0 0,1 0,1 1,0 1,0 0))" --params "5,10"
# 参数: dx,dy 或 dx,dy,dz
# 旋转(角度,默认绕质心)
uv run python scripts/shapely_compute.py transform rotate \
--geom "POLYGON((0 0,1 0,1 1,0 1,0 0))" --params "45"
# 参数: 角度 或 角度,原点_x,原点_y
# 缩放(默认从质心)
uv run python scripts/shapely_compute.py transform scale \
--geom "POLYGON((0 0,1 0,1 1,0 1,0 0))" --params "2,2"
# 参数: sx,sy 或 sx,sy,原点_x,原点_y
# 倾斜
uv run python scripts/shapely_compute.py transform skew \
--geom "POLYGON(...)" --params "15,0"
# 参数: xs,ys (角度)
检查和修复几何体有效性。
# 检查是否有效
uv run python scripts/shapely_compute.py validate --geom "POLYGON((0 0,1 0,1 1,0 1,0 0))"
# 返回: {"is_valid": true, "type": "Polygon", ...}
# 修复无效几何体(自相交等)
uv run python scripts/shapely_compute.py makevalid --geom "POLYGON((0 0,2 2,2 0,0 2,0 0))"
从几何体中提取坐标。
uv run python scripts/shapely_compute.py coords --geom "POLYGON((0 0,1 0,1 1,0 1,0 0))"
# 返回: {"coords": [[0,0],[1,0],[1,1],[0,1],[0,0]], "type": "Polygon"}
解析 WKT 并获取几何体信息。
uv run python scripts/shapely_compute.py fromwkt "POLYGON((0 0,1 0,1 1,0 1,0 0))"
# 返回: {"type": "Polygon", "bounds": [...], "area": 1.0, ...}
point - 单个坐标 (x, y) 或 (x, y, z)line/linestring - 一系列连接的点polygon - 闭合形状,可选孔洞multipoint, multilinestring, multipolygon - 集合"0,0 1,0 1,1 0,1" (空格分隔的 x,y 对)"POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))"所有命令返回 JSON,包含:
wkt: 结果几何体的 WKT 表示type: 几何类型 (Point, LineString, Polygon 等)bounds: (minx, miny, maxx, maxy)is_valid, is_empty: 有效性标志| 用例 | 命令 |
|---|---|
| 碰撞检测 | pred intersects |
| 点包含在多边形内 | pred contains |
| 面积计算 | measure area |
| 缓冲区区域 | op buffer |
| 形状组合 | op union |
| 形状相减 | op difference |
| 边界框 | op envelope 或 measure bounds |
| 简化路径 | op simplify |
/math-mode - 完整的数学编排 (SymPy, Z3)/math-plot - 使用 matplotlib 进行可视化每周安装量
194
仓库
GitHub 星标
3.6K
首次出现
Jan 22, 2026
安全审计
安装于
opencode190
gemini-cli188
codex188
cursor186
github-copilot184
amp181
| I want to... | Command | Example |
|---|---|---|
| Create geometry | create | create polygon --coords "0,0 1,0 1,1 0,1" |
| Intersection | op intersection | op intersection --g1 "POLYGON(...)" --g2 "POLYGON(...)" |
| Check contains | pred contains | pred contains --g1 "POLYGON(...)" --g2 "POINT(0.5 0.5)" |
| Calculate area | measure area | measure area --geom "POLYGON(...)" |
| Distance | distance | distance --g1 "POINT(0 0)" --g2 "POINT(3 4)" |
| Transform | transform translate | transform translate --geom "..." --params "1,2" |
| Validate | validate | validate --geom "POLYGON(...)" |
Create geometric objects from coordinates.
# Point
uv run python scripts/shapely_compute.py create point --coords "1,2"
# Line (2+ points)
uv run python scripts/shapely_compute.py create line --coords "0,0 1,1 2,0"
# Polygon (3+ points, auto-closes)
uv run python scripts/shapely_compute.py create polygon --coords "0,0 1,0 1,1 0,1"
# Polygon with hole
uv run python scripts/shapely_compute.py create polygon --coords "0,0 10,0 10,10 0,10" --holes "2,2 8,2 8,8 2,8"
# MultiPoint
uv run python scripts/shapely_compute.py create multipoint --coords "0,0 1,1 2,2"
# MultiLineString (pipe-separated lines)
uv run python scripts/shapely_compute.py create multilinestring --coords "0,0 1,1|2,2 3,3"
# MultiPolygon (pipe-separated polygons)
uv run python scripts/shapely_compute.py create multipolygon --coords "0,0 1,0 1,1 0,1|2,2 3,2 3,3 2,3"
Boolean geometry operations.
# Intersection of two polygons
uv run python scripts/shapely_compute.py op intersection \
--g1 "POLYGON((0 0,2 0,2 2,0 2,0 0))" \
--g2 "POLYGON((1 1,3 1,3 3,1 3,1 1))"
# Union
uv run python scripts/shapely_compute.py op union --g1 "POLYGON(...)" --g2 "POLYGON(...)"
# Difference (g1 - g2)
uv run python scripts/shapely_compute.py op difference --g1 "POLYGON(...)" --g2 "POLYGON(...)"
# Symmetric difference (XOR)
uv run python scripts/shapely_compute.py op symmetric_difference --g1 "..." --g2 "..."
# Buffer (expand/erode)
uv run python scripts/shapely_compute.py op buffer --g1 "POINT(0 0)" --g2 "1.5"
# Convex hull
uv run python scripts/shapely_compute.py op convex_hull --g1 "MULTIPOINT((0 0),(1 1),(0 2),(2 0))"
# Envelope (bounding box)
uv run python scripts/shapely_compute.py op envelope --g1 "POLYGON(...)"
# Simplify (reduce points)
uv run python scripts/shapely_compute.py op simplify --g1 "LINESTRING(...)" --g2 "0.5"
Spatial relationship tests (returns boolean).
# Does polygon contain point?
uv run python scripts/shapely_compute.py pred contains \
--g1 "POLYGON((0 0,2 0,2 2,0 2,0 0))" \
--g2 "POINT(1 1)"
# Do geometries intersect?
uv run python scripts/shapely_compute.py pred intersects --g1 "..." --g2 "..."
# Is g1 within g2?
uv run python scripts/shapely_compute.py pred within --g1 "POINT(1 1)" --g2 "POLYGON(...)"
# Do geometries touch (share boundary)?
uv run python scripts/shapely_compute.py pred touches --g1 "..." --g2 "..."
# Do geometries cross?
uv run python scripts/shapely_compute.py pred crosses --g1 "LINESTRING(...)" --g2 "LINESTRING(...)"
# Are geometries disjoint (no intersection)?
uv run python scripts/shapely_compute.py pred disjoint --g1 "..." --g2 "..."
# Do geometries overlap?
uv run python scripts/shapely_compute.py pred overlaps --g1 "..." --g2 "..."
# Are geometries equal?
uv run python scripts/shapely_compute.py pred equals --g1 "..." --g2 "..."
# Does g1 cover g2?
uv run python scripts/shapely_compute.py pred covers --g1 "..." --g2 "..."
# Is g1 covered by g2?
uv run python scripts/shapely_compute.py pred covered_by --g1 "..." --g2 "..."
Geometric measurements.
# Area (polygons)
uv run python scripts/shapely_compute.py measure area --geom "POLYGON((0 0,1 0,1 1,0 1,0 0))"
# Length (lines, polygon perimeter)
uv run python scripts/shapely_compute.py measure length --geom "LINESTRING(0 0,3 4)"
# Centroid
uv run python scripts/shapely_compute.py measure centroid --geom "POLYGON((0 0,2 0,2 2,0 2,0 0))"
# Bounds (minx, miny, maxx, maxy)
uv run python scripts/shapely_compute.py measure bounds --geom "POLYGON(...)"
# Exterior ring (polygon only)
uv run python scripts/shapely_compute.py measure exterior_ring --geom "POLYGON(...)"
# All measurements at once
uv run python scripts/shapely_compute.py measure all --geom "POLYGON((0 0,2 0,2 2,0 2,0 0))"
Distance between geometries.
uv run python scripts/shapely_compute.py distance --g1 "POINT(0 0)" --g2 "POINT(3 4)"
# Returns: {"distance": 5.0, "g1_type": "Point", "g2_type": "Point"}
Affine transformations.
# Translate (move)
uv run python scripts/shapely_compute.py transform translate \
--geom "POLYGON((0 0,1 0,1 1,0 1,0 0))" --params "5,10"
# params: dx,dy or dx,dy,dz
# Rotate (degrees, around centroid by default)
uv run python scripts/shapely_compute.py transform rotate \
--geom "POLYGON((0 0,1 0,1 1,0 1,0 0))" --params "45"
# params: angle or angle,origin_x,origin_y
# Scale (from centroid by default)
uv run python scripts/shapely_compute.py transform scale \
--geom "POLYGON((0 0,1 0,1 1,0 1,0 0))" --params "2,2"
# params: sx,sy or sx,sy,origin_x,origin_y
# Skew
uv run python scripts/shapely_compute.py transform skew \
--geom "POLYGON(...)" --params "15,0"
# params: xs,ys (degrees)
Check and fix geometry validity.
# Check if valid
uv run python scripts/shapely_compute.py validate --geom "POLYGON((0 0,1 0,1 1,0 1,0 0))"
# Returns: {"is_valid": true, "type": "Polygon", ...}
# Fix invalid geometry (self-intersecting, etc.)
uv run python scripts/shapely_compute.py makevalid --geom "POLYGON((0 0,2 2,2 0,0 2,0 0))"
Extract coordinates from geometry.
uv run python scripts/shapely_compute.py coords --geom "POLYGON((0 0,1 0,1 1,0 1,0 0))"
# Returns: {"coords": [[0,0],[1,0],[1,1],[0,1],[0,0]], "type": "Polygon"}
Parse WKT and get geometry information.
uv run python scripts/shapely_compute.py fromwkt "POLYGON((0 0,1 0,1 1,0 1,0 0))"
# Returns: {"type": "Polygon", "bounds": [...], "area": 1.0, ...}
point - Single coordinate (x, y) or (x, y, z)line/linestring - Sequence of connected pointspolygon - Closed shape with optional holesmultipoint, multilinestring, multipolygon - Collections"0,0 1,0 1,1 0,1" (space-separated x,y pairs)"POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))"All commands return JSON with:
wkt: WKT representation of result geometrytype: Geometry type (Point, LineString, Polygon, etc.)bounds: (minx, miny, maxx, maxy)is_valid, is_empty: Validity flags| Use Case | Command |
|---|---|
| Collision detection | pred intersects |
| Point-in-polygon | pred contains |
| Area calculation | measure area |
| Buffer zones | op buffer |
| Shape combination | op union |
| Shape subtraction | op difference |
/math-mode - Full math orchestration (SymPy, Z3)/math-plot - Visualization with matplotlibWeekly Installs
194
Repository
GitHub Stars
3.6K
First Seen
Jan 22, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode190
gemini-cli188
codex188
cursor186
github-copilot184
amp181
Apify Actor 输出模式生成工具 - 自动化创建 dataset_schema.json 与 output_schema.json
1,100 周安装
| Bounding box |
op envelope or measure bounds |
| Simplify path | op simplify |