OpenRouteService class

Class encapsulating all the OpenRoute Service APIs and parsing their responses into relevant data models that can be easily integrated into any Dart/Flutter application.

Initialize the class with your API key String and optionally the ORSProfile, then use the methods to get the data you need.

Implemented OpenRoute APIs include:

The API documentation can be found here: https://openrouteservice.org/dev/#/api-docs

Available extensions

Constructors

OpenRouteService.new({required String apiKey, String baseUrl = OpenRouteService.defaultBaseUrl, Client? client, ORSProfile defaultProfile = ORSProfile.footWalking})
Constructor.

Properties

geocodeLayersAvailable Set<String>

Available on OpenRouteService, provided by the ORSGeocode extension

Available Layer settings for Geocoding
no setter
geocodeSourcesAvailable Set<String>

Available on OpenRouteService, provided by the ORSGeocode extension

Available Sources for Geocoding
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

close() → void
Allows closing the HTTP client when done.
directionsMultiRouteCoordsPost({required List<ORSCoordinate> coordinates, Object? alternativeRoutes, List<String>? attributes, bool continueStraight = false, bool? elevation, List<String>? extraInfo, bool geometrySimplify = false, String? id, bool instructions = true, String instructionsFormat = 'text', String language = 'en', bool maneuvers = false, Object? options, String preference = 'recommended', List<int>? radiuses, bool roundaboutExits = false, List<int>? skipSegments, bool suppressWarnings = false, String units = 'm', bool geometry = true, int? maximumSpeed, ORSProfile? profileOverride}) Future<List<ORSCoordinate>>

Available on OpenRouteService, provided by the ORSDirections extension

Fetches the Direction Route information for the route connecting the various given coordinates, from the openrouteservice API, and then parses it's coordinates to a List of ORSCoordinate objects.
directionsMultiRouteDataPost({required List<ORSCoordinate> coordinates, Object? alternativeRoutes, List<String>? attributes, bool continueStraight = false, bool? elevation, List<String>? extraInfo, bool geometrySimplify = false, String? id, bool instructions = true, String instructionsFormat = 'text', String language = 'en', bool maneuvers = false, Object? options, String preference = 'recommended', List<int>? radiuses, bool roundaboutExits = false, List<int>? skipSegments, bool suppressWarnings = false, String units = 'm', bool geometry = true, int? maximumSpeed, ORSProfile? profileOverride}) Future<List<DirectionRouteData>>

Available on OpenRouteService, provided by the ORSDirections extension

Fetches the Direction Route information for the route connecting the various coordinates from the openrouteservice API, and returns the entire geojson DirectionRouteData containing the response data.
directionsMultiRouteGeoJsonPost({required List<ORSCoordinate> coordinates, Object? alternativeRoutes, List<String>? attributes, bool continueStraight = false, bool? elevation, List<String>? extraInfo, bool geometrySimplify = false, String? id, bool instructions = true, String instructionsFormat = 'text', String language = 'en', bool maneuvers = false, Object? options, String preference = 'recommended', List<int>? radiuses, bool roundaboutExits = false, List<int>? skipSegments, bool suppressWarnings = false, String units = 'm', bool geometry = true, int? maximumSpeed, ORSProfile? profileOverride}) Future<GeoJsonFeatureCollection>

Available on OpenRouteService, provided by the ORSDirections extension

Fetches the Direction Route information for the route connecting the various coordinates from the openrouteservice API, and returns the entire geojson GeoJsonFeatureCollection containing the response data.
directionsRouteCoordsGet({required ORSCoordinate startCoordinate, required ORSCoordinate endCoordinate, ORSProfile? profileOverride}) Future<List<ORSCoordinate>>

Available on OpenRouteService, provided by the ORSDirections extension

Fetches the Direction Route information for the route between startCoordinate and endCoordinate from the openrouteservice API, and parses it's coordinates to a List of ORSCoordinate objects.
directionsRouteGeoJsonGet({required ORSCoordinate startCoordinate, required ORSCoordinate endCoordinate, ORSProfile? profileOverride}) Future<GeoJsonFeatureCollection>

Available on OpenRouteService, provided by the ORSDirections extension

Fetches the Direction Route information for the route between startCoordinate and endCoordinate from the openrouteservice API, and returns the entire geojson GeoJsonFeatureCollection containing data.
elevationLinePost({required Object geometry, required String formatIn, String formatOut = 'geojson', String dataset = 'srtm'}) Future<ElevationData>

Available on OpenRouteService, provided by the ORSElevation extension

Fetches the ElevationData by taking planar 2D line objects geometry and enriching them with elevation from a variety of datasets.
elevationPointGet({required ORSCoordinate geometry, String formatOut = 'geojson', String dataset = 'srtm'}) Future<ElevationData>

Available on OpenRouteService, provided by the ORSElevation extension

