PostGIS  2.5.1dev-r@@SVN_REVISION@@

◆ ST_MakeEnvelope()

Datum ST_MakeEnvelope ( PG_FUNCTION_ARGS  )

Definition at line 2066 of file lwgeom_functions_basic.c.

References geometry_serialize(), lwpoly_as_lwgeom(), lwpoly_construct_envelope(), lwpoly_free(), PG_FUNCTION_INFO_V1(), SRID_UNKNOWN, and ST_IsCollection().

Referenced by LWGEOM_same().

2067 {
2068  LWPOLY *poly;
2069  GSERIALIZED *result;
2070  double x1, y1, x2, y2;
2071  int srid = SRID_UNKNOWN;
2072 
2073  POSTGIS_DEBUG(2, "ST_MakeEnvelope called");
2074 
2075  x1 = PG_GETARG_FLOAT8(0);
2076  y1 = PG_GETARG_FLOAT8(1);
2077  x2 = PG_GETARG_FLOAT8(2);
2078  y2 = PG_GETARG_FLOAT8(3);
2079  if ( PG_NARGS() > 4 ) {
2080  srid = PG_GETARG_INT32(4);
2081  }
2082 
2083  poly = lwpoly_construct_envelope(srid, x1, y1, x2, y2);
2084 
2085  result = geometry_serialize(lwpoly_as_lwgeom(poly));
2086  lwpoly_free(poly);
2087 
2088  PG_RETURN_POINTER(result);
2089 }
LWGEOM * lwpoly_as_lwgeom(const LWPOLY *obj)
Definition: lwgeom.c:320
LWPOLY * lwpoly_construct_envelope(int srid, double x1, double y1, double x2, double y2)
Definition: lwpoly.c:98
void lwpoly_free(LWPOLY *poly)
Definition: lwpoly.c:175
#define SRID_UNKNOWN
Unknown SRID value.
Definition: liblwgeom.h:187
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)
Here is the call graph for this function:
Here is the caller graph for this function: