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

◆ asgeojson_multipolygon_buf()

static size_t asgeojson_multipolygon_buf ( const LWMPOLY mpoly,
char *  srs,
char *  output,
GBOX bbox,
int  precision 
)
static

Definition at line 542 of file lwout_geojson.c.

543{
544 LWPOLY *poly;
545 uint32_t i, j;
546 char *ptr=output;
547
548 ptr += sprintf(ptr, "{\"type\":\"MultiPolygon\",");
549 if (srs) ptr += asgeojson_srs_buf(ptr, srs);
550 if (bbox) ptr += asgeojson_bbox_buf(ptr, bbox, FLAGS_GET_Z(mpoly->flags), precision);
551 ptr += sprintf(ptr, "\"coordinates\":[");
552 for (i=0; i<mpoly->ngeoms; i++)
553 {
554 if (i) ptr += sprintf(ptr, ",");
555 ptr += sprintf(ptr, "[");
556 poly = mpoly->geoms[i];
557 for (j=0 ; j < poly->nrings ; j++)
558 {
559 if (j) ptr += sprintf(ptr, ",");
560 ptr += sprintf(ptr, "[");
561 ptr += pointArray_to_geojson(poly->rings[j], ptr, precision);
562 ptr += sprintf(ptr, "]");
563 }
564 ptr += sprintf(ptr, "]");
565 }
566 ptr += sprintf(ptr, "]}");
567
568 return (ptr - output);
569}
static uint8_t precision
Definition cu_in_twkb.c:25
#define FLAGS_GET_Z(flags)
Definition liblwgeom.h:179
static size_t pointArray_to_geojson(POINTARRAY *pa, char *buf, int precision)
static size_t asgeojson_srs_buf(char *output, char *srs)
static size_t asgeojson_bbox_buf(char *output, GBOX *bbox, int hasz, int precision)
uint32_t ngeoms
Definition liblwgeom.h:552
LWPOLY ** geoms
Definition liblwgeom.h:547
lwflags_t flags
Definition liblwgeom.h:549
POINTARRAY ** rings
Definition liblwgeom.h:505
uint32_t nrings
Definition liblwgeom.h:510

References asgeojson_bbox_buf(), asgeojson_srs_buf(), LWMPOLY::flags, FLAGS_GET_Z, LWMPOLY::geoms, LWMPOLY::ngeoms, LWPOLY::nrings, pointArray_to_geojson(), precision, and LWPOLY::rings.

Referenced by asgeojson_geom_buf(), and asgeojson_multipolygon().

Here is the call graph for this function:
Here is the caller graph for this function: