You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now, it seems that the value returned by the data aggregation function has a large upper bound, but within the CartoCSS, it seems to max out at 255.
Using a number that grows well beyond 255 with a date, I found a behavior in the colors that suggests that value = value % 256 somewhere along the line.
Map here. Every time the large black dot flashes, value = 255 even though value should be growing monotonically in time. Checking the json object in the console, you can see that vals_uint8 are above 255. Since it's uint8, does that mean that it will be input into a Uint8Array() so that the modulus is taken? This seems pretty small and forces users to write custom aggregation functions that keep the values below 256.
I think we either need to document this in the torque cartocss, or raise the value to something that's more intuitive from what people would expect from their dataset. For instance, I was dealing with data where the max values were 1e6. I was forced to do log(sum(num_column)) to put value within 0 - 255.
The dataset was generated from this SQL:
SELECT
ST_Transform(CDB_LatLng(random()*90,random()*180),3857) the_geom_webmercator,
a,
now()::date+ a dateof
FROM
generate_series(1,5000) a
OK, so here's the thing: it's a known issue, for which we have no immediate solution, that the maximum value in non-cumulative torque has to be 255. However, as discussed with @javisantana, there's a better way that we can do this.
As you mentioned, because we currently user UInt8Arrays, values higher than 255 are modulo'd by 256. This makes point values go all crazy when values go above that. So, instead of raising the limit (which is unfeasible at this moment), or keeping this modulo nonsense, I suggest changing the array type to Uint8ClampedArray. This puts an effective cap of 255 over any values set:
Sorry @fdansv , tl;dr.
Right now, it seems that the value returned by the data aggregation function has a large upper bound, but within the CartoCSS, it seems to max out at 255.
Using a number that grows well beyond 255 with a date, I found a behavior in the colors that suggests that
value = value % 256
somewhere along the line.Map here. Every time the large black dot flashes,
value = 255
even though value should be growing monotonically in time. Checking the json object in the console, you can see thatvals_uint8
are above 255. Since it's uint8, does that mean that it will be input into aUint8Array()
so that the modulus is taken? This seems pretty small and forces users to write custom aggregation functions that keep the values below 256.I think we either need to document this in the torque cartocss, or raise the value to something that's more intuitive from what people would expect from their dataset. For instance, I was dealing with data where the max values were 1e6. I was forced to do
log(sum(num_column))
to putvalue
within 0 - 255.The dataset was generated from this SQL:
and this CartoCSS:
The text was updated successfully, but these errors were encountered: