Skip to content

Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.

chore: update docs (#3645)

Igor Dykhtadbca1806e14d
diff --git a/README.md b/README.md
index f55fd96b0..add0bb907 100644
--- a/README.md
+++ b/README.md
@@ -97,8 +97,7 @@ You need to add `taskMiddleware` of `react-palm` to your store too. We are activ
```js
import {createStore, combineReducers, applyMiddleware, compose} from 'redux';
-import keplerGlReducer from '@kepler.gl/reducers';
-import {enhanceReduxMiddleware} from '@kepler.gl/middleware';
+import keplerGlReducer, {enhanceReduxMiddleware} from '@kepler.gl/reducers';
const initialState = {};
const reducers = combineReducers({
diff --git a/docs/api-reference/processors/processors.md b/docs/api-reference/processors/processors.md
index b978d62db..f13214f4e 100644
--- a/docs/api-reference/processors/processors.md
+++ b/docs/api-reference/processors/processors.md
@@ -3,6 +3,7 @@
### Table of Contents
- [getFieldsFromData](#getfieldsfromdata)
+- [processArrowTable](#processarrowtable)
- [processCsvData](#processcsvdata)
- [processGeojson](#processgeojson)
- [processKeplerglJSON](#processkeplergljson)
@@ -54,6 +55,36 @@ const fields = getFieldsFromData(data, fieldOrder);
Returns **[Array][16]<[Object][17]>** formatted fields
+## processArrowTable
+
+Process a loaders.gl [ArrowTable][21] (`{shape: 'arrow-table', data}`)
+and return a data object that can be passed to [`addDataToMap`][18].
+Load arrow files with `GeoArrowLoader` and `{arrow: {shape: 'arrow-table'}}`.
+
+**Parameters**
+
+- `arrowTable` **[Object][17]** ArrowTable to parse, see loaders.gl/schema
+
+**Examples**
+
+```javascript
+import {addDataToMap} from '@kepler.gl/actions';
+import {processArrowTable} from '@kepler.gl/processors';
+import {load} from '@loaders.gl/core';
+import {GeoArrowLoader} from '@loaders.gl/arrow';
+
+const arrowTable = await load(url, GeoArrowLoader, {arrow: {shape: 'arrow-table'}});
+
+dispatch(addDataToMap({
+ datasets: {
+ info: {id: 'arrow_dataset', label: 'My Arrow'},
+ data: processArrowTable(arrowTable)
+ }
+}));
+```
+
+Returns **[Object][17]** dataset containing `fields` and `rows` or null
+
## processCsvData
Process csv data, output a data object with `{fields: [], rows: []}`.
@@ -221,3 +252,5 @@ Returns **[Object][17]** dataset containing `fields` and `rows`
[19]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
[20]: http://wiki.geojson.org/GeoJSON_draft_version_6#FeatureCollection
+
+[21]: https://loaders.gl/docs/specifications/category-table
diff --git a/src/processors/src/data-processor.ts b/src/processors/src/data-processor.ts
index 8097c5ea4..2759426b4 100644
--- a/src/processors/src/data-processor.ts
+++ b/src/processors/src/data-processor.ts
@@ -430,10 +430,27 @@ export function processKeplerglDataset(
}
/**
- * Parse arrow table and return a dataset
+ * Process a loaders.gl [`ArrowTable`](https://loaders.gl/docs/specifications/category-table) (`{shape: 'arrow-table', data}`)
+ * and return a data object that can be passed to [`addDataToMap`](../actions/actions.md#adddatatomap).
+ * Load arrow files with `GeoArrowLoader` and `{arrow: {shape: 'arrow-table'}}`.
*
* @param arrowTable ArrowTable to parse, see loaders.gl/schema
* @returns dataset containing `fields` and `rows` or null
+ * @public
+ * @example
+ * import {addDataToMap} from '@kepler.gl/actions';
+ * import {processArrowTable} from '@kepler.gl/processors';
+ * import {load} from '@loaders.gl/core';
+ * import {GeoArrowLoader} from '@loaders.gl/arrow';
+ *
+ * const arrowTable = await load(url, GeoArrowLoader, {arrow: {shape: 'arrow-table'}});
+ *
+ * dispatch(addDataToMap({
+ * datasets: {
+ * info: {id: 'arrow_dataset', label: 'My Arrow'},
+ * data: processArrowTable(arrowTable)
+ * }
+ * }));
*/
export function processArrowTable(arrowTable: ArrowTable): ProcessorResult | null {
// @ts-ignore - Unknown data type causing build failures