PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ LWGEOM_force_sfs()

Datum LWGEOM_force_sfs ( PG_FUNCTION_ARGS  )

Definition at line 572 of file lwgeom_functions_basic.c.

573 {
574  GSERIALIZED *geom = PG_GETARG_GSERIALIZED_P(0);
575  GSERIALIZED *result;
576  LWGEOM *lwgeom;
577  LWGEOM *ogeom;
578  text *ver;
579  int version = 110; /* default version is SFS 1.1 */
580 
581  POSTGIS_DEBUG(2, "LWGEOM_force_sfs called");
582 
583  /* If user specified version, respect it */
584  if ((PG_NARGS() > 1) && (!PG_ARGISNULL(1)))
585  {
586  ver = PG_GETARG_TEXT_P(1);
587 
588  if (!strncmp(VARDATA(ver), "1.2", 3))
589  {
590  version = 120;
591  }
592  }
593 
594  lwgeom = lwgeom_from_gserialized(geom);
595  ogeom = lwgeom_force_sfs(lwgeom, version);
596 
597  result = geometry_serialize(ogeom);
598 
599  PG_FREE_IF_COPY(geom, 0);
600 
601  PG_RETURN_POINTER(result);
602 }
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
Definition: gserialized.c:239
LWGEOM * lwgeom_force_sfs(LWGEOM *geom, int version)
Definition: lwgeom.c:831
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)

References geometry_serialize(), lwgeom_force_sfs(), and lwgeom_from_gserialized().

Here is the call graph for this function: