327{
328
330 static const char *default_prefix = "";
331 char *prefixbuf;
332 const char *prefix = default_prefix;
335 text *prefix_text = PG_GETARG_TEXT_P(2);
337
338
341
342 if (VARSIZE_ANY_EXHDR(prefix_text) > 0)
343 {
344
345 prefixbuf = palloc(VARSIZE_ANY_EXHDR(prefix_text)+2);
346 memcpy(prefixbuf, VARDATA(prefix_text),
347 VARSIZE_ANY_EXHDR(prefix_text));
348
349 prefixbuf[VARSIZE_ANY_EXHDR(prefix_text)] = ':';
350 prefixbuf[VARSIZE_ANY_EXHDR(prefix_text)+1] = '\0';
351 prefix = prefixbuf;
352 }
353 else
354 {
355 prefix = "";
356 }
357
359 if (kml)
360 PG_RETURN_TEXT_P(kml);
361 PG_RETURN_NULL();
362}
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
lwvarlena_t * lwgeom_to_kml2(const LWGEOM *geom, int precision, const char *prefix)