PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ BOX2D_out()

Datum BOX2D_out ( PG_FUNCTION_ARGS  )

Definition at line 94 of file lwgeom_box.c.

95 {
96  char tmp[500]; /* big enough */
97  char *result;
98  int size;
99 
100  GBOX *box = (GBOX *)PG_GETARG_POINTER(0);
101  /* Avoid unaligned access to the gbox struct */
102  GBOX box_aligned;
103  memcpy(&box_aligned, box, sizeof(GBOX));
104 
105  size = sprintf(tmp,
106  "BOX(%.15g %.15g,%.15g %.15g)",
107  box_aligned.xmin,
108  box_aligned.ymin,
109  box_aligned.xmax,
110  box_aligned.ymax);
111 
112  result= palloc(size+1); /* +1= null term */
113  memcpy(result,tmp,size+1);
114  result[size] = '\0';
115 
116  PG_RETURN_CSTRING(result);
117 }
double ymax
Definition: liblwgeom.h:343
double xmax
Definition: liblwgeom.h:341
double ymin
Definition: liblwgeom.h:342
double xmin
Definition: liblwgeom.h:340

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