Maps SDK for Web

tt

This object aggregates all necessary modules and classes to work with maps.

Please refer to the following documentation to check what properties and methods are included in the tt object.

Properties

Evented: Maps.Evented

Use this class to create a new Evented.

LngLat: Maps.LngLat

Use this class to create a new LngLat.

Marker: Maps.Marker

Use this class to create a new marker component.

Point: Maps.Point

Use this class to create a new Point.

Popup: Maps.Popup

Use this class to create a new popup component.

sdkInfo: Function

Returns SDK details. (e.g., version)

workerCount: Number

Gets and sets the number of web workers instantiated on a page with Web SDK maps. By default, it is set to half the number of CPU cores (capped at 6). Make sure to set this property before creating any map instances for it to have effect.

Methods

clearPrewarmedResources( )

Clears up resources that have previously been created by tt.prewarm(). Note that this is typically not necessary. You should only call this function if you expect the user of your app to not return to a Map view at any point in your application.

prewarm( )

Initializes resources like WebWorkers that can be shared across maps to lower load times in some situations. tt.workerCount, if being used, must be set before tt.prewarm() is called to have an effect. By default, the lifecycle of these resources is managed automatically, and they are lazily initialized when a Map is first created. By invoking tt.prewarm(), these resources will be created ahead of time, and will not be cleared when the last Map is removed from the page. This allows them to be re-used by new Map instances that are created later. They can be manually cleared by calling tt.clearPrewarmedResources(). This is only necessary if your web page remains active but stops using maps altogether.

setProductInfo(productId, productVersion)

This method sets the content of the TomTom-User-Agent header. We are collecting anonymous data for statistics of usage of our services in order to increase the quality of our products.

Example
tt.setProductInfo('your-product-id', 'your-product-version');
Parameters
Name Description
productId
String
default:None
Identifier (e.g., a name) of your application e.g., MyApplication
productVersion
String
default:None
Version of your application e.g., 1.0.2

supported([options]): Boolean

This method allows you to check if the user's browser is supported.

Example
tt.supported() // = true
Parameters
Name Description
options
Object
default:None
Object with options
options.failIfMajorPerformanceCaveat
Boolean
default:None
If true, the function will return false if the performance of maps would be dramatically worse than expected (e.g. a software WebGL renderer would be used).
Returns