PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ ST_AsMVTGeom()

Datum ST_AsMVTGeom ( PG_FUNCTION_ARGS  )

Definition at line 42 of file lwgeom_out_mvt.c.

References buffer(), geometry_serialize(), lwgeom_free(), lwgeom_from_gserialized(), mvt_geom(), PG_FUNCTION_INFO_V1(), and pgis_asmvt_transfn().

43 {
44 #ifndef HAVE_LIBPROTOBUF
45  elog(ERROR, "Missing libprotobuf-c");
46  PG_RETURN_NULL();
47 #else
48  LWGEOM *lwgeom_in, *lwgeom_out;
49  GSERIALIZED *geom_in, *geom_out;
50  GBOX *bounds;
51  int extent, buffer;
52  bool clip_geom;
53  if (PG_ARGISNULL(0))
54  PG_RETURN_NULL();
55  geom_in = PG_GETARG_GSERIALIZED_P(0);
56  lwgeom_in = lwgeom_from_gserialized(geom_in);
57  if (PG_ARGISNULL(1))
58  elog(ERROR, "ST_AsMVTGeom: parameter bounds cannot be null");
59  bounds = (GBOX *) PG_GETARG_POINTER(1);
60  extent = PG_ARGISNULL(2) ? 4096 : PG_GETARG_INT32(2);
61  buffer = PG_ARGISNULL(3) ? 256 : PG_GETARG_INT32(3);
62  clip_geom = PG_ARGISNULL(4) ? true : PG_GETARG_BOOL(4);
63  lwgeom_out = mvt_geom(lwgeom_in, bounds, extent, buffer, clip_geom);
64  lwgeom_free(lwgeom_in);
65  if (lwgeom_out == NULL)
66  PG_RETURN_NULL();
67  geom_out = geometry_serialize(lwgeom_out);
68  lwgeom_free(lwgeom_out);
69  PG_FREE_IF_COPY(geom_in, 0);
70  PG_RETURN_POINTER(geom_out);
71 #endif
72 }
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1099
LWGEOM * mvt_geom(const LWGEOM *lwgeom, const GBOX *gbox, uint32_t extent, uint32_t buffer, bool clip_geom)
Transform a geometry into vector tile coordinate space.
Definition: mvt.c:710
Datum buffer(PG_FUNCTION_ARGS)
uint32_t extent
Definition: mvt.h:51
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)
Here is the call graph for this function: