@isvend/coord-transform
TypeScript icon, indicating that this package has built-in type declarations

0.0.11 • Public • Published

坐标转换

来自 https://github.com/wandergis/coordtransform

一个现代的、支持 TypeScript 的百度坐标(BD09)、火星坐标(GCJ02)、和WGS84坐标系相互转换。

安装

// npm
npm install @isvend/coord-transform

// pnpm
pnpm add @isvend/coord-transform

使用

import {
  transformWGS84ToBD09,
  transformBD09ToGCJ02,
  transformBD09ToWGS84,
  transformGCJ02ToWGS84,
  transformWGS84ToGCJ02,
} from "@isvend/coord-transform";

const lng = 116.404;
const lat = 39.915;

console.log("WGS84 to GCJ02", transformWGS84ToGCJ02(lng, lat));
console.log("GCJ02 to WGS84", transformGCJ02ToWGS84(lng, lat));

console.log("WGS84 to BD09", transformWGS84ToBD09(lng, lat));
console.log("BD09 to WGS84", transformBD09ToWGS84(lng, lat));

console.log("BD09 to GCJ02", transformBD09ToGCJ02(lng, lat));
console.log("GCJ02 to BD09", transformBD09ToGCJ02(lng, lat));

Package Sidebar

Install

npm i @isvend/coord-transform

Weekly Downloads

92

Version

0.0.11

License

MIT

Unpacked Size

15.3 kB

Total Files

6

Last publish

Collaborators

  • isvend