Maps SDK for Web
tt.services.geometrySearch
Makes a search request using the TomTom Search API - Geometry Search.
Parameters need to be passed to the constructor.
Response
The response is extended with getTrackingId()
method, which returns the Tracking-ID
associated with the request.
Additionally, the response extends API response by providing toGeoJson()
method, which converts geometry search data into
FeatureCollection with Point geometry.
Each point feature represents poi
from the original response. Properties of poi
are mapped into feature properties
Please refer to Difference between API responses and this library's responses section.
In order to make a batch call, pass an object containing the following properties:
- 'key' - valid API Key for the used service
- 'batchMode' - valid options: sync, async, or redirect
- 'waitTimeSeconds' - maximum waiting time for batch download response. This option only works with 'async' and 'redirect' batch modes. Accepts 120 or an integer between 5 and 60.
- 'batchItems' - array of objects with options for each call.
For more information, please refer to the batch documentation: Routing, Search.
tt.services.<service name>({
batchMode: 'sync'
key: <Your API key>,
batchItems: [{
...
}, {
...
} //... more objects
]
}).then(callback);
Constructor
tt.services.geometrySearch([options], [additionalOptions])
Example
const geometryList = [
{
type: 'POLYGON',
vertices: [
'37.7524152343544,-122.43576049804686',
'37.70660472542312,-122.43301391601562',
'37.712059855877314,-122.36434936523438',
'37.75350561243041,-122.37396240234374'
]
},
{
type: 'CIRCLE',
position: '37.71205,-121.36434',
radius: 6000
},
{
type: 'CIRCLE',
position: '37.31205,-121.36434',
radius: 1000
}
];
function callbackFn(results) {
console.log(results);
}
tt.services.geometrySearch({
key: <Your API key>,
geometryList: geometryList
}).then(callbackFn);
Parameters
Name | Description |
---|---|
options
Object default:None |
Options to be passed to the search call, or an array of such options objects to perform a batch request. |
options.entityTypeSet
String | String[] default:None |
An array or comma-separated list of entity types which can be used to restrict the result
to a specific entity type. Parameter should be used with the idxSet parameter
set to the Geography value.
Available values:
|
additionalOptions
Object default:None |
Additional options to be passed to the service. |
additionalOptions.abortSignal
Object default:None |
Signal created with abortController. Use AbortController to cancel requests in progress. Example
|
options.brandSet
String default:None |
A list of brands divided by commas. This option specifies brands to use for the search. Example
|
options.categorySet
String default:None |
A list of categories codes divided by commas. This option specifies categories codes to use for the search. Those codes can be retrieved by using poiCategories service. Example
|
options.connectorSet
String default:None |
A list of Electrical Vehicle connector types divided by commas. This option specifies connector types, which could be used to restrict the result to Points Of Interest of type Electric Vehicle Station supporting specific connector types. For more info about EV connector names, please refer to Supported Connector Types documentation page. Example
|
options.extendedPostalCodesFor
String default:None |
A comma-separated list of index types or "None" for no indexes. Indexes for which extended postal codes should be included in the results. By default, extended postal codes are available for all indexes except geographies because extended postal code lists for geographies can be quite long, so they have to be explicitly requested when needed. Availability is region-dependent. The available indexes are:
Example
|
options.geometryList
Object[] default:None |
A list of geometries. This is a list of geometries to search in. Currently only two types of geometries are being supported:
Example
|
options.idxSet
String default:None |
A list of indexes divided by commas. This option specifies indexes to use for the search. The predefined indexes are:
Example
|
options.key
String default:None |
A valid API Key for the requested service. Key is required to make use of the given service. It can be issued in the Developer Portal. |
options.language
String default:null |
Language code that decides in which language the results should be returned. The value should correspond to one of the supported IETF language codes. The list is available here. The code is case insensitive. |
options.limit
Number default:10 |
The maximum number of responses that will be returned. Represents the maximum number of responses that will be returned per request. The maximum value is 100. |
options.mapcodes
String default:null |
Enables the return of a comma-separted mapcodes list. It can also filter the response to only show selected mapcode types. See Mapcodes in the response. Values: One or more of:
A mapcode represents a specific location, to within a few meters. Every location on Earth can be represented by a mapcode. Mapcodes are designed to be short, easy to recognize, remember, and communicate. Visit the Mapcode project website for more information. Usage examples: Example
|
options.maxPowerKW
Number default:None |
A number representing a maximum power rate in kilowatts. An optional parameter which can be used to restrict the result to the availability for connectors with a specific maximum value of power in kilowatts. |
options.minPowerKW
Number default:None |
A number representing a minimum power rate in kilowatts. An optional parameter which can be used to restrict the result to the availability for connectors with a specific minimum value of power in kilowatts. |
options.openingHours
String default:None |
The only available option is 'nextSevenDays'. This option shows the opening hours for the next week, starting with the current day in the local time of the POI. Example
|
options.protocol
"http" | "https" default:"https" |
The protocol type to be used in the calls. Represents the type of protocol used to perform a service call. |
options.query
String default:None |
The query string. This value will be properly encoded during the creation of the request. This option represents the text that will be searched. |
options.relatedPois
String default:None |
The only available options are This option is used to provide the possibility to return related Points Of Interest. Points Of Interest can be related to each other when one is physically part of another. For example, an airport terminal can physically belong to an airport. This relationship is expressed as a parent/child relationship: the airport terminal is a child of the airport. Usage:
|
options.timeZone
String default:None |
The only available option is This option is used to indicate the mode in which the timeZone object should be returned. The only available option is iana - mode that shows the IANA ID which allows the user
to determine the current time zone for the POI.
Example
|
options.trackingId
String default:uuid |
Sets value of "Tracking-ID" header. Specifies an identifier for the request. If not set by the user, UUID is generated for each call.
|
options.view
String default:None |
Geopolitical view. Can be one of "Unified", "AR", "IN", "PK", "IL, "MA", "RU", "TR" and "CN". Legend:
|