PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ geometry_from_geography()

Datum geometry_from_geography ( PG_FUNCTION_ARGS  )

Definition at line 651 of file geography_inout.c.

652 {
653  LWGEOM *lwgeom = NULL;
654  GSERIALIZED *ret = NULL;
655  GSERIALIZED *g_ser = PG_GETARG_GSERIALIZED_P(0);
656 
657  lwgeom = lwgeom_from_gserialized(g_ser);
658 
659  /* Recalculate the boxes after re-setting the geodetic bit */
660  lwgeom_set_geodetic(lwgeom, false);
661  lwgeom_refresh_bbox(lwgeom);
662 
663  /* We want "geometry" to think all our "geography" has an SRID, and the
664  implied SRID is the default, so we fill that in if our SRID is actually unknown. */
665  if ( (int)lwgeom->srid <= 0 )
666  lwgeom->srid = SRID_DEFAULT;
667 
668  ret = geometry_serialize(lwgeom);
669  lwgeom_free(lwgeom);
670 
671  PG_RETURN_POINTER(ret);
672 }
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwgeom_refresh_bbox(LWGEOM *lwgeom)
Drop current bbox and calculate a fresh one.
Definition: lwgeom.c:698
void lwgeom_set_geodetic(LWGEOM *geom, int value)
Set the FLAGS geodetic bit on geometry an all sub-geometries and pointlists.
Definition: lwgeom.c:952
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1144
#define SRID_DEFAULT
Definition: liblwgeom.h:198
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)
int32_t srid
Definition: liblwgeom.h:402

References geometry_serialize(), lwgeom_free(), lwgeom_from_gserialized(), lwgeom_refresh_bbox(), lwgeom_set_geodetic(), LWGEOM::srid, and SRID_DEFAULT.

Here is the call graph for this function: