PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ LWGEOM_asEncodedPolyline()

Datum LWGEOM_asEncodedPolyline ( PG_FUNCTION_ARGS  )

Definition at line 409 of file lwgeom_export.c.

410 {
411  GSERIALIZED *geom;
412  LWGEOM *lwgeom;
413  int precision = 5;
414 
415  if ( PG_ARGISNULL(0) ) PG_RETURN_NULL();
416 
417  geom = PG_GETARG_GSERIALIZED_P(0);
418  if (gserialized_get_srid(geom) != 4326) {
419  PG_FREE_IF_COPY(geom, 0);
420  elog(ERROR, "Only SRID 4326 is supported.");
421  PG_RETURN_NULL();
422  }
423  lwgeom = lwgeom_from_gserialized(geom);
424 
425  if (PG_NARGS() > 1 && !PG_ARGISNULL(1))
426  {
427  precision = PG_GETARG_INT32(1);
428  if ( precision < 0 ) precision = 5;
429  }
430 
431  PG_RETURN_TEXT_P(lwgeom_to_encoded_polyline(lwgeom, precision));
432 }
static uint8_t precision
Definition: cu_in_twkb.c:25
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)...
Definition: gserialized.c:126
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
Definition: gserialized.c:239
lwvarlena_t * lwgeom_to_encoded_polyline(const LWGEOM *geom, int precision)

References gserialized_get_srid(), lwgeom_from_gserialized(), lwgeom_to_encoded_polyline(), and precision.

Here is the call graph for this function: