gcoord-crs-convert
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "gcoord-crs-convert" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-4f15212c0598336b9a507e70d4d6a06175ac24ca75f0d5be08d35c4710899ce6. Verify the upstream source and version against https://skillhub.cn/skills/user_f1b049da/grc20265410 before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
skillhub.cn
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
Perform latitude/longitude conversions between WGS84, GCJ02, and BD09 coordinate systems in the browser using gcoord to facilitate map point alignment. Intended for scenarios that require coordinate system conversion, use of the gcoord library, or handling conversions among WGS84, GCJ02 (China "Mars" coordinates), and BD09 (Baidu coordinates).
Introduction source: third_party · user_f1b049da · 1.0.0 Reference
SkillPi interpretation
- Tasks
- Translation pending; see source documentation.
- Testing
- Not tested
Browse files
Frontmatter
name: gcoord-crs-convert
slug: grc20265410
displayName: 坐标系转换
version: 1.0.0
summary: 用 gcoord 在 WGS84、GCJ02、BD09 坐标系间本地转换。
license: MIT
description: 用 gcoord 在浏览器内把经纬度在 WGS84、GCJ02、BD09 之间转换,便于地图打点对齐。当用户需要坐标系转换、gcoord、火星坐标、百度坐标、WGS84转GCJ02时使用。坐标系转换(gcoord)
灵感:能力工具箱 geo-coord(pkg: gcoord)。
拜访地址、门店坐标在不同地图源之间错位时,用 gcoord 在 WGS84 / GCJ02(国测局/火星)/ BD09(百度)间本地转换,不请求后端。
何时使用
- GPS(WGS84)打点到高德/腾讯(GCJ02)
- 百度地图坐标转到高德
- CRM 客户地址坐标统一存储后再展示
硬约束
- 依赖
gcoord;转换用gcoord.transform([lng, lat], from, to)。 - 输入输出均为 [经度, 纬度] 顺序;校验范围(经度 -180~180,纬度 -90~90)。
- 非法输入返回中文原因;禁止静默返回
[NaN, NaN]。 - UI 标明「当前坐标系」与「目标坐标系」,避免连转两次。
- 纯本地;不替代测绘资质与合规要求(仅工具换算)。
推荐实现要点
import gcoord from 'gcoord'
export type Crs = 'WGS84' | 'GCJ02' | 'BD09'
const CRS_MAP = {
WGS84: gcoord.WGS84,
GCJ02: gcoord.GCJ02,
BD09: gcoord.BD09,
} as const
export function convertLngLat(
lng: number,
lat: number,
from: Crs,
to: Crs,
): { ok: true; lng: number; lat: number } | { ok: false; reason: string } {
if (from === to) return { ok: true, lng, lat }
if (![lng, lat].every((n) => Number.isFinite(n))) {
return { ok: false, reason: '经纬度必须是有效数字' }
}
if (lng < -180 || lng > 180 || lat < -90 || lat > 90) {
return { ok: false, reason: '经纬度超出合理范围' }
}
try {
const [outLng, outLat] = gcoord.transform([lng, lat], CRS_MAP[from], CRS_MAP[to])
return { ok: true, lng: outLng, lat: outLat }
} catch {
return { ok: false, reason: '坐标转换失败' }
}
}
/** GPS → 高德/腾讯 */
export const wgs84ToGcj02 = (lng: number, lat: number) =>
convertLngLat(lng, lat, 'WGS84', 'GCJ02')
Agent 步骤
- 安装
gcoord,封装convertLngLat与常用快捷函数。 - 表单:原系/目标系下拉 + 经纬度;结果可复制。
- 自测:已知样点 WGS84→GCJ02 偏移合理(中国境内一般有偏移);同系原样返回。
与 geo-line-distance
- 本 Skill:换坐标系。
- 直线距离:同系坐标下再算距离(先转换再算)。
附加
Current listing version
1.0.0
Safety and assessment details
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 解决地图坐标在不同坐标系间转换的实际工程痛点
- 适用于GPS打点对齐、多地图源坐标统一等高频场景
- 纯本地转换避免后端请求,提升效率
Highlights
- 触发词覆盖完整:坐标系转换、gcoord、火星坐标、百度坐标等
- 场景边界清晰,无歧义
Areas to improve
-
引用文件缺失 Reported severity: Major
SKILL.md 引用了 README.md、reference.md、templates/usage.md 但未传入
Recommendation: 请补充相关引用文件或移除引用链接
Highlights
- 参数校验完整:数字有效性、经纬度范围校验
- 异常处理完善:非法输入返回中文原因,try-catch捕获转换异常
- 有明确的自测验证要求
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
These common operations were not identified in the main document. This does not mean no permissions or risks exist.
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.