public class

CartoMapsService

extends Object
java.lang.Object
   ↳ com.carto.services.CartoMapsService

Class Overview

A high-level interface for Carto Maps Service.
The service can be used to automatically configure layers using
anonymous map configurations or by using parametrized named maps.

Summary

Public Constructors
CartoMapsService()
Constructs a new CartoMapsService instance with default settings.
Public Methods
LayerVector buildMap(Variant mapConfig)
Builds a list of layers given anonymous map configuration.
LayerVector buildNamedMap(String templateId, StringVariantMap templateParams)
Builds a list of layers given named map id and named map parameters.
synchronized void delete()
boolean equals(Object obj)
Checks if this object is equal to the specified object.
String getAPIKey()
Returns the API key used when accessing the online service.
String getAPITemplate()
Returns the API endpoint template of the online service.
StringVector getAuthTokens()
Returns the list of authentication tokens used when accessing online service.
IntVector getLayerIndices()
Returns the list of layer indices that are created.
String getUsername()
Returns the user account name used when accessing the online service.
AssetPackage getVectorTileAssetPackage()
Returns the asset package used when decoding vector tiles.
float getVectorTileBufferSize()
Returns the current vector tile buffer size.
int hashCode()
Returns the hash value of this object.
boolean isDefaultVectorLayerMode()
Returns true if the service configures layers as vector tile layers,
when possible.
boolean isInteractive()
Returns true is the service configures
layers as interactive by using UTF grids for click detection.
boolean isStrictMode()
Returns true if 'strict mode' is enabled (the service throws exceptions whenever an error is encountered).
void setAPIKey(String apiKey)
Sets the optional API key used when accessing the online service.
void setAPITemplate(String apiTemplate)
Sets the API endpoint template of the online service.
void setAuthTokens(StringVector authTokens)
Sets the list of authentication tokens used when accessing online service.
void setDefaultVectorLayerMode(boolean vectorLayerMode)
Sets the service to vector layer mode or raster layer mode.
void setInteractive(boolean interactive)
Sets the interactivity flag of the layers.
void setLayerIndices(IntVector layerIndices)
Sets the list of layer indices that are created.
void setStrictMode(boolean strictMode)
Sets the 'strict mode' flag.
void setUsername(String username)
Sets the user account name used when accessing the online service.
void setVectorTileAssetPackage(AssetPackage assetPackage)
Sets the asset package used when decoding vector tiles.
void setVectorTileBufferSize(float bufferSize)
Sets the current vector tile buffer size.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public CartoMapsService ()

Constructs a new CartoMapsService instance with default settings.

Public Methods

public LayerVector buildMap (Variant mapConfig)

Builds a list of layers given anonymous map configuration.
The map configuration specification can be found in CartoDB documentation page.

Parameters
mapConfig The map configuration JSON deserialized as Variant type.
Returns
  • The list of created layers.
Throws
Exception If IO error occured during the operation.
IOException

public LayerVector buildNamedMap (String templateId, StringVariantMap templateParams)

Builds a list of layers given named map id and named map parameters.

Parameters
templateId The named map id.
templateParams The map containing named map parameter names and their values.
Returns
  • The list of created layers.
Throws
Exception If IO error occured during the operation.
IOException

public synchronized void delete ()

public boolean equals (Object obj)

Checks if this object is equal to the specified object.

Parameters
obj The reference object.
Returns
  • True when objects are equal, false otherwise.

public String getAPIKey ()

Returns the API key used when accessing the online service.

Returns
  • The API key used when accessing the online service.

public String getAPITemplate ()

Returns the API endpoint template of the online service.

Returns
  • The API endpoint template of the online service.

public StringVector getAuthTokens ()

Returns the list of authentication tokens used when accessing online service.

Returns
  • The list of authentication tokens used when accessing online service.

public IntVector getLayerIndices ()

Returns the list of layer indices that are created.
If non-empty, only layers from this list are created.

Returns
  • The list of layer indices that are created.

public String getUsername ()

Returns the user account name used when accessing the online service.

Returns
  • The user account name used when accessing the online service.

public AssetPackage getVectorTileAssetPackage ()

Returns the asset package used when decoding vector tiles.
By default, no asset package is used and null is returned.

Returns
  • The asset package used when decoding vector tiles.

public float getVectorTileBufferSize ()

Returns the current vector tile buffer size.

Returns
  • The current vector tile buffer size in pixels.

public int hashCode ()

Returns the hash value of this object.

Returns
  • The hash value of this object.

public boolean isDefaultVectorLayerMode ()

Returns true if the service configures layers as vector tile layers,
when possible. By default this is false. Vector layers
provide much better visual quality at the expense of performance.

Returns
  • True if vector layers should be used. False is raster layers are used.

public boolean isInteractive ()

Returns true is the service configures
layers as interactive by using UTF grids for click detection.

Returns
  • True if the service configures layers as interactive.

public boolean isStrictMode ()

Returns true if 'strict mode' is enabled (the service throws exceptions whenever an error is encountered).

Returns
  • True if 'strict mode' is enabled.

public void setAPIKey (String apiKey)

Sets the optional API key used when accessing the online service.
Usually this is not needed and can be left blank.

Parameters
apiKey The optional API key used when accessing the online service.

public void setAPITemplate (String apiTemplate)

Sets the API endpoint template of the online service.
By default cartodb.com endpoint is used. This needs to be redefined only for on-premise services.

Parameters
apiTemplate The API endpoint template of the online service. For example, "https://{user}.cartodb.com"

public void setAuthTokens (StringVector authTokens)

Sets the list of authentication tokens used when accessing online service.

Parameters
authTokens The list of authentication tokens used when accessing online service.

public void setDefaultVectorLayerMode (boolean vectorLayerMode)

Sets the service to vector layer mode or raster layer mode.
By default service creates raster layers, but vector layers may
provide much better visual quality at the expense of performance.

Parameters
vectorLayerMode True if vector layers should be used. False is raster layers are used.

public void setInteractive (boolean interactive)

Sets the interactivity flag of the layers.

Parameters
interactive True if layers should be configured as interactive. The default is false.

public void setLayerIndices (IntVector layerIndices)

Sets the list of layer indices that are created.
If non-empty, only layers from this list are created.

Parameters
layerIndices The list of layer indices that are created.

public void setStrictMode (boolean strictMode)

Sets the 'strict mode' flag.

Parameters
strictMode True if all errors result in exceptions. The default is false.

public void setUsername (String username)

Sets the user account name used when accessing the online service.

Parameters
username The user account name used when accessing the online service.

public void setVectorTileAssetPackage (AssetPackage assetPackage)

Sets the asset package used when decoding vector tiles.
Asset package with fonts is needed when texts are used.

Parameters
assetPackage The asset package to use for vector tiles.

public void setVectorTileBufferSize (float bufferSize)

Sets the current vector tile buffer size.
This can be used to tweak/improve performance or fix rendering artifacts.
The lower values make tiles smaller and improve performance but may create rendering artifacts.
The default value is 64 and should be good fit for most visualizations.

Parameters
bufferSize The new buffer size value.