PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ lwgeom_to_wkt()

char* lwgeom_to_wkt ( const LWGEOM geom,
uint8_t  variant,
int  precision,
size_t *  size_out 
)

WKT emitter function.

Allocates a new *char and fills it with the WKT representation. If size_out is not NULL, it will be set to the size of the allocated *char.

Parameters
variantBitmasked value, accepts one of WKT_ISO, WKT_SFSQL, WKT_EXTENDED.
precisionMaximal number of digits after comma in the output doubles.
size_outIf supplied, will return the size of the returned string, including the null terminator.

Definition at line 708 of file lwout_wkt.c.

709 {
711  if (!sb)
712  return NULL;
713  char *str = stringbuffer_getstringcopy(sb);
714  if ( size_out )
715  *size_out = stringbuffer_getlength(sb) + 1;
717  return str;
718 }
static uint8_t variant
Definition: cu_in_twkb.c:26
static uint8_t precision
Definition: cu_in_twkb.c:25
#define str(s)
static stringbuffer_t * lwgeom_to_wkt_internal(const LWGEOM *geom, uint8_t variant, int precision)
Definition: lwout_wkt.c:676
int stringbuffer_getlength(stringbuffer_t *s)
Returns the length of the current string, not including the null terminator (same behavior as strlen(...
Definition: stringbuffer.c:166
void stringbuffer_destroy(stringbuffer_t *s)
Free the stringbuffer_t and all memory managed within it.
Definition: stringbuffer.c:85
char * stringbuffer_getstringcopy(stringbuffer_t *s)
Returns a newly allocated string large enough to contain the current state of the string.
Definition: stringbuffer.c:133

References lwgeom_to_wkt_internal(), precision, str, stringbuffer_destroy(), stringbuffer_getlength(), stringbuffer_getstringcopy(), and variant.

Referenced by _lwt_AddLine(), _lwt_AddPoint(), _lwt_EdgeSplit(), _lwt_FaceByEdges(), _lwt_FindNextRingEdge(), cu_wkt(), cu_wkt_in(), do_encoded_polyline_test(), do_geojson_test(), do_lwgeom_swap_ordinates(), do_test_chaikin(), do_test_filterm(), GenerateLineStringGeometry(), GeneratePointGeometry(), GeneratePolygonGeometry(), lwgeom_to_ewkt(), lwgeom_to_text(), lwgeom_to_wkb_buffer(), lwgeom_to_wkb_varlena(), lwt_ChangeEdgeGeom(), lwt_GetFaceEdges(), rect_tree_to_wkt(), rt_raster_gdal_polygonize(), rt_raster_surface(), test_lwcurve_linearize(), test_lwgeom_locate_along(), test_misc_wkb(), test_unstroke(), and triangle_parse().

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