Sorry, you need to enable JavaScript to visit this website.

Map Styles

 

Service version: 1.0
Last edit: 2019.02.28

On this page

Purpose

The Maps API Resource service delivers resources required to display vector maps. The service consists of the:

  • Metadata method: This retrieves a list of resources of a selected type.
  • Resource method: This retrieves a selected resource.

Request data

Metadata method

HTTPS method: GET

URL format

For ease of viewing and identification:

  • Required parameters are shown in bold text.
  • Optional parameters are shown in normal text.

The generic URL format is as follows:

http|https://baseURL/map/versionNumber/resourceType/resourceVersion/resourceVariant/metadata.format?key=*****

Examples

http://api.tomtom.com/map/1/style/metadata.xml?key=*****
http://api.tomtom.com/map/1/sprite/20.0.0-8/metadata.json?key=*****
http://api.tomtom.com/map/1/glyph/20.0.0-8/metadata.jsonp?key=*****

curl command

curl -XGET 'http://api.tomtom.com/map/1/sprite/20.0.0-8/metadata.json?key=*****'

Request parameters (Metadata method)

The following table describes the parameters that can be used in a request.

  • Required parameters must be used or the call will fail.
  • Parameters and values are case-sensitive.
  • Optional parameters may be used.
  • If there is a default value that will be assumed when an optional parameter is not used, it is shown in the table.
Required parameters
Parameter Description
baseURL
string
Base URL for calling TomTom services.
Value: api.tomtom.com
versionNumber
integer
The version of the service to call.
Value: The current version is 1.
resourceType
string
The type of the requested resource.
Values:

  • style
  • sprite
  • glyph
format
string
The Requested response format.
Values:

  • xml
  • json
  • jsonp
key
string
The authorization key for access to the API.
Value: Your valid API Key.
Optional parameters
Parameter Description
resourceVersion
string
Version of the requested resource.
Value: The version.
resourceVariant
string
Variant of the requested resource. Can only be used when resourceVersion is provided.
Value: The variant name.

▲ Return to top

Resource method

HTTPS method: GET

URL format

For ease of viewing and identification:

  • Required parameters are shown in bold text.
  • Optional parameters are shown in normal text.

The generic URL format is as follows:

http|https://baseURL/map/versionNumber/resourceType/resourceVersion/resourceVariant/resourceName?key=*****

Example

https://api.tomtom.com/map/1/style/20.0.0-8/basic_main.json?key=*****
https://api.tomtom.com/map/1/sprite/20.0.0-8/lite/sprite.png?key=*****

curl command

curl -XGET 'http://api.tomtom.com/map/1/style/20.0.0-8/basic_main.json?key=*****'

Request parameters (Resource method)

The following table describes the parameters that can be used in a request.

  • Required parameters must be used or the call will fail.
  • Parameters and values are case-sensitive.
  • Optional parameters may be used.
  • If there is a default value that will be assumed when an optional parameter is not used, it is shown in the table.
Required parameters
Parameter Description
baseURL
string
Base URL for calling TomTom services
Value: api.tomtom.com
versionNumber
integer
The version of the service to call.
Value: The current version is 1.
resourceType
string
The type of the requested resource.
Values:

  • style
  • sprite
  • glyph
resourceVersion
string
The version of the requested resource. Available versions can be listed using the Metadata method.
Value: A version.
resourceName
string
The requested resource name (with an extension if applicable). Available resources can be listed using the Metadata method.
Value: A resource name.
key
string
Authorization key for access to the API.
Value: Your valid API Key.
Optional parameters
Parameter Description
resourceVariant
string
The variant of the requested resource. Available variants can be listed using the Metadata method.
Value: For example, tomtom

▲ Return to top

Host name cycling

Most web browsers have a default limitation on the number of active connections that can be allowed to each host.

  • This means if map tiles are being loaded via the api.tomtom.com host name, they will be loaded one at a time.
  • A trick that can be used to get around this limitation is to cycle through the hosts we have created as aliases.
  • These host names are:
    • a.api.tomtom.com
    • b.api.tomtom.com
    • c.api.tomtom.com
    • d.api.tomtom.com
  • By cycling through these four different host names, the web browser will be tricked into retrieving four map resources at a time rather than just one.
  • This will significantly speed up the performance of map loading.

For instance, if four map glyphs are being requested, you would request the first one as:

http://a.api.tomtom.com/map/1/glyph/(further parameters)

The second would be:

http://b.api.tomtom.com/map/1/glyph/(further parameters)

The third would be:

http://c.api.tomtom.com/map/1/glyph/(further parameters)

The fourth would be:

http://d.api.tomtom.com/map/1/glyph/(further parameters)

When more than four glyphs are being requested, start back again at a.api.tomtom.com.

▲ Return to top

Response data

Metadata method

The Response to a successful call will be the list of requested resources as shown in the following JSON Response code example. Exception responses will use the response codes described in the following Http Response Codes section.

Response body (JSON)

{
  "content" : [
    {
      "name" : "basic_main-lite.json",
      "type" : "resource"
    },
    {
      "name" : "basic_main.json",
      "type" : "resource"
    },
    {
      "name" : "basic_night-lite.json",
      "type" : "resource"
    },
    {
      "name" : "basic_night.json",
      "type" : "resource"
    },
    {
      "name" : "hybrid_main-lite.json",
      "type" : "resource"
    },
    {
      "name" : "hybrid_main.json",
      "type" : "resource"
    },
    {
      "name" : "hybrid_night-lite.json",
      "type" : "resource"
    },
    {
      "name" : "hybrid_night.json",
      "type" : "resource"
    },
    {
      "name" : "labels_main-lite.json",
      "type" : "resource"
    },
    {
      "name" : "labels_main.json",
      "type" : "resource"
    },
    {
      "name" : "labels_night-lite.json",
      "type" : "resource"
    },
    {
      "name" : "labels_night.json",
      "type" : "resource"
    }
  ]
}

Resource method

The Response to a successful Request will be the requested resource (style, glyph, or sprite). Exception responses will use the response codes described in the following Http Response Codes section.

HTTP Response codes

Code Meaning and Possible Causes
200 OK
400 Bad request: Received by the interface, but there is an exception while processing it. Possible causes include:

  • One or more of the required parameters are missing.
  • An unsupported or unrecognized parameter value.

This code is returned if the parameters of the Request were malformed. A detailed exception explanation is returned in the Response in the "form of service exception" report.

403 Forbidden: The supplied API Key is not valid for this Request.
404 Not found: The requested resource could not be found.
500 Internal Server Error: There is a problem with the service.

▲ Return to top

You are here