CartoBQTilerLayer will be deprecated in future versions. Use CartoLayer instead. If you have existing code using this layer, check the migration steps.
CartoBQTilerLayer
is a layer to visualize large datasets (millions or billions of rows) directly from Google BigQuery without having to move data outside of BigQuery.
First you need to generate a tileset of your dataset in your BigQuery account using CARTO BigQuery Tiler. For more info click here.
import DeckGL from '@deck.gl/react';
import {CartoBQTilerLayer} from '@deck.gl/carto';
function App({viewState}) {
const layer = new CartoBQTilerLayer({
data: 'cartobq.maps.nyc_taxi_points_demo_id',
getLineColor: [255, 255, 255],
getFillColor: [238, 77, 90],
pointRadiusMinPixels: 2,
lineWidthMinPixels: 1
});
return <DeckGL viewState={viewState} layers={[layer]} />;
}
To migrate from CartoBQTilerLayer
to CartoLayer
you only need to change the layer name and set type
property to MAP_TYPES.TILESET
:
import DeckGL from '@deck.gl/react';
import {CartoLayer, MAP_TYPES} from '@deck.gl/carto';
function App({viewState}) {
const layer = new CartoLayer({
type: MAP_TYPES.TILESET,
data: 'cartobq.maps.nyc_taxi_points_demo_id',
getLineColor: [255, 255, 255],
getFillColor: [238, 77, 90],
pointRadiusMinPixels: 2,
lineWidthMinPixels: 1
});
return <DeckGL viewState={viewState} layers={[layer]} />;
}
To install the dependencies from NPM:
npm install deck.gl
# or
npm install @deck.gl/core @deck.gl/layers @deck.gl/carto
import {CartoBQTilerLayer} from '@deck.gl/carto';
new CartoBQTilerLayer({});
To use pre-bundled scripts:
<script src="https://unpkg.com/deck.gl@^8.5.0/dist.min.js"></script>
<script src="https://unpkg.com/@deck.gl/carto@^8.5.0/dist.min.js"></script>
<!-- or -->
<script src="https://unpkg.com/@deck.gl/core@^8.5.0/dist.min.js"></script>
<script src="https://unpkg.com/@deck.gl/layers@^8.5.0/dist.min.js"></script>
<script src="https://unpkg.com/@deck.gl/geo-layers@^8.5.0/dist.min.js"></script>
<script src="https://unpkg.com/@deck.gl/carto@^8.5.0/dist.min.js"></script>
new deck.carto.CartoBQTilerLayer({});
Inherits all properties from MVTLayer
.
Required. Tileset id
- Default:
id
Optional. Needed for highlighting a feature split across two or more tiles if no feature id is provided.
A string pointing to a tile attribute containing a unique identifier for features across tiles.
Optional. Overrides the configuration to connect with CARTO. Check the parameters here.
onDataLoad
is called when the request to the CARTO tiler was completed successfully.
- Default:
tilejson => {}
Receives arguments:
tilejson
(Object) - the response from the tiler service
onDataError
is called when the request to the CARTO tiler failed. By default the Error is thrown.
- Default:
null
Receives arguments:
error
(Error
)