PostGIS  2.5.7dev-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 371 of file g_box.c.

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

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

Here is the call graph for this function: