From c3fada29a84f917ed18e3940b9032f534e979e9e Mon Sep 17 00:00:00 2001 From: Javier Goizueta Date: Wed, 25 May 2016 11:07:06 +0200 Subject: [PATCH] Comment how the max overview level is defined --- scripts-available/CDB_Overviews.sql | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scripts-available/CDB_Overviews.sql b/scripts-available/CDB_Overviews.sql index 10b3f57..f91424a 100644 --- a/scripts-available/CDB_Overviews.sql +++ b/scripts-available/CDB_Overviews.sql @@ -1,7 +1,16 @@ +-- Maximum zoom level for which overviews may be created CREATE OR REPLACE FUNCTION _CDB_MaxOverviewLevel() RETURNS INTEGER AS $$ BEGIN + -- Zoom level will be limited so that both tile coordinates + -- and gridding coordinates within a tile up to 1px + -- (i.e. tile coordinates / 256) + -- can be stored in a 32-bit signed integer. + -- We have 31 bits por positive numbers + -- For zoom level Z coordinates range from 0 to 2^Z-1, so they + -- need Z bits, and need 8 bits more to address pixels within a tile + -- (gridding), so we'll limit Z to a maximum of 31 - 8 RETURN 23; END; $$ LANGUAGE PLPGSQL IMMUTABLE;