Table of contents

March 17, 2022 · View on GitHub

This documentation does not include the class definitions for the REST Response. These are documented in the Bing Maps MSDN documentation here.

Request Classes

Base Classes

BaseRestRequest Class

An abstract class in which all REST service requests derive from.

Methods

NameReturn TypeDescription
Execute()Task<Response>Executes the request.
Execute(Action<int> remainingTimeCallback)Task<Response>Executes the request.
GetRequestUrl()stringAbstract method which generates the Bing Maps REST request URL.

Properties

NameTypeDescription
BingMapsKeystringThe Bing Maps key for making the request.
CulturestringThe culture to use for the request.
DomainstringThe domain of the REST service. Default: https://dev.virtualearth.net/REST/v1/
UserIpstringAn Internet Protocol version 4 (IPv4) address.
UserLocationCoordinateThe user's current position.
UserMapViewBoundingBoxThe geographic region that corresponds to the current viewport.

BaseImageryRestRequest Class

Abstract class that all Imagery rest requests will derive from. Inherits from the BaseRestRequest class and currently exposes all the same properties and methods.

Time Zone API Requests

Three request classes for getting Time Zones at a location, converting Time Zones, and getting Time Zone information. Inherits from the BaseRestRequest class.

FindTimeZoneRequest Class

Find the Time Zone at a specific location based on a point or query. Inherits from the BaseRestRequest class.

Either instantiate this class by specifiying a Point (Coordinate class instance) or a Query (string), but not both.

Constructor

There are three constructors:

public FindTimeZoneRequest();

Find Time Zone by Point:

public FindTimeZoneRequest(Coordinate point);

Find Time Zone by Query:

public FindTimeZoneRequest(string query, DateTime datetime);

Methods

NameReturn TypeDescription
Execute()Task<Response>Executes the request.
Execute(Action<int> remainingTimeCallback)Task<Response>Executes the request.
GetRequestUrl()stringGets the request URL to perform a reverse geocode query.

Properties

NamePropertiesDescription
PointCoordinatePoint for location on Earth for which to get time zone information.
QuerystringQuery to find location on Earth for which to get time zone information.
LocationDateTimeDateTimeThe DateTime for the specified location.
IncludeDstRulesboolWhether to include the DstRule for converted time zone in the response.

ConvertTimeZoneRequest Class

Convert one timezone at a specific UTC datetime to another time zone.

Constructor

This request requires two parameters when calling its constructor: a DateTime for the local UTC datetime and a string with a Windows or IANA timezone ID.

public ConvertTimeZoneRequest(DateTime datetime, string DestID);

Methods

NameReturn TypeDescription
Execute()Task<Response>Executes the request.
Execute(Action<int> remainingTimeCallback)Task<Response>Executes the request.
GetRequestUrl()stringGets the request URL to perform a reverse geocode query.

Properties

NamePropertiesDescription
IncludeDstRulesboolWhether to include the DstRule for converted time zone in the response.
LocationDateTimeDateTimeThe DateTime for the specified location.
DestinationTZIDstringThe Windows or IANA time zone ID. For more detail see the Bing Maps Convert TimeZone API.

ListTimeZonesRequest Class

The Find a Time Zone API has two basic operations: get time zone information about a particular time zone, or retrieve a list of Windows or IANA time zone standards.

Constructor

There is one constructor.

public ListTimeZonesRequest(bool use_list_operation);

If use_list_operaiton is true, a List operation request is created, which will return a list of IANA or Windows standards.

Set the TimeZoneStandard property, which takes string values, of an TimeTimeZoneRequest instance to either "IANA" or "WINDOWS".

Example for List Operation:

var request = new ListTimeZonesRequest(true);
request.TimeZoneStandard = "Windows";

To find information about a particular time zone, set use_list_operation to false when calling the constructor:

var request = new ListTimeZonesRequest(false);
request.TimeZoneStandard = "Iana";
request.DestinationTZID = "America/Vancouver";

Methods

NameReturn TypeDescription
Execute()Task<Response>Executes the request.
Execute(Action<int> remainingTimeCallback)Task<Response>Executes the request.
GetRequestUrl()stringGets the request URL to perform a reverse geocode query.

Properties

NamePropertiesDescription
IncludeDstRulesboolWhether to include the DstRule for converted time zone in the response.
LocationDateTimeDateTimeThe DateTime for the specified location.
TimeZoneStandardstringAny string of either a valid IANA or Windows time zone standard ID.

Locations API

GeocodeRequest Class

Geocodes a query to its coordinates. Inherits from the BaseRestRequest class.

Methods

NameReturn TypeDescription
Execute()Task<Response>Executes the request.
Execute(Action<int> remainingTimeCallback)Task<Response>Executes the request.
GetRequestUrl()stringGets the request URL. If both a Query and Address are specified, the Query value will be used. Throws an exception if a Query or Address value is not specified.

Properties

NameTypeDescription
AddressSimpleAddressThe Address to geocode.
IncludeIso2boolWhen you specified the two-letter ISO country code is included for addresses in the response.
IncludeNeighborhoodboolSpecifies to include the neighborhood in the response when it is available.
MaxResultsintSpecifies the maximum number of locations to return in the response.
QuerystringA free form string address or Landmark. Overrides the Address values if both are specified.

ReverseGeocodeRequest Class

Requests a that converts a coordinate into a location such as an address. Inherits from the BaseRestRequest class.

Methods

NameReturn TypeDescription
Execute()Task<Response>Executes the request.
Execute(Action<int> remainingTimeCallback)Task<Response>Executes the request.
GetRequestUrl()stringGets the request URL to perform a reverse geocode query.

Properties

NameTypeDescription
IncludeEntityTypesList<EntityType>Specifies the entity types that you want to return in the response. Only the types you specify will be returned. If the point cannot be mapped to the entity types you specify, no location information is returned in the response.
IncludeIso2boolWhen you specified the two-letter ISO country code is included for addresses in the response.
IncludeNeighborhoodboolSpecifies to include the neighborhood in the response when it is available.
PointCoordinateA central coordinate to perform the nearby search.

