@carto/kepler.gl 0.0.37 → 0.0.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@carto/kepler.gl",
3
3
  "author": "CARTO",
4
4
  "homepage": "https://github.com/CartoDB/carto-kepler#readme",
5
- "version": "0.0.37",
5
+ "version": "0.0.38",
6
6
  "description": "kepler.gl is a webgl based application to visualize large scale location data in the browser",
7
7
  "license": "MIT",
8
8
  "main": "dist/index.js",
@@ -196,7 +196,8 @@ export {
196
196
  export {
197
197
  HowToButton,
198
198
  LayerColorRangeSelector,
199
- LayerColorSelector
199
+ LayerColorSelector,
200
+ AggregationTypeSelector
200
201
  } from './side-panel/layer-panel/layer-configurator';
201
202
 
202
203
  export {default as ColorPalette} from './side-panel/layer-panel/color-palette';
@@ -823,7 +823,8 @@ class Layer {
823
823
  defaultValue,
824
824
  getAttributeValue,
825
825
  nullValue,
826
- channelScaleType
826
+ channelScaleType,
827
+ aggregation
827
828
  } = this.visualChannels[channel];
828
829
 
829
830
  const shouldGetScale = this.config[field];
@@ -834,6 +835,7 @@ class Layer {
834
835
  // It's important to declare as const all the parameters that we are going to be use in the getEncodedChannelValue call
835
836
  // otherwise, the oldLayerData parameter in formatLayerData method will be wrong (you can check the formatLayerData TileLayer method in Builder as example)
836
837
  const fieldConfig = this.config[field];
838
+ const aggregationValue = this.config.visConfig[aggregation];
837
839
 
838
840
  const scaleFunction =
839
841
  channelScaleType === CHANNEL_SCALES.color
@@ -845,6 +847,7 @@ class Layer {
845
847
  scaleFunction,
846
848
  dataAccessor(dataContainer)(d),
847
849
  fieldConfig,
850
+ aggregationValue,
848
851
  nullValue
849
852
  );
850
853
  } else if (typeof getAttributeValue === 'function') {
@@ -914,6 +917,8 @@ class Layer {
914
917
  scale,
915
918
  data,
916
919
  field,
920
+ // In builder we overwrite the getValue function and we use the _aggregation parameter in spatial index layers as the QuadkeyLayer.
921
+ _aggregation,
917
922
  nullValue = NO_VALUE_COLOR,
918
923
  getValue = defaultGetFieldValue
919
924
  ) {
@@ -233,6 +233,15 @@ export const LAYER_VIS_CONFIGS = {
233
233
  property: 'sizeAggregation',
234
234
  condition: config => config.sizeField
235
235
  },
236
+ heightAggregation: {
237
+ type: 'select',
238
+ defaultValue: AGGREGATION_TYPES.average,
239
+ label: 'layerVisConfigs.heightAggregation',
240
+ options: Object.keys(AGGREGATION_TYPES),
241
+ group: PROPERTY_GROUPS.height,
242
+ property: 'heightAggregation',
243
+ condition: config => config.heightField
244
+ },
236
245
  percentile: {
237
246
  type: 'number',
238
247
  defaultValue: [0, 100],
@@ -291,9 +291,9 @@ export function mergeInteractionTooltipConfig(state, tooltipConfig = {}) {
291
291
  } else {
292
292
  // if dataset is loaded
293
293
  const allFields = state.datasets[dataId].fields.map(d => d.name);
294
- const foundFieldsToShow = tooltipConfig.fieldsToShow[dataId].filter(field =>
295
- allFields.includes(field.name)
296
- );
294
+ const foundFieldsToShow = state.datasets[dataId].metadata.isDynamicSpatialIndex
295
+ ? tooltipConfig.fieldsToShow[dataId]
296
+ : tooltipConfig.fieldsToShow[dataId].filter(field => allFields.includes(field.name));
297
297
 
298
298
  mergedTooltip[dataId] = foundFieldsToShow;
299
299
  }
@@ -1715,7 +1715,9 @@ export function addDefaultLayers(state, datasets) {
1715
1715
  * @returns {Object} nextState
1716
1716
  */
1717
1717
  export function addDefaultTooltips(state, dataset) {
1718
- const tooltipFields = findFieldsToShow(dataset);
1718
+ const tooltipFields = dataset.metadata.isDynamicSpatialIndex
1719
+ ? {[dataset.id]: []}
1720
+ : findFieldsToShow(dataset);
1719
1721
  const merged = {
1720
1722
  ...state.interactionConfig.tooltip.config.fieldsToShow,
1721
1723
  ...tooltipFields