PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ asgeojson_multiline_buf()

static size_t asgeojson_multiline_buf ( const LWMLINE mline,
char *  srs,
char *  output,
GBOX bbox,
int  precision 
)
static

Definition at line 402 of file lwout_geojson.c.

References asgeojson_bbox_buf(), asgeojson_srs_buf(), LWMLINE::flags, FLAGS_GET_Z, LWMLINE::geoms, LWMLINE::ngeoms, pointArray_to_geojson(), and LWLINE::points.

Referenced by asgeojson_geom_buf(), and asgeojson_multiline().

403 {
404  LWLINE *line;
405  int i;
406  char *ptr=output;
407 
408  ptr += sprintf(ptr, "{\"type\":\"MultiLineString\",");
409  if (srs) ptr += asgeojson_srs_buf(ptr, srs);
410  if (bbox) ptr += asgeojson_bbox_buf(ptr, bbox, FLAGS_GET_Z(mline->flags), precision);
411  ptr += sprintf(ptr, "\"coordinates\":[");
412 
413  for (i=0; i<mline->ngeoms; i++)
414  {
415  if (i) ptr += sprintf(ptr, ",");
416  ptr += sprintf(ptr, "[");
417  line = mline->geoms[i];
418  ptr += pointArray_to_geojson(line->points, ptr, precision);
419  ptr += sprintf(ptr, "]");
420  }
421 
422  ptr += sprintf(ptr, "]}");
423 
424  return (ptr - output);
425 }
static size_t asgeojson_srs_buf(char *output, char *srs)
Definition: lwout_geojson.c:93
int ngeoms
Definition: liblwgeom.h:465
uint8_t flags
Definition: liblwgeom.h:462
uint8_t precision
Definition: cu_in_twkb.c:25
static size_t asgeojson_bbox_buf(char *output, GBOX *bbox, int hasz, int precision)
static size_t pointArray_to_geojson(POINTARRAY *pa, char *buf, int precision)
#define FLAGS_GET_Z(flags)
Macros for manipulating the &#39;flags&#39; byte.
Definition: liblwgeom.h:124
LWLINE ** geoms
Definition: liblwgeom.h:467
POINTARRAY * points
Definition: liblwgeom.h:406
Here is the call graph for this function:
Here is the caller graph for this function: