PostGIS  3.3.9dev-r@@SVN_REVISION@@

◆ geography_expand()

Datum geography_expand ( PG_FUNCTION_ARGS  )

Definition at line 455 of file geography_measurement.c.

456 {
457  GSERIALIZED *g = NULL;
458  GSERIALIZED *g_out = NULL;
459  double unit_distance, distance;
460 
461  /* Get a wholly-owned pointer to the geography */
462  g = PG_GETARG_GSERIALIZED_P_COPY(0);
463 
464  /* Read our distance value and normalize to unit-sphere. */
465  distance = PG_GETARG_FLOAT8(1);
466  /* Magic 1% expansion is to bridge difference between potential */
467  /* spheroidal input distance and fact that expanded box filter is */
468  /* calculated on sphere */
469  unit_distance = 1.01 * distance / WGS84_RADIUS;
470 
471  /* Try the expansion */
472  g_out = gserialized_expand(g, unit_distance);
473 
474  /* If the expansion fails, the return our input */
475  if ( g_out == NULL )
476  {
477  PG_RETURN_POINTER(g);
478  }
479 
480  if ( g_out != g )
481  {
482  pfree(g);
483  }
484 
485  PG_RETURN_POINTER(g_out);
486 }
GSERIALIZED * gserialized_expand(GSERIALIZED *g, double distance)
Return a GSERIALIZED with an expanded bounding box.
#define WGS84_RADIUS
Definition: liblwgeom.h:163
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: