搜尋套件、儲存庫與 APP 分類

套件詳情v1.0.8

routing_client_dart

用於路由客戶端 API 的 Dart 套件(支援 OSRM/Valhalla 項目)

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
5410
喜歡數
25
Pub 分數
130

安裝套件

flutter pub add routing_client_dart

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

一個 Dart 套件,為基於 OpenStreetMap 的路由引擎(如 OSRM 與 Valhalla)提供客戶端路由功能。它讓開發者能夠將即時路線計算整合至跨平台應用程式中,支援 Android、iOS、Web、macOS、Windows 與 Linux。此套件簡化了與路由服務的 API 互動,提供請求路線、處理回應與管理錯誤的清晰介面。非常適合需要高效路徑尋找的導航與位置感知應用。

適用情境

  • 即時路線規劃
  • 導航應用開發
  • 地理空間資料分析
  • 多平台位置追蹤
  • 與 OSRM 或 Valhalla 伺服器整合

主要特色

  • 支援 OSRM 與 Valhalla 路由 API
  • 跨平台相容性
  • 簡單的請求/回應處理
  • 錯誤容錯
  • 輕量且易於整合

適合對象

  • 行動和網路導航應用
  • 物流和配送平台
  • 戶外活動追蹤工具
  • 基於位置的服務整合
  • 使用OpenStreetMap數據的開發者

使用建議

  • 需要外部 OSRM 或 Valhalla 伺服器
  • 路由請求需要網路連接
  • 僅限基於OSM的路由提供者
  • 無內建地圖渲染
  • 某些伺服器可能需要驗證

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

Routing Client Dart Package

pub

Package for osm routing client api

we support routing API for osrm-backend

also Valhalla Route API (more APIs will be added )

openrouteservice (coming soon)

from 1.0.0 instruction will be included directly when requesting the route

you can use our osrm service or valhalla service directly insteado of our RoutingManager

client api support
  • OSRM Client Api
    • route service
    • trip service
  • Valhalla Client
    • route service API

Installing

Add the following to your pubspec.yaml file:

dependencies:
  routing_client_dart: ^1.0.7
example for osrm route service
    List<LngLat> waypoints = [
      LngLat(lng: 13.388860, lat: 52.517037),
      LngLat(lng: 13.397634, lat: 52.529407),
      LngLat(lng: 13.428555, lat: 52.523219),
    ];
    final manager = RoutingManager();
    final route = await manager.getRoute(
      OSRMRequest.route(
        waypoints: waypoints,
        geometries: Geometries.polyline,
        steps: true,
        languages: Languages.en,
      )
    );
example for osrm trip service
    List<LngLat> waypoints = [
      LngLat(lng: 13.388860, lat: 52.517037),
      LngLat(lng: 13.397634, lat: 52.529407),
      LngLat(lng: 13.428555, lat: 52.523219),
    ];
    final manager = RoutingManager();
    final road = await manager.getRoute(
      OSRMRequest.trip(
        waypoints: waypoints,
        destination: DestinationGeoPointOption.last,
        source: SourceGeoPointOption.first,
        geometries: Geometries.polyline,
        steps: true,
        languages: Languages.en,
        roundTrip:false,
      )
    );
example for check Location in Road
final currentLocation = LngLat.fromList(lnglat: [13.389147, 52.527549]);
    final isOnPath =
await roadManager.isOnPath(road, currentLocation, tolerance: 5);
Example to get next navigation instruction of current Location
final currentLocation = LngLat.fromList(lnglat: [13.389147, 52.527549]);
    final isOnPath =
final instruction = await roadManager.nextInstruction(instructions, road, currentLocation, tolerance: 5);

Warning the precision of LngLat should be 5 if the road contain polylineEncoded, or the same precies as LngLat in polylines

Note you can get some inaccurate information nextInstruction,for that we will be happy for yours contributions

Note you can get voice instruction for valhalla instruction

Note more documentation will be added to soon

所屬分類

依賴

依賴清單 2 項

原始碼儲存庫

使用此套件的專案