PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ LWGEOM_force_sfs()

Datum LWGEOM_force_sfs ( PG_FUNCTION_ARGS  )

Definition at line 578 of file lwgeom_functions_basic.c.

579{
580 GSERIALIZED *geom = PG_GETARG_GSERIALIZED_P(0);
582 LWGEOM *lwgeom;
583 LWGEOM *ogeom;
584 text *ver;
585 int version = 110; /* default version is SFS 1.1 */
586
587 POSTGIS_DEBUG(2, "LWGEOM_force_sfs called");
588
589 /* If user specified version, respect it */
590 if ((PG_NARGS() > 1) && (!PG_ARGISNULL(1)))
591 {
592 ver = PG_GETARG_TEXT_P(1);
593
594 if (!strncmp(VARDATA(ver), "1.2", 3))
595 {
596 version = 120;
597 }
598 }
599
600 lwgeom = lwgeom_from_gserialized(geom);
601 ogeom = lwgeom_force_sfs(lwgeom, version);
602
603 result = geometry_serialize(ogeom);
604
605 PG_FREE_IF_COPY(geom, 0);
606
607 PG_RETURN_POINTER(result);
608}
char result[OUT_DOUBLE_BUFFER_SIZE]
Definition cu_print.c:267
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:877

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

Here is the call graph for this function: