PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ geography_expand()

Datum geography_expand ( PG_FUNCTION_ARGS  )

Definition at line 451 of file geography_measurement.c.

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

Referenced by geography_dwithin_uncached().

452 {
453  GSERIALIZED *g = NULL;
454  GSERIALIZED *g_out = NULL;
455  double distance;
456 
457  /* Get a wholly-owned pointer to the geography */
458  g = PG_GETARG_GSERIALIZED_P_COPY(0);
459 
460  /* Read our distance value and normalize to unit-sphere. */
461  distance = PG_GETARG_FLOAT8(1) / WGS84_RADIUS;
462 
463  /* Try the expansion */
464  g_out = gserialized_expand(g, distance);
465 
466  /* If the expansion fails, the return our input */
467  if ( g_out == NULL )
468  {
469  PG_RETURN_POINTER(g);
470  }
471 
472  if ( g_out != g )
473  {
474  pfree(g);
475  }
476 
477  PG_RETURN_POINTER(g_out);
478 }
#define WGS84_RADIUS
Definition: liblwgeom.h:116
GSERIALIZED * gserialized_expand(GSERIALIZED *g, double distance)
Return a GSERIALIZED with an expanded bounding box.
Datum distance(PG_FUNCTION_ARGS)
Here is the call graph for this function:
Here is the caller graph for this function: