Skip to content

How to add array and hstore columns type in properties #1089

Closed Answered by zachtrong
zachtrong asked this question in Q&A
Discussion options

You must be logged in to vote

Well, the second solution works for me.

CREATE OR REPLACE
    FUNCTION function_zxy_real_estate(z integer, x integer, y integer)
    RETURNS bytea AS $$
DECLARE
  mvt bytea;
BEGIN
  SELECT INTO mvt ST_AsMVT(tile, 'function_zxy_real_estate', 4096, 'geom') FROM (
    SELECT
      ST_AsMVTGeom(
          ST_Transform(ST_CurveToLine(geom), 3857),
          ST_TileEnvelope(z, x, y),
          4096, 64, true) AS geom, title, address, description, array_to_json(images) as images, hstore_to_json(meta_info) as meta_info
    FROM public.real_estate
    WHERE geom && ST_Transform(ST_TileEnvelope(z, x, y), 4326)
  ) as tile WHERE geom IS NOT NULL;

  RETURN mvt;
END
$$ LANGUAGE plpgsql IMMUTABLE STRI…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by zachtrong
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1088 on December 20, 2023 21:25.