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

◆ lwgeom_to_gml3()

lwvarlena_t * lwgeom_to_gml3 ( const LWGEOM geom,
const char *  srs,
int  precision,
int  opts,
const char *  prefix,
const char *  id 
)
extern

Definition at line 978 of file lwout_gml.c.

979{
981
982 /* Initialize options */
983 GML_Options gmlopts;
984 memset(&gmlopts, 0, sizeof(gmlopts));
985 gmlopts.srs = srs;
986 gmlopts.precision = precision;
987 gmlopts.opts = opts;
988 gmlopts.prefix = prefix;
989 gmlopts.id = id;
990
991 /* Return null for empty (#1377) */
992 if (lwgeom_is_empty(geom))
993 return NULL;
994
996
997 switch (geom->type)
998 {
999 case POINTTYPE:
1000 asgml3_point(&sb, (LWPOINT*)geom, &gmlopts);
1001 break;
1002
1003 case LINETYPE:
1004 asgml3_line(&sb, (LWLINE*)geom, &gmlopts);
1005 break;
1006
1007 case CIRCSTRINGTYPE:
1008 asgml3_circstring(&sb, (LWCIRCSTRING*)geom, &gmlopts );
1009 break;
1010
1011 case POLYGONTYPE:
1012 asgml3_poly(&sb, (LWPOLY*)geom, &gmlopts);
1013 break;
1014
1015 case CURVEPOLYTYPE:
1016 asgml3_curvepoly(&sb, (LWCURVEPOLY*)geom, &gmlopts);
1017 break;
1018
1019 case TRIANGLETYPE:
1020 asgml3_triangle(&sb, (LWTRIANGLE*)geom, &gmlopts);
1021 break;
1022
1023 case MULTIPOINTTYPE:
1024 case MULTILINETYPE:
1025 case MULTIPOLYGONTYPE:
1026 asgml3_multi(&sb, (LWCOLLECTION*)geom, &gmlopts);
1027 break;
1028
1030 asgml3_psurface(&sb, (LWPSURFACE*)geom, &gmlopts);
1031 break;
1032
1033 case TINTYPE:
1034 asgml3_tin(&sb, (LWTIN*)geom, &gmlopts);
1035 break;
1036
1037 case COLLECTIONTYPE:
1038 asgml3_collection(&sb, (LWCOLLECTION*)geom, &gmlopts);
1039 break;
1040
1041 case COMPOUNDTYPE:
1042 asgml3_compound(&sb, (LWCOMPOUND*)geom, &gmlopts );
1043 break;
1044
1045 case MULTICURVETYPE:
1046 asgml3_multicurve(&sb, (LWMCURVE*)geom, &gmlopts );
1047 break;
1048
1049 case MULTISURFACETYPE:
1050 asgml3_multisurface(&sb, (LWMSURFACE*)geom, &gmlopts );
1051 break;
1052
1053 default:
1054 lwerror("lwgeom_to_gml3: '%s' geometry type not supported", lwtype_name(geom->type));
1056 return NULL;
1057 }
1058
1059 return stringbuffer_getvarlena(&sb);
1060}
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:108
#define COMPOUNDTYPE
Definition liblwgeom.h:110
#define CURVEPOLYTYPE
Definition liblwgeom.h:111
#define MULTILINETYPE
Definition liblwgeom.h:106
#define MULTISURFACETYPE
Definition liblwgeom.h:113
#define LINETYPE
Definition liblwgeom.h:103
#define MULTIPOINTTYPE
Definition liblwgeom.h:105
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition liblwgeom.h:102
#define TINTYPE
Definition liblwgeom.h:116
#define MULTIPOLYGONTYPE
Definition liblwgeom.h:107
#define POLYGONTYPE
Definition liblwgeom.h:104
#define POLYHEDRALSURFACETYPE
Definition liblwgeom.h:114
#define CIRCSTRINGTYPE
Definition liblwgeom.h:109
#define MULTICURVETYPE
Definition liblwgeom.h:112
#define TRIANGLETYPE
Definition liblwgeom.h:115
void void lwerror(const char *fmt,...) __attribute__((format(printf
Write a notice out to the error handler.
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:199
static void asgml3_compound(stringbuffer_t *sb, const LWCOMPOUND *col, const GML_Options *opts)
Definition lwout_gml.c:540
static void asgml3_curvepoly(stringbuffer_t *sb, const LWCURVEPOLY *poly, const GML_Options *opts)
Definition lwout_gml.c:590
static void asgml3_multi(stringbuffer_t *sb, const LWCOLLECTION *col, const GML_Options *opts)
Definition lwout_gml.c:682
static void asgml3_poly(stringbuffer_t *sb, const LWPOLY *poly, const GML_Options *opts)
Definition lwout_gml.c:456
static void asgml3_collection(stringbuffer_t *sb, const LWCOLLECTION *col, const GML_Options *opts)
Definition lwout_gml.c:798
static void asgml3_circstring(stringbuffer_t *sb, const LWCIRCSTRING *circ, const GML_Options *opts)
Definition lwout_gml.c:507
static void asgml3_multisurface(stringbuffer_t *sb, const LWMSURFACE *sur, const GML_Options *opts)
Definition lwout_gml.c:893
static void asgml3_psurface(stringbuffer_t *sb, const LWPSURFACE *psur, const GML_Options *opts)
Definition lwout_gml.c:768
static void asgml3_multicurve(stringbuffer_t *sb, const LWMCURVE *cur, const GML_Options *opts)
Definition lwout_gml.c:854
static void asgml3_triangle(stringbuffer_t *sb, const LWTRIANGLE *triangle, const GML_Options *opts)
Definition lwout_gml.c:656
static void asgml3_line(stringbuffer_t *sb, const LWLINE *line, const GML_Options *opts)
Definition lwout_gml.c:401
static void asgml3_point(stringbuffer_t *sb, const LWPOINT *point, const GML_Options *opts)
Definition lwout_gml.c:378
static void asgml3_tin(stringbuffer_t *sb, const LWTIN *tin, const GML_Options *opts)
Definition lwout_gml.c:740
lwvarlena_t * stringbuffer_getvarlena(stringbuffer_t *s)
void stringbuffer_release(stringbuffer_t *s)
void stringbuffer_init_varlena(stringbuffer_t *s)
const char * srs
Definition lwout_gml.c:41
int precision
Definition lwout_gml.c:42
const char * prefix
Definition lwout_gml.c:45
const char * id
Definition lwout_gml.c:46
uint8_t type
Definition liblwgeom.h:462

References asgml3_circstring(), asgml3_collection(), asgml3_compound(), asgml3_curvepoly(), asgml3_line(), asgml3_multi(), asgml3_multicurve(), asgml3_multisurface(), asgml3_point(), asgml3_poly(), asgml3_psurface(), asgml3_tin(), asgml3_triangle(), CIRCSTRINGTYPE, COLLECTIONTYPE, COMPOUNDTYPE, CURVEPOLYTYPE, GML_Options::id, LINETYPE, lwerror(), lwgeom_is_empty(), lwtype_name(), MULTICURVETYPE, MULTILINETYPE, MULTIPOINTTYPE, MULTIPOLYGONTYPE, MULTISURFACETYPE, GML_Options::opts, POINTTYPE, POLYGONTYPE, POLYHEDRALSURFACETYPE, precision, GML_Options::precision, GML_Options::prefix, GML_Options::srs, stringbuffer_getvarlena(), stringbuffer_init_varlena(), stringbuffer_release(), TINTYPE, TRIANGLETYPE, LWGEOM::type, and LWPOINT::type.

Referenced by do_gml3_test(), do_gml3_test_nodims(), do_gml3_test_opts(), do_gml3_test_prefix(), geography_as_gml(), and LWGEOM_asGML().

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