
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
CGCS2000(China Geodetic Coordinate System 2000)是中国国家大地坐标系,本库提供了完整的 CGCS2000 坐标系相关功能,包括坐标转换、坐标系查询和椭球体参数获取等。
npm install cgcs2000
import CGCS2000 from 'cgcs2000';
// 或者
import { CGCS2000 } from 'cgcs2000';
const ellipsoid = CGCS2000.getEllipsoid();
console.log(ellipsoid);
// 输出: { name: 'CGCS2000', semiMajorAxis: 6378137, flattening: 1/298.257222101 }
// 单点转换
const sourceWkid = 4490; // CGCS2000 地理坐标系
const targetWkid = 4546; // CGCS2000 3度带投影(带号46)
const coordinates: [number, number] = [116.397, 39.908]; // [经度, 纬度]
const result = CGCS2000.transform(sourceWkid, targetWkid, coordinates);
console.log(result); // 转换后的坐标
// 批量转换
const points: [number, number][] = [
[116.397, 39.908],
[121.4737, 31.2304],
[113.2644, 23.1291]
];
const results = CGCS2000.transformBatch(sourceWkid, targetWkid, points);
// 根据 WKID 获取坐标系信息
const coordinateSystem = CGCS2000.getCoordinateSystem(4490);
console.log(coordinateSystem?.name); // 坐标系名称
// 根据名称获取坐标系信息
const csByName = CGCS2000.getCoordinateSystemByName("CGCS2000_Geographic");
// 验证是否为 CGCS2000 坐标系
const isValid = CGCS2000.isCGCS2000(4546); // true
// 获取 3 度带无带号坐标系
const gk3NoZone = CGCS2000.getGk3DegNoZone();
// 获取 3 度带带带号坐标系
const gk3WithZone = CGCS2000.getGk3DegWithZone();
// 获取 6 度带无带号坐标系
const gk6NoZone = CGCS2000.getGk6DegNoZone();
// 获取 6 度带带带号坐标系
const gk6WithZone = CGCS2000.getGk6DegWithZone();
// 计算 3 度带带号
const zone3 = CGCS2000.calculate3DegZoneNumber(117); // 中央子午线117度
// 计算 6 度带带号
const zone6 = CGCS2000.calculate6DegZoneNumber(117);
| WKID | 坐标系名称 | 描述 |
|---|---|---|
| 4490 | CGCS2000_Geographic | CGCS2000 地理坐标系 |
| 4546 | CGCS2000_3Degree_GK_Zone_46 | 3度带投影,46带 |
| 4526 | CGCS2000_6Degree_GK_Zone_26 | 6度带投影,26带 |
获取 CGCS2000 椭球体参数
getCoordinateSystem(wkid: number): CoordinateSystem | undefined根据 WKID 获取坐标系定义
getCoordinateSystemByName(name: string): CoordinateSystem | undefined根据名称获取坐标系定义
isCGCS2000(wkid: number): boolean验证 WKID 是否为 CGCS2000 系列坐标系
transform(sourceWkid: number, targetWkid: number, coordinates: [number, number]): [number, number]坐标转换
transformBatch(sourceWkid: number, targetWkid: number, coordinates: [number, number][]): [number, number][]批量坐标转换
获取所有 3 度带无带号坐标系定义
获取所有 3 度带带带号坐标系定义
获取所有 6 度带无带号坐标系定义
获取所有 6 度带带带号坐标系定义
calculate3DegZoneNumber(centralMeridian: number): number根据中央子午线计算 3 度带带号
calculate6DegZoneNumber(centralMeridian: number): number根据中央子午线计算 6 度带带号
当使用不支持的坐标系 WKID 时,会抛出错误:
try {
CGCS2000.transform(4326, 4490, [0, 0]); // WGS84 转 CGCS2000
} catch (error) {
console.error(error.message); // "不支持的源坐标系 WKID: 4326"
}
运行测试:
npm test
生成覆盖率报告:
npm run test:coverage
MIT
FAQs
China Geodetic Coordinate System 2000 (CGCS2000)
The npm package cgcs2000 receives a total of 11 weekly downloads. As such, cgcs2000 popularity was classified as not popular.
We found that cgcs2000 demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.