PostGIS  2.5.0beta1dev-r@@SVN_REVISION@@

◆ ST_DistanceCPA()

Datum ST_DistanceCPA ( PG_FUNCTION_ARGS  )

Definition at line 87 of file lwgeom_functions_temporal.c.

References lwgeom_free(), lwgeom_from_gserialized(), lwgeom_tcpa(), PG_FUNCTION_INFO_V1(), and ST_CPAWithin().

Referenced by ST_IsValidTrajectory().

88 {
89  GSERIALIZED *gs0 = PG_GETARG_GSERIALIZED_P(0);
90  GSERIALIZED *gs1 = PG_GETARG_GSERIALIZED_P(1);
91  /* All checks already performed by liblwgeom, not worth checking again */
94  double mindist;
95  double m = lwgeom_tcpa(g0, g1, &mindist);
96  lwgeom_free(g0);
97  lwgeom_free(g1);
98  PG_FREE_IF_COPY(gs0, 0);
99  PG_FREE_IF_COPY(gs1, 1);
100  if ( m < 0 ) PG_RETURN_NULL();
101  PG_RETURN_FLOAT8(mindist);
102 }
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1144
double lwgeom_tcpa(const LWGEOM *g1, const LWGEOM *g2, double *mindist)
Find the time of closest point of approach.
Here is the call graph for this function:
Here is the caller graph for this function: