mirror of
https://github.com/maplibre/martin.git
synced 2024-12-24 07:22:52 +03:00
17 lines
592 B
MySQL
17 lines
592 B
MySQL
|
DROP FUNCTION IF EXISTS public.function_zoom_xy;
|
||
|
|
||
|
CREATE OR REPLACE FUNCTION public.function_zoom_xy(zoom integer, x integer, y integer) RETURNS bytea AS $$
|
||
|
DECLARE
|
||
|
mvt bytea;
|
||
|
BEGIN
|
||
|
SELECT INTO mvt ST_AsMVT(tile, 'public.function_zoom_xy', 4096, 'geom') FROM (
|
||
|
SELECT
|
||
|
ST_AsMVTGeom(ST_Transform(ST_CurveToLine(geom), 3857), ST_TileEnvelope(zoom, x, y), 4096, 64, true) AS geom
|
||
|
FROM public.table_source
|
||
|
WHERE geom && ST_Transform(ST_TileEnvelope(zoom, x, y), 4326)
|
||
|
) as tile WHERE geom IS NOT NULL;
|
||
|
|
||
|
RETURN mvt;
|
||
|
END
|
||
|
$$ LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE;
|