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

◆ lwgeom_to_svg()

char * lwgeom_to_svg ( const LWGEOM geom,
int  precision,
int  relative 
)

Takes a GEOMETRY and returns a SVG representation.

Definition at line 56 of file lwout_svg.c.

57{
58 char *ret = NULL;
59 int type = geom->type;
60
61 /* Empty string for empties */
62 if( lwgeom_is_empty(geom) )
63 {
64 ret = lwalloc(1);
65 ret[0] = '\0';
66 return ret;
67 }
68
69 switch (type)
70 {
71 case POINTTYPE:
72 ret = assvg_point((LWPOINT*)geom, relative, precision);
73 break;
74 case LINETYPE:
75 ret = assvg_line((LWLINE*)geom, relative, precision);
76 break;
77 case POLYGONTYPE:
78 ret = assvg_polygon((LWPOLY*)geom, relative, precision);
79 break;
80 case MULTIPOINTTYPE:
81 ret = assvg_multipoint((LWMPOINT*)geom, relative, precision);
82 break;
83 case MULTILINETYPE:
84 ret = assvg_multiline((LWMLINE*)geom, relative, precision);
85 break;
87 ret = assvg_multipolygon((LWMPOLY*)geom, relative, precision);
88 break;
89 case COLLECTIONTYPE:
90 ret = assvg_collection((LWCOLLECTION*)geom, relative, precision);
91 break;
92
93 default:
94 lwerror("lwgeom_to_svg: '%s' geometry type not supported",
95 lwtype_name(type));
96 }
97
98 return ret;
99}
static uint8_t precision
Definition cu_in_twkb.c:25
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition lwutil.c:216
#define COLLECTIONTYPE
Definition liblwgeom.h:122
#define MULTILINETYPE
Definition liblwgeom.h:120
#define LINETYPE
Definition liblwgeom.h:117
#define MULTIPOINTTYPE
Definition liblwgeom.h:119
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition liblwgeom.h:116
void * lwalloc(size_t size)
Definition lwutil.c:227
#define MULTIPOLYGONTYPE
Definition liblwgeom.h:121
#define POLYGONTYPE
Definition liblwgeom.h:118
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition lwutil.c:190
static int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members)
Definition lwinline.h:193
static char * assvg_multiline(const LWMLINE *mline, int relative, int precision)
Definition lwout_svg.c:343
static char * assvg_multipoint(const LWMPOINT *mpoint, int relative, int precision)
Definition lwout_svg.c:291
static char * assvg_point(const LWPOINT *point, int relative, int precision)
Definition lwout_svg.c:138
static char * assvg_collection(const LWCOLLECTION *col, int relative, int precision)
Definition lwout_svg.c:454
static char * assvg_line(const LWLINE *line, int relative, int precision)
Definition lwout_svg.c:182
static char * assvg_multipolygon(const LWMPOLY *mpoly, int relative, int precision)
Definition lwout_svg.c:395
static char * assvg_polygon(const LWPOLY *poly, int relative, int precision)
Definition lwout_svg.c:239
uint8_t type
Definition liblwgeom.h:448

References assvg_collection(), assvg_line(), assvg_multiline(), assvg_multipoint(), assvg_multipolygon(), assvg_point(), assvg_polygon(), COLLECTIONTYPE, LINETYPE, lwalloc(), lwerror(), lwgeom_is_empty(), lwtype_name(), MULTILINETYPE, MULTIPOINTTYPE, MULTIPOLYGONTYPE, POINTTYPE, POLYGONTYPE, precision, and LWGEOM::type.

Referenced by do_svg_test(), do_svg_unsupported(), geography_as_svg(), and LWGEOM_asSVG().

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