LocationRecogRequest Class

The Location Recognition API returns a list of entities ranked by their proximity to a specified location.

Constructor

public LocationRecogRequest()

Methods

NameReturn TypeDescription
Execute()Task<Response>Executes the request.
Execute(Action<int> remainingTimeCallback)Task<Response>Executes the request.
GetRequestUrl()stringGets the request URL to perform a reverse geocode query.

Properties

NameTypeDescription
CenterPointCoordinateA central coordinate to perform the nearby search.
DateTimeInputDateTime?The date time to search for local entities.
DistanceUnitsDistanceUnitTypeEnum used to specify distance units: either DistanceUnitType.Kilometers or DistanceUnitType.Miles.
IncludeEntityTypesstringComma-separated string for kinds of entities to search for:

- "address": Address.
- "businessAndPOI": Business and Point of Interest Entity.
- "naturalPOI": Point of Interest entities.

Example: IncludeEntityTypes="businessAndPOI,address"
TopintMax number of entities to return, integers from 0 to 20.
RadiusdoubleMaximum search radius, from 0 to 2 kilometers.
VerbosePlaceNamesboolWhether to include verbose entity names.

LocalSearchRequest Class

The Local Search API returns a list of business entities centered around a location or a geographic region.

Methods

NameReturn TypeDescription
Execute()Task<Response>Executes the request.
Execute(Action<int> remainingTimeCallback)Task<Response>Executes the request.
GetRequestUrl()stringGets the request URL to perform a reverse geocode query.

Properties

NameTypeDescription
MaxResultsintSpecifies the maximum number of locations to return in the response.
QuerystringA free form string address or Landmark. Overrides the Address values if both are specified.
TypesList<string>The specified types used to filter the local entities returned by the Local Search API. A comma-separated list of string type identifiers. See the list of available Type IDs

LocalInsightsRequest Class

The Local Insights API returns a list of local entities within the specified maximum driving time or distance traveled from a specified point on Earth.

Methods

NameReturn TypeDescription
Execute()Task<Response>Executes the request.
Execute(Action<int> remainingTimeCallback)Task<Response>Executes the request.
GetRequestUrl()stringGets the request URL to perform a reverse geocode query.

Properties

NameTypeDescription
DateTimeDateTimeThe dateTime parameter identifies the desired time to be used when calculating an isochrone route. This is supported for driving. When calculating, driving routes the route optimization type should be TimeWithTraffic. The route time will be used as the departure time.
DistanceUnitsDistanceUnitTypeThe units in which the maxTime value is specified.
MaxDistancedoubleThe maximum travel distance in the specified distance units in which the isochrone polygon is generated. Cannot be set when maxTime is set.
MaxTimedoubleThe maximum travel time in the specified time units in which the isochrone polygon is generated. Cannot be set when maxDistance is set. Maximum value is 120 minutes.
OptimizeRouteOptimizationTypeSpecifies what parameters to use to optimize the isochrone route. One of the following values:

- distance: The route is calculated to minimize the distance. Traffic information is not used. Use with maxDistance.
- time [default]: The route is calculated to minimize the time. Traffic information is not used. Use with maxTime.
- timeWithTraffic: The route is calculated to minimize the time and uses current or predictive traffic information depending on if a dateTime value is specified. Use with maxTime.
TimeUnitTimeUnitTypeThe units in which the maxTime value is specified. Default: Seconds
TravelModeTravelModeTypeThe mode of travel for the route. Default: Driving.
TypesList<string>The specified types used to filter the local entities returned by the Local Search API. A comma-separated list of string type identifiers. See the list of available Type IDs
WaypointSimplyWaypointThe point around which the isochrone will be calculated.

AutosuggestRequest Class

The Autosuggest API returns a list of suggested entities which the user is most likely searching for.

Methods

NameReturn TypeDescription
Execute()Task<Response>Executes the request.
Execute(Action<int> remainingTimeCallback)Task<Response>Executes the request.
GetRequestUrl()stringGets the request URL to perform a reverse geocode query.

Properties

NameTypeDescription
CountryFilterstringA list of returned entity types.
IncludeEntityTypesList<AutosuggestEntityType>Specifies the maximum number of locations to return in the response.
MaxResultsintSpecifies the maximum number of locations to return in the response.
QuerystringA free form string address or Landmark. Overrides the Address values if both are specified.

Routes API

Distance Matrix Request

A request that calculates a distance matrix between origins and destinations. Inherits from the BaseRestRequest class.

Methods

NameReturn TypeDescription
Execute()Task<Response>Executes the request.
Execute(Action<int> remainingTimeCallback)Task<Response>Executes the request.
GeocodeWaypoints()TaskGeocodes the origins and destinations.
GetEuclideanDistanceMatrix()Task<DistanceMatrix>Calculates a Distance Matrix for the origins and destinations based on the euclidean distance (straight line/as the crow flies). This calculation only uses; Origins, Destinations, and Distance Units properties from the request and only calculates travel distance.
GetNumberOfCoordinatePairs()intReturns the number of coordinate pairs that would be in the resulting matrix based on the number of origins and destinations in the request.
GetPostRequestBody()stringReturns a JSON string object representing the request.
GetRequestUrl()stringGets the request URL to perform a query for a distance matrix when using POST.

Properties

NameTypeDescription
OriginsList<SimpleWaypoint>Required. List of origins.
DestinationsList<SimpleWaypoint>Required. List of destinations.
TravelModeTravelModeTypeRequired. Specifies the mode of transportation to use when calculating the distance matrix.
StartTimeDateTimeOptional for Driving. Specifies the start or departure time of the matrix to calculate and uses predictive traffic data.
EndTimeDateTimeOptional for Driving. If specified, a matrix based on traffic data with contain a histogram of travel times and distances for the specified resolution intervals (default is 15 minutes) between the start and end times. A start time must be specified for the request to be valid and the total time between start and end cannot be greater than 24 hours.
ResolutionintOptional for Driving. The number of intervals to calculate a histogram of data for each cell where a single interval is a quarter of an hour. Can be one of the following values:

- 1 - 15 minutes
- 2 - 30 minutes
- 3 - 45 minutes
- 4 - an hour

If start time is specified and resolution is not, it will default to an interval of 1 (15 minutes).

Example: resolution=2
DistanceUnitDistanceUnitTypeOptional. The units to use for distances in the response.
TimeUnitTimeUnitTypeOptional. The units to use for time durations in the response.
VehicleSpecVehicleSpecTruck routing specific vehicle attribute.

IsochroneRequest Class

Requests a that requests an isochrone (drive time polygon). Inherits from the BaseRestRequest class.

Methods

NameReturn TypeDescription
Execute()Task<Response>Executes the request.
Execute(Action<int> remainingTimeCallback)Task<Response>Executes the request.
GetRequestUrl()stringGets the request URL for an asynchronous isochrone request.

Properties

NameTypeDescription
DateTimeDateTimeThe dateTime parameter identifies the desired time to be used when calculating an isochrone route. This is supported for driving. When calculating, driving routes the route optimization type should be TimeWithTraffic. The route time will be used as the departure time.
DistanceUnitsDistanceUnitTypeThe units in which the maxTime value is specified.
MaxDistancedoubleThe maximum travel distance in the specified distance units in which the isochrone polygon is generated. Cannot be set when maxTime is set.
MaxTimedoubleThe maximum travel time in the specified time units in which the isochrone polygon is generated. Cannot be set when maxDistance is set. Maximum value is 120 minutes.
OptimizeRouteOptimizationTypeSpecifies what parameters to use to optimize the isochrone route. One of the following values:

- distance: The route is calculated to minimize the distance. Traffic information is not used. Use with maxDistance.
- time [default]: The route is calculated to minimize the time. Traffic information is not used. Use with maxTime.
- timeWithTraffic: The route is calculated to minimize the time and uses current or predictive traffic information depending on if a dateTime value is specified. Use with maxTime.
TimeUnitTimeUnitTypeThe units in which the maxTime value is specified. Default: Seconds
TravelModeTravelModeTypeThe mode of travel for the route. Default: Driving.
WaypointSimplyWaypointThe point around which the isochrone will be calculated.

RouteMajorRoadsRequest Class

Requests routes from a location to major nearby roads. Inherits from the BaseRestRequest class.

Methods

NameReturn TypeDescription
Execute()Task<Response>Executes the request.
Execute(Action<int> remainingTimeCallback)Task<Response>Executes the request.
GetRequestUrl()stringGets the request URL to perform a query for routes using major roads.

Properties

NameTypeDescription
DestinationSimpleWaypointSpecifies the final location for all the routes. A destination can be specified as a Point, a landmark, or an address.
DistanceUnitsDistanceUnitTypeThe units to use for distance.
ExcludeInstructionsboolSpecifies to return only starting points for each major route in the response. When this option is not specified, detailed directions for each route are returned.
RouteAttributesList<RouteAttributeType>Specifies to include or exclude parts of the routes response.

RouteRequest Class

A request that calculates routes between waypoints. Inherits from the BaseRestRequest class.

Methods

NameReturn TypeDescription
Execute()Task<Response>Executes the request.
Execute(Action<int> remainingTimeCallback)Task<Response>Executes the request.
GetRequestUrl()stringGets the request URL to perform a query for route directions.

Properties

NameTypeDescription
RouteOptionsRouteOptionsOptions to use when calculate route.
WaypointsList<SimpleWaypoint>Specifies two or more locations that define the route and that are in sequential order. A route is defined by a set of waypoints and viaWaypoints (intermediate locations that the route must pass through). You can have a maximum of 25 waypoints, and a maximum of 10 viaWaypoints between each set of waypoints. The start and end points of the route cannot be viaWaypoints.

Extended Properties

Some additional options have been added to the route request to increase its functionality.

NameTypeDescription
BatchSizeintThe maximium number of waypoints that can be in a single request. If the batchSize is smaller than the number of waypoints, when the request is executed, it will break the request up into multiple requests, thus allowing routes with more than 25 waypoints to be . Must by between 2 and 25. Default: 25.
WaypointOptimizationTspOptimizationTypeSpecifies if the waypoint order should be optimized using a travelling salesmen algorithm which metric to optimize on. If less than 10 waypoints, brute force is used, for more than 10 waypoints, a genetic algorithm is used. Ignores IsViaPoint on waypoints and makes them waypoints. Default: false

Warning: If travel time or travel distance is used, a standard Bing Maps key will need to be required, not a session key, as the distance matrix API will be used to process the waypoints. This can generate a lot of billable transactions.

SnapToRoadRequest Class

Snaps a set of coordinates to roads. Inherits from the BaseRestRequest class.

Methods

NameReturn TypeDescription
Execute()Task<Response>Executes the request.
Execute(Action<int> remainingTimeCallback)Task<Response>Executes the request.
GetRequestUrl()stringGets the request URL to perform a snap to road query.

Properties

NameTypeDescription
PointsList<Coordinate>A set of points to snap to roads. Up to 100 -points may be passed in.
InterpolateboolIndicates if the space between the snapped points should be filled with additional points along the road, thus returning the full route path. Default: false
IncludeSpeedLimitboolIndicates if speed limitation data should be returned for the snapped points. Default: false
IncludeTruckSpeedLimitboolIndicates if speed limitation data should be returned for the snapped points. Default: false
SpeedUnitSpeedUnitTypeIndicates the units in which the returned speed limit data is in.
TravelModeTravelModeTypeIndicates which routing profile to snap the points to. Default: Driving

TrafficRequest Class

Requests traffic information. Inherits from the BaseRestRequest class.

Methods

NameReturn TypeDescription
Execute()Task<Response>Executes the request.
Execute(Action<int> remainingTimeCallback)Task<Response>Executes the request.
GetRequestUrl()stringGets a URL for requesting traffic data for a GET request.

Properties

NameTypeDescription
IncludeLocationCodesboolSpecifies whether to include traffic location codes in the response. Traffic location codes provide traffic incident information for pre-defined road segments. A subscription is typically required to be able to interpret these codes for a geographical area or country. Default is false.
MapAreaBoundingBoxSpecifies the area to search for traffic incident information. A rectangular area specified as a bounding box. The size of the area can be a maximum of 500 km x 500 km.
SeverityList<SeverityType>Specifies severity level of traffic incidents to return. The default is to return traffic incidents for all severity levels.
TrafficTypeList<TrafficType>;Specifies the type of traffic incidents to return.

OptimizeItineraryRequest class

Request for Bing Maps Multi-Itinerary Optimization API.

Methods

NameReturn TypeDescription
Execute()Task<Response>Executes the request.
Execute(Action<int> remainingTimeCallback)Task<Response>Executes the request.
GetRequestUrl()stringGets a URL for requesting traffic data for a GET request.

Properties

NameTypeDescription
AgentsList<Agent>List of agent itinerary information: including the agent name, shift starting and ending locations for agent, and capacity of the agent's vehicle.
ItineraryItemsList<OptimizeItineraryItem>List of itinerary items to be scheduled among the specified agents, including the location name, location (lat/lon), priority, dwell time, business closing and opening times for each item to be scheduled, quantity to be delivered to or picked up from each location, and pickup/drop off sequence dependency with other itineraryItems.
TypeOptimizationTypeSpecifies whether traffic data should used to optimize the order of waypoint items. Default: SimpleRequest Note: If the ‘type’ parameter is set to ‘TrafficRequest’, it will automatically use ‘true’ as the ‘roadnetwork’ parameter value.
RoadNetworkbool;Optional. If true, uses actual road network information, and both travel distances and travel times between the itinerary locations to calculate optimizations. If false, a constant radius is used to measure distances and a constant travel speed is used to calculate travel times between locations.
CostValueCostValueTypeA parameter used to optimize itineraries in addition to maximizing the sum of item priorities. Default: TravelTime

Elevations API

ElevationRequest Class

A request for elevation data. Inherits from the BaseRestRequest class.

Methods

NameReturn TypeDescription
Execute()Task<Response>Executes the request.
Execute(Action<int> remainingTimeCallback)Task<Response>Executes the request.
GetElevationCoordinates()List<Coordinate>Gets a list of coordinates that are related to the returned index of the elevation data.
GetPointsAsString()stringReturns the Point information as a formatted string. Only the first 1024 points will be used. Example: points=38.8895,77.0501,38.8877,-77.0472,38.8904,-77.0474,38.8896,77.0351
GetPostRequestUrl()stringGets a URL for requesting elevation data for a POST request.
GetRequestUrl()stringGets a URL for requesting elevation data for a GET request.

Properties

NameTypeDescription
BoundsBoundingBoxSpecifies the rectangular area over which to provide elevation values.
ColintSpecifies the number of columns to use to divide the bounding box area into a grid. The rows and columns that define the bounding box each count as two (2) of the rows and columns. Elevation values are returned for all vertices of the grid.
GetGeoidOffsetboolA boolean indicating if the offset from the geoid should be returned. Requires a list of points to be specified.
HeightElevationTypeSpecifies which sea level model to use to calculate elevation.
PointsList<Coordinate>A set of coordinates on the Earth to use in elevation calculations. The exact use of these points depends on the type of elevation request. Overrides the Bounds value if both are specified. The maximum number of points is 1024.
RowintSpecifies the number of rows to use to divide the bounding box area into a grid. The rows and columns that define the bounding box each count as two (2) of the rows and columns. Elevation values are returned for all vertices of the grid.
SamplesintSpecifies the number of equally-spaced elevation values to provide along a polyline path. Used when Points value is set. Make = 1024
BoundsBoundingBoxSpecifies the rectangular area over which to provide elevation values.

ImageryMetadataRequest Class

Requests imagery metadata information from Bing Maps. Inherits from the BaseRestRequest class.

Methods

NameReturn TypeDescription
Execute()Task<Response>Executes the request.
Execute(Action<int> remainingTimeCallback)Task<Response>Executes the request.
GetRequestUrl()stringGets the request URL. Throws an exception if a zoom level is not specified when a centerPoint is specified when ImagerySet is Road, Aerial and AerialWithLabels.

Properties

NameTypeDescription
CenterPointCoordinateRequired when imagerySet is Birdseye or BirdseyeWithLabels. Optional for other imagery sets. The center point to use for the imagery metadata.
GetBasicInfoboolGet only the basic metadata for an imagery set at a specific location. This URL does not return a map tile URL.
ImagerySetImageryTypeThe type of imagery for which you are requesting metadata.
IncludeImageryProvidersboolWhen you specified the two-letter ISO country code is included for addresses in the response.
OrientationdoubleThe orientation of the viewport to use for the imagery metadata. This option only applies to Birdseye imagery.
UseHTTPSboolWhen set to true tile URL's will use HTTPS.
ZoomLevelintRequired if a centerPoint is specified and imagerySet is set to Road, Aerial or AerialWithLabels The level of zoom to use for the imagery metadata.

ImageryRequest Class

Requests an image from the REST imagery service. Inherits from the BaseImageryRestRequest class.

Methods

NameReturn TypeDescription
Execute()Task<Response>Executes the request.
Execute(Action<int> remainingTimeCallback)Task<Response>Executes the request.
GetPostRequestUrl()stringGets a URL for requesting imagery data for a POST request.
GetPushpinsAsString()stringReturns the Pushpin information as a formatted string.
GetRequestUrl()stringGets the request URL. If both a Query and Address are specified, the Query value will be used. Throws an exception if a Query or Address value is not specified.

Properties

NameTypeDescription
CenterPointCoordinateRequired when imagerySet is Birdseye or BirdseyeWithLabels. Optional for other imagery sets. The center point to use for the imagery metadata.
DeclutterPinsboolSpecifies whether to change the display of overlapping pushpins so that they display separately on a map.
EntityTypeEntityTypeIndicates the type of entity that should be highlighted. The entity of this type that contains the centerPoint will be highlighted. Supported EntityTypes: CountryRegion, AdminDivision1, or PopulatedPlace.
FormatImageFormatTypeThe image format to use for the static map.
GetMetadataboolOptional. Specifies whether to return metadata for the static map instead of the image. The static map metadata includes the size of the static map and the placement and size of the pushpins on the static map.
HighlightEntityboolHighlights a polygon for an entity.
ImagerySetImageryTypeThe type of imagery for which you are requesting metadata.
MapAreaBoundingBoxRequired when a center point or set of route points are not specified. The geographic area to display on the map.
MapHeightintThe height of the map. Default is 350px.
MapWidthintThe width of the map. Default is 350px.
PushpinsList<ImageryPushpin>List of pushpins to display on the map.
QuerystringA query string that is used to determine the map location to display.
RouteOptionsRouteOptionsOptions for calculating route.
ShowTrafficboolSpecifies if the traffic flow layer should be displayed on the map or not. Default is false.
StylestringThe custom map style to apply to the image.
WaypointsList<SimpleWaypoint>Specifies two or more locations that define the route and that are in sequential order. A route is defined by a set of waypoints and viaWaypoints (intermediate locations that the route must pass through). You can have a maximum of 25 waypoints, and a maximum of 10 viaWaypoints between each set of waypoints. The start and end points of the route cannot be viaWaypoints.
ZoomLevelintThe level of zoom to display.

Common Classes

BoundingBox Class

Methods

NameReturn TypeDescription
ToString()stringReturns a string in the format SouthLatitude,WestLongitude,NorthLatitude,EastLongitude

Properties

NameTypeDescription
EastLongitudedoubleThe eastern most longitude value.
NorthLatitudedoubleThe northern most latitude value.
SouthLatitudedoubleThe southern most latitude value.
WestLongitudedoubleThe western most longitude value.

Coordinate Class

A class that defines location coordinate value.

Constructor

Coordinate()

Coordinate(double latitude, double longitude)

Static Methods

NameReturn TypeDescription
Parse(string coordinateString)CoordinateParses a coordinate value from a string with the format "latitude,longitude".

Properties

NameTypeDescription
LatitudedoubleLatitude coordinate.
LongitudedoubleLongitude coordinate.

CustomMapStyleManager Class

A static class to assist with working with Bing Maps Customer Map Styles.

Static Methods

NameReturn TypeDescription
GetRestStyle(string style)stringConverts a custom JSON map style, into a style using the REST parameter format. If the style is already in the REST parameter formatter, it will be unaltered.

ImageryPushpin Class

Pushpin defination for Bing Maps REST imagery service as documented here

Methods

NameReturn TypeDescription
ToString()stringReturns a string version of the pushpin in the format pushpin=latitude,longitude;iconStyle;label

Properties

NameTypeDescription
IconStyleintThe icon style to use for the pushpin.
LabelstringLabel to display on top of pushpin.
LocationCoordinateCoordinate to display pushpin.

PointCompression Class

This is a static class that exposes a compression algorithm to encodes/decodes a collections of coordinates into a string. This algorithm is used for generating a compressed collection of coordinates for use with the Bing Maps REST Elevation Service and also used for decoding the compressed coordinates returned by the GeoData API.

These algorithms come from the following documentation:

http://msdn.microsoft.com/en-us/library/jj158958.aspx

http://msdn.microsoft.com/en-us/library/dn306801.aspx

Static Methods

