PostGIS  2.2.7dev-r@@SVN_REVISION@@
Datum LWGEOM_force_sfs ( PG_FUNCTION_ARGS  )

Definition at line 556 of file lwgeom_functions_basic.c.

References dumpnode::geom, geometry_serialize(), lwgeom_force_sfs(), and lwgeom_from_gserialized().

557 {
558  GSERIALIZED *geom = PG_GETARG_GSERIALIZED_P(0);
559  GSERIALIZED *result;
560  LWGEOM *lwgeom;
561  LWGEOM *ogeom;
562  text * ver;
563  int version = 110; /* default version is SFS 1.1 */
564 
565  POSTGIS_DEBUG(2, "LWGEOM_force_sfs called");
566 
567  /* If user specified version, respect it */
568  if ( (PG_NARGS()>1) && (!PG_ARGISNULL(1)) )
569  {
570  ver = PG_GETARG_TEXT_P(1);
571 
572  if ( ! strncmp(VARDATA(ver), "1.2", 3))
573  {
574  version = 120;
575  }
576  }
577 
578  lwgeom = lwgeom_from_gserialized(geom);
579  ogeom = lwgeom_force_sfs(lwgeom, version);
580 
581  result = geometry_serialize(ogeom);
582 
583  PG_FREE_IF_COPY(geom, 0);
584 
585  PG_RETURN_POINTER(result);
586 }
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:744
LWGEOM * geom
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)

Here is the call graph for this function: