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

◆ geography_expand()

Datum geography_expand ( PG_FUNCTION_ARGS  )

Definition at line 454 of file geography_measurement.c.

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