Waypoint
Namespace: Wisej.Web.Ext.GoogleMaps
Assembly: Wisej.Web.Ext.GoogleMaps (4.1.0.0)
A waypoint alters a route by routing it through the specified location.
- C#
- VB.NET
public class Waypoint
Public Class Waypoint
Waypoints are passed to the AddRoute overloads of GoogleMap that accept a Waypoint array. Specify either Location or Address: when Location is set, Address is ignored. See directions#DirectionsWaypoint.
Example:
Routing through a location and an address:
var waypoints = new[]
{
new Waypoint(new LatLng { Lat = 43.7696, Lng = 11.2558 }, true),
new Waypoint("Bologna, Italy", false)
};
this.googleMap1.AddRoute("Rome, Italy", "Milan, Italy", TravelMode.Driving, UnitSystem.Metric, waypoints);
Constructors
Waypoint()
Initializes a new instance of the Waypoint class.
Waypoint(location, stopover)
Initializes a new instance of the Waypoint class using a geographical location.
| Name | Type | Description |
|---|---|---|
| location | LatLng | The LatLng location of the waypoint. |
| stopover | Boolean | True if the waypoint is a stop on the route, which splits the route into two legs. |
Throws:
- ArgumentNullException location is null.
Waypoint(address, stopover)
Initializes a new instance of the Waypoint class using an address.
| Name | Type | Description |
|---|---|---|
| address | String | The address of the waypoint, geocoded by the Google Directions service. |
| stopover | Boolean | True if the waypoint is a stop on the route, which splits the route into two legs. |
Throws:
- NullReferenceException address is null or empty.
Properties
Address
String: Returns or sets the address of the waypoint.
Use this property when not providing a Location, otherwise it's ignored. The address is geocoded by the Google Directions service when the route is calculated.
Throws:
- NullReferenceException The value is null or empty and Location is not set.
Location
LatLng: Returns or sets the location of the waypoint, as a LatLng.
When set, it takes precedence over Address.
Throws:
- ArgumentNullException The value is null.
Stopover
Boolean: Returns or sets whether the waypoint is a stop on the route, which has the effect of splitting the route into two legs.