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

◆ geography_point_outside()

Datum geography_point_outside ( PG_FUNCTION_ARGS  )

Definition at line 686 of file geography_measurement.c.

687{
688 GBOX gbox;
689 GSERIALIZED *g = NULL;
690 GSERIALIZED *g_out = NULL;
691 LWGEOM *lwpoint = NULL;
692 POINT2D pt;
693
694 /* Get our geometry object loaded into memory. */
695 g = PG_GETARG_GSERIALIZED_P(0);
696
697 /* We need the bounding box to get an outside point for area algorithm */
698 if ( gserialized_get_gbox_p(g, &gbox) == LW_FAILURE )
699 {
700 POSTGIS_DEBUG(4,"gserialized_get_gbox_p returned LW_FAILURE");
701 elog(ERROR, "Error in gserialized_get_gbox_p calculation.");
702 PG_RETURN_NULL();
703 }
704 POSTGIS_DEBUGF(4, "got gbox %s", gbox_to_string(&gbox));
705
706 /* Get an exterior point, based on this gbox */
707 gbox_pt_outside(&gbox, &pt);
708
709 lwpoint = (LWGEOM*) lwpoint_make2d(4326, pt.x, pt.y);
710
711 g_out = geography_serialize(lwpoint);
712
713 PG_FREE_IF_COPY(g, 0);
714 PG_RETURN_POINTER(g_out);
715
716}
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_get_gbox_p(const GSERIALIZED *g, GBOX *gbox)
Read the box from the GSERIALIZED or calculate it if necessary.
Definition gserialized.c:65
#define LW_FAILURE
Definition liblwgeom.h:110
int gbox_pt_outside(const GBOX *gbox, POINT2D *pt_outside)
Calculate a spherical point that falls outside the geocentric gbox.
LWPOINT * lwpoint_make2d(int32_t srid, double x, double y)
Definition lwpoint.c:163
double y
Definition liblwgeom.h:376
double x
Definition liblwgeom.h:376

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

Here is the call graph for this function: