-
-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add raster zxy function doc and test
- Loading branch information
1 parent
3c24ae2
commit 5774b36
Showing
4 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
DROP FUNCTION IF EXISTS public.function_zxy_raster; | ||
|
||
CREATE OR REPLACE FUNCTION public.function_zxy_raster(z integer, x integer, y integer) RETURNS bytea AS $$ | ||
DECLARE | ||
mvt bytea; | ||
BEGIN | ||
with rast as ( | ||
SELECT | ||
st_clip( | ||
st_transform(st_union(rast),3857), | ||
st_tileenvelope(z,x,y) | ||
) | ||
as bands | ||
from public.landcover where ST_ConvexHull(rast) && st_transform( st_tileenvelope(z,x,y),4326) | ||
) | ||
SELECT into mvt ST_AsJPEG(st_tile(bands,256,256)) from rast; | ||
return mvt; | ||
END | ||
$$ LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
create extension postgis_raster; | ||
alter DATABASE db SET postgis.enable_outdb_rasters = true; | ||
alter DATABASE db set postgis.gdal_enabled_drivers To 'GTiff PNG JPEG'; | ||
SELECT pg_reload_conf(); |
Binary file not shown.