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

Definition at line 1010 of file lwgeom_functions_basic.c.

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

1011 {
1012  double maxdist;
1013  GSERIALIZED *geom1 = (GSERIALIZED*)PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
1014  GSERIALIZED *geom2 = (GSERIALIZED*)PG_DETOAST_DATUM(PG_GETARG_DATUM(1));
1015  LWGEOM *lwgeom1 = lwgeom_from_gserialized(geom1);
1016  LWGEOM *lwgeom2 = lwgeom_from_gserialized(geom2);
1017 
1018  if (lwgeom1->srid != lwgeom2->srid)
1019  {
1020  elog(ERROR,"Operation on two GEOMETRIES with different SRIDs\n");
1021  PG_RETURN_NULL();
1022  }
1023 
1024  maxdist = lwgeom_maxdistance3d(lwgeom1, lwgeom2);
1025 
1026  PG_FREE_IF_COPY(geom1, 0);
1027  PG_FREE_IF_COPY(geom2, 1);
1028 
1029  /*if called with empty geometries the ingoing mindistance is untouched, and makes us return NULL*/
1030  if (maxdist>-1)
1031  PG_RETURN_FLOAT8(maxdist);
1032 
1033  PG_RETURN_NULL();
1034 }
double lwgeom_maxdistance3d(LWGEOM *lw1, LWGEOM *lw2)
Function initialazing 3d max distance calculation.
Definition: measures3d.c:120
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
int32_t srid
Definition: liblwgeom.h:355

Here is the call graph for this function: