PostGIS  2.1.10dev-r@@SVN_REVISION@@
GBOX* gbox_from_string ( const char *  str)

Warning, this function is only good for x/y/z boxes, used in unit testing of geodetic box generation.

Warning, do not use this function, it is very particular about inputs.

Definition at line 300 of file g_box.c.

References gbox_new(), gflags(), GBOX::xmax, GBOX::xmin, GBOX::ymax, GBOX::ymin, GBOX::zmax, and GBOX::zmin.

301 {
302  const char *ptr = str;
303  char *nextptr;
304  char *gbox_start = strstr(str, "GBOX((");
305  GBOX *gbox = gbox_new(gflags(0,0,1));
306  if ( ! gbox_start ) return NULL; /* No header found */
307  ptr += 6;
308  gbox->xmin = strtod(ptr, &nextptr);
309  if ( ptr == nextptr ) return NULL; /* No double found */
310  ptr = nextptr + 1;
311  gbox->ymin = strtod(ptr, &nextptr);
312  if ( ptr == nextptr ) return NULL; /* No double found */
313  ptr = nextptr + 1;
314  gbox->zmin = strtod(ptr, &nextptr);
315  if ( ptr == nextptr ) return NULL; /* No double found */
316  ptr = nextptr + 3;
317  gbox->xmax = strtod(ptr, &nextptr);
318  if ( ptr == nextptr ) return NULL; /* No double found */
319  ptr = nextptr + 1;
320  gbox->ymax = strtod(ptr, &nextptr);
321  if ( ptr == nextptr ) return NULL; /* No double found */
322  ptr = nextptr + 1;
323  gbox->zmax = strtod(ptr, &nextptr);
324  if ( ptr == nextptr ) return NULL; /* No double found */
325  return gbox;
326 }
GBOX * gbox_new(uint8_t flags)
Create a new gbox with the dimensionality indicated by the flags.
Definition: g_box.c:26
double xmax
Definition: liblwgeom.h:249
double zmax
Definition: liblwgeom.h:253
double ymin
Definition: liblwgeom.h:250
double xmin
Definition: liblwgeom.h:248
double ymax
Definition: liblwgeom.h:251
uint8_t gflags(int hasz, int hasm, int geodetic)
Construct a new flags char.
Definition: g_util.c:131
double zmin
Definition: liblwgeom.h:252

Here is the call graph for this function: