PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ ST_OrientedEnvelope()

Datum ST_OrientedEnvelope ( PG_FUNCTION_ARGS  )

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

3676 {
3677  GSERIALIZED* input;
3679  GEOSGeometry* input_geos;
3680  GEOSGeometry* result_geos;
3681  int32_t srid;
3682 
3683  initGEOS(lwpgnotice, lwgeom_geos_error);
3684 
3685  input = PG_GETARG_GSERIALIZED_P(0);
3686  srid = gserialized_get_srid(input);
3687  input_geos = POSTGIS2GEOS(input);
3688  if (!input_geos)
3689  HANDLE_GEOS_ERROR("Geometry could not be converted to GEOS");
3690 
3691  result_geos = GEOSMinimumRotatedRectangle(input_geos);
3692  GEOSGeom_destroy(input_geos);
3693  if (!result_geos)
3694  HANDLE_GEOS_ERROR("Error computing oriented envelope");
3695 
3696  GEOSSetSRID(result_geos, srid);
3697  result = GEOS2POSTGIS(result_geos, LW_FALSE);
3698  GEOSGeom_destroy(result_geos);
3699 
3700  PG_FREE_IF_COPY(input, 0);
3701  PG_RETURN_POINTER(result);
3702 }
char result[OUT_DOUBLE_BUFFER_SIZE]
Definition: cu_print.c:262
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:126
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: