201 GSERIALIZED *pg_lwgeom = PG_GETARG_GSERIALIZED_P(0);
202 text *format_text = PG_GETARG_TEXT_P(1);
205 char *format_str = NULL;
207 char * formatted_str;
208 text * formatted_text;
215 lwpgerror(
"Only points are supported, you tried type %s.",
lwtype_name(geom_type));
220 if (format_text == NULL) {
221 lwpgerror(
"ST_AsLatLonText: invalid format string (null");
226 assert(format_str != NULL);
230 tmp = (
char *)pg_do_encoding_conversion(
231 (
uint8_t *)format_str, strlen(format_str), GetDatabaseEncoding(), PG_UTF8);
233 if ( tmp != format_str ) {
240 assert(formatted_str != NULL);
244 tmp = (
char *)pg_do_encoding_conversion(
245 (
uint8_t *)formatted_str, strlen(formatted_str),
246 PG_UTF8, GetDatabaseEncoding());
248 if ( tmp != formatted_str) {
249 pfree(formatted_str);
254 formatted_text = cstring2text(formatted_str);
255 pfree(formatted_str);
257 PG_RETURN_POINTER(formatted_text);
uint32_t gserialized_get_type(const GSERIALIZED *s)
Extract the geometry type from the serialized form (it hides in the anonymous data area...
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
char * lwpoint_to_latlon(const LWPOINT *p, const char *format)
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
char * text2cstring(const text *textptr)
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.