maps_toolkit은 지도 작업에 필요한 지리공간 유틸리티를 제공하는 Flutter/Dart 패키지입니다. 다각형의 면적을 계산하고, 지리적 점 사이의 거리를 계산하며, 좌표 간 헤딩과 오프셋을 결정할 수 있는 도구를 제공합니다. 이는 Android Maps Utils 라이브러리의 기능을 반영합니다. 크로스플랫폼 사용을 위해 설계되었으며, Android, iOS, Web, macOS, Windows, Linux를 지원합니다. 복잡한 지리 계산을 단순화하여 정확한 측정과 공간 분석이 필요한 위치 기반 애플리케이션에 이상적입니다.
사용 사례
지도에서 다각형 면적 계산
두 좌표 사이의 거리 측정
점들 사이의 방향 헤딩 결정
좌표 오프셋 계산
지리공간 데이터 시각화
경로 계획 및 분석
주요 기능
다각형 면적 계산
거리 및 방향 계산
좌표 오프셋 유틸리티
크로스 플랫폼 호환성
경량이며 통합이 쉬움
Android Maps Utils의 포트
적합한 대상
지도 기반 애플리케이션
위치 인식 기능
지리정보시스템(GIS) 관련 프로젝트
탐색 및 라우팅 도구
실시간 추적 시스템
공간 분석
고려 사항
유효한 위도/경도 입력이 필요합니다
내장된 지도 렌더링 없음
정확한 지질 계산에 의존합니다
대규모 지형 모델링에 적합하지 않음
google_maps_flutter와 같은 맵 위젯과 함께 사용하는 것이 가장 좋습니다
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
maps_toolkit
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';
voidmain() {
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.