패키지, 저장소 및 앱 카테고리 검색

GitHub 저장소kb0/maps_toolkit

maps_toolkit

면적, 거리, 방향 측정을 위한 Dart 라이브러리

maps_toolkit 프로젝트 이미지
스타
46
포크
17
최근 푸시(UTC)
2025. 1. 29.
프로젝트 상태
활성

원본 README

아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.

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.

Kirill Bychkov GitHub avatar
언어Dart

분류

이 저장소가 배포한 패키지

사용 중인 의존성

의존성 목록 2 개

  • test개발 의존성any
  • lints개발 의존성any

프로젝트에 맞는 저장소를 선택하려면?

사용 목적에 따라 검색하고 개발 활동을 비교한 뒤 원본 저장소에서 요구 사항을 확인하세요.

  1. 이름, 작성자 또는 설명으로 검색하고 기술 주제로 범위를 좁힙니다.
  2. 스타, 포크, 최근 푸시를 함께 비교하세요. 스타는 관심의 지표이며 품질을 보장하지 않습니다.
  3. 사용하기 전에 GitHub에서 README, 라이선스, Issues를 확인하세요.

출처 및 관리

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