Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gee1k/coord-transform
一个现代的、支持 TypeScript 的百度坐标(BD09)、火星坐标(GCJ02)、和WGS84坐标系相互转换。
https://github.com/gee1k/coord-transform
Last synced: about 2 months ago
JSON representation
一个现代的、支持 TypeScript 的百度坐标(BD09)、火星坐标(GCJ02)、和WGS84坐标系相互转换。
- Host: GitHub
- URL: https://github.com/gee1k/coord-transform
- Owner: gee1k
- License: mit
- Created: 2023-07-14T09:13:14.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-07-14T09:46:01.000Z (about 1 year ago)
- Last Synced: 2024-07-06T02:18:42.025Z (3 months ago)
- Language: TypeScript
- Size: 18.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## 坐标转换
> 来自 [https://github.com/wandergis/coordtransform](https://github.com/wandergis/coordtransform)一个现代的、支持 TypeScript 的百度坐标(BD09)、火星坐标(GCJ02)、和WGS84坐标系相互转换。
### 安装
```bash
// npm
npm install @isvend/coord-transform// pnpm
pnpm add @isvend/coord-transform
```### 使用
```js
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));```