PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ LWGEOM_longestline2d()

Datum LWGEOM_longestline2d ( PG_FUNCTION_ARGS  )

Definition at line 673 of file lwgeom_functions_basic.c.

674{
676 GSERIALIZED *geom1 = PG_GETARG_GSERIALIZED_P(0);
677 GSERIALIZED *geom2 = PG_GETARG_GSERIALIZED_P(1);
678 LWGEOM *theline;
679 LWGEOM *lwgeom1 = lwgeom_from_gserialized(geom1);
680 LWGEOM *lwgeom2 = lwgeom_from_gserialized(geom2);
681 gserialized_error_if_srid_mismatch(geom1, geom2, __func__);
682
683 theline = lwgeom_furthest_line(lwgeom1, lwgeom2);
684
685 if (lwgeom_is_empty(theline))
686 PG_RETURN_NULL();
687
688 result = geometry_serialize(theline);
689 lwgeom_free(theline);
690 lwgeom_free(lwgeom1);
691 lwgeom_free(lwgeom2);
692
693 PG_FREE_IF_COPY(geom1, 0);
694 PG_FREE_IF_COPY(geom2, 1);
695 PG_RETURN_POINTER(result);
696}
char result[OUT_DOUBLE_BUFFER_SIZE]
Definition cu_print.c:267
void gserialized_error_if_srid_mismatch(const GSERIALIZED *g1, const GSERIALIZED *g2, const char *funcname)
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwgeom_free(LWGEOM *geom)
Definition lwgeom.c:1246
LWGEOM * lwgeom_furthest_line(const LWGEOM *lw1, const LWGEOM *lw2)
Definition measures.c:49
static int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members)
Definition lwinline.h:199

References gserialized_error_if_srid_mismatch(), lwgeom_free(), lwgeom_from_gserialized(), lwgeom_furthest_line(), lwgeom_is_empty(), and result.

Here is the call graph for this function: