Query API Reference

May 18, 2017 ยท View on GitHub

Namespace: BingMapsSDSToolkit.QueryAPI

This API provides the ability to perform spatial queries against data sources hosted in the Bing Spatial Data Services.

MSDN API Documentation

The following classes and enumerators are used by the Query API.

AvoidType Enumerator

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.

CompareOperator Enumerator

Compare Operators that can be used with filters.

NameDescription
AndLogical and
Note: Not supported when combined with StartsWith or EndsWith wildcard searches.
OrLogical or
Note: Not supported when combined with StartsWith or EndsWith wildcard searches.

FilterExpression Class

Inherits from the IFilter interface.

An object that defines a filter expression.

Constructor

FilterExpression()

FilterExpression(String propertyName, LogicalOperator logicalOperator, Object value)

Properties

NameTypeDescription
OperatorLogicalOperatorThe logical operator to use when comparing filtering against the filter value.
PropertyNameStringThe name of the property to filter against. Note: You cannot filter on the latitude and longitude entity properties.
ValueObjectThe value to compare against.

Methods

NameReturn TypeDescription
ToString()StringConverts the filter expression to string.

FilterGroup Class

Inherits from the IFilter interface.

A group of filter objects and the compare operator to use against them.

Constructor

FilterGroup()

FilterGroup(IFilter\[\] filters, CompareOperator compareOperator)

FilterGroup(IFilter\[\] filters, CompareOperator compareOperator, Boolean not)

Properties

NameTypeDescription
CompareOperatorCompareOperatorThe comparison operator to use with the filters.
FiltersIFilter[]An array of filters expressions.
NotStringA boolean indicating if this filter should not make or not.

Methods

NameReturn TypeDescription
ToString()StringConverts the filter group to string.

FindByPropertyRequest Class

Inherits from the BasicDataSourceInfo class.

A query that searches by property. This is also the basis to all other queries.

Constructor

FindByPropertyRequest()

FindByPropertyRequest(BasicDataSourceInfo info)

Properties

NameTypeDescription
DistanceUnitsDistanceUnitTypeThe distance units to use with the query.
FilterIFilterA filter that specifies conditional expressions for a list of properties and values.
InlineCountBooleanA boolean that specifies whether or not to return a count of the results in the response. Default: false.
IsStagingBooleanA boolean value indicating if the staging version of the data source should be accessed or not.
OrderbyStringA comma delimited list of data source properties to use to sort the results. (up to 3 properties can be specified).
SelectStringA string that contains a comma delimited list of data source properties to return.
SkipInt32Specifies the number of results to skip. This lets you page through the results.
TopInt32An integer value between 1 and 250 that represents the maximium results that can be returned. Default 25.

Methods

NameReturn TypeDescription
GetRequestUrl()StringGets a URL to query the Bing Spatial Data Services.

FindInBoundingBoxRequest Class

Inherist from the FindByProperty class.

A search request that looks for locations that are inside a bounding box.

Constructor

FindInBoundingBoxRequest()

FindInBoundingBoxRequest(BasicDataSourceInfo info)

Properties

NameTypeDescription
EastDoubleThe eastern most longitude of the bounding box. Value between -180 and 180.
NorthDoubleThe northern most latitude of the bounding box. Value between -90 and 90.
SouthDoubleThe southern most latitude of the bounding box. Value between -90 and 90.
WestDoubleThe western most longitude of the bounding box. Value between -180 and 180.

Methods

NameReturn TypeDescription
GetRequestUrl()StringRetrieves the reuqest URL for the query.

FindNearByRequest Class

Inherist from the FindByProperty class.

A radial search request for finding results that are near a location.

Constructor

FindNearByRequest()

FindNearByRequest(BasicDataSourceInfo info)

Properties

NameTypeDescription
AddressStringA string address to perform a nearby search around. If the Center properties is specified it will override this value when doing the search.
CenterGeodataLocationA centeral coordinate to perform the nearby search. Overrides the Address value if both are specified.
DistanceDoubleThe radial search distance. You must specify the distance in between 0.16 and 1000 kilometers.

Methods

NameReturn TypeDescription
GetRequestUrl()StringRetrieves the reuqest URL for the query.

FindNearRouteRequest Class

Inherist from the FindByProperty class.

A search query that looks for locations that are within 1 mile or 1.6 kilometers of a route.

Constructor

FindNearRouteRequest()

FindNearRouteRequest(BasicDataSourceInfo info)

Properties

NameTypeDescription
AvoidAvoidType[]Specifies the road types to minimize or avoid when the route is created for the driving travel mode.
DistanceBeforeFirstTurnInt32Specifies the distance before the first turn is allowed in the route. This option only applies to the driving travel mode.
EndAddressStringA string address to use as the end location of the route. If the EndLocation properties is specified it will override this value when doing the search.
EndLocationGeodataLocationA coordinate to use as the end location of the route. Overrides the EndAddress value if both are specified.
HeadingInt32Specifies 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. For example, setting the heading of 270 degrees creates a route that initially heads west.
OptimizeRouteOptimizationTypeSpecifies what parameters to use to optimize the route on the map. Default: Time.
StartAddressStringA string address to use as the starting location of the route. If the StartLocation properties is specified it will override this value when doing the search.
StartLocationGeodataLocationA coordinate to use as the starting location of the route. Overrides the StartAddress value if both are specified.
TravelModeTravelModeTypeThe mode of travel for the route. Default: Driving.

Methods

NameReturn TypeDescription
GetRequestUrl()StringRetrieves the reuqest URL for the query.

IFilter Interface

A filter interface.

IntersectionSearchRequest Class

Inherist from the FindByProperty class.

A search query which looks to see if and locations intersect the specified Geography.

Constructor

IntersectionSearchRequest()

IntersectionSearchRequest(BasicDataSourceInfo info)

Properties

NameTypeDescription
GeographyGeographyThe Geography to do an intersection test against.

Methods

NameReturn TypeDescription
GetRequestUrl()StringRetrieves the reuqest URL for the query.

LogicalOperator Enumerator

The logical operators that can be used by a filter expression.

NameDescription
EndsWithFinds all property values that end with a specified string value. Not supported with And or Or comparison operators. Is not supported for NavteqNA and NavteqEU data sources.
EqEqual
GeGreater than or equal
GtGreater than
IsInFinds all properties who's value is within a list of values.
LeLess than or equal
LtLess than
NeNot equal
StartsWithFinds all property values that start with a specified string value. Not supported with And or Or comparison operators. Is not supported for NavteqNA and NavteqEU data sources.

QueryManager Class

A static class for processing queries.

Static Methods

NameReturn TypeDescription
ProcessQuery(FindByPropertyRequest request)Task<QueryResponse>Processes a query request.

QueryResponse Class

An object that represents the response from a query.

Constructor

QueryResponse()

Properties

NameTypeDescription
ErrorMessageStringA string containing an error message if an error occurs while processing the query.
ResultsList<QueryResult>An array of query results.

QueryResult Class

An object that represents a single entity result in the query.

Constructor

QueryResult()

Properties

NameTypeDescription
DistanceDoubleThe distance the result is from the search query. The distance value will be in the specified distance units or will default to KM. This value is only set if the request is of type FindNearby, FindInBoundingBox, or FindNearRoute.
EntityUrlStringA url that points to this entity in the data source.
HasGeographyBooleanIndicates if the result has a property of type Geography or not.
IntersectedGeographyGeographyThe intersected section of the Geography
LocationGeodataLocationThe location coordinate of the result.
PropertiesDictionary<string, object>A dictionary of additional properties this entity has.

Methods

NameReturn TypeDescription
GetGeography()GeographyGets first property of type geography for the result.

RouteOptimizationType Enumerator

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

NameDescription
DistanceOptimizes route for shortest distance.
TimeOptimizes route for shortst travel time.
TimeWithTrafficOptimizes route for shortst travel time with respect to current traffic conditions.

TravelModeType Enumerator

The mode of travel for the route.

NameDescription
DrivingDriving mode
WalkingWalking Mode