[Maps] coerce string doc-values to numbers if used in styling (#33657)

This commit is contained in:
Thomas Neirynck 2019-03-22 11:51:31 -04:00 committed by GitHub
parent 4d60e86287
commit 41d4172fe5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -227,9 +227,9 @@ export class VectorStyle extends AbstractStyle {
//scale to [0,1] domain
for (let i = 0; i < features.length; i++) {
const unscaledValue = features[i].properties[fieldName];
const unscaledValue = parseFloat(features[i].properties[fieldName]);
let scaledValue;
if (typeof unscaledValue !== 'number' || isNaN(unscaledValue)) {//cannot scale
if (isNaN(unscaledValue)) {//cannot scale
scaledValue = -1;//put outside range
} else if (diff === 0) {//values are identical
scaledValue = 1;//snap to end of color range