Open jgoizueta opened 6 years ago
Note: there is and additional unrelated problem with the complex queries above, caused by a backend bug, which is fixed by https://github.com/CartoDB/Windshaft-cartodb/pull/981
Hey, so... The original issue is solved? Has it been tested? I can test it otherwise.
Recently there was some surprise because hexagon grid maps that worked with CARTO.js caused problems with CARTO VL when ported by @elenatorro
This is a case of what Builder (and the old Editor) does to cluster spatially into hexagon or square grids by using complex SQL to generate a grid and then join the data to it.
They used this kind of queries:
The problem is that CARTO VL (unlike CARTO.js) requests global metadata from the tiler, and to compute it, the tiler executes the query in the context of the whole dataset extents (which affects the
!bbox!
, etc.) and fails because a huge grid would need to be created (theCDB_HexagonGrid
andCDB_RectangleGrid
abort trying to generate such grids that would cause memory problems to PG and would be impossible to join with the data).CARTO.js would also fail if trying to fetch a low zoom level tile, but it doesn't fail instantiating the map because it doesn't request metadata stats.
There's a workaround for the problem that prevents this visualization: we can change the SQL code so that we use a coarser grid for low zoom levels:
But one thing to consider is to augment the aggregations of the Maps API so that we can use them to create this kind of grids. We would need to add two new placements: square and hexagon, to generate polygon aggregate geometries instead of points. (the first would be easy with the current implementation, the second is trickier). We'd also need a way to handle this in the Viz language, similarly to
resolution
. This would have a number of benefits:So, in summary:
CDB_HexagonGrid
in the documentation?