diff --git a/tests/fixtures/functions/function_zxy_raster.sql b/tests/fixtures/functions/function_zxy_raster.sql new file mode 100644 index 000000000..263b5e000 --- /dev/null +++ b/tests/fixtures/functions/function_zxy_raster.sql @@ -0,0 +1,13 @@ +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_transform(rast,3857) as bands from public.landcover where rast && st_transform( st_tileenvelope(z,x,y),32644) + ) + SELECT into mvt ST_AsJPEG(st_tile(bands,512,512)) from rast; + return mvt; +END +$$ LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; diff --git a/tests/fixtures/initdb.sh b/tests/fixtures/initdb.sh index 74121058c..f55340767 100755 --- a/tests/fixtures/initdb.sh +++ b/tests/fixtures/initdb.sh @@ -26,6 +26,11 @@ for sql_file in "$FIXTURES_DIR"/tables/*.sql; do psql -e -P pager=off -v ON_ERROR_STOP=1 -f "$sql_file" done +echo "Importing raster tables from $FIXTURES_DIR/raster" +echo "################################################################################################" +psql -e -P pager=off -v ON_ERROR_STOP=1 -f "$FIXTURES_DIR"/raster/init_raster_support.sql +raster2pgsql -s 4326 -I -C -F -t 100x100 "$FIXTURES_DIR"/raster/raster.tif public.landcover | psql -e -P pager=off -v ON_ERROR_STOP=1 + echo -e "\n\n\n" echo "################################################################################################" echo "Importing functions from $FIXTURES_DIR/functions" diff --git a/tests/fixtures/raster/init_raster_support.sql b/tests/fixtures/raster/init_raster_support.sql new file mode 100644 index 000000000..00fb7905c --- /dev/null +++ b/tests/fixtures/raster/init_raster_support.sql @@ -0,0 +1,4 @@ +create extension postgis_raster; +-- ALTER SYSTEM SET postgis.gdal_enabled_drivers TO 'GTiff PNG JPEG'; +-- ALTER SYSTEM postgis.enable_outdb_rasters = true; +-- SELECT pg_reload_conf(); \ No newline at end of file diff --git a/tests/fixtures/raster/raster.tif b/tests/fixtures/raster/raster.tif new file mode 100644 index 000000000..6cfb2b7b7 Binary files /dev/null and b/tests/fixtures/raster/raster.tif differ