PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ BOX2D_out()

Datum BOX2D_out ( PG_FUNCTION_ARGS  )

Definition at line 96 of file lwgeom_box.c.

References LWGEOM_to_BOX2D(), PG_FUNCTION_INFO_V1(), GBOX::xmax, GBOX::xmin, GBOX::ymax, and GBOX::ymin.

Referenced by BOX2D_in().

97 {
98  char tmp[500]; /* big enough */
99  char *result;
100  int size;
101 
102  GBOX *box = (GBOX *)PG_GETARG_POINTER(0);
103  /* Avoid unaligned access to the gbox struct */
104  GBOX box_aligned;
105  memcpy(&box_aligned, box, sizeof(GBOX));
106 
107  size = sprintf(tmp,
108  "BOX(%.15g %.15g,%.15g %.15g)",
109  box_aligned.xmin,
110  box_aligned.ymin,
111  box_aligned.xmax,
112  box_aligned.ymax);
113 
114  result= palloc(size+1); /* +1= null term */
115  memcpy(result,tmp,size+1);
116  result[size] = '\0';
117 
118  PG_RETURN_CSTRING(result);
119 }
double xmax
Definition: liblwgeom.h:293
double ymin
Definition: liblwgeom.h:294
double xmin
Definition: liblwgeom.h:292
double ymax
Definition: liblwgeom.h:295
Here is the call graph for this function:
Here is the caller graph for this function: