PostGIS  3.1.6dev-r@@SVN_REVISION@@

◆ relate_full()

Datum relate_full ( PG_FUNCTION_ARGS  )

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

2642 {
2643  GSERIALIZED *geom1;
2644  GSERIALIZED *geom2;
2645  GEOSGeometry *g1, *g2;
2646  char *relate_str;
2647  text *result;
2648  int bnr = GEOSRELATE_BNR_OGC;
2649 
2650  /* TODO handle empty */
2651  geom1 = PG_GETARG_GSERIALIZED_P(0);
2652  geom2 = PG_GETARG_GSERIALIZED_P(1);
2653  gserialized_error_if_srid_mismatch(geom1, geom2, __func__);
2654 
2655  if ( PG_NARGS() > 2 )
2656  bnr = PG_GETARG_INT32(2);
2657 
2658  initGEOS(lwpgnotice, lwgeom_geos_error);
2659 
2660  g1 = POSTGIS2GEOS(geom1 );
2661  if (!g1)
2662  HANDLE_GEOS_ERROR("First argument geometry could not be converted to GEOS");
2663  g2 = POSTGIS2GEOS(geom2 );
2664  if (!g2)
2665  {
2666  GEOSGeom_destroy(g1);
2667  HANDLE_GEOS_ERROR("Second argument geometry could not be converted to GEOS");
2668  }
2669 
2670  POSTGIS_DEBUG(3, "constructed geometries ");
2671 
2672  POSTGIS_DEBUGF(3, "%s", GEOSGeomToWKT(g1));
2673  POSTGIS_DEBUGF(3, "%s", GEOSGeomToWKT(g2));
2674 
2675  relate_str = GEOSRelateBoundaryNodeRule(g1, g2, bnr);
2676 
2677  GEOSGeom_destroy(g1);
2678  GEOSGeom_destroy(g2);
2679 
2680  if (!relate_str) HANDLE_GEOS_ERROR("GEOSRelate");
2681 
2682  result = cstring_to_text(relate_str);
2683  GEOSFree(relate_str);
2684 
2685  PG_FREE_IF_COPY(geom1, 0);
2686  PG_FREE_IF_COPY(geom2, 1);
2687 
2688  PG_RETURN_TEXT_P(result);
2689 }
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: