For the complete documentation index, see llms.txt. This page is also available as Markdown.

All processors

getFieldsFromData

Analyze field types from data in string format, e.g. uploaded csv. Assign type, tableFieldIndex and format (timestamp only) to each field

Parameters

  • data Array<Object> array of row object

  • fieldOrder Array array of field names as string

Examples

import {getFieldsFromData} from '@kepler.gl/processors';
const data = [{
  time: '2016-09-17 00:09:55',
  value: '4',
  surge: '1.2',
  isTrip: 'true',
  zeroOnes: '0'
}, {
  time: '2016-09-17 00:30:08',
  value: '3',
  surge: null,
  isTrip: 'false',
  zeroOnes: '1'
}, {
  time: null,
  value: '2',
  surge: '1.3',
  isTrip: null,
  zeroOnes: '1'
}];

const fieldOrder = ['time', 'value', 'surge', 'isTrip', 'zeroOnes'];
const fields = getFieldsFromData(data, fieldOrder);
// fields = [
// {name: 'time', format: 'YYYY-M-D H:m:s', tableFieldIndex: 1, type: 'timestamp'},
// {name: 'value', format: '', tableFieldIndex: 4, type: 'integer'},
// {name: 'surge', format: '', tableFieldIndex: 5, type: 'real'},
// {name: 'isTrip', format: '', tableFieldIndex: 6, type: 'boolean'},
// {name: 'zeroOnes', format: '', tableFieldIndex: 7, type: 'integer'}];

Returns Array<Object> formatted fields

processCsvData

Process csv data, output a data object with {fields: [], rows: []}. The data object can be wrapped in a dataset and pass to addDataToMap

Parameters

Examples

Returns Object data object {fields: [], rows: []}

processGeojson

Process GeoJSON FeatureCollection, output a data object with {fields: [], rows: []}. The data object can be wrapped in a dataset and pass to addDataToMap

Parameters

  • rawData Object raw geojson feature collection

Examples

Returns Object dataset containing fields and rows

processKeplerglJSON

Process saved kepler.gl json to be pass to addDataToMap. The json object should contain datasets and config.

Parameters

Examples

Returns Object datasets and config {datasets: {}, config: {}}

processRowObject

Process data where each row is an object, output can be passed to addDataToMap

Parameters

  • rawData Array<Object> an array of row object, each object should have the same number of keys

Examples

Returns Object dataset containing fields and rows

Last updated

Was this helpful?