On 2025-07-06 14:40 +0200, Matthew Shaw wrote: > I'm struggling to understand how to use ST_AsMVT. It doesn't exist as a > true function, but this PSQL command shows that it does exist as an "agg" > > \df *st_asmvt* > > Schema | Name | Result data type | Argument data > types > | Type > --------+--------------+------------------+----------------------------------------------------------------------------------------------------------------------+------ > public | st_asmvt | bytea | anyelement > > | agg > public | st_asmvt | bytea | anyelement, text > > | agg > public | st_asmvt | bytea | anyelement, text, integer > > | agg > public | st_asmvt | bytea | anyelement, text, integer, text > > | agg > public | st_asmvt | bytea | anyelement, text, integer, text, > text > | agg > public | st_asmvtgeom | geometry | geom geometry, bounds box2d, > extent integer DEFAULT 4096, buffer integer DEFAULT 256, clip_geom boolean > DEFAULT true | func > > But as soon as I try to invoke ST_AsMVT, it errors: > > select ST_AsMVT(tile, 'highways'::text, 4096, 'geom'::text, array['class']) > from > (SELECT > ST_AsMVTGeom(geom, > ST_TileEnvelope(11,1019, 671), > 4096, 64, true) AS geom, > class > FROM openstreetmap.highway > WHERE geom && ST_Transform(ST_TileEnvelope(11,1019, 671), 4326)) as tile > > > ERROR: function st_asmvt(record, text, integer, text, text[]) does not > exist LINE 3: select ST_AsMVT(tile, 'highways'::text, 4096, 'geom'::text, > ... ^ HINT: No function matches the given name and argument types. You > might need to add explicit type casts.
The last argument (feature_id_name) must be text, not an array. -- Erik Wienhold
