id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc 4600,ST_TileEnvelope default tile is imprecise,Algunenano,Algunenano,"When checking the initial tile I get integer precision, which is odd to say the least: {{{ select ST_AsText(ST_TileEnvelope(0, 0, 0)); st_astext ------------------------------------------------------------------------------------------------------------ POLYGON((-20037510 -20037510,-20037510 20037510,20037510 20037510,20037510 -20037510,-20037510 -20037510)) (1 row) }}} Carto's function seems to do this ok: {{{ Select ST_AsText(cdb_xyz_extent(0, 0, 0)); st_astext ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- POLYGON((-20037508.3427892 20037508.3427892,-20037508.3427892 -20037508.3427892,20037508.3427892 -20037508.3427892,20037508.3427892 20037508.3427892,-20037508.3427892 20037508.3427892)) }}} This seems related to the limited precision of floats, which is how bbox are stored. The problem is that this imprecision is found in the base tile, so its error is translated to all other tiles and becomes evident in any tile around the borders. The difference is low for 0/0/0: {{{ Select ST_Area(ST_Intersection(ST_TileEnvelope(0, 0, 0), cdb_xyz_extent(0, 0, 0))) / ST_Area(cdb_xyz_extent(0, 0, 0)); ?column? ---------- 1 (1 row) }}} But it's not for certain lower tiles: {{{ Select ST_Area(ST_Intersection(ST_TileEnvelope(18, 262143, 0), cdb_xyz_extent(262143, 0, 18))) / ST_Area(cdb_xyz_extent(262143, 0, 18)); ?column? -------------------- 0.9784369447535859 (1 row) }}} That's over 2% error. Although it isn't great, I suggest recalculating the bbox of the input geometry the precision of a 64b floating point (vs 32b). With that, the same tile (18/0/0) is `0.999999996832113` equivalent, which is what we would expect since CARTO's function uses a slightly different geometry and algorithm. ",defect,closed,medium,PostGIS 3.0.1,postgis,3.0.x,fixed,,