Table of Contents

Class Route

Namespace
GoogleMapsApi.Entities.Directions.Response
Assembly
GoogleMapsApi.dll

When the Directions API returns results, it places them within a (JSON) routes array. Even if the service returns no results (such as if the origin and/or destination doesn't exist) it still returns an empty routes array. (XML responses consist of zero or more route elements.) Each element of the routes array contains a single result from the specified origin and destination. This route may consist of one or more legs depending on whether any waypoints were specified. As well, the route also contains copyright and warning information which must be displayed to the user in addition to the routing information.

public class Route
Inheritance
Route
Inherited Members

Properties

Bounds

bounds (optionally returned) contains the viewport bounding box of the overview_polyline.

[JsonPropertyName("bounds")]
public FramedLocation? Bounds { get; set; }

Property Value

FramedLocation

Copyrights

copyrights contains the copyrights text to be displayed for this route. You must handle and display this information yourself.

[JsonPropertyName("copyrights")]
public string? Copyrights { get; set; }

Property Value

string

Legs

legs[] contains an array which contains information about a leg of the route, between two locations within the given route. A separate leg will be present for each waypoint or destination specified. (A route with no waypoints will contain exactly one leg within the legs array.) Each leg consists of a series of steps. (See Directions Legs below.)

[JsonPropertyName("legs")]
public IEnumerable<Leg>? Legs { get; set; }

Property Value

IEnumerable<Leg>

OverviewPath

overview_path contains an object holding an array of encoded points and levels that represent an approximate (smoothed) path of the resulting directions.

[JsonPropertyName("overview_polyline")]
public OverviewPolyline? OverviewPath { get; set; }

Property Value

OverviewPolyline

Summary

summary contains a short textual description for the route, suitable for naming and disambiguating the route from alternatives.

[JsonPropertyName("summary")]
public string? Summary { get; set; }

Property Value

string

Warnings

warnings[] contains an array of warnings to be displayed when showing these directions. You must handle and display these warnings yourself.

[JsonPropertyName("warnings")]
public string[]? Warnings { get; set; }

Property Value

string[]

WaypointOrder

waypoint_order contains an array indicating the order of any waypoints in the calculated route. This waypoints may be reordered if the request was passed optimize:true within its waypoints parameter.

[JsonPropertyName("waypoint_order")]
public int[]? WaypointOrder { get; set; }

Property Value

int[]