When you use the Query API, you can specify query options that define what data is returned and how it is formatted. Query options are specified as URL parameters. The query options used by the Query API include a subset of the query options defined by an Open Data Protocol (OData) specification. In addition to the OData query options, the Query API also provides custom query options, such as a spatial filter. Use spatial filter to define the area to query.
Specifies a conditional expression for a list of properties and values.
The Query API supports logical operators and precedence grouping. For a complete list of the supported operators, see the Supported $filter Operators section below.
The Query API also supports the StartsWith and EndsWith functions to perform wildcard searches. Only one wildcard search can be performed at a time, and wildcard searches cannot be combined with additional $filter expressions. Wildcard searches are not supported for NavteqNA and NavteqEU data sources. For more information, see The Wildcard Search Functions section below.
Specifies the format of the HTTP response. The supported formats for the Query API are JSON and Atom. The default format is Atom.
Specifies whether or not to return a count of the results in the response. Possible values for this query option include:
Specifies one or more properties to use to sort the results of a query. You can specify up to three (3) properties. Results are sorted in ascending order.
Each type of query, such as Query by ID or Query by Property, has a default sort order for query results. If the $orderby option is not specified, query results are sorted using the default sort for that query type. For information about the default sort rules, see the documentation for each query type.
Specifies one of the following:
Specifies to not return a specified number of query results. For example, if this value is set to 50, then the first result that is returned is the 51st result. You can use the $skip query option with the $top query option to display a subset of the query results. For example, the following parameter combinations provide sets of 10 results at a time.
&$skip=0&$top=10 [provides results 1 to 10]
&$skip=10&$top=10 [provides results 11 to 20]
Specifies the maximum number of results to return in the query response. The default value is 25 and the maximum value is 250. You can return more than 250 results by making multiple queries and using the $skip parameter to step through the results.
When you are performing a StartsWith or EndsWith wildcard search, you cannot use the And or Or comparison operators to combine multiple $filter expressions.
Greater than or equal
Less than or equal
Wildcard searches are not supported for NavteqNA and NavteqEU data sources.
Wildcard searches do not support And or Or comparison operators. Therefore, you cannot combine a wildcard search with additional $filter expressions, and you cannot request more than one wildcard search at a time.
$filter=StartsWith(property,searchString) eq true
Finds all property values that start with ‘searchString’.
Example:$filter=StartsWith(Locality,'San') eq true
$filter=EndsWith(property,searchString) eq true
Finds all property values that end with 'searchString'
Example:$filter=EndsWith(Locality,'York') eq true
Use the spatial filter in your query to set the area to search. The Query API offers four spatial filters.
Search a set distance from a location
spatialFilter=nearby(latitude,longitude,maximum distance in kilometers)
Search in a bounding box (an area defined by pairs of longitude and latitude values)
spatialFilter=bbox(South Latitude,West Longitude,North Latitude,East Longitude)
Search near a route
When you perform a nearRoute search, entities that are within one (1) mile or 1.6 kilometers are returned.
spatialFilter=nearRoute(latitude or ddress of route start,longitude or address of route end)
Search within a geographical area defined by a geography type
When you perform an ‘intersects’ search, entities that are within the geographical area defined by the specified geography are returned. Supported geography types include polygon and line string and are also used to define geography properties for entities. To see definitions of these types, see Geography Types.
Example: spatialFilter=intersects('POLYGON((9.86445 57.13876,9.89266 57.13876, 9.89266 56.94234,9.86445 56.94234,9.86445 57.13876))')