분류, 패키지 및 저장소 검색

google_maps_routes 표지
패키지 상세v1.1.2

google_maps_routes

Google 지도 방향 API를 사용하여 Google 지도에 경로를 그리는 패키지입니다.

AndroidiOSWeb
30일 다운로드
850
좋아요
29
Pub 점수
140

패키지 설치

flutter pub add google_maps_routes

패키지 개요

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

Google Directions API를 사용하여 Google 지도에 경로를 그리는 데 도움을 주는 플러터 패키지입니다. 위치 간 경로 정보를 가져와 렌더링함으로써 경로 시각화를 단순화하며, 안드로이드, iOS 및 웹 플랫폼에서 실시간 내비게이션 경로를 지원합니다. Google Maps for Flutter와 원활하게 통합되어 개발자가 다각선 경로, 경유지, 여행 정보를 표시할 수 있게 해줍니다. 방향별 내비게이션 또는 위치 기반 라우팅 기능이 필요한 앱에 적합합니다.

사용 사례

  • 운전 방향 표시
  • 걷기 또는 자전거 길 시각화
  • 턴바이턴 내비게이션 통합
  • 배송 또는 라이드셰어링 앱 구축
  • 여행 일정 계획 도구 만들기

주요 기능

  • 폴리라인을 사용한 경로 그리기
  • 여러 경유지 지원
  • Google Directions API와의 통합
  • 크로스 플랫폼 호환성 (Android, iOS, Web)
  • 최소 구성으로 간편한 설정

적합한 대상

  • 내비게이션 앱 개발자
  • 물류 및 배송 애플리케이션
  • 여행 및 관광 앱
  • 위치 기반 서비스 플랫폼
  • 동적 라우트 렌더링이 필요한 앱

고려 사항

  • 유효한 Google Maps API 키가 필요합니다
  • 인터넷 연결에 따라 다릅니다
  • Google Directions API 사용 비용이 발생할 수 있습니다
  • Google 맵 플랫폼에 제한됨
  • API 사용 레벨에 따라 속도 제한이 적용됩니다

원본 README

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

google_maps_routes

This is a package for creating routes on google maps using the directions API from Google. Routes are drawn with help of the flutter_polyline_points package.

Screenshot

example-route

Usage

To use the google_maps_routes package, first depend on it.

Then import it where you want to use it

import 'package:google_maps_routes/google_maps_routes.dart';

To use it you need a List of points like this:

/// LatLng is included in google_maps_flutter
List<LatLng> points = [
    LatLng(latitude, longitude),
    LatLng(latitude, longitude),
    LatLng(latitude, longitude),
    LatLng(latitude, longitude),
];

Then you need to instantiate this plugin

MapsRoutes route = new MapsRoutes();

To create a route, just call the following function:

/// routeName is a string and can be anything; it can include spaces but
/// they will be replaced with a dash
/// example: 'Example route' turns into 'Example-route'

/// color is a Color type and will be used as the polyline color:
/// example: Color.fromRGBO(130, 78, 210, 1.0)

/// googleApyKey is a string and is a google directions API key
/// example: get it at
/// https://developers.google.com/maps/documentation/directions/get-api-key
await route.drawRoute(points, routeName, color, googleApiKey);

To use a different travel mode, use the travelMode parameter.

/// Options: driving, bicycling, transit, walking
await route.drawRoute(
    points,
    routeName,
    color,
    googleApiKey,
    travelMode: TravelModes.walking
);

To display the polylines you need to add a polylines parameter to your google map widget.

GoogleMap(polylines: route.routes),

If you ever want to clear the routes, just call:

route.routes.clear();

If you want to calculate the distance of the route use you call the following function with the same List of points you used for drawing the route. You can also use it by itself.

/// Initialize a calculator
DistanceCalculator distanceCalculator = new DistanceCalculator();

/// Call a function that returns a string
/// Pass it the List of points
/// By default it will return with 1 decimal point but you can pass an 
/// option that changes that 
distanceCalculator.calculateRouteDistance(points, decimals: 1);
Credits

카테고리

의존성

의존성 목록 2 개

소스 저장소

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

아직 데이터가 없습니다.