PostGIS 3.0.6dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ 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 364 of file gbox.c.

365{
366 const char *ptr = str;
367 char *nextptr;
368 char *gbox_start = strstr(str, "GBOX((");
369 GBOX *gbox = gbox_new(lwflags(0,0,1));
370 if ( ! gbox_start ) return NULL; /* No header found */
371 ptr += 6;
372 gbox->xmin = strtod(ptr, &nextptr);
373 if ( ptr == nextptr ) return NULL; /* No double found */
374 ptr = nextptr + 1;
375 gbox->ymin = strtod(ptr, &nextptr);
376 if ( ptr == nextptr ) return NULL; /* No double found */
377 ptr = nextptr + 1;
378 gbox->zmin = strtod(ptr, &nextptr);
379 if ( ptr == nextptr ) return NULL; /* No double found */
380 ptr = nextptr + 3;
381 gbox->xmax = strtod(ptr, &nextptr);
382 if ( ptr == nextptr ) return NULL; /* No double found */
383 ptr = nextptr + 1;
384 gbox->ymax = strtod(ptr, &nextptr);
385 if ( ptr == nextptr ) return NULL; /* No double found */
386 ptr = nextptr + 1;
387 gbox->zmax = strtod(ptr, &nextptr);
388 if ( ptr == nextptr ) return NULL; /* No double found */
389 return gbox;
390}
GBOX * gbox_new(lwflags_t flags)
Create a new gbox with the dimensionality indicated by the flags.
Definition gbox.c:32
lwflags_t lwflags(int hasz, int hasm, int geodetic)
Construct a new flags bitmask.
Definition lwutil.c:471
#define str(s)
double ymax
Definition liblwgeom.h:343
double zmax
Definition liblwgeom.h:345
double xmax
Definition liblwgeom.h:341
double zmin
Definition liblwgeom.h:344
double ymin
Definition liblwgeom.h:342
double xmin
Definition liblwgeom.h:340

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

Here is the call graph for this function: