--- src/rtout_x3d.c +++ src/rtout_x3d.c @@ -63,6 +63,20 @@ rtgeom_to_x3d3(const RTCTX *ctx, const RTGEOM *geom, char *srs, int precision, i { int type = geom->type; +/* apply patch postgis: https://trac.osgeo.org/postgis/changeset/15444 */ +/* https://trac.osgeo.org/postgis/ticket/3704 */ + +/* Empty string for empties */ + if( rtgeom_is_empty(ctx, geom) ) + { + char *ret = NULL; + ret = malloc(1); + ret[0] = '\0'; + return ret; + } + +/* end patch */ + switch (type) { case RTPOINTTYPE: