PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ BOX2D_out()

Datum BOX2D_out ( PG_FUNCTION_ARGS  )

Definition at line 96 of file lwgeom_box.c.

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 ymax
Definition: liblwgeom.h:298
double xmax
Definition: liblwgeom.h:296
double ymin
Definition: liblwgeom.h:297
double xmin
Definition: liblwgeom.h:295

References GBOX::xmax, GBOX::xmin, GBOX::ymax, and GBOX::ymin.