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

패키지 상세v1.0.1

google_map_polyutil

네이티브 Google 지도 유틸리티 클래스 PolyUtil의 Dart 구현

30일 다운로드
16
좋아요
26
Pub 점수
40

패키지 설치

flutter pub add google_map_polyutil

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

Google Maps PolyUtil 클래스의 Dart 구현으로, 지도에서 다각형과 다각선을 처리하기 위한 기하학적 유틸리티를 제공합니다. 점이 다각형 내부에 있는지 확인하거나, 점 간 거리를 계산하며, 다각선을 단순화하는 등의 작업을 지원합니다. 이 패키지는 Google Maps를 사용하는 Flutter 앱에서 지리공간 계산에 특히 유용합니다. 원본 Android 및 iOS Google Maps SDK와 기능을 동일하게 하여 플랫폼 간 일관된 동작을 보장합니다.

사용 사례

  • 점이 다각형 내부에 있는지 확인하기
  • 복잡한 다각형선 간소화
  • 지도 좌표 간 거리 계산
  • 다각형 경계를 갖춘 지오펜싱
  • 지도 기반 데이터 필터링

주요 기능

  • 크로스 플랫폼 호환성
  • PolyUtil 메서드의 정확한 복제
  • 경량이고 효율적
  • 위도/경도 연산을 지원합니다
  • 외부 종속성 없음

적합한 대상

  • Google Maps를 사용하는 Flutter 앱
  • 위치 기반 서비스
  • 지오페싱 구현
  • Map 데이터 처리
  • 실시간 추적 시스템

고려 사항

  • 모든 네이티브 PolyUtil 기능을 지원하지 않습니다
  • 경계 사례에 대한 수동 처리가 필요합니다
  • 기본적인 기하 연산에 국한됨
  • 내장된 지도 렌더링 없음
  • 고성능 실시간 기하학에 적합하지 않습니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

google_map_polyutil

Dart bridge between native google map utility class PolyUtil and your application.

Now you can use all PolyUtil methods that are available in google map utility class PolyUtil.

Usage

Import package:google_map_polyutil/google_map_polyutil.dart and then you are all set to call all it's static methods.

Methods available

  • containsLocation [Future] : Computes whether the given point lies inside the specified polygon.
  • decode [Future<List>] : Decodes an encoded path string into a sequence of LatLngs.
  • distanceToLine [Future] : Computes the distance on the sphere between the point p and the line segment start to end.
  • encode [Future] : Encodes a sequence of LatLngs into an encoded path string.
  • isClosedPolygon [Future] : Returns true if the provided list of points is a closed polygon (i.e., the first and last points are the same), and false if it is not.
  • isLocationOnEdge [Future] : Computes whether the given point lies on or near the edge of a polygon, within a specified tolerance in meters.
  • isLocationOnPath [Future] : Computes whether the given point lies on or near a polyline, within a specified tolerance in meters.
  • simplify Future<List> : Simplifies the given poly (polyline or polygon) using the Douglas-Peucker decimation algorithm.

Example

// Let's prepare dummy arguments.
List<LatLng> paths = [];
paths.add(LatLng(0,0));
paths.add(LatLng(0,1));
paths.add(LatLng(0,2));
paths.add(LatLng(0,4));

// Coordinate you want to check if it lies within or near path.
LatLng point = LatLng(0, 3);

String encodedString = "???_ibE?_seK?_ibE";
containsLocation
GoogleMapPolyUtil.containsLocation(
	point: point,
    polygon: paths
).then((result) => print(result));
decode
GoogleMapPolyUtil.decode(
	encodedPath: encodedPath
).then((result) => print(result));
distanceToLine
GoogleMapPolyUtil.distanceToLine(
	point: LatLng(0, 0),
    start: LatLng(0, 0),
    end: LatLng(0, 8)
).then((result) => print(result));
encode
GoogleMapPolyUtil.encode(
	path: paths
).then((result) => print(result));
isClosedPolygon
GoogleMapPolyUtil.isClosedPolygon(
	poly: path,
    polygon: paths
).then((result) => print(result));
isLocationOnEdge
GoogleMapPolyUtil.isLocationOnEdge(
	point: point,
    polygon: paths
).then((result) => print(result));
isLocationOnPath
GoogleMapPolyUtil.isLocationOnEdge(
	point: point,
    polygon: paths
).then((result) => print(result));
simplify
GoogleMapPolyUtil.simplify(
	poly: paths,
    tolerance: 100
).then((result) => print(result));

Author

Ashim Upadhaya

Note : This plugin can only be used for android application. iOS support in not available yet.

카테고리

의존성

의존성 목록 2 개

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.