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

open_route_service 표지
패키지 상세v1.2.9

open_route_service

Dart 및 Flutter 프로젝트용으로 openrouteservice API를 래핑한 컨테이너로, 경로와 그 데이터를 쉽게 생성할 수 있습니다.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
1.3천
좋아요
90
Pub 점수
150

패키지 설치

flutter pub add open_route_service

패키지 개요

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

open_route_service 패키지는 Dart 및 Flutter용으로 OpenRouteService API에 대한 사용자 친화적인 래퍼를 제공하여 개발자가 애플리케이션에 경로 계획 및 지리공간 데이터를 쉽게 통합할 수 있도록 합니다. 깔끔하고 직관적인 메서드를 통해 경로 계산, 안내 정보 조회, 맵 관련 정보 접근 등의 작업을 간소화합니다. 단계별 내비게이션 또는 여행 거리 계산이 필요한 위치 기반 앱에 적합하며, 모바일, 웹, 데스크톱 등 다양한 플랫폼을 지원합니다. 이 패키지는 가볍고 잘 문서화되어 있어 초보자와 숙련된 개발자 모두에게 접근하기 쉬우며 사용하기 편리합니다.

사용 사례

  • 여행 앱에서의 경로 계획
  • 턴바이턴 안내를 제공하는 내비게이션
  • 거리 및 소요 시간 계산
  • 지도 기반 물류 추적
  • 지리공간 데이터 검색
  • 다중 플랫폼 위치 서비스

주요 기능

  • 간단한 API 통합
  • 다중 플랫폼 지원
  • 실시간 경로 생성
  • JSON 응답 파싱
  • 내장 오류 처리
  • 크로스 플랫폼 호환성

적합한 대상

  • Flutter 개발자가 탐색 기능을 구축하고 있습니다
  • 경로 최적화가 필요한 앱
  • OpenRouteService API를 사용하는 프로젝트
  • 경량 지오로케이션 도구를 찾는 개발자
  • 크로스플랫폼 모바일 및 웹 앱

고려 사항

  • OpenRouteService에서 API 키가 필요합니다
  • 인터넷 연결에 따라 다름
  • OpenRouteService의 사용 가능한 엔드포인트에 제한됨
  • 복잡한 응답을 처리하기 위해 추가 파싱이 필요할 수 있습니다
  • 구독 등급에 따라 속도 제한이 적용됩니다

원본 README

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

open_route_service

Build, Format, Test open_route_service version pub points OpenSSF Scorecard License: MIT

A Dart and Flutter client for openrouteservice directions, isochrones, matrices, geocoding, points of interest, elevation, and route optimization.

The package provides typed request and response models around the openrouteservice API for Dart and Flutter projects.

Contribute to openrouteservice API by donating to help keep the service free and accessible to everyone. For more information about the API, view the openrouteservice API documentation.

Contents

Features

The goal is to develop an all-encompassing package that can encapsulate everything openrouteservice API offers.

With all of their internal Optimizations, this includes:

  1. Directions: Route Generation between any two or more coordinates for any mode of transportation. For example, from a starting point to a destination on 'foot-walking'.

    E.g. ORSDirections.directionsRouteCoordsGet gives a List of ORSCoordinate which can then be easily used to draw a Polyline route on a map in a Flutter Application or anything else you can think of.

    Route Drawn on Flutter App Map using Coordinates
    Route Drawn on Map (Flutter)
  2. Elevation: Get the elevation of a coordinate, or a list of coordinates. Fetches the ElevationData by taking a 2D ORSCoordinate or planar line geometry, and enriching it with elevation from a variety of datasets.

    Elevation Response Received
    Sample Elevation Response
  3. Isochrones: Obtain Isochrone (areas of reachability) Data for the locations given. The isochrone is a polygon that encloses a given point and is bounded by a given time.

    The isochrone data can be used to draw them on a map in a Flutter Application, or anything else you can think of.

    Isochrone Drawn on Map
    Isochrone Drawn on Map
  4. Time-Distance Matrix: Obtain one-to-many, many-to-one and many-to-many matrices for time and distance. Returns duration or distance matrix for multiple source and destination points.

  5. Pelias Geocoding: Resolve input coordinates to addresses and vice versa. Provides functionality for geocoding autocomplete queries, search queries, and reverse geocoding.

    Reverse Geocoding Information used on Map
    Reverse Geocode on Map
  6. POIs: Obtains information about the Points of Interest (POIs) in the area surrounding a geometry which can either be a bounding box, polygon or buffered linestring, or point.

    The Points of Interest can be marked on a map in a Flutter Application, or their properties and information visualized in various ways, or anything else you can think of.

    Points of Interest Drawn on Map
    POI Drawn on Map
  7. Routing Optimizations: The optimization endpoint solves Vehicle Routing Problems and can be used to schedule multiple vehicles and jobs, respecting time windows, capacities and required skills.

    This service is based on the excellent Vroom project. Please also consult its API documentation.

    Optimization Data for Vroom Jobs and Vehicles extracted and their route information printed in Console
    Optimization Route Data

