PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ geography_as_svg()

Datum geography_as_svg ( PG_FUNCTION_ARGS  )

Definition at line 402 of file geography_inout.c.

403 {
404  char *svg;
405  text *result;
406  GSERIALIZED *g = PG_GETARG_GSERIALIZED_P(0);
407  int relative = PG_GETARG_INT32(1) ? 1 : 0;
408  int precision = PG_GETARG_INT32(2);
409  LWGEOM *lwgeom = lwgeom_from_gserialized(g);
410 
411  if (precision > DBL_DIG)
412  precision = DBL_DIG;
413  else if (precision < 0)
414  precision = 0;
415 
416  svg = lwgeom_to_svg(lwgeom, precision, relative);
417 
418  lwgeom_free(lwgeom);
419  PG_FREE_IF_COPY(g, 0);
420 
421  result = cstring_to_text(svg);
422  lwfree(svg);
423 
424  PG_RETURN_TEXT_P(result);
425 }
static uint8_t precision
Definition: cu_in_twkb.c:25
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
Definition: gserialized.c:239
char * lwgeom_to_svg(const LWGEOM *geom, int precision, int relative)
Takes a GEOMETRY and returns a SVG representation.
Definition: lwout_svg.c:56
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1138
void lwfree(void *mem)
Definition: lwutil.c:242

References lwfree(), lwgeom_free(), lwgeom_from_gserialized(), lwgeom_to_svg(), and precision.

Here is the call graph for this function: