PostGIS  3.7.0dev-r@@SVN_REVISION@@

◆ ST_LineCrossingDirection()

Datum ST_LineCrossingDirection ( PG_FUNCTION_ARGS  )

Definition at line 469 of file lwgeom_functions_analytic.c.

470 {
471  int type1, type2, rv;
472  LWLINE *l1 = NULL;
473  LWLINE *l2 = NULL;
474  GSERIALIZED *geom1 = PG_GETARG_GSERIALIZED_P(0);
475  GSERIALIZED *geom2 = PG_GETARG_GSERIALIZED_P(1);
476 
477  gserialized_error_if_srid_mismatch(geom1, geom2, __func__);
478 
479  type1 = gserialized_get_type(geom1);
480  type2 = gserialized_get_type(geom2);
481 
482  if ( type1 != LINETYPE || type2 != LINETYPE )
483  {
484  elog(ERROR,"This function only accepts LINESTRING as arguments.");
485  PG_RETURN_NULL();
486  }
487 
490 
491  rv = lwline_crossing_direction(l1, l2);
492 
493  PG_FREE_IF_COPY(geom1, 0);
494  PG_FREE_IF_COPY(geom2, 1);
495 
496  PG_RETURN_INT32(rv);
497 
498 }
void gserialized_error_if_srid_mismatch(const GSERIALIZED *g1, const GSERIALIZED *g2, const char *funcname)
Definition: gserialized.c:432
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
Definition: gserialized.c:268
uint32_t gserialized_get_type(const GSERIALIZED *g)
Extract the geometry type from the serialized form (it hides in the anonymous data area,...
Definition: gserialized.c:118
LWLINE * lwgeom_as_lwline(const LWGEOM *lwgeom)
Definition: lwgeom.c:179
#define LINETYPE
Definition: liblwgeom.h:103
int lwline_crossing_direction(const LWLINE *l1, const LWLINE *l2)
Given two lines, characterize how (and if) they cross each other.
Definition: lwalgorithm.c:467

References gserialized_error_if_srid_mismatch(), gserialized_get_type(), LINETYPE, lwgeom_as_lwline(), lwgeom_from_gserialized(), and lwline_crossing_direction().

Here is the call graph for this function: