PostGIS  3.7.0dev-r@@SVN_REVISION@@

◆ geography_point_outside()

Datum geography_point_outside ( PG_FUNCTION_ARGS  )

Definition at line 674 of file geography_measurement.c.

675 {
676  GBOX gbox;
677  LWGEOM *lwpoint = NULL;
678  POINT2D pt;
679 
680  /* We need the bounding box to get an outside point for area algorithm */
681  if (gserialized_datum_get_gbox_p(PG_GETARG_DATUM(0), &gbox) == LW_FAILURE)
682  {
683  POSTGIS_DEBUG(4, "gserialized_datum_get_gbox_p returned LW_FAILURE");
684  elog(ERROR, "Error in gserialized_datum_get_gbox_p calculation.");
685  PG_RETURN_NULL();
686  }
687  POSTGIS_DEBUGF(4, "got gbox %s", gbox_to_string(&gbox));
688 
689  /* Get an exterior point, based on this gbox */
690  gbox_pt_outside(&gbox, &pt);
691 
692  lwpoint = (LWGEOM*) lwpoint_make2d(4326, pt.x, pt.y);
693 
694  PG_RETURN_POINTER(geography_serialize(lwpoint));
695 }
char * gbox_to_string(const GBOX *gbox)
Allocate a string representation of the GBOX, based on dimensionality of flags.
Definition: gbox.c:404
int gserialized_datum_get_gbox_p(Datum gsdatum, GBOX *gbox)
Given a GSERIALIZED datum, as quickly as possible (peaking into the top of the memory) return the gbo...
LWPOINT * lwpoint_make2d(int32_t srid, double x, double y)
Definition: lwpoint.c:163
#define LW_FAILURE
Definition: liblwgeom.h:96
int gbox_pt_outside(const GBOX *gbox, POINT2D *pt_outside)
Calculate a spherical point that falls outside the geocentric gbox.
Definition: lwgeodetic.c:1506
double y
Definition: liblwgeom.h:390
double x
Definition: liblwgeom.h:390

References gbox_pt_outside(), gbox_to_string(), gserialized_datum_get_gbox_p(), LW_FAILURE, lwpoint_make2d(), POINT2D::x, and POINT2D::y.

Here is the call graph for this function: