PostGIS  3.0.0dev-r@@SVN_REVISION@@

◆ LWGEOM_maxdistance2d_linestring()

Datum LWGEOM_maxdistance2d_linestring ( PG_FUNCTION_ARGS  )

Definition at line 796 of file lwgeom_functions_basic.c.

References error_if_srid_mismatch(), LWGEOM_closestpoint3d(), lwgeom_from_gserialized(), lwgeom_maxdistance2d(), PG_FUNCTION_INFO_V1(), and LWGEOM::srid.

Referenced by LWGEOM_dfullywithin().

797 {
798  double maxdist;
799  GSERIALIZED *geom1 = PG_GETARG_GSERIALIZED_P(0);
800  GSERIALIZED *geom2 = PG_GETARG_GSERIALIZED_P(1);
801  LWGEOM *lwgeom1 = lwgeom_from_gserialized(geom1);
802  LWGEOM *lwgeom2 = lwgeom_from_gserialized(geom2);
803 
804  error_if_srid_mismatch(lwgeom1->srid, lwgeom2->srid);
805 
806  maxdist = lwgeom_maxdistance2d(lwgeom1, lwgeom2);
807 
808  PG_FREE_IF_COPY(geom1, 0);
809  PG_FREE_IF_COPY(geom2, 1);
810 
811  /*if called with empty geometries the ingoing mindistance is untouched, and makes us return NULL*/
812  if (maxdist>-1)
813  PG_RETURN_FLOAT8(maxdist);
814 
815  PG_RETURN_NULL();
816 }
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void error_if_srid_mismatch(int srid1, int srid2)
Definition: lwutil.c:336
int32_t srid
Definition: liblwgeom.h:401
double lwgeom_maxdistance2d(const LWGEOM *lw1, const LWGEOM *lw2)
Function initializing max distance calculation.
Definition: measures.c:169
Here is the call graph for this function:
Here is the caller graph for this function: