PostGIS  3.3.9dev-r@@SVN_REVISION@@

◆ LWGEOM_asEncodedPolyline()

Datum LWGEOM_asEncodedPolyline ( PG_FUNCTION_ARGS  )

Definition at line 412 of file lwgeom_export.c.

413 {
414  GSERIALIZED *geom;
415  LWGEOM *lwgeom;
416  int precision = 5;
417 
418  if ( PG_ARGISNULL(0) ) PG_RETURN_NULL();
419 
420  geom = PG_GETARG_GSERIALIZED_P(0);
421  if (gserialized_get_srid(geom) != 4326) {
422  PG_FREE_IF_COPY(geom, 0);
423  elog(ERROR, "Only SRID 4326 is supported.");
424  PG_RETURN_NULL();
425  }
426  lwgeom = lwgeom_from_gserialized(geom);
427 
428  if (PG_NARGS() > 1 && !PG_ARGISNULL(1))
429  {
430  precision = PG_GETARG_INT32(1);
431  if ( precision < 0 ) precision = 5;
432  }
433 
434  PG_RETURN_TEXT_P(lwgeom_to_encoded_polyline(lwgeom, precision));
435 }
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: