PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ relate_full()

Datum relate_full ( PG_FUNCTION_ARGS  )

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

2655 {
2656  GSERIALIZED *geom1;
2657  GSERIALIZED *geom2;
2658  GEOSGeometry *g1, *g2;
2659  char *relate_str;
2660  text *result;
2661  int bnr = GEOSRELATE_BNR_OGC;
2662 
2663  /* TODO handle empty */
2664  geom1 = PG_GETARG_GSERIALIZED_P(0);
2665  geom2 = PG_GETARG_GSERIALIZED_P(1);
2666  gserialized_error_if_srid_mismatch(geom1, geom2, __func__);
2667 
2668  if ( PG_NARGS() > 2 )
2669  bnr = PG_GETARG_INT32(2);
2670 
2671  initGEOS(lwpgnotice, lwgeom_geos_error);
2672 
2673  g1 = POSTGIS2GEOS(geom1 );
2674  if (!g1)
2675  HANDLE_GEOS_ERROR("First argument geometry could not be converted to GEOS");
2676  g2 = POSTGIS2GEOS(geom2 );
2677  if (!g2)
2678  {
2679  GEOSGeom_destroy(g1);
2680  HANDLE_GEOS_ERROR("Second argument geometry could not be converted to GEOS");
2681  }
2682 
2683  POSTGIS_DEBUG(3, "constructed geometries ");
2684 
2685  POSTGIS_DEBUGF(3, "%s", GEOSGeomToWKT(g1));
2686  POSTGIS_DEBUGF(3, "%s", GEOSGeomToWKT(g2));
2687 
2688  relate_str = GEOSRelateBoundaryNodeRule(g1, g2, bnr);
2689 
2690  GEOSGeom_destroy(g1);
2691  GEOSGeom_destroy(g2);
2692 
2693  if (!relate_str) HANDLE_GEOS_ERROR("GEOSRelate");
2694 
2695  result = cstring_to_text(relate_str);
2696  GEOSFree(relate_str);
2697 
2698  PG_FREE_IF_COPY(geom1, 0);
2699  PG_FREE_IF_COPY(geom2, 1);
2700 
2701  PG_RETURN_TEXT_P(result);
2702 }
char result[OUT_DOUBLE_BUFFER_SIZE]
Definition: cu_print.c:262
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,...)
GEOSGeometry * POSTGIS2GEOS(const GSERIALIZED *pglwgeom)
#define HANDLE_GEOS_ERROR(label)

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

Here is the call graph for this function: