Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.
[Bug] Fixed bug with fixed radius after remove size field in pointlayer (#1343)
Shan He2ea853b1dffe
diff --git a/src/layers/point-layer/point-layer.js b/src/layers/point-layer/point-layer.jsindex 41b35e556..b7cd67a68 100644--- a/src/layers/point-layer/point-layer.js+++ b/src/layers/point-layer/point-layer.js@@ -228,7 +228,10 @@ export default class PointLayer extends Layer {renderLayer(opts) {const {data, gpuFilter, objectHovered, mapState, interactionConfig} = opts;- const radiusScale = this.getRadiusScaleByZoom(mapState);++ // if no field size is defined we need to pass fixed radius = false+ const fixedRadius = this.config.visConfig.fixedRadius && Boolean(this.config.sizeField);+ const radiusScale = this.getRadiusScaleByZoom(mapState, fixedRadius);const layerProps = {stroked: this.config.visConfig.outline,diff --git a/test/browser/layer-tests/point-layer-specs.js b/test/browser/layer-tests/point-layer-specs.jsindex 196380497..82feb2020 100644--- a/test/browser/layer-tests/point-layer-specs.js+++ b/test/browser/layer-tests/point-layer-specs.js@@ -395,6 +395,72 @@ test('#PointLayer -> formatLayerData', t => {'getRadius should return corrent radius');}+ },+ {+ name: 'Test gps point.2 Data with fixed radius and null SizeField',+ layer: {+ type: 'point',+ id: 'test_layer_2',+ config: {+ dataId,+ label: 'some point file',+ columns: {+ lat: 'lat',+ lng: 'lng'+ },+ color: [10, 10, 10],+ visConfig: {+ outline: true,+ fixedRadius: true+ },+ // size by id(integer)+ sizeField: null+ }+ },+ datasets: {+ [dataId]: {+ ...preparedDataset,+ filteredIndex+ }+ },+ assert: result => {+ const {layerData, layer} = result;++ const expectedLayerData = {+ data: [+ {+ data: testRows[0],+ index: 0,+ position: [testRows[0][2], testRows[0][1], 0]+ },+ {+ data: testRows[4],+ index: 4,+ position: [testRows[4][2], testRows[4][1], 0]+ }+ ],+ getFilterValue: () => {},+ getLineColor: () => {},+ getFillColor: () => {},+ getRadius: () => {},+ getPosition: () => {},+ textLabels: []+ };++ t.deepEqual(+ Object.keys(layerData).sort(),+ Object.keys(expectedLayerData).sort(),+ 'layerData should have 6 keys'+ );+ t.deepEqual(+ layerData.data,+ expectedLayerData.data,+ 'should format correct point layerData data'+ );+ t.deepEqual(layer.config.sizeDomain, [0, 1], 'should update layer sizeDomain');+ // getRadius should be a constant because sizeField is null+ t.equal(layerData.getRadius, 1, 'getRadius should return current radius');+ }}];