Data Sources
Last updated
Was this helpful?
Last updated
Was this helpful?
A data source in CARTO for Developers defines the data that will be accessed by your application, the credentials (connection) that will be used to retrieve it, and additional parameters to control the data fetching process.
Data sources are typically imported from . For example, this data source will be used to fetch a table from your data warehouse using the connection carto_dw
.
After initializing a source, you can reference them in your and .
All data source take the following global options:
Vector data: points, lines or polygons.
Spatial index data: data aggregated in H3 or Quadbin spatial indexes.
Raster data: pixels covering a specific area.
Boundaries data: properties (point-based vector data) aggregated in a set of static boundaries (polygons).
Additional information can be found inside each specific source documentation, and we have prepared a full set of working examples
accessToken: The API Access Token or OAuth Access Token that will be used to fetch the data. Learn more about access tokens in .
connectionName: The name of the connection in CARTO that will be used to fetch the data. Keep in mind that privileges to the data are granted via the credentials used in the connection. Learn more about .
apiBaseUrl (optional): The base URL that hosts the APIs. It varies depending on your CARTO region/deployment method. By default it will use https://gcp-us-east1.api.carto.com
which is the URL for the CARTO cloud US-based tenant, but it will be different if you operate in another region or in your own deployment. Learn .
clientId (optional): An arbitrary string that can be used to identify the application, area or functionality that is performing the requests. It will be reflected later in the allowing developers to track usage in their applications.
headers (optional): An array of valid HTTP headers that will be attached to all requests originating from this source. This is useful to .
Data sources return a JavaScript Promise
— You as a developer in most cases do not need to worry about the lifecycle of a data source. Instead, simply plug your data source into a from the @deck.gl/CARTO module or into a .