mirror of
https://github.com/maplibre/martin.git
synced 2024-12-19 12:51:37 +03:00
b3fb720a94
If a PostgreSQL function has an SQL comment, it will try to parse as JSON and use its values to override the auto-generated TileJSON. It is recommended to use this form when creating comments to ensure valid JSON values. ```sql DO $do$ BEGIN EXECUTE 'COMMENT ON FUNCTION YOUR_FUNCTION (ARG1_TYPE,ARG2_TYPE,..ARGN_TYPE) IS $tj$' || $$ { "description": "description override", ... } $$::json || '$tj$'; END $do$; ``` Partially implements #822
33 lines
1.1 KiB
PL/PgSQL
33 lines
1.1 KiB
PL/PgSQL
DROP FUNCTION IF EXISTS "MixedCase"."function_Mixed_Name";
|
|
|
|
CREATE OR REPLACE FUNCTION "MixedCase"."function_Mixed_Name"("Z" integer, x integer, y integer)
|
|
RETURNS TABLE("mVt" bytea, key text) AS $$
|
|
SELECT mvt, md5(mvt) as key FROM (
|
|
SELECT ST_AsMVT(tile, 'MixedCase.function_Mixed_Name', 4096, 'geom') as mvt FROM (
|
|
SELECT
|
|
ST_AsMVTGeom(
|
|
ST_Transform(ST_CurveToLine("Geom"), 3857),
|
|
ST_TileEnvelope("Z", x, y),
|
|
4096, 64, true) AS geom
|
|
FROM "MixedCase"."MixPoints"
|
|
WHERE "Geom" && ST_Transform(ST_TileEnvelope("Z", x, y), 4326)
|
|
) as tile WHERE geom IS NOT NULL) src
|
|
$$ LANGUAGE SQL IMMUTABLE STRICT PARALLEL SAFE;
|
|
|
|
DO $do$ BEGIN
|
|
EXECUTE 'COMMENT ON FUNCTION "MixedCase"."function_Mixed_Name" (INT4, INT4, INT4) IS $tj$' || $$
|
|
{
|
|
"description": "a function source with MixedCase name",
|
|
"vector_layers": [
|
|
{
|
|
"id": "MixedCase.function_Mixed_Name",
|
|
"fields": {
|
|
"TABLE": "",
|
|
"Geom": ""
|
|
}
|
|
}
|
|
]
|
|
}
|
|
$$::json || '$tj$';
|
|
END $do$;
|