0 purchases
coord convert
CoordConvert #
CoordConvert is a small library to convert coordinates between different coordinate systems.
Supported coordinate systems:
WGS-84 | Standart used in most maps such as Google Maps, Apple Maps, Mapbox, OpenStreetMaps, etc
GCJ-02 | Coordinate system used by Chinese maps like Amap (Gaode Maps), Tencent Maps, etc except Baidu maps
BD-09 | Coordinate system used by Baidu Maps
Based on formulas from here
Get started #
Add dependency #
dependencies:
coord_convert: 1.0.0
copied to clipboard
Usage examples #
Convert to WGS-84
import 'package:coord_convert/coord_convert.dart';
final coords = Coords(31.233568, 121.505504); // Coords(lat, lng)
// WGS-84 from GCJ-02
final Coords fromGCJ02 = CoordConvert.gcj02towgs84(coords);
// WGS-84 from BD-09
final Coords fromBD09 = CoordConvert.bd09towgs84(coords);
copied to clipboard
Convert to GCJ-02
import 'package:coord_convert/coord_convert.dart';
final coords = Coords(31.233568, 121.505504); // Coords(lat, lng)
// GCJ-02 from WGS-84
final fromWGS84 = CoordConvert.wgs84togcj02(coords);
// GCJ-02 from BD-09
final fromBD09 = CoordConvert.bd09togcj02(coords);
copied to clipboard
Convert to BD-09
import 'package:coord_convert/coord_convert.dart';
final coords = Coords(31.233568, 121.505504); // Coords(lat, lng)
// BD-09 from WGS-84
final fromWGS84 = CoordConvert.wgs84tobd09(coords);
// BD-09 from GCJ-02
final fromGCJ02 = CoordConvert.gcj02tobd09(coords);
copied to clipboard
Contributing #
Pull requests are welcome.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.