static size_t asgeojson_multipolygon_buf(const LWMPOLY *mpoly, char *srs, char *output, GBOX *bbox, int precision) { LWPOLY *poly; int i, j; char *ptr=output; ptr += sprintf(ptr, "{\"type\":\"MultiPolygon\","); if (srs) ptr += asgeojson_srs_buf(ptr, srs); if (bbox) ptr += asgeojson_bbox_buf(ptr, bbox, FLAGS_GET_Z(mpoly->flags), precision); ptr += sprintf(ptr, "\"coordinates\":["); for (i=0; i<mpoly->ngeoms; i++) { if (i) ptr += sprintf(ptr, ","); ptr += sprintf(ptr, "["); poly = mpoly->geoms[i]; for (j=0 ; j < poly->nrings ; j++) { if (j) ptr += sprintf(ptr, ","); ptr += sprintf(ptr, "["); ptr += pointArray_to_geojson(poly->rings[j], ptr, precision); ptr += sprintf(ptr, "]"); } ptr += sprintf(ptr, "]"); } ptr += sprintf(ptr, "]}"); return (ptr - output); }
static size_t asgeojson_multiline_buf(const LWMLINE *mline, char *srs, char *output, GBOX *bbox, int precision) { LWLINE *line; int i; char *ptr=output; ptr += sprintf(ptr, "{\"type\":\"MultiLineString\","); if (srs) ptr += asgeojson_srs_buf(ptr, srs); if (bbox) ptr += asgeojson_bbox_buf(ptr, bbox, FLAGS_GET_Z(mline->flags), precision); ptr += sprintf(ptr, "\"coordinates\":["); for (i=0; i<mline->ngeoms; i++) { if (i) ptr += sprintf(ptr, ","); ptr += sprintf(ptr, "["); line = mline->geoms[i]; ptr += pointArray_to_geojson(line->points, ptr, precision); ptr += sprintf(ptr, "]"); } ptr += sprintf(ptr, "]}"); return (ptr - output); }
static size_t asgeojson_line_buf(const LWLINE *line, char *srs, char *output, GBOX *bbox, int precision) { char *ptr=output; ptr += sprintf(ptr, "{\"type\":\"LineString\","); if (srs) ptr += asgeojson_srs_buf(ptr, srs); if (bbox) ptr += asgeojson_bbox_buf(ptr, bbox, FLAGS_GET_Z(line->flags), precision); ptr += sprintf(ptr, "\"coordinates\":["); ptr += pointArray_to_geojson(line->points, ptr, precision); ptr += sprintf(ptr, "]}"); return (ptr-output); }
static size_t asgeojson_point_buf(const LWPOINT *point, char *srs, char *output, GBOX *bbox, int precision) { char *ptr = output; ptr += sprintf(ptr, "{\"type\":\"Point\","); if (srs) ptr += asgeojson_srs_buf(ptr, srs); if (bbox) ptr += asgeojson_bbox_buf(ptr, bbox, FLAGS_GET_Z(point->flags), precision); ptr += sprintf(ptr, "\"coordinates\":"); ptr += pointArray_to_geojson(point->point, ptr, precision); ptr += sprintf(ptr, "}"); return (ptr-output); }
static size_t asgeojson_poly_buf(const LWPOLY *poly, char *srs, char *output, GBOX *bbox, int precision) { int i; char *ptr=output; ptr += sprintf(ptr, "{\"type\":\"Polygon\","); if (srs) ptr += asgeojson_srs_buf(ptr, srs); if (bbox) ptr += asgeojson_bbox_buf(ptr, bbox, FLAGS_GET_Z(poly->flags), precision); ptr += sprintf(ptr, "\"coordinates\":["); for (i=0; i<poly->nrings; i++) { if (i) ptr += sprintf(ptr, ","); ptr += sprintf(ptr, "["); ptr += pointArray_to_geojson(poly->rings[i], ptr, precision); ptr += sprintf(ptr, "]"); } ptr += sprintf(ptr, "]}"); return (ptr-output); }
static size_t asgeojson_multipoint_buf(const LWMPOINT *mpoint, char *srs, char *output, GBOX *bbox, int precision) { LWPOINT *point; int i; char *ptr=output; ptr += sprintf(ptr, "{\"type\":\"MultiPoint\","); if (srs) ptr += asgeojson_srs_buf(ptr, srs); if (bbox) ptr += asgeojson_bbox_buf(ptr, bbox, FLAGS_GET_Z(mpoint->flags), precision); ptr += sprintf(ptr, "\"coordinates\":["); for (i=0; i<mpoint->ngeoms; i++) { if (i) ptr += sprintf(ptr, ","); point = mpoint->geoms[i]; ptr += pointArray_to_geojson(point->point, ptr, precision); } ptr += sprintf(ptr, "]}"); return (ptr - output); }