PostGIS  2.1.10dev-r@@SVN_REVISION@@
Datum LWGEOM_maxdistance2d_linestring ( PG_FUNCTION_ARGS  )

Definition at line 770 of file lwgeom_functions_basic.c.

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

771 {
772  double maxdist;
773  GSERIALIZED *geom1 = (GSERIALIZED*)PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
774  GSERIALIZED *geom2 = (GSERIALIZED*)PG_DETOAST_DATUM(PG_GETARG_DATUM(1));
775  LWGEOM *lwgeom1 = lwgeom_from_gserialized(geom1);
776  LWGEOM *lwgeom2 = lwgeom_from_gserialized(geom2);
777 
778  if (lwgeom1->srid != lwgeom2->srid)
779  {
780  elog(ERROR,"Operation on two GEOMETRIES with different SRIDs\n");
781  PG_RETURN_NULL();
782  }
783 
784  maxdist = lwgeom_maxdistance2d(lwgeom1, lwgeom2);
785 
786  PG_FREE_IF_COPY(geom1, 0);
787  PG_FREE_IF_COPY(geom2, 1);
788 
789  /*if called with empty geometries the ingoing mindistance is untouched, and makes us return NULL*/
790  if (maxdist>-1)
791  PG_RETURN_FLOAT8(maxdist);
792 
793  PG_RETURN_NULL();
794 }
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
int32_t srid
Definition: liblwgeom.h:355
double lwgeom_maxdistance2d(LWGEOM *lw1, LWGEOM *lw2)
Function initialazing max distance calculation.
Definition: measures.c:129

Here is the call graph for this function: