Skip to content

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

[Bug] fix processor export, support previous (#428)

Shan He4f8328070663
diff --git a/docs/api-reference/ecosystem.md b/docs/api-reference/ecosystem.md
index 43211be15..ebc8ce169 100644
--- a/docs/api-reference/ecosystem.md
+++ b/docs/api-reference/ecosystem.md
@@ -54,9 +54,9 @@ Read more about [Actions and Updaters][actions-updaters].
![Processor and Schema][processor-schema]
-Processors and schema manager are useful helpers to get data in and out of kepler.gl. You can use `Processors.processCsvData(csv)` and `Processors.processGeojson(geojson)` to parse csv or geoJson file and pass it to `addDataToMap()` action.
+Processors and schema manager are useful helpers to get data in and out of kepler.gl. You can use `processCsvData(csv)` and `processGeojson(geojson)` to parse csv or geoJson file and pass it to `addDataToMap()` action.
-To save and reload the current map, you can call `KeplerGlSchema.save()` and pass it the instant state. It will return a json output containing map data and config. Pass this json file to `Processors.processKeplerglJSON()` and then `addDataToMap()` will reproduce the same map.
+To save and reload the current map, you can call `KeplerGlSchema.save()` and pass it the instant state. It will return a json output containing map data and config. Pass this json file to `processKeplerglJSON()` and then `addDataToMap()` will reproduce the same map.
Read more about [Processors][processors] and [Schema Manager][schemas].
diff --git a/examples/custom-reducer/package.json b/examples/custom-reducer/package.json
index fcab6d7c9..5f5bd7645 100644
--- a/examples/custom-reducer/package.json
+++ b/examples/custom-reducer/package.json
@@ -6,7 +6,7 @@
},
"dependencies": {
"global": "^4.3.0",
- "kepler.gl": "^0.2.2",
+ "kepler.gl": "^0.2.3",
"react": "^15.3.1",
"react-dom": "^15.6.1",
"react-palm": "^1.1.2",
diff --git a/examples/demo-app/package.json b/examples/demo-app/package.json
index 69e556a5a..bc7f79a82 100644
--- a/examples/demo-app/package.json
+++ b/examples/demo-app/package.json
@@ -1,6 +1,6 @@
{
"scripts": {
- "start": "webpack-dev-server --progress --hot --open",
+ "start": "webpack-dev-server --mode development --env.es6 --progress --hot --open",
"start-prod": "webpack-dev-server -p --env.prod --progress --hot --open",
"start-local": "webpack-dev-server --mode development --env.es6 --progress --hot --open",
"start-local-es5": "webpack-dev-server --env.local --progress --hot --open"
@@ -9,7 +9,7 @@
"d3-request": "^1.0.6",
"dropbox": "^4.0.12",
"global": "^4.3.0",
- "kepler.gl": "^0.2.2",
+ "kepler.gl": "^0.2.3",
"lodash.debounce": "^4.0.8",
"lodash.get": "^4.4.2",
"react": "^15.6.2",
diff --git a/examples/demo-app/src/app.js b/examples/demo-app/src/app.js
index 3f68b119e..29eea71a1 100644
--- a/examples/demo-app/src/app.js
+++ b/examples/demo-app/src/app.js
@@ -48,7 +48,7 @@ import sampleGeojsonPoints from './data/sample-geojson-points.json';
import sampleH3Data from './data/sample-hex-id-csv';
import sampleIconCsv, {config as savedMapConfig} from './data/sample-icon-csv';
import {addDataToMap, addNotification} from 'kepler.gl/actions';
-import Processors from 'kepler.gl/processors';
+import {processCsvData, processGeojson} from 'kepler.gl/processors';
/* eslint-enable no-unused-vars */
const MAPBOX_TOKEN = process.env.MapboxAccessToken; // eslint-disable-line
@@ -221,7 +221,7 @@ class App extends Component {
label: 'Icon Data',
id: 'test_icon_data'
},
- data: Processors.processCsvData(sampleIconCsv)
+ data: processCsvData(sampleIconCsv)
}
],
options: {
@@ -238,10 +238,10 @@ class App extends Component {
addDataToMap({
datasets: [{
info: {label: 'Bart Stops Geo'},
- data: Processors.processGeojson(sampleGeojsonPoints)
+ data: processGeojson(sampleGeojsonPoints)
}, {
info: {label: 'SF Zip Geo'},
- data: Processors.processGeojson(sampleGeojson)
+ data: processGeojson(sampleGeojson)
}]
})
);
@@ -257,7 +257,7 @@ class App extends Component {
label: 'H3 Hexagons V2',
id: 'h3-hex-id'
},
- data: Processors.processCsvData(sampleH3Data)
+ data: processCsvData(sampleH3Data)
}
]
})
diff --git a/examples/demo-app/src/reducers/index.js b/examples/demo-app/src/reducers/index.js
index b20b37c37..16716a178 100644
--- a/examples/demo-app/src/reducers/index.js
+++ b/examples/demo-app/src/reducers/index.js
@@ -22,7 +22,7 @@ import {combineReducers} from 'redux';
import {handleActions} from 'redux-actions';
import keplerGlReducer, {combinedUpdaters} from 'kepler.gl/reducers';
-import Processor from 'kepler.gl/processors';
+import {processGeojson, processCsvData} from 'kepler.gl/processors';
import KeplerGlSchema from 'kepler.gl/schemas';
import sharingReducer from './sharing';
@@ -98,10 +98,10 @@ export const loadRemoteResourceSuccess = (state, action) => {
// TODO: replace generate with a different function
const datasetId = action.options.id || generateHashId(6);
const {dataUrl} = action.options;
- let processorMethod = Processor.processCsvData;
+ let processorMethod = processCsvData;
// TODO: create helper to determine file ext eligibility
if (dataUrl.includes('.json') || dataUrl.includes('.geojson')) {
- processorMethod = Processor.processGeojson;
+ processorMethod = processGeojson;
}
const datasets = {
diff --git a/examples/open-modal/package.json b/examples/open-modal/package.json
index cd17aff98..9c64d2e55 100644
--- a/examples/open-modal/package.json
+++ b/examples/open-modal/package.json
@@ -6,7 +6,7 @@
},
"dependencies": {
"global": "^4.3.0",
- "kepler.gl": "^0.2.2",
+ "kepler.gl": "^0.2.3",
"react": "^15.3.1",
"react-dom": "^15.6.1",
"react-modal": "^3.1.10",
diff --git a/src/processors/data-processor.js b/src/processors/data-processor.js
index c331ccda7..397ba9f65 100644
--- a/src/processors/data-processor.js
+++ b/src/processors/data-processor.js
@@ -568,3 +568,13 @@ export function processKeplerglJSON(rawData) {
? KeplerGlSchema.load(rawData.datasets, rawData.config)
: null;
}
+
+export const Processors = {
+ processGeojson,
+ processCsvData,
+ processRowObject,
+ processKeplerglJSON,
+ analyzerTypeToFieldType,
+ getFieldsFromData,
+ parseCsvRowsByFieldType
+}
diff --git a/src/processors/index.js b/src/processors/index.js
index dad374a8d..fadc85cb3 100644
--- a/src/processors/index.js
+++ b/src/processors/index.js
@@ -31,3 +31,5 @@ export {
// File Handlers
export {getFileHandler, getFileType} from './file-handler';
+
+export {Processors as default} from './data-processor';