cartodb-postgresql/test/CDB_XYZ_ExtentTest.sql
Paul Norman 3b48acf60c Round extent outputs in test
Travis was reporting rounded results, so this should make the behavior more consistent
2015-12-22 16:34:18 -08:00

10 lines
471 B
SQL

WITH zoom AS ( select generate_series(0,2) as Z ),
range AS ( select z, generate_series(0, pow(2,z)::int-1) as r FROM zoom),
inp AS ( select z0.z, r1.r as x, r2.r as y FROM zoom z0, range r1, range r2 WHERE z0.z = r1.z and r1.z = r2.z ),
ext AS ( select x,y,z,CDB_XYZ_Extent(x,y,z) as g from inp )
select X::text || ',' || Y::text || ',' || Z::text as xyz,
round(st_xmin(g)), round(st_xmax(g)), round(st_ymin(g)), round(st_ymax(g))
from ext order by xyz;