Aus öffentlichen Paketdaten erstellte Orientierung.
Das open_route_service-Paket bietet eine benutzerfreundliche Wrapper-Schnittstelle für die OpenRouteService-APIs in Dart und Flutter, die Entwicklern ermöglicht, Routenplanung und geospatialen Daten nahtlos in ihre Anwendungen zu integrieren. Es vereinfacht Aufgaben wie die Berechnung von Routen, die Abrufung von Wegbeschreibungen und den Zugriff auf kartografische Informationen durch klare, intuitive Methoden. Ideal für ortsbasierte Anwendungen, die Schritt-für-Schritt-Navigation oder Reisedistanz-Berechnungen erfordern, unterstützt es mehrere Plattformen wie Mobilgeräte, Web und Desktop. Das Paket ist leichtgewichtig und gut dokumentiert, was es sowohl für Einsteiger als auch erfahrene Entwickler zugänglich macht.
Anwendungsfälle
Routenplanung in Reise-Apps
Navigation mit Schritt-für-Schritt-Anweisungen
Entfernungs- und Dauerberechnung
kartengestützte Logistikverfolgung
Geodatenabruf
Multiplattform-Standortdienste
Hauptmerkmale
Einfache API-Integration
Unterstützung für mehrere Plattformen
Echtzeit-Routenberechnung
JSON-Antwortanalyse
Eingebaute Fehlerbehandlung
Plattformübergreifende Kompatibilität
Geeignet für
Flutter-Entwickler, die Navigationsfunktionen erstellen
Apps, die eine Routenoptimierung benötigen
Projekte, die OpenRouteService-APIs verwenden
Entwickler, die leichte Geolocation-Tools suchen
Plattformübergreifende mobile und Web-Anwendungen
Hinweise
Benötigt einen API-Schlüssel von OpenRouteService
Abhängig von der Internetverbindung
Beschränkt auf die verfügbaren Endpunkte von OpenRouteService
Möglicherweise ist zusätzliche Analyse für komplexe Antworten erforderlich
Geschwindigkeitsbegrenzungen gelten je nach Abonnementstufe
Original-README
Originaler README-Schnappschuss aus dem verknüpften Quell-Repository. Aktuelle Inhalte finden Sie im Repository.
open_route_service
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.
The goal is to develop an all-encompassing package that can encapsulate everything openrouteservice API offers.
With all of their internal Optimizations, this includes:
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
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
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
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.
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
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
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.
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.finalOpenRouteService client = OpenRouteService(apiKey: 'YOUR-API-KEY');
// Example coordinates to test betweenconstdouble startLat = 37.4220698;
constdouble startLng = -122.0862784;
constdouble endLat = 37.4111466;
constdouble endLng = -122.0792365;
// Form Route between coordinatesfinalList<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.finalList<LatLng> routePoints = routeCoordinates
.map((coordinate) => LatLng(coordinate.latitude, coordinate.longitude))
.toList();
// Create Polyline (requires Material UI for Color)finalPolyline 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.