PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ geometry_from_geography()

Datum geometry_from_geography ( PG_FUNCTION_ARGS  )

Definition at line 530 of file geography_inout.c.

531 {
532  LWGEOM *lwgeom = NULL;
533  GSERIALIZED *ret = NULL;
534  GSERIALIZED *g_ser = PG_GETARG_GSERIALIZED_P(0);
535 
536  lwgeom = lwgeom_from_gserialized(g_ser);
537 
538  /* Recalculate the boxes after re-setting the geodetic bit */
539  lwgeom_set_geodetic(lwgeom, false);
540  lwgeom_refresh_bbox(lwgeom);
541 
542  /* We want "geometry" to think all our "geography" has an SRID, and the
543  implied SRID is the default, so we fill that in if our SRID is actually unknown. */
544  if ( (int)lwgeom->srid <= 0 )
545  lwgeom->srid = SRID_DEFAULT;
546 
547  ret = geometry_serialize(lwgeom);
548  lwgeom_free(lwgeom);
549 
550  PG_RETURN_POINTER(ret);
551 }
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
Definition: gserialized.c:239
void lwgeom_refresh_bbox(LWGEOM *lwgeom)
Drop current bbox and calculate a fresh one.
Definition: lwgeom.c:707
void lwgeom_set_geodetic(LWGEOM *geom, int value)
Set the FLAGS geodetic bit on geometry an all sub-geometries and pointlists.
Definition: lwgeom.c:964
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1155
#define SRID_DEFAULT
Definition: liblwgeom.h:225
int32_t srid
Definition: liblwgeom.h:460

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

Here is the call graph for this function: