637 char *encodedpolyline;
641 if ( PG_ARGISNULL(0) ) PG_RETURN_NULL();
643 geom = PG_GETARG_GSERIALIZED_P(0);
645 PG_FREE_IF_COPY(geom, 0);
646 elog(ERROR,
"Only SRID 4326 is supported.");
651 if (PG_NARGS() > 1 && !PG_ARGISNULL(1))
653 precision = PG_GETARG_INT32(1);
654 if ( precision < 0 ) precision = 5;
659 PG_FREE_IF_COPY(geom, 0);
661 result = cstring_to_text(encodedpolyline);
664 PG_RETURN_TEXT_P(result);
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwgeom_free(LWGEOM *geom)
char * lwgeom_to_encoded_polyline(const LWGEOM *geom, int precision)
int32_t gserialized_get_srid(const GSERIALIZED *s)
Extract the SRID from the serialized form (it is packed into three bytes so this is a handy function)...