Tile colorizing with property values issue

Hi there,

Got a strange one. In a particular 3DTileset I’m getting a runtime error when colorizing a 3DTileset. My (relevant) rules are for property _count0 (verified);

["isNaN(${_count0}) || !isFinite(${_count0})", "color('orange', 0.4)"]
["${_count0} > 400", "color('red', 0.4)"]

However, I’m getting the runtime error;

Operator ">" requires number arguments. Arguments are 480 and 400.

In this case, the value of the property is ‘480’, and by the ruleset it has passed the number sniff-test with isNaN(). Is there some bug somewhere where it passes the numbers test, but the value is still the string ‘480’ and not converted correctly? Seems odd that the number 480 isn’t recognized as a number? Ever seen this before? It works fine on most other properties, so I’m looking for what could cause this, either a bug in isNaN() or something about the value that’s odd. What are the rules for the value conversion from the batchTable to the GL engine? If an extra space sneaks in (untrimmed, for example) or something like that?

Any hints welcome!



Followup: I can confirm that the value coming in is a string with a number, so for example “456” (string), and this somehow passes the isNaN() test.

A string is technically not a number, but can be treated as such given whatever type conversions happens in that code, so where might the bug then be? Or is it a gotcha we need to try to test for before using the rendering engine? I can see the usefulness of the test both passing and failing, but maybe the bug is that the type conversion (to number) happens on == but not on < and >?

The bug / gotcha might be that isNaN() does type conversion, but the < > operators do not? Thoughts?

(Also notice that the properties list of a 3DTileset now comes with an attempt at a schema definition for the properties, and that’s awesome! I was in the middle of writing one where I traverse the tiles as they load, going through the batchTables [which I might still do to do value categorisations], what version did that come in? :slight_smile: )