FLUTTER ECOSYSTEM

fegyi001/mgrs_dart

WGS84 अक्षांश/देशांतर और MGRS निर्देशांक के बीच परिवर्तन के लिए उपयोगिता (Dart संस्करण of proj4js/mgrs)

mgrs_dart प्रोजेक्ट कवर
Stars
1
Forks
3
अंतिम पुश (UTC)
4 नव॰ 2025
प्रोजेक्ट स्थिति
सक्रिय
Gergely Padányi-Gulyás GitHub avatar
GITHUB User

Gergely Padányi-Gulyás ↗

Software developer | Clean coder | Nvim enthusiast | Weekend woodworker | Goat owner

भाषाएँDart

इस रिपॉज़िटरी के पैकेज

उपयोग की गई निर्भरताएँ

निर्भरता सूची 3 आइटम

मूल README

यह अंग्रेज़ी मूल स्नैपशॉट है। नवीनतम सामग्री GitHub पर देखें।

README खोलें / बंद करें

mgrs_dart

Utility for converting between WGS84 lat/lng and MGRS coordinates (Dart version of proj4js/mgrs).

Installing

Add mgrs_dart to pubspec.yml (dependencies section), then run pub get to download the new dependencies.

dependencies:
  mgrs_dart: any # or the latest version on Pub

Using

Mgrs_dart has 3 methods

  • toPoint, takes an mgrs string, returns an array of [lon,lat]
  • forward, takes an array of [lon,lat] and optional accuracy and returns an mgrs string
  • inverse, takes an mgrs string and returns a bbox.
import 'package:mgrs_dart/mgrs_dart.dart';

void main() {
  var point = [-115.08209766323476, 36.236123461597515];
  var mgrsString = '11SPA7234911844';
  var accuracy = 5;

  // MGRS string to LonLat (results List<double>)
  var calculatedPoint = Mgrs.toPoint(mgrsString);
  print("Mgrs.toPoint('$mgrsString') = $calculatedPoint;");
  // Mgrs.toPoint('11SPA7234911844') = [-115.08209766323476, 36.236123461597515];

  // LonLat to MGRS string (results String)
  var calculatedMgrsString = Mgrs.forward(point, accuracy);
  print("Mgrs.forward($point, $accuracy) = '$calculatedMgrsString';");
  // Mgrs.forward([-115.08209766323476, 36.236123461597515], 5) = '11SPA7234911844';

  // MGRS string to BBOX  (results List<double>)
  var calculatedBox = Mgrs.inverse(mgrsString);
  print("Mgrs.inverse('$mgrsString') = $calculatedBox;");
  // Mgrs.inverse('11SPA7234911844') = [-115.08209766323476, 36.236123461597515, -115.08208632067898, 36.23613229376363];
}

Author

Mgrs_dart was ported from proj4js/mgrs by Gergely Padányi-Gulyás (@fegyi001) at Ulyssys Ltd, Budapest, Hungary.