搜索插件、代码仓与 APP 分类

插件详情v3.0.0

mgrs_dart

用于在WGS84纬度/经度和MGRS坐标之间进行转换的工具(proj4js/mgrs的Dart版本)。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
120万
喜欢数
7
Pub 分数
160

安装插件

flutter pub add mgrs_dart

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

mgrs_dart 包提供了一种 Dart 实现,用于在 WGS84 纬度/经度坐标与军用网格参考系统(MGRS)坐标之间进行转换。它旨在模仿 proj4js/mgrs 的功能,提供准确且高效的地理空间转换。适用于需要在军事或地理环境中精确位置引用的应用程序,支持所有主要平台,包括 Android、iOS、Web、macOS、Windows 和 Linux。该包轻量级,可无缝集成到 Flutter 项目中。

适合场景

  • 军事和国防应用
  • 地理空间数据处理
  • 基于位置的映射工具
  • 字段数据采集系统
  • 跨平台的坐标标准化

主要特点

  • 精确的 WGS84 到 MGRS 转换
  • 支持所有主要平台
  • 轻量且易于集成
  • 双向坐标变换
  • 开源且持续维护

适合对象

  • 开发人员处理地理空间数据
  • 需要MGRS标准的应用程序
  • Flutter 应用需要坐标系转换
  • 涉及野外作业或军事后勤的项目

使用建议

  • 需要了解MGRS坐标系统
  • 仅限WGS84和MGRS转换
  • 不支持其他坐标系
  • 最适合需要MGRS精度的用例
  • 不适用于通用地理信息系统工作流

原始 README

以下为关联源码仓库的 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.

所属分类

依赖

依赖清单 1 项

源码仓库

使用此插件的项目