PostGIS  3.1.6dev-r@@SVN_REVISION@@

◆ lwgeom_to_wkt_internal()

static stringbuffer_t* lwgeom_to_wkt_internal ( const LWGEOM geom,
uint8_t  variant,
int  precision 
)
static

Definition at line 672 of file lwout_wkt.c.

673 {
674  stringbuffer_t *sb;
675  if ( geom == NULL )
676  return NULL;
677  sb = stringbuffer_create();
678  /* Extended mode starts with an "SRID=" section for geoms that have one */
679  if ( (variant & WKT_EXTENDED) && lwgeom_has_srid(geom) )
680  {
681  stringbuffer_aprintf(sb, "SRID=%d;", geom->srid);
682  }
683  lwgeom_to_wkt_sb(geom, sb, precision, variant);
684  if ( stringbuffer_getstring(sb) == NULL )
685  {
686  lwerror("Uh oh");
687  return NULL;
688  }
689  return sb;
690 }
static uint8_t variant
Definition: cu_in_twkb.c:26
static uint8_t precision
Definition: cu_in_twkb.c:25
#define WKT_EXTENDED
Definition: liblwgeom.h:2157
int lwgeom_has_srid(const LWGEOM *geom)
Return true or false depending on whether a geometry has a valid SRID set.
Definition: lwgeom.c:1387
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
static void lwgeom_to_wkt_sb(const LWGEOM *geom, stringbuffer_t *sb, int precision, uint8_t variant)
Definition: lwout_wkt.c:612
int stringbuffer_aprintf(stringbuffer_t *s, const char *fmt,...)
Appends a formatted string to the current string buffer, using the format and argument list provided.
Definition: stringbuffer.c:228
stringbuffer_t * stringbuffer_create(void)
Allocate a new stringbuffer_t.
Definition: stringbuffer.c:33
const char * stringbuffer_getstring(stringbuffer_t *s)
Returns a reference to the internal string being managed by the stringbuffer.
Definition: stringbuffer.c:113
int32_t srid
Definition: liblwgeom.h:474

References lwerror(), lwgeom_has_srid(), lwgeom_to_wkt_sb(), precision, LWGEOM::srid, stringbuffer_aprintf(), stringbuffer_create(), stringbuffer_getstring(), variant, and WKT_EXTENDED.

Referenced by lwgeom_to_wkt(), and lwgeom_to_wkt_varlena().

Here is the call graph for this function:
Here is the caller graph for this function: