PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ geography_expand()

Datum geography_expand ( PG_FUNCTION_ARGS  )

Definition at line 465 of file geography_measurement.c.

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

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

Here is the call graph for this function: