PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ geography_point_outside()

Datum geography_point_outside ( PG_FUNCTION_ARGS  )

Definition at line 677 of file geography_measurement.c.

678 {
679  GBOX gbox;
680  LWGEOM *lwpoint = NULL;
681  POINT2D pt;
682 
683  /* We need the bounding box to get an outside point for area algorithm */
684  if (gserialized_datum_get_gbox_p(PG_GETARG_DATUM(0), &gbox) == LW_FAILURE)
685  {
686  POSTGIS_DEBUG(4, "gserialized_datum_get_gbox_p returned LW_FAILURE");
687  elog(ERROR, "Error in gserialized_datum_get_gbox_p calculation.");
688  PG_RETURN_NULL();
689  }
690  POSTGIS_DEBUGF(4, "got gbox %s", gbox_to_string(&gbox));
691 
692  /* Get an exterior point, based on this gbox */
693  gbox_pt_outside(&gbox, &pt);
694 
695  lwpoint = (LWGEOM*) lwpoint_make2d(4326, pt.x, pt.y);
696 
697  PG_RETURN_POINTER(geography_serialize(lwpoint));
698 }
char * gbox_to_string(const GBOX *gbox)
Allocate a string representation of the GBOX, based on dimensionality of flags.
Definition: gbox.c:392
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:1558
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: