Table of Contents

ThinkGeo Vector Map.js API Documentation

Map Suite VectorMap.js is an extension of OpenLayers used to create vector maps for web and mobile devices. It's an open-source on ThinkGeo Github. Map Suite VectorMap.js simplifies the process of creating the vector maps within OpenLayers and optimizes the performance in some aspects.

Credential

Map Suite VectorMap.js provides two ways to pass your authentication credentials for access to vector tile services.

Define your "API Key" in your layer:

var layer = new ol.mapsuite.WorldStreetsVectorTileLayer("streets.json",
{
apiKey:"API Key"
});

Define your "Client Id" and "Client Secret" in your layer:

var layer = new ol.mapsuite.WorldStreetsVectorTileLayer("streets.json",
{
clientId:"Client Id",
clientSecret:"Client Secret"
});

NOTE: Please refer to [[thinkgeo_cloud_client_keys_guideline|Cloud Keys Guidline]] on how to create your own credentials from ThinkGeo and consume services provided by ThinkGeo.

Map

ol.Map in OpenLayers is borrowed by "Map Suite VectorMap.js" to create the map instance.

ol.mapsuite.VectorTileLayer

ol.mapsuite.VectorTileLayer extends OpenLayers class ol.layer.VectorTile with additional options.

var vectorTileLayer= new ol.mapsuite.VectorTileLayer(styleJson,
{
apiKey:"API Key",
multithread:false,
declutter:true
});

parameters

new ol.mapsuite.VectorTileLayer("styleJson file", options)

The vector StyleJson object in JSON format or the vector styleJson file url, containing the definition of data sources, vector layers and styles used in the vector layers. For ol.mapsuite.VectorTile, the source in StyleJson object only receives tiles with vector features in ".MVT" format.

Name Type A string value will be attached to each tile request URL as a querystring configuration called "apiKey" for credential authentication on service.Needed when clientId or clientSecret are undefined
multithread boolean A boolean value indicating whether or not using multi-thread to read and draw features. Basically, single-thread will have a better user-experience and higher performance, but doesn't support query feature details based on coordinate. Default is true.
declutter boolean A bool value indicating whether drawing duplicated labels.Default is true.
proxy url the url of a proxy srever
clientId string A string to access server data with clientSecret. Needed when apiKey is undefined, but not recommended.
clientSecret string A string to access server data with clientId. Needed when apiKey is undefined, but not recommended.

methods

Return the associated VectorTileSource of the layer.

ol.mapsuite.VectorTileSource

ol.mapsuite.VectorTileSource extends OpenLayers class ol.source.VectorTile with all options inherited.

events

Triggered before sending a tile XmlHttpRequest.

ol.mapsuite.WorldStreetsVectorTileLayer

ol.mapsuite.WorldStreetsVectorTileLayer extends ol.mapsuite.VectorTileLayer class with ThinkGeo World Streets Vector Tile Service highly integrated.

var vectorTileLayer= new ol.mapsuite.WorldStreetsVectorTileLayer(styleJson,
{
multithread:true,
declutter:true
});