Search packages, repositories and app categories

Package detailsv3.0.0

mgrs_dart

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

AndroidiOSWebmacOSWindowsLinux
30-day downloads
1.2M
Likes
7
Pub points
160

Install package

flutter pub add mgrs_dart

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

The mgrs_dart package provides a Dart implementation for converting between WGS84 latitude/longitude coordinates and Military Grid Reference System (MGRS) coordinates. It is designed to mirror the functionality of proj4js/mgrs, offering accurate and efficient geospatial transformations. Ideal for applications requiring precise location referencing in military or geographic contexts, it supports all major platforms including Android, iOS, Web, macOS, Windows, and Linux. The package is lightweight and integrates seamlessly with Flutter projects.

Use cases

  • Military and defense applications
  • Geospatial data processing
  • Location-based mapping tools
  • Field data collection systems
  • Coordinate standardization across platforms

Key features

  • Accurate WGS84 to MGRS conversion
  • Support for all major platforms
  • Lightweight and easy to integrate
  • Bidirectional coordinate transformation
  • Open-source and actively maintained

Suitable for

  • Developers working with geospatial data
  • Applications requiring MGRS standards
  • Flutter apps needing coordinate system conversion
  • Projects involving field operations or military logistics

Considerations

  • Requires understanding of MGRS coordinate system
  • Limited to WGS84 and MGRS conversions
  • No support for other coordinate systems
  • Best suited for use cases where MGRS precision is required
  • Not intended for general-purpose GIS workflows

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

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.

Categories

Dependencies

Dependency list 1 items

Source repository

Projects using this package