PostGIS  3.3.9dev-r@@SVN_REVISION@@

◆ relate_full()

Datum relate_full ( PG_FUNCTION_ARGS  )

Definition at line 2544 of file postgis/lwgeom_geos.c.

2545 {
2546  GSERIALIZED *geom1;
2547  GSERIALIZED *geom2;
2548  GEOSGeometry *g1, *g2;
2549  char *relate_str;
2550  text *result;
2551  int bnr = GEOSRELATE_BNR_OGC;
2552 
2553  /* TODO handle empty */
2554  geom1 = PG_GETARG_GSERIALIZED_P(0);
2555  geom2 = PG_GETARG_GSERIALIZED_P(1);
2556  gserialized_error_if_srid_mismatch(geom1, geom2, __func__);
2557 
2558  if ( PG_NARGS() > 2 )
2559  bnr = PG_GETARG_INT32(2);
2560 
2561  initGEOS(lwpgnotice, lwgeom_geos_error);
2562 
2563  g1 = POSTGIS2GEOS(geom1 );
2564  if (!g1)
2565  HANDLE_GEOS_ERROR("First argument geometry could not be converted to GEOS");
2566  g2 = POSTGIS2GEOS(geom2 );
2567  if (!g2)
2568  {
2569  GEOSGeom_destroy(g1);
2570  HANDLE_GEOS_ERROR("Second argument geometry could not be converted to GEOS");
2571  }
2572 
2573  POSTGIS_DEBUG(3, "constructed geometries ");
2574 
2575  POSTGIS_DEBUGF(3, "%s", GEOSGeomToWKT(g1));
2576  POSTGIS_DEBUGF(3, "%s", GEOSGeomToWKT(g2));
2577 
2578  relate_str = GEOSRelateBoundaryNodeRule(g1, g2, bnr);
2579 
2580  GEOSGeom_destroy(g1);
2581  GEOSGeom_destroy(g2);
2582 
2583  if (!relate_str) HANDLE_GEOS_ERROR("GEOSRelate");
2584 
2585  result = cstring_to_text(relate_str);
2586  GEOSFree(relate_str);
2587 
2588  PG_FREE_IF_COPY(geom1, 0);
2589  PG_FREE_IF_COPY(geom2, 1);
2590 
2591  PG_RETURN_TEXT_P(result);
2592 }
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)
Definition: gserialized.c:403
void lwgeom_geos_error(const char *fmt,...)
#define HANDLE_GEOS_ERROR(label)
GEOSGeometry * POSTGIS2GEOS(const GSERIALIZED *pglwgeom)

References gserialized_error_if_srid_mismatch(), HANDLE_GEOS_ERROR, lwgeom_geos_error(), POSTGIS2GEOS(), and result.

Here is the call graph for this function: