PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ LWGEOM_maxdistance2d_linestring()

Datum LWGEOM_maxdistance2d_linestring ( PG_FUNCTION_ARGS  )

Definition at line 797 of file lwgeom_functions_basic.c.

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

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

Here is the call graph for this function: