Data sources

About data sources

Now that you have created a connection to your Data Warehouse in CARTO, you can start using them to access their data within your code. The way your application accesses data from your CARTO connections is by using Data sources.

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 @carto/api-client .

import {vectorTableSource} from '@carto/api-client'

const data = vectorTableSource({
  accessToken: 'XXX',
  connectionName: 'carto_dw',
  tableName: 'carto-demo-data.demo_tables.chicago_crime_sample'
});

Types of data sources

There are several types of data sources, with specific parameters depending on the data type (vector, spatial indexes, raster or boundaries) and the resource type (table, query or tileset):

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).

Using data sources

Once you've added data sources in your application, the next step is to reference them in your CARTO + deck.gl layers to visualize data in your map, or use them to build custom charts and widgets.

Technical reference

Learn all the technical details in our Data Sources reference

Last updated

Was this helpful?