https://github.com/icemap/coordinate
A golang library for geographic coordinate conversions. Can convert coordinate from [lWGS84]/[Web Mercator]/[Mercator]/[GCJ02].
https://github.com/icemap/coordinate
geography golang
Last synced: 7 months ago
JSON representation
A golang library for geographic coordinate conversions. Can convert coordinate from [lWGS84]/[Web Mercator]/[Mercator]/[GCJ02].
- Host: GitHub
- URL: https://github.com/icemap/coordinate
- Owner: Icemap
- Created: 2022-02-25T13:42:44.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-02-27T06:01:07.000Z (over 3 years ago)
- Last Synced: 2025-01-12T11:49:35.295Z (over 1 year ago)
- Topics: geography, golang
- Language: Go
- Homepage:
- Size: 12.7 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# coordinate

English | [中文](README_ch.md)
A golang library for geographic coordinate conversions, supporting the following coordinate systems:
- [WGS84](https://en.wikipedia.org/wiki/World_Geodetic_System)
- [Web Mercator](https://en.wikipedia.org/wiki/Web_Mercator_projection)
- [Mercator](https://en.wikipedia.org/wiki/Mercator_projection)
- [GCJ02](https://en.wikipedia.org/wiki/Restrictions_on_geographic_data_in_China#GCJ-02)
## Feature
- Convert coordinates between this coordinate systems
## Install
```bash
$ go get -u github.com/Icemap/coordinate
```
## Example
### `GCJ02` coordinate system to `WGS84` coordinate system
```go
import "github.com/Icemap/coordinate"
gcj02Point := Coordinate{X: 110.0, Y: 20.0}
wgs84Point, err := coordinate.Convert(coordinate.GCJ02, coordinate.WGS84, gcj02Point)
```
### `GCJ02` coordinate system to `Web Mercator` coordinate system
```go
import "github.com/Icemap/coordinate"
gcj02Point := Coordinate{X: 110.0, Y: 20.0}
webMercatorPoint, err := coordinate.Convert(coordinate.GCJ02, coordinate.WebMercator, gcj02Point)
```