PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ LWGEOM_force_sfs()

Datum LWGEOM_force_sfs ( PG_FUNCTION_ARGS  )

Definition at line 571 of file lwgeom_functions_basic.c.

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

Referenced by LWGEOM_force_curve().

572 {
573  GSERIALIZED *geom = PG_GETARG_GSERIALIZED_P(0);
574  GSERIALIZED *result;
575  LWGEOM *lwgeom;
576  LWGEOM *ogeom;
577  text * ver;
578  int version = 110; /* default version is SFS 1.1 */
579 
580  POSTGIS_DEBUG(2, "LWGEOM_force_sfs called");
581 
582  /* If user specified version, respect it */
583  if ( (PG_NARGS()>1) && (!PG_ARGISNULL(1)) )
584  {
585  ver = PG_GETARG_TEXT_P(1);
586 
587  if ( ! strncmp(VARDATA(ver), "1.2", 3))
588  {
589  version = 120;
590  }
591  }
592 
593  lwgeom = lwgeom_from_gserialized(geom);
594  ogeom = lwgeom_force_sfs(lwgeom, version);
595 
596  result = geometry_serialize(ogeom);
597 
598  PG_FREE_IF_COPY(geom, 0);
599 
600  PG_RETURN_POINTER(result);
601 }
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:793
LWGEOM * geom
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)
Here is the call graph for this function:
Here is the caller graph for this function: