PostGIS  2.2.7dev-r@@SVN_REVISION@@
static size_t asgeojson_geom_buf ( const LWGEOM geom,
char *  output,
GBOX bbox,
int  precision 
)
static

Definition at line 626 of file lwout_geojson.c.

References asgeojson_line_buf(), asgeojson_multiline_buf(), asgeojson_multipoint_buf(), asgeojson_multipolygon_buf(), asgeojson_point_buf(), asgeojson_poly_buf(), LINETYPE, lwerror(), lwfree(), MULTILINETYPE, MULTIPOINTTYPE, MULTIPOLYGONTYPE, POINTTYPE, POLYGONTYPE, and LWGEOM::type.

Referenced by asgeojson_collection_buf().

627 {
628  int type = geom->type;
629  char *ptr=output;
630 
631  switch (type)
632  {
633  case POINTTYPE:
634  ptr += asgeojson_point_buf((LWPOINT*)geom, NULL, ptr, bbox, precision);
635  break;
636 
637  case LINETYPE:
638  ptr += asgeojson_line_buf((LWLINE*)geom, NULL, ptr, bbox, precision);
639  break;
640 
641  case POLYGONTYPE:
642  ptr += asgeojson_poly_buf((LWPOLY*)geom, NULL, ptr, bbox, precision);
643  break;
644 
645  case MULTIPOINTTYPE:
646  ptr += asgeojson_multipoint_buf((LWMPOINT*)geom, NULL, ptr, bbox, precision);
647  break;
648 
649  case MULTILINETYPE:
650  ptr += asgeojson_multiline_buf((LWMLINE*)geom, NULL, ptr, bbox, precision);
651  break;
652 
653  case MULTIPOLYGONTYPE:
654  ptr += asgeojson_multipolygon_buf((LWMPOLY*)geom, NULL, ptr, bbox, precision);
655  break;
656 
657  default:
658  if (bbox) lwfree(bbox);
659  lwerror("GeoJson: geometry not supported.");
660  }
661 
662  return (ptr-output);
663 }
static size_t asgeojson_point_buf(const LWPOINT *point, char *srs, char *output, GBOX *bbox, int precision)
#define LINETYPE
Definition: liblwgeom.h:71
static size_t asgeojson_multiline_buf(const LWMLINE *mline, char *srs, char *output, GBOX *bbox, int precision)
void lwfree(void *mem)
Definition: lwutil.c:214
#define POLYGONTYPE
Definition: liblwgeom.h:72
#define MULTIPOINTTYPE
Definition: liblwgeom.h:73
static size_t asgeojson_poly_buf(const LWPOLY *poly, char *srs, char *output, GBOX *bbox, int precision)
static size_t asgeojson_multipoint_buf(const LWMPOINT *mpoint, char *srs, char *output, GBOX *bbox, int precision)
uint8_t precision
Definition: cu_in_twkb.c:25
static size_t asgeojson_line_buf(const LWLINE *line, char *srs, char *output, GBOX *bbox, int precision)
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:75
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:70
static size_t asgeojson_multipolygon_buf(const LWMPOLY *mpoly, char *srs, char *output, GBOX *bbox, int precision)
uint8_t type
Definition: liblwgeom.h:380
#define MULTILINETYPE
Definition: liblwgeom.h:74
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:74

Here is the call graph for this function:

Here is the caller graph for this function: