Maps SDK for Web

tt.services.copyrights

The Copyrights service implementation provides a full copyrights notice in a HTML format that can be displayed to the user when the copyrights link is clicked.

The Copyrights API can take as an argument an area which concerns the copyrights. If this argument is omitted the whole world is considered.

The API handles the "edge of the world" issue. It allows the proper handling of bounding box that is outside of world extents (-180, -90, 180, 90).

Parameters need to be passed to the constructor.

Response

The final response from the service is a HTML string with the copyrights information that have to be displayed. The whole respose is wrapped into a div element with the id copyrightMessage. Country names are enclosed within h4 elements and the copyrights information per each supplier is enclosed in p elements. This makes styling with CSS fairly easy. An example response may look like this:

<div id="copyrightMessage"><h4>General Copyrights:</h4>
  <p>© 1992 – 2018 TomTom. All rights reserved. This
  material is proprietary and the subject of
  copyrights protection, database right protection
  and other intellectual property rights owned
  by TomTom or its suppliers. The use of
  this material is subject to the terms of a license
  agreement. Any unauthorized copying or disclosure
  of this material will lead to criminal and civil
  liabilities.</p>
  <p>Data Source © 2018 TomTom</p>
</div>

The response is also extended by getTrackingId() method, which returns the Tracking-ID associated with the request.

Constructor

tt.services.copyrights([options], [additionalOptions])

Example
//a bounding box copyrights call
tt.services.copyrights({
  key: <Your API key>,
  boundingBox: '0, 0, 1, 1'
}).then(function(response) {
    console.log(response);
  });

//a tile-level copyrights call
tt.services.copyrights({
  key: <Your API key>,
  zoom: 1,
  x: 1,
  y: 1
}).then(function(response) {
    console.log(response);
  });
Parameters
Name Description
options
Object
default:None
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
var abortController = new AbortController();
var options = {};
tt.services.calculateRoute(options, { abortSignal: abortController.signal })
    .then(function(response) { console.log(response) });
    .catch(function(error) {
        if (abortController.signal.aborted === true) {
            console.log('Request aborted.');
        }
    });
abortController.abort();
options.boundingBox
Maps.LngLatBounds | Number[] | Object[] | String
default:None
Bounding box area in one of the supported formats.
The bounding box is a limited area within the search results. If it is omitted then the whole world will be taken into consideration. In case the area specified exceeds the world boundaries, the following actions will be taken depending on which side was exceeded:
  • Latitudes: the exceeded values will be replaced with their maximun.
  • Longitudes: The service will split the area into two (or more) valid bounding boxes, will execute a search request for each one, and then merge the responses into a single result.
This option is able to convert a number of popular formats into the bounding box. The supported formats are listed below:
  • Maps.LngLatBounds class instance
  • {minLon: 0, minLat: 0, maxLon: 1, maxLat: 1} A plain object with the keys minLon, minLat, maxLon, maxLat.
  • [0, 0, 1, 1] An array of numbers describing the bounding box following the order: minLon, minLat, maxLon, maxLat.
  • [[0, 0], [1, 1]] A two-dimensional array with two indexes [southWest, northEast], each one with longitude and latitude values.
  • "0,0,1,1" A comma-separated string with numbers in the order: minLon, minLat, maxLon, maxLat.
  • [{lon: 0, lat: 0},{lon: 1, lat: 1}] A one-dimensional array with two objects in the order: southWest, northEast, and each object with a lat and lon key.
  • [{lng: 0, lat: 0},{lng: 1, lat: 1}] A one-dimensional array with two objects in the order: southWest, northEast and each object with a lat and lon key.
  • [Maps.LngLat, Maps.LngLat] A one-dimensional array with two Maps.LngLat instances in the order: southWest and northEast.
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.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.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.
  • It can be used to trace a call.
  • The value must match the regular expression '^[a-zA-Z0-9-]{1,100}$'.
  • An example of the format that matches this regular expression is UUID: (e.g. 9ac68072-c7a4-11e8-a8d5-f2801f1b9fd1). For details check RFC 4122.
  • If specified, it is replicated in the Tracking-ID Response header.
  • It is only meant to be used for support and does not involve tracking of you or your users in any form.
options.x
Integer
default:None
The x axis value.
This option specifies the x axis value in a slippy map format. Only used for tile-level copyright calls.
options.y
Integer
default:None
The y axis value.
This option specifies the y axis value in a slippy map format. Only used for tile-level copyright calls.
options.zoom
Integer
default:None
The zoom level.
This option specifies the zoom level in a slippy map format. Only used for tile-level copyright calls.