622{
625 char *encodedpolyline;
627 text *result;
628
629 if ( PG_ARGISNULL(0) ) PG_RETURN_NULL();
630
631 geom = PG_GETARG_GSERIALIZED_P(0);
633 PG_FREE_IF_COPY(geom, 0);
634 elog(ERROR, "Only SRID 4326 is supported.");
635 PG_RETURN_NULL();
636 }
638
639 if (PG_NARGS() > 1 && !PG_ARGISNULL(1))
640 {
643 }
644
647 PG_FREE_IF_COPY(geom, 0);
648
649 result = cstring_to_text(encodedpolyline);
651
652 PG_RETURN_TEXT_P(result);
653}
int32_t gserialized_get_srid(const GSERIALIZED *g)
Extract the SRID from the serialized form (it is packed into three bytes so this is a handy function)...
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
char * lwgeom_to_encoded_polyline(const LWGEOM *geom, int precision)
void lwgeom_free(LWGEOM *geom)