PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ gbox_from_string()

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 341 of file g_box.c.

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

342 {
343  const char *ptr = str;
344  char *nextptr;
345  char *gbox_start = strstr(str, "GBOX((");
346  GBOX *gbox = gbox_new(gflags(0,0,1));
347  if ( ! gbox_start ) return NULL; /* No header found */
348  ptr += 6;
349  gbox->xmin = strtod(ptr, &nextptr);
350  if ( ptr == nextptr ) return NULL; /* No double found */
351  ptr = nextptr + 1;
352  gbox->ymin = strtod(ptr, &nextptr);
353  if ( ptr == nextptr ) return NULL; /* No double found */
354  ptr = nextptr + 1;
355  gbox->zmin = strtod(ptr, &nextptr);
356  if ( ptr == nextptr ) return NULL; /* No double found */
357  ptr = nextptr + 3;
358  gbox->xmax = strtod(ptr, &nextptr);
359  if ( ptr == nextptr ) return NULL; /* No double found */
360  ptr = nextptr + 1;
361  gbox->ymax = strtod(ptr, &nextptr);
362  if ( ptr == nextptr ) return NULL; /* No double found */
363  ptr = nextptr + 1;
364  gbox->zmax = strtod(ptr, &nextptr);
365  if ( ptr == nextptr ) return NULL; /* No double found */
366  return gbox;
367 }
GBOX * gbox_new(uint8_t flags)
Create a new gbox with the dimensionality indicated by the flags.
Definition: g_box.c:28
double xmax
Definition: liblwgeom.h:277
double zmax
Definition: liblwgeom.h:281
double ymin
Definition: liblwgeom.h:278
double xmin
Definition: liblwgeom.h:276
double ymax
Definition: liblwgeom.h:279
uint8_t gflags(int hasz, int hasm, int geodetic)
Construct a new flags char.
Definition: g_util.c:130
double zmin
Definition: liblwgeom.h:280
Here is the call graph for this function: