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

插件详情v3.1.0

maps_toolkit

地图工具包 - 地理测量工具 - 多边形面积、点之间的距离、两点间的方位角和偏移量(来自 `android-maps-utils` 的 SphericalUtil、PolyUtil 的移植)。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
4.8万
喜欢数
389
Pub 分数
160

安装插件

flutter pub add maps_toolkit

插件介绍

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

maps_toolkit 是一个 Flutter/Dart 包,提供用于处理地图的必要地理空间工具。它提供了计算多边形面积、计算地理点之间的距离,以及确定坐标之间的航向和偏移量的工具——与 Android Maps Utils 库的功能相匹配。该包专为跨平台使用而设计,支持 Android、iOS、Web、macOS、Windows 和 Linux。该包简化了复杂的地理计算,非常适合需要精确测量和空间分析的位置相关应用。

适合场景

  • 计算地图上的多边形面积
  • 测量两个坐标之间的距离
  • 确定两点之间的方向方位
  • 计算坐标偏移
  • 地理空间数据可视化
  • 路线规划与分析

主要特点

  • 多边形面积计算
  • 距离和方位计算
  • 坐标偏移工具
  • 跨平台兼容性
  • 轻量且易于集成
  • Android Maps Utils 的移植版本

适合对象

  • 基于地图的应用程序
  • 位置感知功能
  • GIS 相关项目
  • 导航和路由工具
  • 实时跟踪系统
  • 空间分析

使用建议

  • 需要有效的纬度/经度输入
  • 无内置地图渲染
  • 依赖精确的大地测量计算
  • 不适合大规模地形建模
  • 最好与地图小部件(如 google_maps_flutter)一起使用

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

maps_toolkit

Pub Package Build Status Coverage Status GitHub Issues GitHub Forks GitHub Stars GitHub License

A library for area, distance, heading measurements (spherical_util.dart if port from android-maps-utils).

Getting Started

In your dart/flutter project add the dependency:

 dependencies:
   ...
   maps_toolkit: ^3.0.0

A simple usage example:

import 'package:maps_toolkit/maps_toolkit.dart';

main() {
  val distanceBetweenPoints = SphericalUtil.computeDistanceBetween(
    LatLng(51.5073509, -0.1277583),
    LatLng(48.856614, 2.3522219)
  );

  final p1 = LatLng(45.153474463955796, 39.33852195739747);
  final p2 = LatLng(45.153474463955796, 39.33972358703614);
  final p3 = LatLng(45.15252112936569, 39.33972358703614);
  final p4 = LatLng(45.1525022138355, 39.3385460972786);

  val areaInSquareMeters = SphericalUtil.computeArea([p1, p2, p3, p4, p1]);
}

Usage with Google Maps package (specify a prefix for an import):

import 'package:maps_toolkit/maps_toolkit.dart' as mp;
import 'package:google_maps/google_maps.dart';
import 'package:test/test.dart';

void main() {
  final pointFromToolkit = mp.LatLng(90, 0);
  final pointFromGoogleMap = LatLng(90, 0);

  mp.SphericalUtil.computeAngleBetween(pointFromToolkit, pointFromToolkit);
}

List of functions

  • SphericalUtil.computeArea - calculate the area of a closed path on Earth.

  • SphericalUtil.computeDistanceBetween - calculate the distance between two points, in meters.

  • SphericalUtil.computeHeading - calculate the heading from one point to another point.

  • SphericalUtil.computeLength - calculate the length of the given path, in meters, on Earth.

  • SphericalUtil.computeOffset - calculate the point resulting from moving a distance from an origin in the specified heading (expressed in degrees clockwise from north).

  • SphericalUtil.computeOffsetOrigin - calculate the location of origin when provided with a point destination, meters travelled and original heading.

  • SphericalUtil.computeSignedArea - calculate the signed area of a closed path on Earth.

  • SphericalUtil.interpolate - calculate the point which lies the given fraction of the way between the origin and the destination.

  • PolygonUtil.containsLocation - computes whether the given point lies inside the specified polygon.

  • PolygonUtil.isLocationOnEdge - computes whether the given point lies on or near the edge of a polygon, within a specified tolerance in meters.

  • PolygonUtil.isLocationOnPath - computes whether the given point lies on or near a polyline, within a specified tolerance in meters.

  • PolygonUtil.locationIndexOnPath - computes whether (and where) a given point lies on or near a polyline, within a specified tolerance.

  • PolygonUtil.locationIndexOnEdgeOrPath - computes whether (and where) a given point lies on or near a polyline, within a specified tolerance.

  • PolygonUtil.simplify - simplifies the given poly (polyline or polygon) using the Douglas-Peucker decimation algorithm.

  • PolygonUtil.isClosedPolygon - returns true if the provided list of points is a closed polygon.

  • PolygonUtil.distanceToLine - computes the distance on the sphere between the point p and the line segment start to end.

  • PolygonUtil.decode - decodes an encoded path string into a sequence of LatLngs.

  • PolygonUtil.encode - encodes a sequence of LatLngs into an encoded path string.

Features and bugs

Please file feature requests and bugs at the issue tracker.

所属分类

源码仓库

使用此插件的项目

暂无相关数据。