Appropriate tests have also been written for each of the above APIs and can be used to check if the package and/or API are functioning properly.

Prerequisites

Installation

Run dart pub add open_route_service or flutter pub add open_route_service in your Dart/Flutter project directory to install the package.

After adding the package, AI coding agents can load its usage skill with dart run skills@ get.

Usage

  1. Import the package where needed:

    import 'package:open_route_service/open_route_service.dart';
    
  2. Create a new instance of the class with your openrouteservice API Key:

    OpenRouteService openrouteservice = OpenRouteService(apiKey: 'YOUR-API-KEY');
    
  3. Use the handy class methods to easily generate Directions, Isochrones, Time-Distance Matrix, Pelias Geocoding, POIs, Elevation and routing Optimizations etc, letting the package handle all the complex HTTP requests in the background for you.

Example Usage

To use the package with the Directions API to generate and draw a Route on a map in a Flutter application:

import 'package:open_route_service/open_route_service.dart';

Future<void> main() async {
  // Initialize the openrouteservice with your API key.
  final OpenRouteService client = OpenRouteService(apiKey: 'YOUR-API-KEY');

  // Example coordinates to test between
  const double startLat = 37.4220698;
  const double startLng = -122.0862784;
  const double endLat = 37.4111466;
  const double endLng = -122.0792365;

  // Form Route between coordinates
  final List<ORSCoordinate> routeCoordinates = await client.directionsRouteCoordsGet(
    startCoordinate: ORSCoordinate(latitude: startLat, longitude: startLng),
    endCoordinate: ORSCoordinate(latitude: endLat, longitude: endLng),
  );

  // Print the route coordinates
  routeCoordinates.forEach(print);

  // Map route coordinates to a list of LatLng (requires google_maps_flutter package)
  // to be used in the Map route Polyline.
  final List<LatLng> routePoints = routeCoordinates
      .map((coordinate) => LatLng(coordinate.latitude, coordinate.longitude))
      .toList();

  // Create Polyline (requires Material UI for Color)
  final Polyline routePolyline = Polyline(
    polylineId: PolylineId('route'),
    visible: true,
    points: routePoints,
    color: Colors.red,
    width: 4,
  );

  // Use Polyline to draw route on map or do anything else with the data :)
}

Security

Report vulnerabilities privately by following SECURITY.md. Do not include API keys or other credentials in issues, examples, or pull requests.

Contribution Guidelines

See CONTRIBUTING.md for the development workflow and test requirements. Use GitHub issues for reproducible bugs and focused feature requests.

Dependencies

  • Dart or Flutter, for the Dart SDK which this obviously runs on.
  • http, for internally making RESTful HTTP Network requests to the API endpoints.

Additional information

Sponsor Message

The first release of this package was sponsored by Cashtic, a Cross-Platform peer-to-peer ATM cash network for Android and Web. Get it on Google Play!

License

This package is available under the MIT License.

카테고리

의존성

의존성 목록 1 개

소스 저장소

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

아직 데이터가 없습니다.