PostGIS  3.7.0dev-r@@SVN_REVISION@@

◆ ST_OrientedEnvelope()

Datum ST_OrientedEnvelope ( PG_FUNCTION_ARGS  )

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

2651 {
2652  GSERIALIZED* input;
2654  GEOSGeometry* input_geos;
2655  GEOSGeometry* result_geos;
2656  int32_t srid;
2657 
2658  initGEOS(lwpgnotice, lwgeom_geos_error);
2659 
2660  input = PG_GETARG_GSERIALIZED_P(0);
2661  srid = gserialized_get_srid(input);
2662  input_geos = POSTGIS2GEOS(input);
2663  if (!input_geos)
2664  HANDLE_GEOS_ERROR("Geometry could not be converted to GEOS");
2665 
2666  result_geos = GEOSMinimumRotatedRectangle(input_geos);
2667  GEOSGeom_destroy(input_geos);
2668  if (!result_geos)
2669  HANDLE_GEOS_ERROR("Error computing oriented envelope");
2670 
2671  GEOSSetSRID(result_geos, srid);
2672  result = GEOS2POSTGIS(result_geos, LW_FALSE);
2673  GEOSGeom_destroy(result_geos);
2674 
2675  PG_FREE_IF_COPY(input, 0);
2676  PG_RETURN_POINTER(result);
2677 }
char result[OUT_DOUBLE_BUFFER_SIZE]
Definition: cu_print.c:267
int32_t gserialized_get_srid(const GSERIALIZED *g)
Extract the SRID from the serialized form (it is packed into three bytes so this is a handy function)...
Definition: gserialized.c:155
void lwgeom_geos_error(const char *fmt,...)
#define LW_FALSE
Definition: liblwgeom.h:94
GSERIALIZED * GEOS2POSTGIS(GEOSGeom geom, char want3d)
GEOSGeometry * POSTGIS2GEOS(const GSERIALIZED *pglwgeom)
#define HANDLE_GEOS_ERROR(label)

References GEOS2POSTGIS(), gserialized_get_srid(), HANDLE_GEOS_ERROR, LW_FALSE, lwgeom_geos_error(), POSTGIS2GEOS(), and result.

Here is the call graph for this function: