Maps SDK for Web
Class tomtom
The main namespace of the TomTom Maps SDK for Web. This is a place where you get access to all the services,
Leaflet's main object L
and configuration.
Properties
display: Object
L: Object
languageSelector: L.LanguageSelector
unitFormatConverter: UnitFormatConverter
unitSelector: L.UnitSelector
unitSelector: L.UnitSelector
Methods
additionalData([options]): AdditionalData
Factory function to create instances of the AdditionalData class.
Parameters
Name | Description | Required | Type/Values | Default |
---|---|---|---|---|
options | All the available options are described in the class page | No | Object | None |
Returns
alongRouteSearch([options]): AlongRouteSearch
Factory function to create instances of the AlongRouteSearch class.
Parameters
Name | Description | Required | Type/Values | Default |
---|---|---|---|---|
options | All the available options are described in the class page | No | Object | None |
Returns
categorySearch([options]): CategorySearch
Factory function to create instances of the CategorySearch class.
Parameters
Name | Description | Required | Type/Values | Default |
---|---|---|---|---|
options | All the available options are described in the class page | No | Object | None |
Returns
controlPanel([options]): L.ControlPanel
Factory function that creates a new instance of the L.ControlPanel widget.
Parameters
Name | Description | Required | Type/Values | Default |
---|---|---|---|---|
options | All the options are available in the widget's page | No | Object | None |
Returns
copyright([options]): Copyright
Factory function to create instances of the Copyright class.
Parameters
Name | Description | Required | Type/Values | Default |
---|---|---|---|---|
options | All the available options are described in the class page | No | Object | None |
Returns
copyrightCaption([options]): CopyrightCaption
Factory function to create instances of the CopyrightCaption class.
Parameters
Name | Description | Required | Type/Values | Default |
---|---|---|---|---|
options | All the available options are described in the class page | No | Object | None |
Returns
crossStreetLookup([options]): CrossStreetLookup
Factory function to create instances of the CrossStreetLookupclass.
Parameters
Name | Description | Required | Type/Values | Default |
---|---|---|---|---|
options | All the available options are described in the class page | No | Object | None |
Returns
distanceMeasurement([options]): L.DistanceMeasurement
Factory function that creates a new instance of the L.DistanceMeasurement widget.
Parameters
Name | Description | Required | Type/Values | Default |
---|---|---|---|---|
options | All the options are available in the widget's page | No | Object | None |
Returns
foldable([options]): L.Foldable
Factory function that creates a new instance of the L.Foldable widget.
Parameters
Name | Description | Required | Type/Values | Default |
---|---|---|---|---|
options | All the options are available in the widget's page | No | Object | None |
Returns
fuzzySearch([options]): FuzzySearch
Factory function to create instances of the FuzzySearch class.
Parameters
Name | Description | Required | Type/Values | Default |
---|---|---|---|---|
options | All the available options are described in the class page | No | Object | None |
Returns
geocode([options]): Geocode
Factory function to create instances of the Geocode class.
Parameters
Name | Description | Required | Type/Values | Default |
---|---|---|---|---|
options | All the available options are described in the class page | No | Object | None |
Returns
geometrySearch([options]): GeometrySearch
Factory function to create instances of the GeometrySearch class.
Parameters
Name | Description | Required | Type/Values | Default |
---|---|---|---|---|
options | All the available options are described in the class page | No | Object | None |
Returns
globalGeopolViewService( ): GeopolViewService
Returns the global geopolitical view service instance used by all the leaflet maps.
It lets you get and change the geopolitical view used by the entire SDK.
Whenever the setCurrentGeopolView method of this instance is called, all the GeopolViewService instances used by maps will be updated too.
But if you use the setCurrentGeopolView method in a GeopolViewService of a map instance only that instance will be updated.
Returns
globalLocaleService( ): LocaleService
Returns the global locale service instance used by all the leaflet maps.
It lets you get and change the locale configuration used by the entire SDK.
Whenever the setCurrentLocale method of this instance is called, all the LocaleService instances used by maps will be updated too.
But if you use the setCurrentLocale method in a LocaleService of a map instance only that instance will be updated.
Returns
globalUnitService( ): UnitService
Returns the global unit view service instance used by all the leaflet maps.
It lets you get and change the unit view used by the entire SDK.
Whenever the setCurrentUnit method of this instance is called, all the UnitService instances used by maps will be updated too.
But if you use the setCurrentUnit method in a UnitService of a map instance only that instance will be updated.
Returns
key(name, [value])
Sets a key 'config' object in the security configuration file. When the key's name is omitted, then the default key is set.
Parameters
Example
tomtom.key('keyValue'); // sets global key
tomtom.key('service/traffic', 'keyValue'); // sets key for traffic service
localeService( ): LocaleService
Factory function to create instances of the LocaleService class.
Returns
location([options]): L.Location
Factory function that creates a new instance of the L.Location widget.
Parameters
Name | Description | Required | Type/Values | Default |
---|---|---|---|---|
options | All the options are available in the widget's page | No | Object | None |
Returns
lowBandwidthSearch([options]): LowBandwidthSearch
Factory function to create instances of the LowBandwidthSearch class.
Parameters
Name | Description | Required | Type/Values | Default |
---|---|---|---|---|
options | All the available options are described in the class page | No | Object | None |
Returns
map( ): L.Map
Factory function to create instances of the L.Map class.
Returns
mapsKey(value)
Sets a key for the services: map tiles and copyrights. Can also be passed on the map object's initialization with key parameter.
Parameters
Name | Description | Required | Type/Values | Default |
---|---|---|---|---|
value | Value of the maps key | Yes | String | None |
Example
tomtom.mapsKey('keyValue'); // sets maps key
markersView([options]): L.MarkersLayer Deprecated
Factory function that creates a new instance of the L.MarkersLayer class.
Parameters
Name | Description | Required | Type/Values | Default |
---|---|---|---|---|
options | All the options are available in the class's page | No | Object | None |
Returns
matrixRouting([options]): MatrixRouting
Factory function to create instances of the MatrixRouting class.
Parameters
Name | Description | Required | Type/Values | Default |
---|---|---|---|---|
options | All the available options are described in the class page | No | Object | None |
Returns
messageBox([options]): L.MessageBox
Factory function that creates a new instance of the L.MessageBox class.
Parameters
Name | Description | Required | Type/Values | Default |
---|---|---|---|---|
options | All the options are available in the class's page | No | Object | None |
Returns
miniMap([options]): L.TomTomMinimap
Factory function that creates a new instance of the L.TomTomMinimap widget.
Parameters
Name | Description | Required | Type/Values | Default |
---|---|---|---|---|
options | All the options are available in the widget's page | No | Object | None |
Returns
nearbySearch([options]): NearbySearch
Factory function to create instances of the NearbySearch class.
Parameters
Name | Description | Required | Type/Values | Default |
---|---|---|---|---|
options | All the available options are described in the class page | No | Object | None |
Returns
poiSearch([options]): PoiSearch
Factory function to create instances of the PoiSearch class.
Parameters
Name | Description | Required | Type/Values | Default |
---|---|---|---|---|
options | All the available options are described in the class page | No | Object | None |
Returns
reachableRange([options]): ReachableRange
Factory function to create instances of the Reachable Range Routing class.
Parameters
Name | Description | Required | Type/Values | Default |
---|---|---|---|---|
options | All the available options are described in the class page | No | Object | None |
Returns
resultsList([options]): L.ResultsList
Factory function that creates a new instance of the L.ResultsList widget.
Parameters
Name | Description | Required | Type/Values | Default |
---|---|---|---|---|
options | All the options are available in the widget's page | No | Object | None |
Returns
reverseGeocode([options]): ReverseGeocode
Factory function to create instances of the ReverseGeocode class.
Parameters
Name | Description | Required | Type/Values | Default |
---|---|---|---|---|
options | All the available options are described in the class page | No | Object | None |
Returns
routeInputs([options]): L.RouteInputs
Factory function that creates a new instance of the L.RouteInputs widget.
Parameters
Name | Description | Required | Type/Values | Default |
---|---|---|---|---|
options | All the options are available in the widget's page | No | Object | None |
Returns
routeInstructions([options]): L.RouteInstructions
Factory function that creates a new instance of the L.RouteInstructions widget.
Parameters
Name | Description | Required | Type/Values | Default |
---|---|---|---|---|
options | All the options are available in the widget's page | No | Object | None |
Returns
routeOnMap([options]): L.RouteOnMap
Factory function that creates a new instance of the L.RouteOnMap widget.
Parameters
Name | Description | Required | Type/Values | Default |
---|---|---|---|---|
options | All the options are available in the widget's page | No | Object | None |
Returns
routeSummary([options]): L.RouteSummary
Factory function that creates a new instance of the L.RouteSummary widget.
Parameters
Name | Description | Required | Type/Values | Default |
---|---|---|---|---|
options | All the options are available in the widget's page | No | Object | None |
Returns
routing([options]): Routing
Factory function to create instances of the Routing class.
Parameters
Name | Description | Required | Type/Values | Default |
---|---|---|---|---|
options | All the available options are described in the class page | No | Object | None |
Returns
routingKey(value)
Sets a key for the routing service.
Parameters
Name | Description | Required | Type/Values | Default |
---|---|---|---|---|
value | Value of the routing key | Yes | String | None |
Example
tomtom.routingKey('keyValue'); // sets routing key
searchBox([options]): L.SearchBox
Factory function that creates a new instance of the L.SearchBox widget.
Parameters
Name | Description | Required | Type/Values | Default |
---|---|---|---|---|
options | All the options are available in the widget's page | No | Object | None |
Returns
searchKey(value)
Sets a key for search, geocode and reverse geocode services.
Parameters
Name | Description | Required | Type/Values | Default |
---|---|---|---|---|
value | Value of the search key | Yes | String | None |
Example
tomtom.searchKey('keyValue'); // sets search key
setMapbox(mapboxgl)
It takes a mapbox global object that have to be used for render the vector maps.
The use of this method is required if you use the version of this SDK version without Mapbox GL JS embedded in it.
The currently supported version of Mapbox GL JS is v0.51.0.
Parameters
Name | Description | Required | Type/Values | Default |
---|---|---|---|---|
mapboxgl | Reference to mapboxgl object (global object provided by Mapbox GL JS library) | Yes | Object | None |
Example
tomtom.setMapbox(mapboxgl); //sets mapboxgl reference
setProductInfo(productId, productVersion)
This method sets the content of TomTom-User-Agent header. We are collecting anonymous data for statistics of usage of our services in order to increase quality of our products.
staticMapImage([options]): StaticMapImage
Factory function to create instances of the StaticMapImage class.
Parameters
Name | Description | Required | Type/Values | Default |
---|---|---|---|---|
options | All the available options are described in the class page | No | Object | None |
Returns
structuredGeocode([options]): StructuredGeocode
Factory function to create instances of the class.
Parameters
Name | Description | Required | Type/Values | Default |
---|---|---|---|---|
options | All the available options are described in the class page | No | Object | None |
Returns
tomTomMarkersLayer([options]): L.TomTomMarkersLayer
Factory function to create instances of the L.TomTomMarkersLayer class.
Parameters
Name | Description | Required | Type/Values | Default |
---|---|---|---|---|
options | All the available options are described in the class page | No | Object | None |
Returns
traffic([options]): TrafficIncidents
Factory function to create instances of the TrafficIncidents class.
Parameters
Name | Description | Required | Type/Values | Default |
---|---|---|---|---|
options | All the available options are described in the class page | No | Object | None |
Returns
trafficFlowKey(value)
Sets a key for traffic flow tiles service. Can also be passed on the map object's initialization as an option of the traffic flow layer.
Parameters
Name | Description | Required | Type/Values | Default |
---|---|---|---|---|
value | Value of the traffic flow key | Yes | String | None |
Example
tomtom.trafficFlowKey('keyValue'); // sets traffic flow key
trafficFlowSegmentData([options]): TrafficFlowSegmentData
Factory function to create instances of the TrafficFlowSegmentData class.
Parameters
Name | Description | Required | Type/Values | Default |
---|---|---|---|---|
options | All the available options are described in the class page | No | Object | None |
Returns
trafficKey(value)
Sets a key for the traffic incidents tiles and services. Can also be passed on the map object's initialization as an option of the traffic incidents layer.
Parameters
Name | Description | Required | Type/Values | Default |
---|---|---|---|---|
value | Value of the traffic key | Yes | String | None |
Example
tomtom.trafficKey('keyValue'); // sets traffic key
unitService([parent]): UnitService
Factory function that creates a new instance of the UnitService class.
Parameters
Name | Description | Required | Type/Values | Default |
---|---|---|---|---|
parent | If is defined makes the new instance a "slave" of the given instance | No | UnitService | None |
Returns
useHttp([useHttp])
Tells the SDK to use HTTP instead of HTTPS (default) for the requests to TomTom Maps APIs.
This configuration can be decided per service call basis with the protocol
option.
Parameters
Name | Description | Required | Type/Values | Default |
---|---|---|---|---|
useHttp | true : HTTP will be used, false HTTPS will be used
|
No | Boolean | None |
Example
tomtom.useHttp(true); // all requests will be HTTP now
useJsonp([useJsonp]) Deprecated
Tells the SDK to use JSONP instead of JSON (default) for the requests to TomTom Maps APIs.
Parameters
Name | Description | Required | Type/Values | Default |
---|---|---|---|---|
useJsonp | true : JSONP will be used, false JSON will be used
|
No | Boolean | None |
Example
tomtom.useJsonp(true); // all requests will be JSONP from now on
vectorMapsKey(value)
Sets a key for the vector tiles service. Can also be passed on the map object's initialization with the key parameter or using key method. In cases where default key covers vectors tile service as well setting specific key here is not required.
Parameters
Name | Description | Required | Type/Values | Default |
---|---|---|---|---|
value | Value of the vector maps key | Yes | String | None |
Example
tomtom.vectorMapsKey('keyValue'); // sets the vector maps key