Fetches the ElevationData by taking a 2D geometry and enriching it with elevation from a variety of datasets. Uses the GET method for the endpoint.
elevationPointPost({required ORSCoordinate geometry, String formatIn = 'point', String formatOut = 'geojson', String dataset = 'srtm'}) Future<ElevationData>

Available on OpenRouteService, provided by the ORSElevation extension

Fetches the ElevationData by taking a 2D coordinate and enriching it with elevation from a variety of datasets. Uses the POST method for the endpoint.
geocodeAutoCompleteGet({required String text, ORSCoordinate? focusPointCoordinate, ORSCoordinate? boundaryRectangleMinCoordinate, ORSCoordinate? boundaryRectangleMaxCoordinate, String? boundaryCountry, List<String>? sources, List<String> layers = const <String>[]}) Future<GeoJsonFeatureCollection>

Available on OpenRouteService, provided by the ORSGeocode extension

Fetches the Geocode Autocomplete data for the given text from chosen sources and using settings layers, and returns the entire geojson GeoJsonFeatureCollection containing the data.
geocodeReverseGet({required ORSCoordinate point, double boundaryCircleRadius = 1, int size = 10, List<String> layers = const <String>[], List<String>? sources, String? boundaryCountry}) Future<GeoJsonFeatureCollection>

Available on OpenRouteService, provided by the ORSGeocode extension

Fetches the Reverse Geocode data from the given sources and using settings layers, and returns the entire geojson GeoJsonFeatureCollection containing the data.
geocodeSearchGet({required String text, ORSCoordinate? focusPointCoordinate, ORSCoordinate? boundaryRectangleMinCoordinate, ORSCoordinate? boundaryRectangleMaxCoordinate, ORSCoordinate? boundaryCircleCoordinate, double boundaryCircleRadius = 50, String? boundaryGid, String? boundaryCountry, List<String>? sources, List<String> layers = const <String>[], int size = 10}) Future<GeoJsonFeatureCollection>

Available on OpenRouteService, provided by the ORSGeocode extension

Fetches the Geocode Search data for the given search text from chosen sources and using settings layers, and returns the entire geojson GeoJsonFeatureCollection containing the data.
geocodeSearchStructuredGet({String? address, String? neighbourhood, String? country, String? postalcode, String? region, String? county, String? locality, String? borough, ORSCoordinate? focusPointCoordinate, ORSCoordinate? boundaryRectangleMinCoordinate, ORSCoordinate? boundaryRectangleMaxCoordinate, ORSCoordinate? boundaryCircleCoordinate, double boundaryCircleRadius = 50, String? boundaryCountry, List<String>? sources, List<String> layers = const <String>[], int size = 10}) Future<GeoJsonFeatureCollection>

Available on OpenRouteService, provided by the ORSGeocode extension

Fetches the Geocode Structured Search data for the given search address and/or neighbourhood and/or country and/or postalcode and/or region and/or county and/or locality and/or borough from chosen sources and using settings layers, and returns the entire geojson GeoJsonFeatureCollection containing the data. Uses the Structured Search API endpoint.
isochronesPost({required List<ORSCoordinate> locations, required List<int> range, List<String> attributes = const <String>[], String? id, bool intersections = false, int? interval, String locationType = 'start', Map<String, dynamic>? options, String rangeType = 'time', int? smoothing, String areaUnits = 'm', String units = 'm', ORSProfile? profileOverride}) Future<GeoJsonFeatureCollection>

Available on OpenRouteService, provided by the ORServiceIsochrones extension

Obtain Isochrone (areas of reachability) Data for the locations given as a List of ORSCoordinate.
matrixPost({required List<ORSCoordinate> locations, List<int>? destinations, String? id, List<String> metrics = const <String>['duration'], List? metricsStrings, bool resolveLocations = false, List<int>? sources, String units = 'm', ORSProfile? profileOverride}) Future<TimeDistanceMatrix>

Available on OpenRouteService, provided by the ORSMatrix extension

Returns duration, distance matrix for multiple source, destination points.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
optimizationDataPost({required List<VroomJob> jobs, required List<VroomVehicle> vehicles, List? matrix, Object? options}) Future<OptimizationData>

Available on OpenRouteService, provided by the ORSOptimization extension

Get the Optimization Data from openrouteservice for Vehicle routing problem scheduling, for the input jobs, vehicles and optionally custom matrix and options.
poisDataPost({required String request, Object? geometry, Object? filters, int? limit, String? sortBy}) Future<PoisData>

Available on OpenRouteService, provided by the ORSPois extension

Fetches the information about the Points of Interest (POI) in the area surrounding a geometry which can either be a bounding box, polygon or buffered linestring or point.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

defaultBaseUrl → const String
The default base URL of all the endpoints, https://api.openrouteservice.org