PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ geography_expand()

Datum geography_expand ( PG_FUNCTION_ARGS  )

Definition at line 463 of file geography_measurement.c.

464 {
465  GSERIALIZED *g = NULL;
466  GSERIALIZED *g_out = NULL;
467  double unit_distance, distance;
468 
469  /* Get a wholly-owned pointer to the geography */
470  g = PG_GETARG_GSERIALIZED_P_COPY(0);
471 
472  /* Read our distance value and normalize to unit-sphere. */
473  distance = PG_GETARG_FLOAT8(1);
474  /* Magic 1% expansion is to bridge difference between potential */
475  /* spheroidal input distance and fact that expanded box filter is */
476  /* calculated on sphere */
477  unit_distance = 1.01 * distance / WGS84_RADIUS;
478 
479  /* Try the expansion */
480  g_out = gserialized_expand(g, unit_distance);
481 
482  /* If the expansion fails, the return our input */
483  if ( g_out == NULL )
484  {
485  PG_RETURN_POINTER(g);
486  }
487 
488  if ( g_out != g )
489  {
490  pfree(g);
491  }
492 
493  PG_RETURN_POINTER(g_out);
494 }
GSERIALIZED * gserialized_expand(GSERIALIZED *g, double distance)
Return a GSERIALIZED with an expanded bounding box.
#define WGS84_RADIUS
Definition: liblwgeom.h:162
static double distance(double x1, double y1, double x2, double y2)
Definition: lwtree.c:1032

References distance(), gserialized_expand(), and WGS84_RADIUS.

Here is the call graph for this function: