Compute webmercator resolution with full accuracy

Fixes #241
This commit is contained in:
Javier Goizueta 2016-04-25 14:02:26 +02:00
parent 897689dd43
commit 75c7ae98e4

View File

@ -6,7 +6,7 @@ CREATE OR REPLACE FUNCTION CDB_XYZ_Resolution(z INTEGER)
RETURNS FLOAT8 RETURNS FLOAT8
AS $$ AS $$
-- circumference divided by 256 is z0 resolution, then divide by 2^z -- circumference divided by 256 is z0 resolution, then divide by 2^z
SELECT 40075017.0 / 256 / power(2, z); SELECT 6378137.0*2.0*pi() / 256.0 / power(2.0, z);
$$ LANGUAGE SQL IMMUTABLE STRICT; $$ LANGUAGE SQL IMMUTABLE STRICT;
-- } -- }