PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ ST_MakeEnvelope()

Datum ST_MakeEnvelope ( PG_FUNCTION_ARGS  )

Definition at line 2059 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().

2060 {
2061  LWPOLY *poly;
2062  GSERIALIZED *result;
2063  double x1, y1, x2, y2;
2064  int srid = SRID_UNKNOWN;
2065 
2066  POSTGIS_DEBUG(2, "ST_MakeEnvelope called");
2067 
2068  x1 = PG_GETARG_FLOAT8(0);
2069  y1 = PG_GETARG_FLOAT8(1);
2070  x2 = PG_GETARG_FLOAT8(2);
2071  y2 = PG_GETARG_FLOAT8(3);
2072  if ( PG_NARGS() > 4 ) {
2073  srid = PG_GETARG_INT32(4);
2074  }
2075 
2076  poly = lwpoly_construct_envelope(srid, x1, y1, x2, y2);
2077 
2078  result = geometry_serialize(lwpoly_as_lwgeom(poly));
2079  lwpoly_free(poly);
2080 
2081  PG_RETURN_POINTER(result);
2082 }
LWGEOM * lwpoly_as_lwgeom(const LWPOLY *obj)
Definition: lwgeom.c:288
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:174
#define SRID_UNKNOWN
Unknown SRID value.
Definition: liblwgeom.h:188
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)
Here is the call graph for this function:
Here is the caller graph for this function: