flutter_hkgrid80_wgs84_converter

This package allows you to convert WGS 84 Latitude and Longitude to Hong Kong Grid 1980 Easting and Northing.

Usage

Add this repository to pubspec.yaml.

Example:

dependencies:
    flutter:
        sdk: flutter
    flutter_hkgrid80_wgs84_converter:
        git: 
            url: git://github.com/lowkahonn/flutter_hkgrid80_wgs84_converter
            ref: master

Import package:flutter_hkgrid80_wgs84_converter/flutter_hkgrid80_wgs84_converter.dart, and use Converter.convert to convert between the two systems.

Note: This converter is up to 1e-5% error.

Example:

import 'package:flutter_hkgrid80_wgs84_converter/flutter_hkgrid80_wgs84_converter.dart';

final coordinate = new Coordinate(
    x: 834349.252, 
    y: 815894.556,
    lat: 22.281927, 
    lng: 114.158256
);

// from x y to lat long
Coordinate latLng = Converter.convert.gridToLatLng(coordinate);
print(latLng.lat.toString()); // 22.281930012478536 
print(latLng.lng.toString()); // 114.15824821181121

// from lat long to x y
Coordinate xy = Converter.convert.latLngToGrid(coordinate);
print(xy.x.toString()); // 834350.1488648592
print(xy.y.toString()); // 815894.2762260285

Libraries

constants
converter
coordinate
flutter_hkgrid80_wgs84_converter

Dart

VM

dart:ffi
Foreign Function Interface for interoperability with the C programming language. [...]

Web

dart:html
HTML elements and other resources for web-based applications that need to interact with the browser and the DOM (Document Object Model). [...]
dart:js
Low-level support for interoperating with JavaScript. [...]
dart:js_util
Utility methods to efficiently manipulate typed JSInterop objects in cases where the name to call is not known at runtime. You should only use these methods when the same effect cannot be achieved with @JS annotations. These methods would be extension methods on JSObject if Dart supported extension methods.