coord_convert 0.1.0

Flutter Android iOS web

Small library to convert coordinates between different coordinate systems.

CoordConvert #

pub package

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: 0.1.0

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);

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);

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);

Contributing #

Pull requests are welcome.

0
likes
100
pub points
34%
popularity

Small library to convert coordinates between different coordinate systems.

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

mattermoran@gmail.com

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on coord_convert