OSRMLib 1.0.2
dotnet add package OSRMLib --version 1.0.2
NuGet\Install-Package OSRMLib -Version 1.0.2
<PackageReference Include="OSRMLib" Version="1.0.2" />
paket add OSRMLib --version 1.0.2
#r "nuget: OSRMLib, 1.0.2"
// Install OSRMLib as a Cake Addin #addin nuget:?package=OSRMLib&version=1.0.2 // Install OSRMLib as a Cake Tool #tool nuget:?package=OSRMLib&version=1.0.2
OSRMLib
Useful library for Open Source Routing Machine (OSRM).
To stay abreast what's happening, please read the OSRM documentation first.
Header
- Services
- Responses
- OSRM Classes
- Annotation
- Lane
- Route
- RouteLeg
- RouteStep
- StepManeuver
- Waypoint
- Examples
Services <a name="Services"></a>
Service options are represented by properties of class
Each service has the folowing:
- General options:
public string Version { get; set; }
public string Profile { get; set; }
public IEnumerable<Location> Coordinates { get; set; }
public IEnumerable<double> Radiuses { get; set; }
public bool GenerateHints { get; set; }
public IEnumerable<string> Hints { get; set; }
public IEnumerable<string> Exclude { get; set; }
public bool SkipWaypoints { get; set; }
public Snapping Snapping { get; set; }
Additional options, that depending on service and must comply with the rules of OSRM documentation.
And method, which send request to OSRM server by current service, named "Call":
public async Task<T> Call<T>()
Call would return a task with response depending on service.
Nearest service <a name="NearestService"></a>
Additional options:
public int? Number { get; set; }
Call method returns: Task<NearestResponse>
Route service <a name="RouteService"></a>
Additional options:
public string Alternatives { get; set; }
public bool Steps { get; set; }
public Annotations Annotations { get; set; }
public Overview Overview { get; set; }
public ContinueStraight ContinueStraight { get; set; }
public IEnumerable<int> Waypoints { get; set; }
Call method returns: Task<RouteResponse>
Table service <a name="TableService"></a>
Additional options:
public IEnumerable<int> Sources { get; set; }
public IEnumerable<int> Destinations { get; set; }
public string Annotations { get; set; }
public double FallbackSpeed { get; set; }
public FallbackCoordinate FallbackCoordinate { get; set; }
public double ScaleFactor { get; set; }
Call method returns: Task<TableResponse>
Match service <a name="MatchService"></a>
Additional options:
public bool Steps { get; set; }
public Annotations Annotations { get; set; }
public Overview Overview { get; set; }
public IEnumerable<long> Timestamps { get; set; }
public Gaps Gaps { get; set; }
public bool Tidy { get; set; }
public IEnumerable<int> Waypoints { get; set; }
Call method returns: Task<MatchResponse>
Trip service <a name="TripService"></a>
Additional options:
public bool RoundTrip { get; set; }
public Source Source { get; set; }
public Destination Destination { get; set; }
public bool Steps { get; set; }
public Annotations Annotations { get; set; }
public Overview Overview { get; set; }
Call method returns: Task<TripResponse>
Responses <a name="Responses"></a>
Each response has the folowing:
- General properties
public string Code { get; set; }
- Additional properties depending on service.
Nearest Response <a name="NearestResponse"></a>
Additional properties:
public Waypoint[] Waypoints { get; set; }
Route Response <a name="RouteResponse"></a>
Additional properties:
public Waypoint[] Waypoints { get; set; }
public Route[] Routes { get; set; }
Table Response <a name="TableResponse"></a>
Additional properties:
public List<List<double>> Durations { get; set; }
public List<List<double>> Distances { get; set; }
public Waypoint[] Sources { get; set; }
public Waypoint[] Destinations { get; set; }
Match Response <a name="MatchResponse"></a>
Additional properties:
public Waypoint[] Tracepoints { get; set; }
public Route[] Matchings { get; set; }
Trip Response <a name="TripResponse"></a>
Additional properties:
public Waypoint[] Waypoints { get; set; }
public Route[] Trips { get; set; }
Examples <a name="Examples"></a>
RouteService routeS = new RouteService();
public async void GetRoute(Location startPos, Location endPos){
// Add general "Coordinates" option
routeS.Coordinates = new List<Location> { startPos, endPos };
// Call route service for this coordinates and print it points
var response = await routeS.Call();
var points = response.Routes[0].Geometry;
foreach(var point in points)
{
Console.WriteLine($"Point: {point.Latitude}; {point.Longitude}");
}
}
var startLocation = new Location(65.792032, -151.909505);
var destLocation = new Location(64.828840, -147.669597);
//Print route points from Alaska cooridnates to Fairbanks city
await GetRoute(startLocation, destLocation);
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Newtonsoft.Json (>= 13.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.