API Reference

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.

  • API Key
    If the "API Key" is passed in, then all we have to do is attach that API key to each tile request URL as a querystring configuration called an “apiKey”. These keys don’t expire unless you disable them.

    Define your "API Key" in your layer:

    var layer = new ol.mapsuite.WorldStreetsVectorTileLayer("streets.json", 
                {
                  apiKey:"API Key"
                });
    
  • Client ID and Client Secret
    If the "Client ID" and "Client Secret" are passed in we will automate the process of making a request out to the service authentication endpoint and getting the "token" so that you don't have to be involved in the process.

    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 Sign Up ThinkGeo Account 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)
  • styleJson file (object | url)

    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.

  • options (object)

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

  • getSource() -> {ol.mapsuite.VectorTileSource}

    Return the associated VectorTileSource of the layer.

ol.mapsuite.VectorTileSource

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

events

  • sendingTileRequest (ol.events.Event)

    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 
                    });

results matching ""

    No results matching ""