PostGIS  2.3.8dev-r@@SVN_REVISION@@

◆ asgeojson_geom_buf()

static size_t asgeojson_geom_buf ( const LWGEOM geom,
char *  output,
GBOX bbox,
int  precision 
)
static

Definition at line 640 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, ovdump::type, and LWGEOM::type.

Referenced by asgeojson_collection_buf().

641 {
642  int type = geom->type;
643  char *ptr=output;
644 
645  switch (type)
646  {
647  case POINTTYPE:
648  ptr += asgeojson_point_buf((LWPOINT*)geom, NULL, ptr, bbox, precision);
649  break;
650 
651  case LINETYPE:
652  ptr += asgeojson_line_buf((LWLINE*)geom, NULL, ptr, bbox, precision);
653  break;
654 
655  case POLYGONTYPE:
656  ptr += asgeojson_poly_buf((LWPOLY*)geom, NULL, ptr, bbox, precision);
657  break;
658 
659  case MULTIPOINTTYPE:
660  ptr += asgeojson_multipoint_buf((LWMPOINT*)geom, NULL, ptr, bbox, precision);
661  break;
662 
663  case MULTILINETYPE:
664  ptr += asgeojson_multiline_buf((LWMLINE*)geom, NULL, ptr, bbox, precision);
665  break;
666 
667  case MULTIPOLYGONTYPE:
668  ptr += asgeojson_multipolygon_buf((LWMPOLY*)geom, NULL, ptr, bbox, precision);
669  break;
670 
671  default:
672  if (bbox) lwfree(bbox);
673  lwerror("GeoJson: geometry not supported.");
674  }
675 
676  return (ptr-output);
677 }
static size_t asgeojson_point_buf(const LWPOINT *point, char *srs, char *output, GBOX *bbox, int precision)
#define LINETYPE
Definition: liblwgeom.h:85
static size_t asgeojson_multiline_buf(const LWMLINE *mline, char *srs, char *output, GBOX *bbox, int precision)
void lwfree(void *mem)
Definition: lwutil.c:242
#define POLYGONTYPE
Definition: liblwgeom.h:86
#define MULTIPOINTTYPE
Definition: liblwgeom.h:87
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:89
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:84
static size_t asgeojson_multipolygon_buf(const LWMPOLY *mpoly, char *srs, char *output, GBOX *bbox, int precision)
uint8_t type
Definition: liblwgeom.h:395
type
Definition: ovdump.py:41
#define MULTILINETYPE
Definition: liblwgeom.h:88
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:102
Here is the call graph for this function:
Here is the caller graph for this function: