PostGIS  2.3.7dev-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 376 of file g_box.c.

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

377 {
378  const char *ptr = str;
379  char *nextptr;
380  char *gbox_start = strstr(str, "GBOX((");
381  GBOX *gbox = gbox_new(gflags(0,0,1));
382  if ( ! gbox_start ) return NULL; /* No header found */
383  ptr += 6;
384  gbox->xmin = strtod(ptr, &nextptr);
385  if ( ptr == nextptr ) return NULL; /* No double found */
386  ptr = nextptr + 1;
387  gbox->ymin = strtod(ptr, &nextptr);
388  if ( ptr == nextptr ) return NULL; /* No double found */
389  ptr = nextptr + 1;
390  gbox->zmin = strtod(ptr, &nextptr);
391  if ( ptr == nextptr ) return NULL; /* No double found */
392  ptr = nextptr + 3;
393  gbox->xmax = strtod(ptr, &nextptr);
394  if ( ptr == nextptr ) return NULL; /* No double found */
395  ptr = nextptr + 1;
396  gbox->ymax = strtod(ptr, &nextptr);
397  if ( ptr == nextptr ) return NULL; /* No double found */
398  ptr = nextptr + 1;
399  gbox->zmax = strtod(ptr, &nextptr);
400  if ( ptr == nextptr ) return NULL; /* No double found */
401  return gbox;
402 }
GBOX * gbox_new(uint8_t flags)
Create a new gbox with the dimensionality indicated by the flags.
Definition: g_box.c:43
double xmax
Definition: liblwgeom.h:292
double zmax
Definition: liblwgeom.h:296
double ymin
Definition: liblwgeom.h:293
double xmin
Definition: liblwgeom.h:291
double ymax
Definition: liblwgeom.h:294
uint8_t gflags(int hasz, int hasm, int geodetic)
Construct a new flags char.
Definition: g_util.c:145
double zmin
Definition: liblwgeom.h:295

Here is the call graph for this function: