---
description: "ColumnLayer renders extruded cylinders or regular polygons at given coordinates."
---
# ColumnLayer

import {ColumnLayerDemo} from '@site/src/doc-demos/layers';
The `ColumnLayer` renders extruded cylinders (tessellated regular polygons) at given coordinates. It is the primitive layer rendered by [HexagonLayer](../aggregation-layers/hexagon-layer.md) after aggregation. Unlike the `HexagonLayer`, it renders one column for each data object.
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
```js
import {Deck} from '@deck.gl/core';
import {ColumnLayer} from '@deck.gl/layers';
const layer = new ColumnLayer({
id: 'ColumnLayer',
data: 'https://raw.githubusercontent.com/visgl/deck.gl-data/master/website/hexagons.json',
diskResolution: 12,
extruded: true,
radius: 250,
elevationScale: 5000,
getElevation: d => d.value,
getFillColor: d => [48, 128, d.value * 255, 255],
getPosition: d => d.centroid,
pickable: true
});
new Deck({
initialViewState: {
longitude: -122.4,
latitude: 37.74,
zoom: 11
},
controller: true,
getTooltip: ({object}) => object && `height: ${object.value * 5000}m`,
layers: [layer]
});
```
```ts
import {Deck, PickingInfo} from '@deck.gl/core';
import {ColumnLayer} from '@deck.gl/layers';
type DataType = {
value: number;
centroid: [longitude: number, latitude: number];
};
const layer = new ColumnLayer({
id: 'ColumnLayer',
data: 'https://raw.githubusercontent.com/visgl/deck.gl-data/master/website/hexagons.json',
diskResolution: 12,
extruded: true,
radius: 250,
elevationScale: 5000,
getElevation: (d: DataType) => d.value,
getFillColor: (d: DataType) => [48, 128, d.value * 255, 255],
getPosition: (d: DataType) => d.centroid,
pickable: true
});
new Deck({
initialViewState: {
longitude: -122.4,
latitude: 37.74,
zoom: 11
},
controller: true,
getTooltip: ({object}: PickingInfo) => object && `height: ${object.value * 5000}m`,
layers: [layer]
});
```
```tsx
import React from 'react';
import {DeckGL} from '@deck.gl/react';
import {ColumnLayer} from '@deck.gl/layers';
import type {PickingInfo} from '@deck.gl/core';
type DataType = {
value: number;
centroid: [longitude: number, latitude: number];
};
function App() {
const layer = new ColumnLayer({
id: 'ColumnLayer',
data: 'https://raw.githubusercontent.com/visgl/deck.gl-data/master/website/hexagons.json',
diskResolution: 12,
extruded: true,
radius: 250,
elevationScale: 5000,
getElevation: (d: DataType) => d.value,
getFillColor: (d: DataType) => [48, 128, d.value * 255, 255],
getPosition: (d: DataType) => d.centroid,
pickable: true
});
return ) => object && `height: ${object.value * 5000}m`}
layers={[layer]}
/>;
}
```
```js
import {Field, FixedSizeList, Float32, vectorFromArray} from 'apache-arrow';
import {ColumnLayer} from '@deck.gl/layers';
const positionType = new FixedSizeList(2, new Field('value', new Float32()));
const positions = vectorFromArray([[-122.4, 37.74]], positionType);
const layer = new ColumnLayer({
getPosition: positions,
getElevation: vectorFromArray([100], new Float32())
});
```
See [Using with Arrow](../../developer-guide/using-with-arrow.md) for column layouts and mixed inputs.
## Installation
To install the dependencies from NPM:
```bash
npm install deck.gl
# or
npm install @deck.gl/core @deck.gl/layers
```
```ts
import {ColumnLayer} from '@deck.gl/layers';
import type {ColumnLayerProps} from '@deck.gl/layers';
new ColumnLayer(...props: ColumnLayerProps[]);
```
To use pre-bundled scripts:
```html
```
```js
new deck.ColumnLayer({});
```
## Properties
Inherits from all [Base Layer](../core/layer.md) properties.
### Render Options
#### `diskResolution` (number, optional) {#diskresolution}
* Default: `20`
The number of sides to render the disk as. The disk is a regular polygon that fits inside the given radius. A higher resolution will yield a smoother look close-up, but also need more resources to render.
#### `radius` (number, optional)  {#radius}
* Default: `1000`
Disk size in units specified by `radiusUnits` (default meters).
#### `angle` (number, optional)  {#angle}
* Default: `0`
Disk rotation, counter-clockwise in degrees.
#### `vertices` (Position[], optional) {#vertices}
Replace the default geometry (regular polygon that fits inside the unit circle) with a custom one. The length of the array must be at least `diskResolution`. Each vertex is a point `[x, y]` that is the offset from the instance position, relative to the radius.
#### `offset` (number[2], optional)  {#offset}
* Default: `[0, 0]`
Disk offset from the position, relative to the radius. By default, the disk is centered at each position.
#### `coverage` (number, optional)  {#coverage}
* Default: `1`
Radius multiplier, between 0 - 1. The radius of the disk is calculated by
`coverage * radius`
#### `elevationScale` (number, optional)  {#elevationscale}
* Default: `1`
Column elevation multiplier. The elevation of column is calculated by
`elevationScale * getElevation(d)`. `elevationScale` is a handy property
to scale all column elevations without updating the data.
#### `filled` (boolean, optional) {#filled}
* Default: `true`
Whether to draw a filled column (solid fill).
#### `stroked` (boolean, optional) {#stroked}
* Default: `false`
Whether to draw an outline around the disks. Only applies if `extruded: false`.
#### `extruded` (boolean, optional) {#extruded}
* Default: `true`
Whether to extrude the columns. If set to `false`, all columns will be rendered as flat polygons.
#### `wireframe` (boolean, optional) {#wireframe}
* Default: `false`
Whether to generate a line wireframe of the column. The outline will have
"horizontal" lines closing the top and bottom polygons and a vertical line
(a "strut") for each vertex around the disk. Only applies if `extruded: true`.
#### `flatShading` (boolean, optional) {#flatshading}
* Default: `false`
If `true`, the vertical surfaces of the columns use [flat shading](https://en.wikipedia.org/wiki/Shading#Flat_vs._smooth_shading).
If `false`, use smooth shading. Only effective if `extruded` is `true`.
#### `radiusUnits` (string, optional) {#radiusunits}
* Default: `'meters'`
The units of the radius, one of `'meters'`, `'common'`, and `'pixels'`. See [unit system](../../developer-guide/coordinate-systems.md#supported-units).
#### `lineWidthUnits` (string, optional) {#linewidthunits}
* Default: `'meters'`
The units of the line width, one of `'meters'`, `'common'`, and `'pixels'`. See [unit system](../../developer-guide/coordinate-systems.md#supported-units).
#### `lineWidthScale` (number, optional)  {#linewidthscale}
* Default: `1`
The line width multiplier that multiplied to all outlines if the `stroked` attribute is `true`.
#### `lineWidthMinPixels` (number, optional)  {#linewidthminpixels}
* Default: `0`
The minimum outline width in pixels.
#### `lineWidthMaxPixels` (number, optional)  {#linewidthmaxpixels}
* Default: Number.MAX_SAFE_INTEGER
The maximum outline width in pixels.
#### `material` (Material, optional) {#material}
* Default: `true`
This is an object that contains material props for [lighting effect](../core/lighting-effect.md) applied on extruded polygons. Check [the lighting guide](../../developer-guide/using-effects.md#material-settings) for configurable settings.
### Data Accessors
Arrow inputs follow the shared [column requirements and limitations](../../developer-guide/using-with-arrow.md#limitations).
#### `getPosition` (constant | Accessor | arrow.Vector, optional)  {#getposition}
* Default: `object => object.position`
Method called to retrieve the position of each column, in `[x, y]`. An optional third component can be used to set the elevation of the bottom.
An Arrow vector supplies one value per object. See [position columns](../../developer-guide/using-with-arrow.md#positions-and-other-vectors) for requirements.
On top-level layers, Deck's [`normalizedColors`](../core/deck.md#normalizedcolors)
option interprets plain-array color constants and callback results as 0โ1 channels.
Built-in defaults, typed arrays, binary inputs, and Arrow color columns retain their encoding.
#### `getFillColor` (constant | Accessor | arrow.Vector, optional)  {#getfillcolor}
* Default: `[0, 0, 0, 255]`
For arrays and callback results, the rgba color is in the format of `[r, g, b, [a]]`. Each channel is a number between 0-255 and `a` is 255 if not supplied.
* If an array is provided, it is used as the color for all objects.
* If a function is provided, it is called on each object to retrieve its color.
* If not provided, it falls back to `getColor`.
An Arrow vector supplies one value per object. See [color columns](../../developer-guide/using-with-arrow.md#colors) for requirements.
#### `getLineColor` (constant | Accessor | arrow.Vector, optional)  {#getlinecolor}
* Default: `[0, 0, 0, 255]`
For arrays and callback results, the rgba color is in the format of `[r, g, b, [a]]`. Each channel is a number between 0-255 and `a` is 255 if not supplied.
* If an array is provided, it is used as the outline color for all columns.
* If a function is provided, it is called on each object to retrieve its outline color.
* If not provided, it falls back to `getColor`.
An Arrow vector supplies one value per object. See [color columns](../../developer-guide/using-with-arrow.md#colors) for requirements.
#### `getElevation` (constant | Accessor | arrow.Vector, optional)  {#getelevation}
* Default: `1000`
The elevation of each cell in meters.
* If a number is provided, it is used as the elevation for all objects.
* If a function is provided, it is called on each object to retrieve its elevation.
An Arrow vector supplies one value per object. See [scalar columns](../../developer-guide/using-with-arrow.md#scalars) for requirements.
#### `getLineWidth` (constant | Accessor | arrow.Vector, optional)  {#getlinewidth}
* Default: `1`
The width of the outline of the column, in units specified by `lineWidthUnits` (default meters). Only applies if `extruded: false` and `stroked: true`.
* If a number is provided, it is used as the outline width for all columns.
* If a function is provided, it is called on each object to retrieve its outline width.
An Arrow vector supplies one value per object. See [scalar columns](../../developer-guide/using-with-arrow.md#scalars) for requirements.
## GPUVector inputs ๐งช {#gpuvector-inputs-unstable}
> GPU buffer layouts are internal to layer implementations and can change in future releases.
GPUVector props let applications supply caller-owned GPU buffers to the rendering path. This is particularly useful when applications compute rendering attributes on the GPU.
- `positions` โ `float32x3` โ Positions in XYZ order.
- `elevations` โ `float32`
- `fillColors` โ `unorm8x4` โ Packed RGBA fill colors.
- `lineColors` โ `unorm8x4` โ Packed RGBA outline colors.
- `lineWidths` โ `float32`
Notes:
- Supply one value per rendered instance, in instance order.
- See [Direct GPUVector inputs](../../developer-guide/using-with-arrow.md#direct-gpuvector-inputs) for ownership, chunk alignment, and preprocessing requirements.
## Source
[modules/layers/src/column-layer](https://github.com/visgl/deck.gl/tree/master/modules/layers/src/column-layer)