NameReturn TypeDescription
Encode(List<[Coordinate](#Coordinate> points)stringCompresses a list of coordinates into a string. Based on: http://msdn.microsoft.com/en-us/library/jj158958.aspx
TryDecode(string value, out List<Coordinate> parsedValue)boolDecodes a collection of coordinates from a compressed string. Returns a boolean indicating if the algorithm was able to decode the compressed coordinates or not. Based on: http://msdn.microsoft.com/en-us/library/dn306801.aspx

RouteOptions Class

A class that defines the options that can to use when calculating a route.

Properties

NameTypeDescription
AvoidList<AvoidType>Specifies the road types to minimize or avoid when a route is created for the driving travel mode.
DateTimeDateTimeThe dateTime parameter identifies the desired time to be used when calculating a route. This is supported by driving and transit routes. When calculating, driving routes the route optimization type should be TimeWithTraffic. The route time will be used as the departure time. When calculating transit routes timeType can be specified.
DistanceBeforeFirstTurnintSpecifies the distance before the first turn is allowed in the route. This option only applies to the driving travel mode. An integer distance specified in meters. Use this parameter to make sure that the moving vehicle has enough distance to make the first turn.
DistanceUnitsDistanceUnitTypeThe units to use for distance.
HeadingintSpecifies the initial heading for the route. An integer value between 0 and 359 that represents degrees from north where north is 0 degrees and the heading is specified clockwise from north.
MaxSolutionsintSpecifies the maximum number of transit or driving routes to return. An interger between 1 and 3. This parameter is available for the Driving and Transit travel modes for routes between two waypoints. This parameter does not support routes with more than two waypoints. For driving routes, you must not set the avoid and distanceBeforeFirstTurn parameters. The maxSolutions parameter is supported for routes in the United States, Canada, Mexico, United Kingdom, Australia, and India.
OptimizeRouteOptimizationTypeSpecifies what parameters to use to optimize the route.
RouteAttributesList<RouteAttributeType>Specifies to include or exclude parts of the routes response.
TimeTypeRouteTimeTypeSpecifies how to interpret the date and transit time value that is specified by the dateTime parameter.
TolerancesList<double>Specifies a series of tolerance values. Each value produces a subset of points that approximates the route that is described by the full set of points. This parameter is only valid when the routePathOutput parameter is set to Points. You can specify a maximum of seven (7) tolerance values.
TravelModeTravelModeTypeThe mode of travel for the route. Default: Driving.
VehicleSpecVehicleSpecTruck routing specific vehicle attribute.

ServiceManager Class

This is a static class that is used for processing all requests to the Bing Maps REST Services asynchronously. Note that all requests classes now have an Execute function which will retrun a Response object which can be used as an alternative.

Static Properties

NameTypeDescription
ProxyIWebProxyProxy settings to be used when making web requests.
QpsLimitintThe number of queries per second to limit certain requests to. This is primarily used when batching multiple requests in a single process such as when geoeocidng all waypoints for the distance matrix API, or when manually generating a truck based distance matrix using the routing API.

Static Methods

NameReturn TypeDescription
GetResponseAsync(BaseRestRequest request)Task<Response>Processes a REST requests that returns data.
GetResponseAsync(BaseRestRequest request, Action<int> remainingTimeCallback)Task<Response>Processes a REST requests that returns data.
GetImageAsync(BaseImageryRestRequest imageryRequest)Task<Stream>Processes a REST requests that returns an image stream.

SimpleAddress Class

A simple address class that can be passed in to queries.

Properties

NameTypeDescription
AddressLinestringThe official street line of an address relative to the area, as specified by the Locality, or PostalCode, properties. Typical use of this element would be to provide a street address or any official address.
AdminDistrictstringThe subdivision name in the country or region for an address. This element is typically treated as the first order administrative subdivision, but in some cases, it is the second, third, or fourth order subdivision in a country, dependency, or region.
CountryRegionstringThe ISO country code for the country.
LocalitystringThe locality, such as the city or neighborhood, that corresponds to an address.
PostalCodestringThe post code, postal code, or ZIP Code of an address.

SimpleWaypoint Class

A simple waypoint class that can be used to calculate a route.

Constructor

SimpleWaypoint()

SimpleWaypoint(Coordinate coordinate)

SimpleWaypoint(string address)

SimpleWaypoint(Coordinate coordinate, string address)

SimpleWaypoint(double latitude, double longitude)

Methods

NameReturn TypeDescription
TryGeocode(SimpleWaypoint waypoint, string bingMapsKey)TaskTries to geocode a simple waypoint.
TryGeocode(SimpleWaypoint waypoint, BaseRestRequest baseRequest)TaskTries to geocode a simple waypoint.
TryGeocodeWaypoints(List<SimpleWaypoint> waypoints, string bingMapsKey)TaskAttempts to geocode a list of simple waypoints.
TryGeocodeWaypoints(List<SimpleWaypoint> waypoints, BaseRestRequest baseRequest)TaskAttempts to geocode a list of simple waypoints.

Static Methods

NameReturn TypeDescription
Parse(string waypointString)SimpleWaypointParses a simple waypoint value from a string. If it has the format "latitude,longitude", it will be used as a coordinate, otherwise as an address.

Properties

NameTypeDescription
AddressstringThe address query for the waypoint.
CoordinateCoordinateThe coordinate of the waypoint. When specified this will be used instead of the Address value in requests.
IsViaPointboolA bool indicating whether the waypoint is a via point.

VehicleSpec Class

A class that defines the options that can to use when calculating a truck route. Extends the RouteOptions class.

Properties

NameTypeDescription
DimensionUnitDimensionUnitTypeThe unit of measurement of width, height, length.
WeightUnitWeightUnitTypeThe unit of measurement of weight.
VehicleHeightdoubleThe height of the vehicle in the specified dimension units.
VehicleWidthdoubleThe width of the vehicle in the specified dimension units.
VehicleLengthdoubleThe length of the vehicle in the specified dimension units.
VehicleWeightdoubleThe weight of the vehicle in the specified weight units.
VehicleAxlesintThe number of axles.
VehicleSemiboolIndicates if the truck is pulling a semi-trailer. Semi-trailer restrictions are mostly used in North America.
VehicleTrailersintSpecifies number of trailers pulled by a vehicle. The provided value must be between 0 and 4.
VehicleMaxGradientdoubleThe max gradient the vehicle can drive measured in degrees.
VehicleMinTurnRadiusdoubleThe mini-mum required radius for the vehicle to turn in the specified dimension units.
VehicleAvoidCrossWindboolIndicates if the vehicle shall avoid crosswinds.
VehicleAvoidGroundingRiskboolIndicates if the route shall avoid the risk of grounding.
VehicleHazardousMaterialsList<HazardousMaterialType>A list of one or more hazardous materials for which the vehicle is transporting.
VehicleHazardousPermitsList<HazardousMaterialPermitType>A list of one or more hazardous materials for which the vehicle has permits.

Enumerations

AvoidType Enumeration

Specifies the road types to minimize or avoid when the route is created for the driving travel mode.

NameDescription
HighwaysAvoids the use of highways in the route.
MinimizeHighwaysMinimizes (tries to avoid) the use of highways in the route.
MinimizeTollsMinimizes (tries to avoid) the use of toll roads in the route.
TollsAvoids the use of toll roads in the route.

ConfidenceLevelType Enumeration

The level of confidence that the geocoded location result is a match.

NameDescription
HighHigh confidence match.
LowLow confidence match.
MediumMedium confidence match.
NoneNo confidence level set.

DimensionUnitType Enumeration

Measurement units of vehicle dimensions.

NameDescription
MeterDimensions in meters.
FootDimensions in feet.

DistanceUnitType Enumeration

Units of measurements for distances.

NameDescription
KilometersDistances in Kilometers.
MilesDistances in Miles.

ElevationType Enumeration

Relative elevation type.

NameDescription
EllipsoidEllipsoid Earth model (WGS84).
SealevelGeoid Earth model (EGM2008 2.5-).

EntityType Enumeration

Types of location based entities.

NameDescription
AddressA street address or RoadBlock.
AdminDivision1First administrative level within the country/region level, such as a state or a province.
AdminDivision2Second administrative level within the country/region level, such as a county.
CountryRegionCountry or region
NeighborhoodA section of a populated place that is typically well-known, but often with indistinct boundaries.
PopulatedPlaceA concentrated area of human settlement, such as a city, town or village.
Postcode1The smallest post code category, such as a zip code.

HazardousMaterialPermitType Enumeration

Types of hazardous material permits for truck routing.

NameDescription
AllAppropriateForLoadPermit for goods which are all appropriate for load.
CombustiblePermit for combustible material.
CorrosivePermit for corrosive material.
ExplosivePermit for explosive material.
FlammablePermit for flammable material.
FlammableSolidPermit for flammable solid material.
GasPermit for gases.
OrganicPermit for organic material.
PoisonPermit for poisonous material.
PoisonousInhalationPermit for poisonous inhalation material.
RadioactivePermit for radioactive material.

HazardousMaterialType Enumeration

Hazardous materials in which a truck may transport.

NameDescription
CombustableCombustable materials.
CorrosiveCorrosive materials.
ExplosiveExplosive materials.
FlammableFlammable materials.
FlammableSolidFlammable Solid materials.
GasGases.
GoodsHarmfulToWaterGoods Harmful To Water.
OrganicOrganic materials.
PoisonPoisonous materials.
PoisonousInhalationPoisonous Inhalation materials.
RadioactiveRadioactive materials.

ImageFormatType Enumeration

Imagery format types.

NameDescription
GIFGIF image format.
JPEGJPEG image format. JPEG format is the default for Road, Aerial and AerialWithLabels imagery.
PNGPNG image format. PNG is the default format for CollinsBart and OrdnanceSurvey imagery.

ImageryType Enumeration

Types of map imagery.

NameDescription
AerialAerial imagery.
AerialWithLabelsAerial imagery with a road overlay.
AerialWithLabelsOnDemandAerial imagery with on-demand road overlay.
BirdseyeBird-s eye (oblique-angle) imagery
BirdseyeWithLabelsBird-s eye imagery with a road overlay.
BirdseyeV2The second generation Bird-s eye (oblique-angle) imagery.
BirdseyeV2WithLabelsThe second generation Bird-s eye (oblique-angle) imagerywith a road overlay.
CanvasDarkA dark version of the road maps.
CanvasGrayA grayscale version of the road maps.
CanvasLightA lighter version of the road maps which also has some of the details such as hill shading disabled.
OrdnanceSurveyOrdnance Survey imagery.
RoadRoads without additional imagery.
RoadOnDemandRoads without additional imagery. Uses dynamic tile service.

RouteAttributeType Enumeration

The type of route attributes to include in a route response.

NameDescription
AllUsed to specify the following attributes as a group: excluteItinerary, routePath, and transitStops.
ExcludeItineraryDo not include detailed directions in the response. Detailed directions are provided as itinerary items and contain details such as written instructions and traffic location codes.
RoutePathInclude a set of point (latitude and longitude) values that describe the route-s path in the response.
RouteSummariesOnlyInclude only travel time and distance for the route, and does not provide other information.
RegionTravelSummaryInclude travel summary of distance, time, and toll road distance by two entity types: country (e.g. US, Canada) and administrative division or subregion (e.g. “state” in US and “province” in Canada).
TransitStopsInclude information about transit stops for transit routes.

RouteOptimizationType Enumeration

Specifies what parameters to use to optimize the route on the map.

NameDescription
DistanceOptimizes route for shortest distance.
TimeOptimizes route for shortest travel time.
TimeAvoidClosureThe route is calculated to minimize the time and avoid road closures. Traffic information is not used in the calculation.
TimeWithTrafficOptimizes route for shortest travel time with respect to current traffic conditions.

RouteTimeType Enumeration

Specifies how to interpret the date and transit time value that is specified by the dateTime parameter.

NameDescription
ArrivalThe dateTime parameter contains the desired arrival time for a transit request.
DepartureThe dateTime parameter contains the desired departure time for a transit request.
LastAvailableThe dateTime parameter contains the latest departure time available for a transit request.

SeverityType Enumeration

Specifies the severity level of a traffic incident.

NameDescription
LowImpactLow impact severity.
MinorMinor severity.
ModerateModerate severity.
SeriousSerious severity.

SpeedUnitType Enumeration

Unit of speed.

NameDescription
KPHKilometers per hour.
MPHMiles per hour.

TimeUnitType Enumeration

Represents the units in which time is measured.

NameDescription
MinuteTime is in minutes.
SecondTime is in seconds.

TrafficType Enumeration

Specifies the type of a traffic incident.

NameDescription
AccidentAccident incident type.
CongestionCongestion incident type.
DisabledVehicleDisabled vehicle incident type.
MassTransitMass transit incident type.
MiscellaneousMiscellaneous incident type.
OtherNewsOther news incident type.
PlannedEventPlanned event incident type.
RoadHazardRoad hazard incident type.
ConstructionConstruction incident type.
AlertAlert incident type.
WeatherWeather incident type.

TravelModeType Enumeration

The mode of travel for the route.

NameDescription
DrivingDriving mode.
WalkingWalking mode.
TransitTransit mode.
TruckTruck driving mode.

WeightUnitType Enumeration

Unit of measurement for vehicle weights.

NameDescription
KilogramsWeight in kilograms.
PoundsWeight in pounds.

Enhanced Response Classes

These are response classes that have been extended extensively to make them easier to use.

DistanceMatrix Class

Static Methods

NameReturn TypeDescription
CreateStraightLineNxNMatrix(List<SimpleWaypoint> waypoints, DistanceUnitType distanceUnits, string bingMapsKey)Distance MatrixCreates a NxN distance matrix with straight line distances.

Methods

An indexing system has been added to the DistanceMatrix class to make it easy to retrieve cells by origin and destination index.

NameReturn TypeDescription
GetCell(int originIdx, int destinationIdx)DistanceMatrixCellRetrives the distance matrix cell for a specified origin-destination pair. Returns -1 if a cell can not be found in the results or had an error in calculation.
GetCell(int originIdx, int destinationIdx, DateTime timeInterval)DistanceMatrixCellRetrives the distance matrix cell for a specified origin-destination pair and time interval. Returns -1 if a cell can not be found in the results or had an error in calculation.
GetCell(int originIdx, int destinationIdx, int timeIntervalIdx)DistanceMatrixCellRetrives the distance matrix cell for a specified origin-destination pair and time interval. Returns -1 if a cell can not be found in the results or had an error in calculation.
GetCells(int originIdx, int destinationIdx)DistanceMatrixCell[]Gets all cells for the specified origin and destination index, ordered by time (ascending).
GetDistance(int originIdx, int destinationIdx)doubleRetrives the travel distance for a specified origin-destination pair. Returns -1 if a cell can not be found in the results or had an error in calculation.
GetDistance(int originIdx, int destinationIdx, DateTime timeInterval)doubleRetrives the travel distance for a specified origin-destination pair and time interval. Returns -1 if a cell can not be found in the results or had an error in calculation.
GetDistance(int originIdx, int destinationIdx, int timeIntervalIdx)doubleRetrives the travel distance for a specified origin-destination pair and time interval. Returns -1 if a cell can not be found in the results or had an error in calculation.
GetDistances(int originIdx, int destinationIdx)double[]Gets all travel distances for the specified origin and destination index, ordered by time (ascending).
GetEdgeDistance(int[] waypointIndicies)doubleRetrieves the total travel distance between all waypoints indicies which represent an edge (graph/path). If a path between to waypoints is not routable, a large distance value will be returned.
GetEdgeDistance(int[] waypointIndicies, bool isRoundTrip)doubleRetrieves the total travel distance between all waypoints indicies which represent an edge (graph/path). If a path between to waypoints is not routable, a large distance value will be returned.
GetEdgeTime(int[] waypointIndicies)doubleRetrieves the total travel time between all waypoints indicies which represent an edge (graph/path). If a path between to waypoints is not routable, a large time value will be returned.
GetEdgeTime(int[] waypointIndicies, bool isRoundTrip)doubleRetrieves the total travel time between all waypoints indicies which represent an edge (graph/path). If a path between to waypoints is not routable, a large time value will be returned.
GetTime(int originIdx, int destinationIdx)doubleRetrives the travel time for a specified origin-destination pair. Returns -1 if a cell can not be found in the results or had an error in calculation.
GetTime(int originIdx, int destinationIdx, DateTime timeInterval)doubleRetrieves the travel time for a specified origin-destination pair and time interval. Returns -1 if a cell can not be found in the results or had an error in calculation.
GetTime(int originIdx, int destinationIdx, int timeIntervalIdx)doubleRetrieves the travel time for a specified origin-destination pair and time interval. Returns -1 if a cell can not be found in the results or had an error in calculation.
GetTimes(int originIdx, int destinationIdx)double[]Gets all travel times for the specified origin and destination index, ordered by time (ascending).

Properties

NameTypeDescription
DestinationsSimpleWaypoint[]The array of destinations that were used to calculate the distance matrix.
ErrorMessagestringDetails of an error that may have occurred when processing the request.
OriginsSimpleWaypoint[]The array of destinations that were used to calculate the distance matrix.
ResultDistanceMatrixCell[]Array of distance matrix cell results containing information for each coordinate pair and time interval.
TimeIntervalsList<DateTime>A list of time intervals in which the distance matrix calculated for.

Extension Classes

TravellingSalesmen Class

This is a static class that solves the travelling salesmen problem. Uses a greedy algrithm when 10 or less waypoints are specified, and a genetic algorithm for larger waypoint sets.

Methods

NameReturn TypeDescription
Solve(List<SimpleWaypoint> waypoints, TravelModeType? travelMode, TspOptimizationType? tspOptimization, DateTime? departureTime, string bingMapsKey)Task<TspSolution>Solves the travelling salesmen problem.
Solve(DistanceMatrix matrix, TspOptimizationType tspOptimization)Task<TspSolution>Solves the travelling salesmen problem.

TspOptimizationType Enumeration

Metrics in which the travelling salesmen problem is solved for.

NameDescription
StraightLineDistanceOptimizes based on straight line distances (as the crow flies).
TravelDistanceOptimizes based on travel distances (roads). Uses the Distance Matrix API.
TravelTimeOptimizes based on travel times (roads). Uses the Distance Matrix API.

TspSolution Class

The result from a Travelling Salesmen calculation.

Properties

NameTypeDescription
DistanceMatrixDistanceMatrixThe distance matrix used in the calculation.
IsRoundTripboolIndicates if the path is for a round trip and returns to the origin or not.
OptimizedWaypointsList<SimpleWaypoint>A list of the waypoints in an optimized ordered.
OptimizedWeightdoubleThe optimized weight (time or distance) between all waypoints based on the TspOptimizationType.
TravelModeTravelModeTypeThe travel mode used to calculate the distance matrix.
TspOptimizationTspOptimizationTypeThe metric used to solve the travelling salesmen problem for.

Response class extensions

Extensions that have been added to response classes.

Response class extension

Extensions to the Response class to assist with common tasks.

Static Methods

NameReturn TypeDescription
HasResource(Response response)boolCheck that a response has one or more resources. This is a helper class to save on having to check all the parts of the response tree.
GetFirstResource(Response response)ResourceGets the first resource in a response.

RoutePath class extension

Extensions to the RoutePath class to assist with common tasks.

Methods

NameReturn TypeDescription
GetCoordinates()Coordinate[]Gets an array of coordinate objects for the route path.