PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ LWGEOM_force_sfs()

Datum LWGEOM_force_sfs ( PG_FUNCTION_ARGS  )

Definition at line 575 of file lwgeom_functions_basic.c.

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

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

Here is the call graph for this function: