PostGIS  3.2.2dev-r@@SVN_REVISION@@

◆ relate_full()

Datum relate_full ( PG_FUNCTION_ARGS  )

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

2573 {
2574  GSERIALIZED *geom1;
2575  GSERIALIZED *geom2;
2576  GEOSGeometry *g1, *g2;
2577  char *relate_str;
2578  text *result;
2579  int bnr = GEOSRELATE_BNR_OGC;
2580 
2581  /* TODO handle empty */
2582  geom1 = PG_GETARG_GSERIALIZED_P(0);
2583  geom2 = PG_GETARG_GSERIALIZED_P(1);
2584  gserialized_error_if_srid_mismatch(geom1, geom2, __func__);
2585 
2586  if ( PG_NARGS() > 2 )
2587  bnr = PG_GETARG_INT32(2);
2588 
2589  initGEOS(lwpgnotice, lwgeom_geos_error);
2590 
2591  g1 = POSTGIS2GEOS(geom1 );
2592  if (!g1)
2593  HANDLE_GEOS_ERROR("First argument geometry could not be converted to GEOS");
2594  g2 = POSTGIS2GEOS(geom2 );
2595  if (!g2)
2596  {
2597  GEOSGeom_destroy(g1);
2598  HANDLE_GEOS_ERROR("Second argument geometry could not be converted to GEOS");
2599  }
2600 
2601  POSTGIS_DEBUG(3, "constructed geometries ");
2602 
2603  POSTGIS_DEBUGF(3, "%s", GEOSGeomToWKT(g1));
2604  POSTGIS_DEBUGF(3, "%s", GEOSGeomToWKT(g2));
2605 
2606  relate_str = GEOSRelateBoundaryNodeRule(g1, g2, bnr);
2607 
2608  GEOSGeom_destroy(g1);
2609  GEOSGeom_destroy(g2);
2610 
2611  if (!relate_str) HANDLE_GEOS_ERROR("GEOSRelate");
2612 
2613  result = cstring_to_text(relate_str);
2614  GEOSFree(relate_str);
2615 
2616  PG_FREE_IF_COPY(geom1, 0);
2617  PG_FREE_IF_COPY(geom2, 1);
2618 
2619  PG_RETURN_TEXT_P(result);
2620 }
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:404
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: