Created
April 1, 2014 21:20
-
-
Save ajashton/9923452 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- ZRES | |
-- Takes a web mercator zoom level and returns the pixel resolution for that | |
-- scale, assuming 256x256 pixel tiles. Non-integer zoom levels are accepted. | |
-- For databases with the PostGIS extension enabled. | |
create or replace function zres(z float) | |
returns float | |
language plpgsql immutable | |
as $func$ | |
begin | |
return (40075016.6855785/(256*2^z)); | |
end; | |
$func$; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment