From: Olivier Courtin Date: Mon, 22 Feb 2010 18:43:06 +0000 (+0000) Subject: move ST_AsSVG from postgis to lwgeom dir. write cun it tests. related to #377 X-Git-Tag: 2.0.0alpha1~3210 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=287fbffddd04cab7e85145a420147a5f52b623a5;p=postgis move ST_AsSVG from postgis to lwgeom dir. write cun it tests. related to #377 git-svn-id: http://svn.osgeo.org/postgis/trunk@5289 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/liblwgeom/Makefile.in b/liblwgeom/Makefile.in index 0ec1d6291..bd4414118 100644 --- a/liblwgeom/Makefile.in +++ b/liblwgeom/Makefile.in @@ -56,7 +56,8 @@ SA_OBJS = \ lwtree.o \ lwout_gml.o \ lwout_kml.o \ - lwout_geojson.o + lwout_geojson.o \ + lwout_svg.o NM_OBJS = \ lwspheroid.o diff --git a/liblwgeom/cunit/Makefile.in b/liblwgeom/cunit/Makefile.in index ee18f3692..b9f6291ce 100644 --- a/liblwgeom/cunit/Makefile.in +++ b/liblwgeom/cunit/Makefile.in @@ -25,6 +25,7 @@ OBJS= \ cu_out_gml.o \ cu_out_kml.o \ cu_out_geojson.o \ + cu_out_svg.o \ cu_tester.o # If we couldn't find the cunit library then display a helpful message diff --git a/liblwgeom/cunit/cu_out_svg.c b/liblwgeom/cunit/cu_out_svg.c new file mode 100644 index 000000000..a1699fe84 --- /dev/null +++ b/liblwgeom/cunit/cu_out_svg.c @@ -0,0 +1,358 @@ +/********************************************************************** + * $Id$ + * + * PostGIS - Spatial Types for PostgreSQL + * http://postgis.refractions.net + * Copyright 2010 Olivier Courtin + * + * This is free software; you can redistribute and/or modify it under + * the terms of the GNU General Public Licence. See the COPYING file. + * + **********************************************************************/ + +#include "cu_out_svg.h" + +/* +** Called from test harness to register the tests in this file. +*/ +CU_pSuite register_out_svg_suite(void) +{ + CU_pSuite pSuite; + pSuite = CU_add_suite("SVG Out Suite", init_out_svg_suite, clean_out_svg_suite); + if (NULL == pSuite) + { + CU_cleanup_registry(); + return NULL; + } + + if ( + (NULL == CU_add_test(pSuite, "test_precision()", out_svg_test_precision)) || + (NULL == CU_add_test(pSuite, "test_dims()", out_svg_test_dims)) || + (NULL == CU_add_test(pSuite, "test_relative()", out_svg_test_relative)) || + (NULL == CU_add_test(pSuite, "test_geoms()", out_svg_test_geoms)) || + (NULL == CU_add_test(pSuite, "test_srid()", out_svg_test_srid)) + ) + { + CU_cleanup_registry(); + return NULL; + } + return pSuite; +} + +/* +** The suite initialization function. +** Create any re-used objects. +*/ +int init_out_svg_suite(void) +{ + return 0; +} + +/* +** The suite cleanup function. +** Frees any global objects. +*/ +int clean_out_svg_suite(void) +{ + return 0; +} + +static void do_svg_test(char * in, char * out, int precision, int relative) +{ + LWGEOM *g; + char * h; + + g = lwgeom_from_ewkt(in, PARSER_CHECK_NONE); + h = lwgeom_to_svg(lwgeom_serialize(g), precision, relative); + + if (strcmp(h, out)) + fprintf(stderr, "\nIn: %s\nOut: %s\nTheo: %s\n", in, h, out); + + CU_ASSERT_STRING_EQUAL(h, out); + + lwgeom_free(g); + lwfree(h); +} + + +static void do_svg_unsupported(char * in, char * out) +{ + LWGEOM *g; + char *h; + + g = lwgeom_from_ewkt(in, PARSER_CHECK_NONE); + h = lwgeom_to_svg(lwgeom_serialize(g), 0, 0); + + if (strcmp(cu_error_msg, out)) + fprintf(stderr, "\nIn: %s\nOut: %s\nTheo: %s\n", + in, cu_error_msg, out); + + CU_ASSERT_STRING_EQUAL(out, cu_error_msg); + cu_error_msg_reset(); + + lwfree(h); + lwgeom_free(g); +} + + +void out_svg_test_precision(void) +{ + /* 0 precision, i.e a round - with Circle point */ + do_svg_test( + "POINT(1.1111111111111 1.1111111111111)", + "cx=\"1\" cy=\"-1\"", + 0, 0); + + /* 0 precision, i.e a round - with Point */ + do_svg_test( + "POINT(1.1111111111111 1.1111111111111)", + "x=\"1\" y=\"-1\"", + 0, 1); + + /* 0 precision, i.e a round - with PointArray */ + do_svg_test( + "LINESTRING(1.1111111111111 1.1111111111111,1.1111111111111 1.1111111111111)", + "M 1 -1 L 1 -1", + 0, 0); + + /* 0 precision, i.e a round - with relative PointArray */ + do_svg_test( + "LINESTRING(1.1111111111111 1.1111111111111,1.1111111111111 1.1111111111111)", + "M 1 -1 l 0 0", + 0, 1); + + + /* 9 digits precision - with Circle point */ + do_svg_test( + "POINT(1.2345678901234 1.2345678901234)", + "cx=\"1.23456789\" cy=\"-1.23456789\"", + 9, 0); + + /* 9 digits precision - with Point */ + do_svg_test( + "POINT(1.2345678901234 1.2345678901234)", + "x=\"1.23456789\" y=\"-1.23456789\"", + 9, 1); + + /* 9 digits precision - with PointArray */ + do_svg_test( + "LINESTRING(1.2345678901234 1.2345678901234,2.3456789012345 2.3456789012345)", + "M 1.23456789 -1.23456789 L 2.345678901 -2.345678901", + 9, 0); + + /* 9 digits precision - with relative PointArray */ + do_svg_test( + "LINESTRING(1.2345678901234 1.2345678901234,2.3456789012345 2.3456789012345)", + "M 1.23456789 -1.23456789 l 1.111111011 -1.111111011", + 9, 1); + + + /* huge data - with Circle point */ + do_svg_test( + "POINT(1E300 -1E300)", + "cx=\"1e+300\" cy=\"1e+300\"", + 0, 0); + + /* huge data - with Point */ + do_svg_test( + "POINT(1E300 -1E300)", + "x=\"1e+300\" y=\"1e+300\"", + 0, 1); + + /* huge data - with PointArray */ + do_svg_test( + "LINESTRING(1E300 -1E300,1E301 -1E301)", + "M 1e+300 1e+300 L 1e+301 1e+301", + 0, 0); + + /* huge data - with relative PointArray */ + do_svg_test( + "LINESTRING(1E300 -1E300,1E301 -1E301)", + "M 1e+300 1e+300 l 9e+300 9e+300", + 0, 1); +} + + +void out_svg_test_dims(void) +{ + /* 4D - with Circle point */ + do_svg_test( + "POINT(0 1 2 3)", + "cx=\"0\" cy=\"-1\"", + 0, 0); + + /* 4D - with Point */ + do_svg_test( + "POINT(0 1 2 3)", + "x=\"0\" y=\"-1\"", + 0, 1); + + /* 4D - with PointArray */ + do_svg_test( + "LINESTRING(0 1 2 3,4 5 6 7)", + "M 0 -1 L 4 -5", + 0, 0); + + /* 4D - with relative PointArray */ + do_svg_test( + "LINESTRING(0 1 2 3,4 5 6 7)", + "M 0 -1 l 4 -4", + 0, 1); +} + + +void out_svg_test_geoms(void) +{ + /* Linestring */ + do_svg_test( + "LINESTRING(0 1,2 3,4 5)", + "M 0 -1 L 2 -3 4 -5", + 0, 0); + + /* Polygon */ + do_svg_test( + "POLYGON((0 1,2 3,4 5,0 1))", + "M 0 -1 L 2 -3 4 -5 Z", + 0, 0); + + /* Polygon - with internal ring */ + do_svg_test( + "POLYGON((0 1,2 3,4 5,0 1),(6 7,8 9,10 11,6 7))", + "M 0 -1 L 2 -3 4 -5 Z M 6 -7 L 8 -9 10 -11 Z", + 0, 0); + + /* MultiPoint */ + do_svg_test( + "MULTIPOINT(0 1,2 3)", + "cx=\"0\" cy=\"-1\",cx=\"2\" cy=\"-3\"", + 0, 0); + + /* MultiLine */ + do_svg_test( + "MULTILINESTRING((0 1,2 3,4 5),(6 7,8 9,10 11))", + "M 0 -1 L 2 -3 4 -5 M 6 -7 L 8 -9 10 -11", + 0, 0); + + /* MultiPolygon */ + do_svg_test( + "MULTIPOLYGON(((0 1,2 3,4 5,0 1)),((6 7,8 9,10 11,6 7)))", + "M 0 -1 L 2 -3 4 -5 Z M 6 -7 L 8 -9 10 -11 Z", + 0, 0); + + /* GeometryCollection */ + do_svg_test( + "GEOMETRYCOLLECTION(POINT(0 1),LINESTRING(2 3,4 5))", + "cx=\"0\" cy=\"-1\";M 2 -3 L 4 -5", + 0, 0); + + /* Empty GeometryCollection */ + do_svg_test( + "GEOMETRYCOLLECTION EMPTY", + "", + 0, 0); + +#if 0 + /* Nested GeometryCollection */ + do_svg_test( + "GEOMETRYCOLLECTION(POINT(0 1),GEOMETRYCOLLECTION(LINESTRING(2 3,4 5)))", + "cx=\"0\" cy=\"-1\";M 2 -3 L 4 -5", + 0, 0); +#endif + + /* CircularString */ + do_svg_unsupported( + "CIRCULARSTRING(-2 0,0 2,2 0,0 2,2 4)", + "lwgeom_to_svg: 'CircularString' geometry type not supported"); + + /* CompoundString */ + do_svg_unsupported( + "COMPOUNDCURVE(CIRCULARSTRING(0 0,1 1,1 0),(1 0,0 1))", + "lwgeom_to_svg: 'CompoundString' geometry type not supported"); + + /* CurvePolygon */ + do_svg_unsupported( + "CURVEPOLYGON(CIRCULARSTRING(-2 0,-1 -1,0 0,1 -1,2 0,0 2,-2 0),(-1 0,0 0.5,1 0,0 1,-1 0))", + "lwgeom_to_svg: 'CurvePolygon' geometry type not supported"); + + /* MultiCurve */ + do_svg_unsupported( + "MULTICURVE((5 5,3 5,3 3,0 3),CIRCULARSTRING(0 0,2 1,2 2))", + "lwgeom_to_svg: 'MultiCurve' geometry type not supported"); + + /* MultiSurface */ + do_svg_unsupported( + "MULTISURFACE(CURVEPOLYGON(CIRCULARSTRING(-2 0,-1 -1,0 0,1 -1,2 0,0 2,-2 0),(-1 0,0 0.5,1 0,0 1,-1 0)),((7 8,10 10,6 14,4 11,7 8)))", + "lwgeom_to_svg: 'MultiSurface' geometry type not supported"); +} + +void out_svg_test_relative(void) +{ + /* Linestring */ + do_svg_test( + "LINESTRING(0 1,2 3,4 5)", + "M 0 -1 l 2 -2 2 -2", + 0, 1); + + /* Polygon */ + do_svg_test( + "POLYGON((0 1,2 3,4 5,0 1))", + "M 0 -1 l 2 -2 2 -2 z", + 0, 1); + + /* Polygon - with internal ring */ + do_svg_test( + "POLYGON((0 1,2 3,4 5,0 1),(6 7,8 9,10 11,6 7))", + "M 0 -1 l 2 -2 2 -2 z M 6 -7 l 2 -2 2 -2 z", + 0, 1); + + /* MultiPoint */ + do_svg_test( + "MULTIPOINT(0 1,2 3)", + "x=\"0\" y=\"-1\",x=\"2\" y=\"-3\"", + 0, 1); + + /* MultiLine */ + do_svg_test( + "MULTILINESTRING((0 1,2 3,4 5),(6 7,8 9,10 11))", + "M 0 -1 l 2 -2 2 -2 M 6 -7 l 2 -2 2 -2", + 0, 1); + + /* MultiPolygon */ + do_svg_test( + "MULTIPOLYGON(((0 1,2 3,4 5,0 1)),((6 7,8 9,10 11,6 7)))", + "M 0 -1 l 2 -2 2 -2 z M 6 -7 l 2 -2 2 -2 z", + 0, 1); + + /* GeometryCollection */ + do_svg_test( + "GEOMETRYCOLLECTION(POINT(0 1),LINESTRING(2 3,4 5))", + "x=\"0\" y=\"-1\";M 2 -3 l 2 -2", + 0, 1); +} + +void out_svg_test_srid(void) +{ + /* SRID - with Circle point */ + do_svg_test( + "SRID=4326;POINT(0 1)", + "cx=\"0\" cy=\"-1\"", + 0, 0); + + /* SRID - with Point */ + do_svg_test( + "SRID=4326;POINT(0 1)", + "x=\"0\" y=\"-1\"", + 0, 1); + + /* SRID - with PointArray */ + do_svg_test( + "SRID=4326;LINESTRING(0 1,2 3)", + "M 0 -1 L 2 -3", + 0, 0); + + /* SRID - with relative PointArray */ + do_svg_test( + "SRID=4326;LINESTRING(0 1,2 3)", + "M 0 -1 l 2 -2", + 0, 1); +} diff --git a/liblwgeom/cunit/cu_out_svg.h b/liblwgeom/cunit/cu_out_svg.h new file mode 100644 index 000000000..21125ebee --- /dev/null +++ b/liblwgeom/cunit/cu_out_svg.h @@ -0,0 +1,29 @@ +/********************************************************************** + * $Id:$ + * + * PostGIS - Spatial Types for PostgreSQL + * http://postgis.refractions.net + * Copyright 2010 Olivier Courtin + * + * This is free software; you can redistribute and/or modify it under + * the terms of the GNU General Public Licence. See the COPYING file. + * + **********************************************************************/ + +#include +#include +#include +#include "CUnit/Basic.h" + +#include "libgeom.h" +#include "cu_tester.h" + +/**********************************************************************/ + + +/* Test functions */ +void out_svg_test_precision(void); +void out_svg_test_geoms(void); +void out_svg_test_dims(void); +void out_svg_test_srid(void); +void out_svg_test_relative(void); diff --git a/liblwgeom/cunit/cu_tester.c b/liblwgeom/cunit/cu_tester.c index 6605744ac..ae210d244 100644 --- a/liblwgeom/cunit/cu_tester.c +++ b/liblwgeom/cunit/cu_tester.c @@ -120,13 +120,20 @@ int main() return CU_get_error(); } - /* Add the kml suite to the registry */ + /* Add the geojson suite to the registry */ if (NULL == register_out_geojson_suite()) { CU_cleanup_registry(); return CU_get_error(); } + /* Add the svg suite to the registry */ + if (NULL == register_out_svg_suite()) + { + CU_cleanup_registry(); + return CU_get_error(); + } + /* Run all tests using the CUnit Basic interface */ CU_basic_set_mode(CU_BRM_VERBOSE); CU_basic_run_tests(); diff --git a/liblwgeom/cunit/cu_tester.h b/liblwgeom/cunit/cu_tester.h index b001eee8a..d8fcc7bd8 100644 --- a/liblwgeom/cunit/cu_tester.h +++ b/liblwgeom/cunit/cu_tester.h @@ -10,6 +10,7 @@ CU_pSuite register_homogenize_suite(void); CU_pSuite register_out_gml_suite(void); CU_pSuite register_out_kml_suite(void); CU_pSuite register_out_geojson_suite(void); +CU_pSuite register_out_svg_suite(void); int init_measures_suite(void); int init_geodetic_suite(void); @@ -19,6 +20,7 @@ int init_homogenize_suite(void); int init_out_gml_suite(void); int init_out_kml_suite(void); int init_out_geojson_suite(void); +int init_out_svg_suite(void); int clean_measures_suite(void); int clean_geodetic_suite(void); @@ -28,4 +30,5 @@ int clean_homogenize_suite(void); int clean_out_gml_suite(void); int clean_out_kml_suite(void); int clean_out_geojson_suite(void); +int clean_out_svg_suite(void); diff --git a/liblwgeom/liblwgeom.h b/liblwgeom/liblwgeom.h index faeccee93..a477ab544 100644 --- a/liblwgeom/liblwgeom.h +++ b/liblwgeom/liblwgeom.h @@ -1411,6 +1411,7 @@ extern char * lwgeom_to_gml2(uchar *geom, char *srs, int precision); extern char * lwgeom_to_gml3(uchar *geom, char *srs, int precision, int is_deegree); extern char * lwgeom_to_kml2(uchar *geom, int precision); extern char * lwgeom_to_geojson(uchar *geom, char *srs, int precision, int has_bbox); +extern char * lwgeom_to_svg(uchar *geom, int precision, int relative); extern uchar parse_hex(char *str); diff --git a/liblwgeom/lwout_svg.c b/liblwgeom/lwout_svg.c new file mode 100644 index 000000000..589860f40 --- /dev/null +++ b/liblwgeom/lwout_svg.c @@ -0,0 +1,679 @@ +/********************************************************************** + * $Id: lwgeom_svg.c 5211 2010-02-06 10:49:22Z colivier $ + * + * PostGIS - Spatial Types for PostgreSQL + * http://postgis.refractions.net + * Copyright 2001-2003 Refractions Research Inc. + * + * This is free software; you can redistribute and/or modify it under + * the terms of hte GNU General Public Licence. See the COPYING file. + * + **********************************************************************/ + +/** @file +* +* SVG output routines. +* Originally written by: Klaus Förster +* Refactored by: Olivier Courtin (Camptocamp) +* +* BNF SVG Path: +**********************************************************************/ + + +#include "liblwgeom.h" + +static char * assvg_point(LWPOINT *point, int relative, int precision); +static char * assvg_line(LWLINE *line, int relative, int precision); +static char * assvg_polygon(LWPOLY *poly, int relative, int precision); +static char * assvg_multipoint(LWGEOM_INSPECTED *insp, int relative, int precision); +static char * assvg_multiline(LWGEOM_INSPECTED *insp, int relative, int precision); +static char * assvg_multipolygon(LWGEOM_INSPECTED *insp, int relative, int precision); +static char * assvg_collection(LWGEOM_INSPECTED *insp, int relative, int precision); + +static size_t assvg_inspected_size(LWGEOM_INSPECTED *insp, int relative, int precision); +static size_t assvg_inspected_buf(LWGEOM_INSPECTED *insp, char *output, int relative, int precision); +static size_t pointArray_svg_size(POINTARRAY *pa, int precision); +static size_t pointArray_svg_rel(POINTARRAY *pa, char * output, int close_ring, int precision); +static size_t pointArray_svg_abs(POINTARRAY *pa, char * output, int close_ring, int precision); + + +/** + * Takes a GEOMETRY and returns a SVG representation + */ +char * +lwgeom_to_svg(uchar *geom, int precision, int relative) +{ + char *ret = NULL; + int type; + + type = lwgeom_getType(geom[0]); + switch (type) + { + case POINTTYPE: + ret = assvg_point(lwpoint_deserialize(geom), relative, precision); + break; + case LINETYPE: + ret = assvg_line(lwline_deserialize(geom), relative, precision); + break; + case POLYGONTYPE: + ret = assvg_polygon(lwpoly_deserialize(geom), relative, precision); + break; + case MULTIPOINTTYPE: + ret = assvg_multipoint(lwgeom_inspect(geom), relative, precision); + break; + case MULTILINETYPE: + ret = assvg_multiline(lwgeom_inspect(geom), relative, precision); + break; + case MULTIPOLYGONTYPE: + ret = assvg_multipolygon(lwgeom_inspect(geom), relative, precision); + break; + case COLLECTIONTYPE: + ret = assvg_collection(lwgeom_inspect(geom), relative, precision); + break; + + default: + lwerror("lwgeom_to_svg: '%s' geometry type not supported", + lwgeom_typename(type)); + } + + return ret; +} + + +/** + * Point Geometry + */ + +static size_t +assvg_point_size(LWPOINT *point, int circle, int precision) +{ + size_t size; + + size = (OUT_MAX_DIGS_DOUBLE + precision) * 2; + if (circle) size += sizeof("cx='' cy=''"); + else size += sizeof("x='' y=''"); + + return size; +} + +static size_t +assvg_point_buf(LWPOINT *point, char * output, int circle, int precision) +{ + char *ptr=output; + char x[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1]; + char y[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1]; + POINT2D pt; + + getPoint2d_p(point->point, 0, &pt); + + if (fabs(pt.x) < OUT_MAX_DOUBLE) + sprintf(x, "%.*f", precision, pt.x); + else + sprintf(x, "%g", pt.x); + trim_trailing_zeros(x); + + /* SVG Y axis is reversed, an no need to transform 0 into -0 */ + if (fabs(pt.y) < OUT_MAX_DOUBLE) + sprintf(y, "%.*f", precision, fabs(pt.y) ? pt.y * -1 : pt.y); + else + sprintf(y, "%g", fabs(pt.y) ? pt.y * -1 : pt.y); + trim_trailing_zeros(y); + + if (circle) ptr += sprintf(ptr, "x=\"%s\" y=\"%s\"", x, y); + else ptr += sprintf(ptr, "cx=\"%s\" cy=\"%s\"", x, y); + + return (ptr-output); +} + +static char * +assvg_point(LWPOINT *point, int circle, int precision) +{ + char *output; + int size; + + size = assvg_point_size(point, circle, precision); + output = lwalloc(size); + assvg_point_buf(point, output, circle, precision); + + return output; +} + + +/** + * Line Geometry + */ + +static size_t +assvg_line_size(LWLINE *line, int relative, int precision) +{ + size_t size; + + size = sizeof("M "); + size += pointArray_svg_size(line->points, precision); + + return size; +} + +static size_t +assvg_line_buf(LWLINE *line, char * output, int relative, int precision) +{ + char *ptr=output; + + /* Start path with SVG MoveTo */ + ptr += sprintf(ptr, "M "); + if (relative) + ptr += pointArray_svg_rel(line->points, ptr, 1, precision); + else + ptr += pointArray_svg_abs(line->points, ptr, 1, precision); + + return (ptr-output); +} + +static char * +assvg_line(LWLINE *line, int relative, int precision) +{ + char *output; + int size; + + size = assvg_line_size(line, relative, precision); + output = lwalloc(size); + assvg_line_buf(line, output, relative, precision); + + return output; +} + + +/** + * Polygon Geometry + */ + +static size_t +assvg_polygon_size(LWPOLY *poly, int relative, int precision) +{ + int i; + size_t size=0; + + for (i=0; inrings; i++) + size += pointArray_svg_size(poly->rings[i], precision) + sizeof(" "); + size += sizeof("M Z") * poly->nrings; + + return size; +} + +static size_t +assvg_polygon_buf(LWPOLY *poly, char * output, int relative, int precision) +{ + int i; + char *ptr=output; + + for (i=0; inrings; i++) + { + if (i) ptr += sprintf(ptr, " "); /* Space beetween each ring */ + ptr += sprintf(ptr, "M "); /* Start path with SVG MoveTo */ + + if (relative) + { + ptr += pointArray_svg_rel(poly->rings[i], ptr, 0, precision); + ptr += sprintf(ptr, " z"); /* SVG closepath */ + } + else + { + ptr += pointArray_svg_abs(poly->rings[i], ptr, 0, precision); + ptr += sprintf(ptr, " Z"); /* SVG closepath */ + } + } + + return (ptr-output); +} + +static char * +assvg_polygon(LWPOLY *poly, int relative, int precision) +{ + char *output; + int size; + + size = assvg_polygon_size(poly, relative, precision); + output = lwalloc(size); + assvg_polygon_buf(poly, output, relative, precision); + + return output; +} + + +/** + * Multipoint Geometry + */ + +static size_t +assvg_multipoint_size(LWGEOM_INSPECTED *insp, int relative, int precision) +{ + LWPOINT *point; + size_t size=0; + int i; + + for (i=0 ; ingeometries ; i++) + { + point = lwgeom_getpoint_inspected(insp, i); + size += assvg_point_size(point, relative, precision); + if (point) lwpoint_release(point); + } + size += sizeof(",") * --i; /* Arbitrary comma separator */ + + return size; +} + +static size_t +assvg_multipoint_buf(LWGEOM_INSPECTED *insp, char *output, int relative, int precision) +{ + LWPOINT *point; + int i; + char *ptr=output; + + for (i=0 ; ingeometries ; i++) + { + if (i) ptr += sprintf(ptr, ","); /* Arbitrary comma separator */ + point = lwgeom_getpoint_inspected(insp, i); + ptr += assvg_point_buf(point, ptr, relative, precision); + if (point) lwpoint_release(point); + } + + return (ptr-output); +} + +static char * +assvg_multipoint(LWGEOM_INSPECTED *point, int relative, int precision) +{ + char *output; + int size; + + size = assvg_multipoint_size(point, relative, precision); + output = lwalloc(size); + assvg_multipoint_buf(point, output, relative, precision); + + return output; +} + + +/** + * Multiline Geometry + */ + +static size_t +assvg_multiline_size(LWGEOM_INSPECTED *insp, int relative, int precision) +{ + LWLINE *line; + size_t size=0; + int i; + + for (i=0 ; ingeometries ; i++) + { + line = lwgeom_getline_inspected(insp, i); + size += assvg_line_size(line, relative, precision); + if (line) lwline_release(line); + } + size += sizeof(" ") * --i; /* SVG whitespace Separator */ + + return size; +} + +static size_t +assvg_multiline_buf(LWGEOM_INSPECTED *insp, char *output, int relative, int precision) +{ + LWLINE *line; + int i; + char *ptr=output; + + for (i=0 ; ingeometries ; i++) + { + if (i) ptr += sprintf(ptr, " "); /* SVG whitespace Separator */ + line = lwgeom_getline_inspected(insp, i); + ptr += assvg_line_buf(line, ptr, relative, precision); + if (line) lwline_release(line); + } + + return (ptr-output); +} + +static char * +assvg_multiline(LWGEOM_INSPECTED *line, int relative, int precision) +{ + char *output; + int size; + + size = assvg_multiline_size(line, relative, precision); + output = lwalloc(size); + assvg_multiline_buf(line, output, relative, precision); + + return output; +} + + +/* + * Multipolygon Geometry + */ + +static size_t +assvg_multipolygon_size(LWGEOM_INSPECTED *insp, int relative, int precision) +{ + LWPOLY *poly; + size_t size=0; + int i; + + for (i=0 ; ingeometries ; i++) + { + poly = lwgeom_getpoly_inspected(insp, i); + size += assvg_polygon_size(poly, relative, precision); + if (poly) lwpoly_release(poly); + } + size += sizeof(" ") * --i; /* SVG whitespace Separator */ + + return size; +} + +static size_t +assvg_multipolygon_buf(LWGEOM_INSPECTED *insp, char *output, int relative, int precision) +{ + LWPOLY *poly; + int i; + char *ptr=output; + + for (i=0 ; ingeometries ; i++) + { + if (i) ptr += sprintf(ptr, " "); /* SVG whitespace Separator */ + poly = lwgeom_getpoly_inspected(insp, i); + ptr += assvg_polygon_buf(poly, ptr, relative, precision); + if (poly) lwpoly_release(poly); + } + + return (ptr-output); +} + +static char * +assvg_multipolygon(LWGEOM_INSPECTED *poly, int relative, int precision) +{ + char *output; + int size; + + size = assvg_multipolygon_size(poly, relative, precision); + output = lwalloc(size); + assvg_multipolygon_buf(poly, output, relative, precision); + + return output; +} + + +/** +* Collection Geometry +*/ + +static size_t +assvg_collection_size(LWGEOM_INSPECTED *insp, int relative, int precision) +{ + int i = 0; + size_t size=0; + LWGEOM_INSPECTED *subinsp; + uchar *subgeom; + + for (i=0; ingeometries; i++) + { + subgeom = lwgeom_getsubgeometry_inspected(insp, i); + subinsp = lwgeom_inspect(subgeom); + size += assvg_inspected_size(subinsp, relative, precision); + lwinspected_release(subinsp); + } + + if ( i ) /* We have some geometries, so add space for delimiters. */ + size += sizeof(";") * --i; + + if (size == 0) size++; /* EMPTY GEOMETRYCOLLECTION */ + + return size; +} + +static size_t +assvg_collection_buf(LWGEOM_INSPECTED *insp, char *output, int relative, int precision) +{ + int i; + char *ptr=output; + LWGEOM_INSPECTED *subinsp; + uchar *subgeom; + + /* EMPTY GEOMETRYCOLLECTION */ + if (insp->ngeometries == 0) *ptr = '\0'; + + for (i=0; ingeometries; i++) + { + if (i) ptr += sprintf(ptr, ";"); + subgeom = lwgeom_getsubgeometry_inspected(insp, i); + subinsp = lwgeom_inspect(subgeom); + ptr += assvg_inspected_buf(subinsp, ptr, relative, precision); + lwinspected_release(subinsp); + } + + return (ptr - output); +} + +static char * +assvg_collection(LWGEOM_INSPECTED *insp, int relative, int precision) +{ + char *output; + int size; + + size = assvg_collection_size(insp, relative, precision); + output = lwalloc(size); + assvg_collection_buf(insp, output, relative, precision); + + return output; +} + + + +static size_t +assvg_inspected_buf(LWGEOM_INSPECTED *insp, char *output, int relative, int precision) +{ + LWPOINT *point; + LWLINE *line; + LWPOLY *poly; + int type = lwgeom_getType(insp->serialized_form[0]); + char *ptr=output; + + switch (type) + { + case POINTTYPE: + point=lwgeom_getpoint_inspected(insp, 0); + ptr += assvg_point_buf(point, ptr, relative, precision); + lwpoint_release(point); + break; + + case LINETYPE: + line=lwgeom_getline_inspected(insp, 0); + ptr += assvg_line_buf(line, ptr, relative, precision); + lwline_release(line); + break; + + case POLYGONTYPE: + poly=lwgeom_getpoly_inspected(insp, 0); + ptr += assvg_polygon_buf(poly, ptr, relative, precision); + lwpoly_release(poly); + break; + + case MULTIPOINTTYPE: + ptr += assvg_multipoint_buf(insp, ptr, relative, precision); + break; + + case MULTILINETYPE: + ptr += assvg_multiline_buf(insp, ptr, relative, precision); + break; + + case MULTIPOLYGONTYPE: + ptr += assvg_multipolygon_buf(insp, ptr, relative, precision); + break; + + default: + lwerror("ST_AsSVG: '%s' geometry type not supported.", + lwgeom_typename(type)); + } + + return (ptr-output); +} + + +static size_t +assvg_inspected_size(LWGEOM_INSPECTED *insp, int relative, int precision) +{ + int type = lwgeom_getType(insp->serialized_form[0]); + size_t size = 0; + LWPOINT *point; + LWLINE *line; + LWPOLY *poly; + + switch (type) + { + case POINTTYPE: + point=lwgeom_getpoint_inspected(insp, 0); + size = assvg_point_size(point, relative, precision); + lwpoint_release(point); + break; + + case LINETYPE: + line=lwgeom_getline_inspected(insp, 0); + size = assvg_line_size(line, relative, precision); + lwline_release(line); + break; + + case POLYGONTYPE: + poly=lwgeom_getpoly_inspected(insp, 0); + size = assvg_polygon_size(poly, relative, precision); + lwpoly_release(poly); + + case MULTIPOINTTYPE: + size = assvg_multipoint_size(insp, relative, precision); + break; + + case MULTILINETYPE: + size = assvg_multiline_size(insp, relative, precision); + break; + + case MULTIPOLYGONTYPE: + size = assvg_multipolygon_size(insp, relative, precision); + break; + + default: + lwerror("ST_AsSVG: geometry not supported."); + } + + return size; +} + + +static size_t +pointArray_svg_rel(POINTARRAY *pa, char *output, int close_ring, int precision) +{ + int i, end; + char *ptr; + char x[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1]; + char y[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1]; + POINT2D pt, lpt; + + ptr = output; + + if (close_ring) end = pa->npoints; + else end = pa->npoints - 1; + + /* Starting point */ + getPoint2d_p(pa, 0, &pt); + + if (fabs(pt.x) < OUT_MAX_DOUBLE) + sprintf(x, "%.*f", precision, pt.x); + else + sprintf(x, "%g", pt.x); + trim_trailing_zeros(x); + + if (fabs(pt.y) < OUT_MAX_DOUBLE) + sprintf(y, "%.*f", precision, fabs(pt.y) ? pt.y * -1 : pt.y); + else + sprintf(y, "%g", fabs(pt.y) ? pt.y * -1 : pt.y); + trim_trailing_zeros(y); + + ptr += sprintf(ptr,"%s %s l", x, y); + + /* All the following ones */ + for (i=1 ; i < end ; i++) + { + lpt = pt; + + getPoint2d_p(pa, i, &pt); + if (fabs(pt.x -lpt.x) < OUT_MAX_DOUBLE) + sprintf(x, "%.*f", precision, pt.x -lpt.x); + else + sprintf(x, "%g", pt.x -lpt.x); + trim_trailing_zeros(x); + + /* SVG Y axis is reversed, an no need to transform 0 into -0 */ + if (fabs(pt.y -lpt.y) < OUT_MAX_DOUBLE) + sprintf(y, "%.*f", precision, + fabs(pt.y -lpt.y) ? (pt.y - lpt.y) * -1: (pt.y - lpt.y)); + else + sprintf(y, "%g", + fabs(pt.y -lpt.y) ? (pt.y - lpt.y) * -1: (pt.y - lpt.y)); + trim_trailing_zeros(y); + + ptr += sprintf(ptr," %s %s", x, y); + } + + return (ptr-output); +} + + +/** + * Returns maximum size of rendered pointarray in bytes. + */ +static size_t +pointArray_svg_abs(POINTARRAY *pa, char *output, int close_ring, int precision) +{ + int i, end; + char *ptr; + char x[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1]; + char y[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1]; + POINT2D pt; + + ptr = output; + + if (close_ring) end = pa->npoints; + else end = pa->npoints - 1; + + for (i=0 ; i < end ; i++) + { + getPoint2d_p(pa, i, &pt); + + if (fabs(pt.x) < OUT_MAX_DOUBLE) + sprintf(x, "%.*f", precision, pt.x); + else + sprintf(x, "%g", pt.x); + trim_trailing_zeros(x); + + /* SVG Y axis is reversed, an no need to transform 0 into -0 */ + if (fabs(pt.y) < OUT_MAX_DOUBLE) + sprintf(y, "%.*f", precision, fabs(pt.y) ? pt.y * -1:pt.y); + else + sprintf(y, "%g", fabs(pt.y) ? pt.y * -1:pt.y); + trim_trailing_zeros(y); + + if (i == 1) ptr += sprintf(ptr, " L "); + else if (i) ptr += sprintf(ptr, " "); + ptr += sprintf(ptr,"%s %s", x, y); + } + + return (ptr-output); +} + + +/** + * Returns maximum size of rendered pointarray in bytes. + */ +static size_t +pointArray_svg_size(POINTARRAY *pa, int precision) +{ + return (OUT_MAX_DIGS_DOUBLE + precision + sizeof(" ")) + * 2 * pa->npoints + sizeof(" L "); +} diff --git a/postgis/geography_inout.c b/postgis/geography_inout.c index 647a7a2f8..faa1a2fdd 100644 --- a/postgis/geography_inout.c +++ b/postgis/geography_inout.c @@ -633,8 +633,8 @@ Datum geography_as_svg(PG_FUNCTION_ARGS) char *svg; text *result; int len; - bool relative = false; - int precision=MAX_DOUBLE_PRECISION; + int relative = 0; + int precision=OUT_MAX_DOUBLE_PRECISION; if ( PG_ARGISNULL(0) ) PG_RETURN_NULL(); @@ -645,17 +645,17 @@ Datum geography_as_svg(PG_FUNCTION_ARGS) /* check for relative path notation */ if ( PG_NARGS() > 1 && ! PG_ARGISNULL(1) ) - relative = PG_GETARG_INT32(1) ? true:false; + relative = PG_GETARG_INT32(1) ? 0:1; if ( PG_NARGS() > 2 && ! PG_ARGISNULL(2) ) { precision = PG_GETARG_INT32(2); - if ( precision > MAX_DOUBLE_PRECISION ) - precision = MAX_DOUBLE_PRECISION; + if ( precision > OUT_MAX_DOUBLE_PRECISION ) + precision = OUT_MAX_DOUBLE_PRECISION; else if ( precision < 0 ) precision = 0; } - svg = geometry_to_svg(lwgeom_serialize(lwgeom), relative, precision); + svg = lwgeom_to_svg(lwgeom_serialize(lwgeom), precision, relative); PG_FREE_IF_COPY(lwgeom, 0); len = strlen(svg) + VARHDRSZ; @@ -663,7 +663,7 @@ Datum geography_as_svg(PG_FUNCTION_ARGS) SET_VARSIZE(result, len); memcpy(VARDATA(result), svg, len-VARHDRSZ); - pfree(svg); + lwfree(svg); PG_RETURN_POINTER(result); } diff --git a/postgis/lwgeom_export.h b/postgis/lwgeom_export.h index a2ca7584a..c21a995be 100644 --- a/postgis/lwgeom_export.h +++ b/postgis/lwgeom_export.h @@ -13,13 +13,4 @@ * Commons define and prototype function for all export functions */ -#define MAX_DOUBLE 1E15 -#define SHOW_DIGS_DOUBLE 20 -#define MAX_DOUBLE_PRECISION 15 -#define MAX_DIGS_DOUBLE (SHOW_DIGS_DOUBLE + 2) /* +2 mean add dot and sign */ - char * getSRSbySRID(int SRID, bool short_crs); - -char *geometry_to_geojson(uchar *srl, char *srs, bool has_bbox, int precision); -char *geometry_to_kml2(uchar *srl, int precision); -char *geometry_to_svg(uchar *srl, bool relative, int precision); diff --git a/postgis/lwgeom_svg.c b/postgis/lwgeom_svg.c index 19844e151..f10c607e5 100644 --- a/postgis/lwgeom_svg.c +++ b/postgis/lwgeom_svg.c @@ -21,25 +21,11 @@ #include "postgres.h" -#include "lwgeom_pg.h" #include "liblwgeom.h" +#include "lwgeom_pg.h" #include "lwgeom_export.h" Datum assvg_geometry(PG_FUNCTION_ARGS); -static char * assvg_point(LWPOINT *point, bool relative, int precision); -static char * assvg_line(LWLINE *line, bool relative, int precision); -static char * assvg_polygon(LWPOLY *poly, bool relative, int precision); -static char * assvg_multipoint(LWGEOM_INSPECTED *insp, bool relative, int precision); -static char * assvg_multiline(LWGEOM_INSPECTED *insp, bool relative, int precision); -static char * assvg_multipolygon(LWGEOM_INSPECTED *insp, bool relative, int precision); -static char * assvg_collection(LWGEOM_INSPECTED *insp, bool relative, int precision); - -static size_t assvg_inspected_size(LWGEOM_INSPECTED *insp, bool relative, int precision); -static size_t assvg_inspected_buf(LWGEOM_INSPECTED *insp, char *output, bool relative, int precision); -static size_t pointArray_svg_size(POINTARRAY *pa, int precision); -static size_t pointArray_svg_rel(POINTARRAY *pa, char * output, bool close_ring, int precision); -static size_t pointArray_svg_abs(POINTARRAY *pa, char * output, bool close_ring, int precision); - /** * SVG features @@ -51,8 +37,8 @@ Datum assvg_geometry(PG_FUNCTION_ARGS) char *svg; text *result; int len; - bool relative = false; - int precision=MAX_DOUBLE_PRECISION; + int relative = 0; + int precision=OUT_MAX_DOUBLE_PRECISION; if ( PG_ARGISNULL(0) ) PG_RETURN_NULL(); @@ -60,17 +46,17 @@ Datum assvg_geometry(PG_FUNCTION_ARGS) /* check for relative path notation */ if ( PG_NARGS() > 1 && ! PG_ARGISNULL(1) ) - relative = PG_GETARG_INT32(1) ? true:false; + relative = PG_GETARG_INT32(1) ? 1:0; if ( PG_NARGS() > 2 && ! PG_ARGISNULL(2) ) { precision = PG_GETARG_INT32(2); - if ( precision > MAX_DOUBLE_PRECISION ) - precision = MAX_DOUBLE_PRECISION; + if ( precision > OUT_MAX_DOUBLE_PRECISION ) + precision = OUT_MAX_DOUBLE_PRECISION; else if ( precision < 0 ) precision = 0; } - svg = geometry_to_svg(SERIALIZED_FORM(geom), relative, precision); + svg = lwgeom_to_svg(SERIALIZED_FORM(geom), precision, relative); PG_FREE_IF_COPY(geom, 0); len = strlen(svg) + VARHDRSZ; @@ -78,649 +64,7 @@ Datum assvg_geometry(PG_FUNCTION_ARGS) SET_VARSIZE(result, len); memcpy(VARDATA(result), svg, len-VARHDRSZ); - pfree(svg); + lwfree(svg); PG_RETURN_POINTER(result); } - - -/** - * Takes a GEOMETRY and returns a SVG representation - */ -char * -geometry_to_svg(uchar *geom, bool relative, int precision) -{ - char *ret = NULL; - int type; - - type = lwgeom_getType(geom[0]); - switch (type) - { - case POINTTYPE: - ret = assvg_point(lwpoint_deserialize(geom), relative, precision); - break; - case LINETYPE: - ret = assvg_line(lwline_deserialize(geom), relative, precision); - break; - case POLYGONTYPE: - ret = assvg_polygon(lwpoly_deserialize(geom), relative, precision); - break; - case MULTIPOINTTYPE: - ret = assvg_multipoint(lwgeom_inspect(geom), relative, precision); - break; - case MULTILINETYPE: - ret = assvg_multiline(lwgeom_inspect(geom), relative, precision); - break; - case MULTIPOLYGONTYPE: - ret = assvg_multipolygon(lwgeom_inspect(geom), relative, precision); - break; - case COLLECTIONTYPE: - ret = assvg_collection(lwgeom_inspect(geom), relative, precision); - break; - - default: - lwerror("ST_AsSVG: '%s' geometry type not supported.", - lwgeom_typename(type)); - } - - return ret; -} - - -/** - * Point Geometry - */ - -static size_t -assvg_point_size(LWPOINT *point, bool circle, int precision) -{ - size_t size; - - size = (MAX_DIGS_DOUBLE + precision) * 2; - if (circle) size += sizeof("cx='' cy=''"); - else size += sizeof("x='' y=''"); - - return size; -} - -static size_t -assvg_point_buf(LWPOINT *point, char * output, bool circle, int precision) -{ - char *ptr=output; - char x[MAX_DIGS_DOUBLE+MAX_DOUBLE_PRECISION+1]; - char y[MAX_DIGS_DOUBLE+MAX_DOUBLE_PRECISION+1]; - POINT2D pt; - - getPoint2d_p(point->point, 0, &pt); - - if (fabs(pt.x) < MAX_DOUBLE) - sprintf(x, "%.*f", precision, pt.x); - else - sprintf(x, "%g", pt.x); - trim_trailing_zeros(x); - - /* SVG Y axis is reversed, an no need to transform 0 into -0 */ - if (fabs(pt.y) < MAX_DOUBLE) - sprintf(y, "%.*f", precision, fabs(pt.y) ? pt.y * -1 : pt.y); - else - sprintf(y, "%g", fabs(pt.y) ? pt.y * -1 : pt.y); - trim_trailing_zeros(y); - - if (circle) ptr += sprintf(ptr, "x=\"%s\" y=\"%s\"", x, y); - else ptr += sprintf(ptr, "cx=\"%s\" cy=\"%s\"", x, y); - - return (ptr-output); -} - -static char * -assvg_point(LWPOINT *point, bool circle, int precision) -{ - char *output; - int size; - - size = assvg_point_size(point, circle, precision); - output = palloc(size); - assvg_point_buf(point, output, circle, precision); - - return output; -} - - -/** - * Line Geometry - */ - -static size_t -assvg_line_size(LWLINE *line, bool relative, int precision) -{ - size_t size; - - size = sizeof("M "); - size += pointArray_svg_size(line->points, precision); - - return size; -} - -static size_t -assvg_line_buf(LWLINE *line, char * output, bool relative, int precision) -{ - char *ptr=output; - - /* Start path with SVG MoveTo */ - ptr += sprintf(ptr, "M "); - if (relative) - ptr += pointArray_svg_rel(line->points, ptr, true, precision); - else - ptr += pointArray_svg_abs(line->points, ptr, true, precision); - - return (ptr-output); -} - -static char * -assvg_line(LWLINE *line, bool relative, int precision) -{ - char *output; - int size; - - size = assvg_line_size(line, relative, precision); - output = palloc(size); - assvg_line_buf(line, output, relative, precision); - - return output; -} - - -/** - * Polygon Geometry - */ - -static size_t -assvg_polygon_size(LWPOLY *poly, bool relative, int precision) -{ - int i; - size_t size=0; - - for (i=0; inrings; i++) - size += pointArray_svg_size(poly->rings[i], precision) + sizeof(" "); - size += sizeof("M Z") * poly->nrings; - - return size; -} - -static size_t -assvg_polygon_buf(LWPOLY *poly, char * output, bool relative, int precision) -{ - int i; - char *ptr=output; - - for (i=0; inrings; i++) - { - if (i) ptr += sprintf(ptr, " "); /* Space beetween each ring */ - ptr += sprintf(ptr, "M "); /* Start path with SVG MoveTo */ - - if (relative) - { - ptr += pointArray_svg_rel(poly->rings[i], ptr, false, precision); - ptr += sprintf(ptr, " z"); /* SVG closepath */ - } - else - { - ptr += pointArray_svg_abs(poly->rings[i], ptr, false, precision); - ptr += sprintf(ptr, " Z"); /* SVG closepath */ - } - } - - return (ptr-output); -} - -static char * -assvg_polygon(LWPOLY *poly, bool relative, int precision) -{ - char *output; - int size; - - size = assvg_polygon_size(poly, relative, precision); - output = palloc(size); - assvg_polygon_buf(poly, output, relative, precision); - - return output; -} - - -/** - * Multipoint Geometry - */ - -static size_t -assvg_multipoint_size(LWGEOM_INSPECTED *insp, bool relative, int precision) -{ - LWPOINT *point; - size_t size=0; - int i; - - for (i=0 ; ingeometries ; i++) - { - point = lwgeom_getpoint_inspected(insp, i); - size += assvg_point_size(point, relative, precision); - if (point) lwpoint_release(point); - } - size += sizeof(",") * --i; /* Arbitrary comma separator */ - - return size; -} - -static size_t -assvg_multipoint_buf(LWGEOM_INSPECTED *insp, char *output, bool relative, int precision) -{ - LWPOINT *point; - int i; - char *ptr=output; - - for (i=0 ; ingeometries ; i++) - { - if (i) ptr += sprintf(ptr, ","); /* Arbitrary comma separator */ - point = lwgeom_getpoint_inspected(insp, i); - ptr += assvg_point_buf(point, ptr, relative, precision); - if (point) lwpoint_release(point); - } - - return (ptr-output); -} - -static char * -assvg_multipoint(LWGEOM_INSPECTED *point, bool relative, int precision) -{ - char *output; - int size; - - size = assvg_multipoint_size(point, relative, precision); - output = palloc(size); - assvg_multipoint_buf(point, output, relative, precision); - - return output; -} - - -/** - * Multiline Geometry - */ - -static size_t -assvg_multiline_size(LWGEOM_INSPECTED *insp, bool relative, int precision) -{ - LWLINE *line; - size_t size=0; - int i; - - for (i=0 ; ingeometries ; i++) - { - line = lwgeom_getline_inspected(insp, i); - size += assvg_line_size(line, relative, precision); - if (line) lwline_release(line); - } - size += sizeof(" ") * --i; /* SVG whitespace Separator */ - - return size; -} - -static size_t -assvg_multiline_buf(LWGEOM_INSPECTED *insp, char *output, bool relative, int precision) -{ - LWLINE *line; - int i; - char *ptr=output; - - for (i=0 ; ingeometries ; i++) - { - if (i) ptr += sprintf(ptr, " "); /* SVG whitespace Separator */ - line = lwgeom_getline_inspected(insp, i); - ptr += assvg_line_buf(line, ptr, relative, precision); - if (line) lwline_release(line); - } - - return (ptr-output); -} - -static char * -assvg_multiline(LWGEOM_INSPECTED *line, bool relative, int precision) -{ - char *output; - int size; - - size = assvg_multiline_size(line, relative, precision); - output = palloc(size); - assvg_multiline_buf(line, output, relative, precision); - - return output; -} - - -/* - * Multipolygon Geometry - */ - -static size_t -assvg_multipolygon_size(LWGEOM_INSPECTED *insp, bool relative, int precision) -{ - LWPOLY *poly; - size_t size=0; - int i; - - for (i=0 ; ingeometries ; i++) - { - poly = lwgeom_getpoly_inspected(insp, i); - size += assvg_polygon_size(poly, relative, precision); - if (poly) lwpoly_release(poly); - } - size += sizeof(" ") * --i; /* SVG whitespace Separator */ - - return size; -} - -static size_t -assvg_multipolygon_buf(LWGEOM_INSPECTED *insp, char *output, bool relative, int precision) -{ - LWPOLY *poly; - int i; - char *ptr=output; - - for (i=0 ; ingeometries ; i++) - { - if (i) ptr += sprintf(ptr, " "); /* SVG whitespace Separator */ - poly = lwgeom_getpoly_inspected(insp, i); - ptr += assvg_polygon_buf(poly, ptr, relative, precision); - if (poly) lwpoly_release(poly); - } - - return (ptr-output); -} - -static char * -assvg_multipolygon(LWGEOM_INSPECTED *poly, bool relative, int precision) -{ - char *output; - int size; - - size = assvg_multipolygon_size(poly, relative, precision); - output = palloc(size); - assvg_multipolygon_buf(poly, output, relative, precision); - - return output; -} - - -/** -* Collection Geometry -*/ - -static size_t -assvg_collection_size(LWGEOM_INSPECTED *insp, bool relative, int precision) -{ - int i = 0; - size_t size=0; - LWGEOM_INSPECTED *subinsp; - uchar *subgeom; - - for (i=0; ingeometries; i++) - { - subgeom = lwgeom_getsubgeometry_inspected(insp, i); - subinsp = lwgeom_inspect(subgeom); - size += assvg_inspected_size(subinsp, relative, precision); - lwinspected_release(subinsp); - } - - if ( i ) /* We have some geometries, so add space for delimiters. */ - size += sizeof(";") * --i; - - if (size == 0) size++; /* EMPTY GEOMETRYCOLLECTION */ - - return size; -} - -static size_t -assvg_collection_buf(LWGEOM_INSPECTED *insp, char *output, bool relative, int precision) -{ - int i; - char *ptr=output; - LWGEOM_INSPECTED *subinsp; - uchar *subgeom; - - /* EMPTY GEOMETRYCOLLECTION */ - if (insp->ngeometries == 0) *ptr = '\0'; - - for (i=0; ingeometries; i++) - { - if (i) ptr += sprintf(ptr, ";"); - subgeom = lwgeom_getsubgeometry_inspected(insp, i); - subinsp = lwgeom_inspect(subgeom); - ptr += assvg_inspected_buf(subinsp, ptr, relative, precision); - lwinspected_release(subinsp); - } - - return (ptr - output); -} - -static char * -assvg_collection(LWGEOM_INSPECTED *insp, bool relative, int precision) -{ - char *output; - int size; - - size = assvg_collection_size(insp, relative, precision); - output = palloc(size); - assvg_collection_buf(insp, output, relative, precision); - - return output; -} - - - -static size_t -assvg_inspected_buf(LWGEOM_INSPECTED *insp, char *output, bool relative, int precision) -{ - LWPOINT *point; - LWLINE *line; - LWPOLY *poly; - int type = lwgeom_getType(insp->serialized_form[0]); - char *ptr=output; - - switch (type) - { - case POINTTYPE: - point=lwgeom_getpoint_inspected(insp, 0); - ptr += assvg_point_buf(point, ptr, relative, precision); - lwpoint_release(point); - break; - - case LINETYPE: - line=lwgeom_getline_inspected(insp, 0); - ptr += assvg_line_buf(line, ptr, relative, precision); - lwline_release(line); - break; - - case POLYGONTYPE: - poly=lwgeom_getpoly_inspected(insp, 0); - ptr += assvg_polygon_buf(poly, ptr, relative, precision); - lwpoly_release(poly); - break; - - case MULTIPOINTTYPE: - ptr += assvg_multipoint_buf(insp, ptr, relative, precision); - break; - - case MULTILINETYPE: - ptr += assvg_multiline_buf(insp, ptr, relative, precision); - break; - - case MULTIPOLYGONTYPE: - ptr += assvg_multipolygon_buf(insp, ptr, relative, precision); - break; - - default: - lwerror("ST_AsSVG: '%s' geometry type not supported.", - lwgeom_typename(type)); - } - - return (ptr-output); -} - - -static size_t -assvg_inspected_size(LWGEOM_INSPECTED *insp, bool relative, int precision) -{ - int type = lwgeom_getType(insp->serialized_form[0]); - size_t size = 0; - LWPOINT *point; - LWLINE *line; - LWPOLY *poly; - - switch (type) - { - case POINTTYPE: - point=lwgeom_getpoint_inspected(insp, 0); - size = assvg_point_size(point, relative, precision); - lwpoint_release(point); - break; - - case LINETYPE: - line=lwgeom_getline_inspected(insp, 0); - size = assvg_line_size(line, relative, precision); - lwline_release(line); - break; - - case POLYGONTYPE: - poly=lwgeom_getpoly_inspected(insp, 0); - size = assvg_polygon_size(poly, relative, precision); - lwpoly_release(poly); - - case MULTIPOINTTYPE: - size = assvg_multipoint_size(insp, relative, precision); - break; - - case MULTILINETYPE: - size = assvg_multiline_size(insp, relative, precision); - break; - - case MULTIPOLYGONTYPE: - size = assvg_multipolygon_size(insp, relative, precision); - break; - - default: - lwerror("ST_AsSVG: geometry not supported."); - } - - return size; -} - - -static size_t -pointArray_svg_rel(POINTARRAY *pa, char *output, bool close_ring, int precision) -{ - int i, end; - char *ptr; - char x[MAX_DIGS_DOUBLE+MAX_DOUBLE_PRECISION+1]; - char y[MAX_DIGS_DOUBLE+MAX_DOUBLE_PRECISION+1]; - POINT2D pt, lpt; - - ptr = output; - - if (close_ring) end = pa->npoints; - else end = pa->npoints - 1; - - /* Starting point */ - getPoint2d_p(pa, 0, &pt); - - if (fabs(pt.x) < MAX_DOUBLE) - sprintf(x, "%.*f", precision, pt.x); - else - sprintf(x, "%g", pt.x); - trim_trailing_zeros(x); - - if (fabs(pt.y) < MAX_DOUBLE) - sprintf(y, "%.*f", precision, fabs(pt.y) ? pt.y * -1 : pt.y); - else - sprintf(y, "%g", fabs(pt.y) ? pt.y * -1 : pt.y); - trim_trailing_zeros(y); - - ptr += sprintf(ptr,"%s %s l", x, y); - - /* All the following ones */ - for (i=1 ; i < end ; i++) - { - lpt = pt; - - getPoint2d_p(pa, i, &pt); - if (fabs(pt.x -lpt.x) < MAX_DOUBLE) - sprintf(x, "%.*f", precision, pt.x -lpt.x); - else - sprintf(x, "%g", pt.x -lpt.x); - trim_trailing_zeros(x); - - /* SVG Y axis is reversed, an no need to transform 0 into -0 */ - if (fabs(pt.y -lpt.y) < MAX_DOUBLE) - sprintf(y, "%.*f", precision, - fabs(pt.y -lpt.y) ? (pt.y - lpt.y) * -1: (pt.y - lpt.y)); - else - sprintf(y, "%g", - fabs(pt.y -lpt.y) ? (pt.y - lpt.y) * -1: (pt.y - lpt.y)); - trim_trailing_zeros(y); - - ptr += sprintf(ptr," %s %s", x, y); - } - - return (ptr-output); -} - - -/** - * Returns maximum size of rendered pointarray in bytes. - */ -static size_t -pointArray_svg_abs(POINTARRAY *pa, char *output, bool close_ring, int precision) -{ - int i, end; - char *ptr; - char x[MAX_DIGS_DOUBLE+MAX_DOUBLE_PRECISION+1]; - char y[MAX_DIGS_DOUBLE+MAX_DOUBLE_PRECISION+1]; - POINT2D pt; - - ptr = output; - - if (close_ring) end = pa->npoints; - else end = pa->npoints - 1; - - for (i=0 ; i < end ; i++) - { - getPoint2d_p(pa, i, &pt); - - if (fabs(pt.x) < MAX_DOUBLE) - sprintf(x, "%.*f", precision, pt.x); - else - sprintf(x, "%g", pt.x); - trim_trailing_zeros(x); - - /* SVG Y axis is reversed, an no need to transform 0 into -0 */ - if (fabs(pt.y) < MAX_DOUBLE) - sprintf(y, "%.*f", precision, fabs(pt.y) ? pt.y * -1:pt.y); - else - sprintf(y, "%g", fabs(pt.y) ? pt.y * -1:pt.y); - trim_trailing_zeros(y); - - if (i == 1) ptr += sprintf(ptr, " L "); - else if (i) ptr += sprintf(ptr, " "); - ptr += sprintf(ptr,"%s %s", x, y); - } - - return (ptr-output); -} - - -/** - * Returns maximum size of rendered pointarray in bytes. - */ -static size_t -pointArray_svg_size(POINTARRAY *pa, int precision) -{ - return (MAX_DIGS_DOUBLE + precision + sizeof(" ")) - * 2 * pa->npoints + sizeof(" L "); -} diff --git a/regress/svg.sql b/regress/svg.sql index 42bc76a1e..4a0668191 100755 --- a/regress/svg.sql +++ b/regress/svg.sql @@ -1,159 +1,13 @@ --- --- spatial_ref_sys data --- -INSERT INTO "spatial_ref_sys" ("srid","auth_name","auth_srid","srtext","proj4text") VALUES (4326,'EPSG',4326,'GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]]','+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs '); ---- EPSG 27572 : NTF (Paris) / Lambert zone II -INSERT INTO "spatial_ref_sys" ("srid","auth_name","auth_srid","srtext","proj4text") VALUES (27572,'EPSG',27572,'PROJCS["NTF (Paris) / Lambert zone II",GEOGCS["NTF (Paris)",DATUM["Nouvelle_Triangulation_Francaise_Paris",SPHEROID["Clarke 1880 (IGN)",6378249.2,293.4660212936269,AUTHORITY["EPSG","7011"]],TOWGS84[-168,-60,320,0,0,0,0],AUTHORITY["EPSG","6807"]],PRIMEM["Paris",2.33722917,AUTHORITY["EPSG","8903"]],UNIT["grad",0.01570796326794897,AUTHORITY["EPSG","9105"]],AUTHORITY["EPSG","4807"]],PROJECTION["Lambert_Conformal_Conic_1SP"],PARAMETER["latitude_of_origin",52],PARAMETER["central_meridian",0],PARAMETER["scale_factor",0.99987742],PARAMETER["false_easting",600000],PARAMETER["false_northing",2200000],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AUTHORITY["EPSG","27572"]]','+proj=lcc +lat_1=46.8 +lat_0=46.8 +lon_0=0 +k_0=0.99987742 +x_0=600000 +y_0=2200000 +a=6378249.2 +b=6356515 +towgs84=-168,-60,320,0,0,0,0 +pm=paris +units=m +no_defs '); ---- EPSG 31467 : DHDN / Gauss-Kruger zone 3 -INSERT INTO "spatial_ref_sys" ("srid","auth_name","auth_srid","srtext","proj4text") VALUES (31467,'EPSG',31467,'PROJCS["DHDN / Gauss-Kruger zone 3",GEOGCS["DHDN",DATUM["Deutsches_Hauptdreiecksnetz",SPHEROID["Bessel 1841",6377397.155,299.1528128,AUTHORITY["EPSG","7004"]],AUTHORITY["EPSG","6314"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4314"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",9],PARAMETER["scale_factor",1],PARAMETER["false_easting",3500000],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AUTHORITY["EPSG","31467"]]','+proj=tmerc +lat_0=0 +lon_0=9 +k=1.000000 +x_0=3500000 +y_0=0 +ellps=bessel +datum=potsdam +units=m +no_defs '); - - --- Simple output -SELECT 'simple_point', ST_AsSVG(GeomFromEWKT('POINT(1 1)')); - - -- Empty Geometry SELECT 'empty_geom', ST_AsSVG(GeomFromEWKT(NULL)); -- Option -SELECT 'option_01', ST_AsSVG(GeomFromEWKT('SRID=4326;LINESTRING(1 1, 4 4, 5 7)'), 0); -SELECT 'option_02', ST_AsSVG(GeomFromEWKT('SRID=4326;LINESTRING(1 1, 4 4, 5 7)'), 1); -SELECT 'option_03', ST_AsSVG(GeomFromEWKT('SRID=4326;LINESTRING(1 1, 4 4, 5 7)'), 0, 0); -SELECT 'option_04', ST_AsSVG(GeomFromEWKT('SRID=4326;LINESTRING(1 1, 4 4, 5 7)'), 1, 0); +SELECT 'option_01', ST_AsSVG(GeomFromEWKT('LINESTRING(1 1, 4 4, 5 7)'), 0); +SELECT 'option_02', ST_AsSVG(GeomFromEWKT('LINESTRING(1 1, 4 4, 5 7)'), 1); +SELECT 'option_03', ST_AsSVG(GeomFromEWKT('LINESTRING(1 1, 4 4, 5 7)'), 0, 0); +SELECT 'option_04', ST_AsSVG(GeomFromEWKT('LINESTRING(1 1, 4 4, 5 7)'), 1, 0); -- Precision -SELECT 'precision_01', ST_AsSVG(GeomFromEWKT('SRID=4326;POINT(1.1111111 1.1111111)'), 0); -SELECT 'precision_02', ST_AsSVG(GeomFromEWKT('SRID=4326;POINT(1.1111111 1.1111111)'), 3); -SELECT 'precision_03', ST_AsSVG(GeomFromEWKT('SRID=4326;POINT(1.1111111 1.1111111)'), -2); -SELECT 'precision_04', ST_AsSVG(GeomFromEWKT('SRID=4326;POINT(1.1111111 1.1111111)'), 19); - - - --- --- Line --- - --- Geometry from frida project: -SELECT 'line_01', ST_AsSVG(GeomFromEWKT('LINESTRING(3429562.6 5799490.68,3429750.99 5799199.87,3429825.45 5799078.39,3429901.8 5798961.45,3429995.54 5798822.93,3430072.89 5798719.46,3430216 5798558.95,3430272.08 5798489.33,3430393.87 5798328.51,3430463.53 5798251.11,3430532.22 5798190.16,3430591.24 5798149.53,3430667.67 5798108.9,3430723.78 5798088.58,3430797.33 5798067.95,3430857.34 5798056.34,3430912.52 5798051.5,3430961.89 5798048.59,3431052.88 5798053.43,3431159.36 5798059.24,3431218.41 5798061.18,3431366.56 5798056.09,3431474.07 5798044.47,3431568.02 5798028.97,3431644.53 5798012.51)'), 0, 2); - -SELECT 'line_02', ST_AsSVG(GeomFromEWKT('LINESTRING(3429562.6 5799490.68,3429750.99 5799199.87,3429825.45 5799078.39,3429901.8 5798961.45,3429995.54 5798822.93,3430072.89 5798719.46,3430216 5798558.95,3430272.08 5798489.33,3430393.87 5798328.51,3430463.53 5798251.11,3430532.22 5798190.16,3430591.24 5798149.53,3430667.67 5798108.9,3430723.78 5798088.58,3430797.33 5798067.95,3430857.34 5798056.34,3430912.52 5798051.5,3430961.89 5798048.59,3431052.88 5798053.43,3431159.36 5798059.24,3431218.41 5798061.18,3431366.56 5798056.09,3431474.07 5798044.47,3431568.02 5798028.97,3431644.53 5798012.51)'), 1, 2); - - -SELECT 'line_03', ST_AsSVG(GeomFromEWKT('LINESTRING(3429562.6 5799490.68,3429750.99 5799199.87,3429825.45 5799078.39,3429901.8 5798961.45,3429995.54 5798822.93,3430072.89 5798719.46,3430216 5798558.95,3430272.08 5798489.33,3430393.87 5798328.51,3430463.53 5798251.11,3430532.22 5798190.16,3430591.24 5798149.53,3430667.67 5798108.9,3430723.78 5798088.58,3430797.33 5798067.95,3430857.34 5798056.34,3430912.52 5798051.5,3430961.89 5798048.59,3431052.88 5798053.43,3431159.36 5798059.24,3431218.41 5798061.18,3431366.56 5798056.09,3431474.07 5798044.47,3431568.02 5798028.97,3431644.53 5798012.51)'), 0, 0); - -SELECT 'line_04', ST_AsSVG(GeomFromEWKT('LINESTRING(3429562.6 5799490.68,3429750.99 5799199.87,3429825.45 5799078.39,3429901.8 5798961.45,3429995.54 5798822.93,3430072.89 5798719.46,3430216 5798558.95,3430272.08 5798489.33,3430393.87 5798328.51,3430463.53 5798251.11,3430532.22 5798190.16,3430591.24 5798149.53,3430667.67 5798108.9,3430723.78 5798088.58,3430797.33 5798067.95,3430857.34 5798056.34,3430912.52 5798051.5,3430961.89 5798048.59,3431052.88 5798053.43,3431159.36 5798059.24,3431218.41 5798061.18,3431366.56 5798056.09,3431474.07 5798044.47,3431568.02 5798028.97,3431644.53 5798012.51)'), 1, 0); - - - --- --- Polygon --- - --- Geometry from frida project: - -SELECT 'polygon_01', ST_AsSVG(GeomFromEWKT('POLYGON((3429857.62 5799440.07,3429873.86 5799496.16,3429904.86 5799503.55,3429972.77 5799561.12,3430034.77 5799577.36,3430031.82 5799639.36,3430139.59 5799691.03,3430146.97 5799724.99,3430271.57 5799792.88,3430289.29 5799776.64,3430312.91 5799662.95,3430416.27 5799710.2,3430419.22 5799614.22,3430268.61 5799612.75,3430291.3 5799203.76,3430255.86 5799175.7,3430214.51 5799347,3430183.49 5799355.87,3430180.54 5799366.2,3430146.57 5799367.68,3430142.14 5799349.96,3430065.35 5799375.06,3429961.97 5799426.75,3429857.62 5799440.07))'), 0, 2); - -SELECT 'polygon_02', ST_AsSVG(GeomFromEWKT('POLYGON((3429857.62 5799440.07,3429873.86 5799496.16,3429904.86 5799503.55,3429972.77 5799561.12,3430034.77 5799577.36,3430031.82 5799639.36,3430139.59 5799691.03,3430146.97 5799724.99,3430271.57 5799792.88,3430289.29 5799776.64,3430312.91 5799662.95,3430416.27 5799710.2,3430419.22 5799614.22,3430268.61 5799612.75,3430291.3 5799203.76,3430255.86 5799175.7,3430214.51 5799347,3430183.49 5799355.87,3430180.54 5799366.2,3430146.57 5799367.68,3430142.14 5799349.96,3430065.35 5799375.06,3429961.97 5799426.75,3429857.62 5799440.07))'), 1, 2); - -SELECT 'polygon_03', ST_AsSVG(GeomFromEWKT('POLYGON((3429857.62 5799440.07,3429873.86 5799496.16,3429904.86 5799503.55,3429972.77 5799561.12,3430034.77 5799577.36,3430031.82 5799639.36,3430139.59 5799691.03,3430146.97 5799724.99,3430271.57 5799792.88,3430289.29 5799776.64,3430312.91 5799662.95,3430416.27 5799710.2,3430419.22 5799614.22,3430268.61 5799612.75,3430291.3 5799203.76,3430255.86 5799175.7,3430214.51 5799347,3430183.49 5799355.87,3430180.54 5799366.2,3430146.57 5799367.68,3430142.14 5799349.96,3430065.35 5799375.06,3429961.97 5799426.75,3429857.62 5799440.07))'), 0, 0); - -SELECT 'polygon_04', ST_AsSVG(GeomFromEWKT('POLYGON((3429857.62 5799440.07,3429873.86 5799496.16,3429904.86 5799503.55,3429972.77 5799561.12,3430034.77 5799577.36,3430031.82 5799639.36,3430139.59 5799691.03,3430146.97 5799724.99,3430271.57 5799792.88,3430289.29 5799776.64,3430312.91 5799662.95,3430416.27 5799710.2,3430419.22 5799614.22,3430268.61 5799612.75,3430291.3 5799203.76,3430255.86 5799175.7,3430214.51 5799347,3430183.49 5799355.87,3430180.54 5799366.2,3430146.57 5799367.68,3430142.14 5799349.96,3430065.35 5799375.06,3429961.97 5799426.75,3429857.62 5799440.07))'), 1, 0); - - --- --- Multipoint --- - --- SELECT astext(collect(the_geom)) FROM poi WHERE poitypname='Schule'; --- Geometry from frida project: - -SELECT 'multipoint_01', ST_AsSVG(GeomFromEWKT('MULTIPOINT(3433276.43 5795308.93,3428545.3 5795827.75,3431576.99 5799084.19,3431724.2 5797152.59,3431984.2 5796564.79,3435147.61 5797649.58,3434660.86 5796941.74,3434674.52 5797030.54,3435714.36 5797022.6,3436368.88 5796951.04,3436730.03 5796768.6,3435538.55 5796267.1,3435847.22 5795917.96,3434312.09 5794846.02,3433121.69 5793670.73,3433176.36 5793489.29,3434316.04 5793940.09,3433222.92 5793040.49,3433416.13 5792891.62,3430717.47 5792600.58,3435384.08 5792877.68,3435229.15 5792177.25,3435120 5792319.07,3435088.72 5792111.21,3434484.89 5792110.2,3435777.91 5792419.49,3435717.37 5794318.12,3436895.13 5794569.43,3437621.86 5793931.6,3435597.14 5793467.9,3435246.51 5793394.63,3434722.1 5793374.87,3434712.16 5793810.3,3434773.28 5793816.87,3434629.91 5793855.31,3434992.34 5794140.1,3434927.13 5794252.29,3434958.58 5794286.16,3435120.48 5794163.36,3435850.1 5791727.49,3435930.75 5791636.32,3436268.87 5791882.68,3437110.23 5791664.12,3435960.34 5790928.2,3433545.81 5789755.43,3439096.86 5790884.26,3438576.87 5795046.69,3438396.95 5794858.59,3438193.25 5794695.6,3438447.92 5796130.77,3440688.22 5793670.37)'), 0, 2); - -SELECT 'multipoint_02', ST_AsSVG(GeomFromEWKT('MULTIPOINT(3433276.43 5795308.93,3428545.3 5795827.75,3431576.99 5799084.19,3431724.2 5797152.59,3431984.2 5796564.79,3435147.61 5797649.58,3434660.86 5796941.74,3434674.52 5797030.54,3435714.36 5797022.6,3436368.88 5796951.04,3436730.03 5796768.6,3435538.55 5796267.1,3435847.22 5795917.96,3434312.09 5794846.02,3433121.69 5793670.73,3433176.36 5793489.29,3434316.04 5793940.09,3433222.92 5793040.49,3433416.13 5792891.62,3430717.47 5792600.58,3435384.08 5792877.68,3435229.15 5792177.25,3435120 5792319.07,3435088.72 5792111.21,3434484.89 5792110.2,3435777.91 5792419.49,3435717.37 5794318.12,3436895.13 5794569.43,3437621.86 5793931.6,3435597.14 5793467.9,3435246.51 5793394.63,3434722.1 5793374.87,3434712.16 5793810.3,3434773.28 5793816.87,3434629.91 5793855.31,3434992.34 5794140.1,3434927.13 5794252.29,3434958.58 5794286.16,3435120.48 5794163.36,3435850.1 5791727.49,3435930.75 5791636.32,3436268.87 5791882.68,3437110.23 5791664.12,3435960.34 5790928.2,3433545.81 5789755.43,3439096.86 5790884.26,3438576.87 5795046.69,3438396.95 5794858.59,3438193.25 5794695.6,3438447.92 5796130.77,3440688.22 5793670.37)'), 1, 2); - - -SELECT 'multipoint_03', ST_AsSVG(GeomFromEWKT('MULTIPOINT(3433276.43 5795308.93,3428545.3 5795827.75,3431576.99 5799084.19,3431724.2 5797152.59,3431984.2 5796564.79,3435147.61 5797649.58,3434660.86 5796941.74,3434674.52 5797030.54,3435714.36 5797022.6,3436368.88 5796951.04,3436730.03 5796768.6,3435538.55 5796267.1,3435847.22 5795917.96,3434312.09 5794846.02,3433121.69 5793670.73,3433176.36 5793489.29,3434316.04 5793940.09,3433222.92 5793040.49,3433416.13 5792891.62,3430717.47 5792600.58,3435384.08 5792877.68,3435229.15 5792177.25,3435120 5792319.07,3435088.72 5792111.21,3434484.89 5792110.2,3435777.91 5792419.49,3435717.37 5794318.12,3436895.13 5794569.43,3437621.86 5793931.6,3435597.14 5793467.9,3435246.51 5793394.63,3434722.1 5793374.87,3434712.16 5793810.3,3434773.28 5793816.87,3434629.91 5793855.31,3434992.34 5794140.1,3434927.13 5794252.29,3434958.58 5794286.16,3435120.48 5794163.36,3435850.1 5791727.49,3435930.75 5791636.32,3436268.87 5791882.68,3437110.23 5791664.12,3435960.34 5790928.2,3433545.81 5789755.43,3439096.86 5790884.26,3438576.87 5795046.69,3438396.95 5794858.59,3438193.25 5794695.6,3438447.92 5796130.77,3440688.22 5793670.37)'), 0, 0); - -SELECT 'multipoint_04', ST_AsSVG(GeomFromEWKT('MULTIPOINT(3433276.43 5795308.93,3428545.3 5795827.75,3431576.99 5799084.19,3431724.2 5797152.59,3431984.2 5796564.79,3435147.61 5797649.58,3434660.86 5796941.74,3434674.52 5797030.54,3435714.36 5797022.6,3436368.88 5796951.04,3436730.03 5796768.6,3435538.55 5796267.1,3435847.22 5795917.96,3434312.09 5794846.02,3433121.69 5793670.73,3433176.36 5793489.29,3434316.04 5793940.09,3433222.92 5793040.49,3433416.13 5792891.62,3430717.47 5792600.58,3435384.08 5792877.68,3435229.15 5792177.25,3435120 5792319.07,3435088.72 5792111.21,3434484.89 5792110.2,3435777.91 5792419.49,3435717.37 5794318.12,3436895.13 5794569.43,3437621.86 5793931.6,3435597.14 5793467.9,3435246.51 5793394.63,3434722.1 5793374.87,3434712.16 5793810.3,3434773.28 5793816.87,3434629.91 5793855.31,3434992.34 5794140.1,3434927.13 5794252.29,3434958.58 5794286.16,3435120.48 5794163.36,3435850.1 5791727.49,3435930.75 5791636.32,3436268.87 5791882.68,3437110.23 5791664.12,3435960.34 5790928.2,3433545.81 5789755.43,3439096.86 5790884.26,3438576.87 5795046.69,3438396.95 5794858.59,3438193.25 5794695.6,3438447.92 5796130.77,3440688.22 5793670.37)'), 1, 0); - - - --- --- MultiLine --- --- Geometry from frida project: --- SELECT st_astext(st_linemerge(the_geom)) FROM river WHERE glname='Stichkanal'; - -SELECT 'multiline_01', ST_AsSVG(GeomFromEWKT('MULTILINESTRING((3429562.6 5799490.68,3429750.99 5799199.87,3429825.45 5799078.39,3429901.8 5798961.45,3429995.54 5798822.93,3430072.89 5798719.46,3430216 5798558.95,3430272.08 5798489.33,3430393.87 5798328.51,3430463.53 5798251.11,3430532.22 5798190.16,3430591.24 5798149.53,3430667.67 5798108.9,3430723.78 5798088.58,3430797.33 5798067.95,3430857.34 5798056.34,3430912.52 5798051.5,3430961.89 5798048.59,3431052.88 5798053.43,3431159.36 5798059.24,3431218.41 5798061.18,3431366.56 5798056.09,3431474.07 5798044.47,3431568.02 5798028.97,3431644.53 5798012.51),(3433260.06 5797002.92,3433234.61 5797070.25,3433138.56 5797278.81,3433074.19 5797398.94,3433033.73 5797461.79,3432961.43 5797551.84,3432882.76 5797626.57,3432780.32 5797701.09,3432706.28 5797743.23,3432542.66 5797808.05,3432360.32 5797842.47,3432258.52 5797836.77,3432197.62 5797837.57,3432081.75 5797865.64,3431876.6 5797945.1,3431865.15 5797948.73),(3431865.15 5797948.73,3431644.53 5798012.51),(3431865.15 5797948.73,3431815.75 5797807.76),(3433260.06 5797002.92,3433361.19 5796788.54,3433467.4 5796572.78,3433670.6 5796160.06),(3433670.6 5796160.06,3433709.27 5796096.88,3433744.46 5796021.84,3433861.98 5795869.38,3434029.1 5795680.43,3434229.42 5795456.34,3434239.36 5795425.11,3434296.02 5795363.18))'), 0, 2); - -SELECT 'multiline_02', ST_AsSVG(GeomFromEWKT('MULTILINESTRING((3429562.6 5799490.68,3429750.99 5799199.87,3429825.45 5799078.39,3429901.8 5798961.45,3429995.54 5798822.93,3430072.89 5798719.46,3430216 5798558.95,3430272.08 5798489.33,3430393.87 5798328.51,3430463.53 5798251.11,3430532.22 5798190.16,3430591.24 5798149.53,3430667.67 5798108.9,3430723.78 5798088.58,3430797.33 5798067.95,3430857.34 5798056.34,3430912.52 5798051.5,3430961.89 5798048.59,3431052.88 5798053.43,3431159.36 5798059.24,3431218.41 5798061.18,3431366.56 5798056.09,3431474.07 5798044.47,3431568.02 5798028.97,3431644.53 5798012.51),(3433260.06 5797002.92,3433234.61 5797070.25,3433138.56 5797278.81,3433074.19 5797398.94,3433033.73 5797461.79,3432961.43 5797551.84,3432882.76 5797626.57,3432780.32 5797701.09,3432706.28 5797743.23,3432542.66 5797808.05,3432360.32 5797842.47,3432258.52 5797836.77,3432197.62 5797837.57,3432081.75 5797865.64,3431876.6 5797945.1,3431865.15 5797948.73),(3431865.15 5797948.73,3431644.53 5798012.51),(3431865.15 5797948.73,3431815.75 5797807.76),(3433260.06 5797002.92,3433361.19 5796788.54,3433467.4 5796572.78,3433670.6 5796160.06),(3433670.6 5796160.06,3433709.27 5796096.88,3433744.46 5796021.84,3433861.98 5795869.38,3434029.1 5795680.43,3434229.42 5795456.34,3434239.36 5795425.11,3434296.02 5795363.18))'), 1, 2); - -SELECT 'multiline_03', ST_AsSVG(GeomFromEWKT('MULTILINESTRING((3429562.6 5799490.68,3429750.99 5799199.87,3429825.45 5799078.39,3429901.8 5798961.45,3429995.54 5798822.93,3430072.89 5798719.46,3430216 5798558.95,3430272.08 5798489.33,3430393.87 5798328.51,3430463.53 5798251.11,3430532.22 5798190.16,3430591.24 5798149.53,3430667.67 5798108.9,3430723.78 5798088.58,3430797.33 5798067.95,3430857.34 5798056.34,3430912.52 5798051.5,3430961.89 5798048.59,3431052.88 5798053.43,3431159.36 5798059.24,3431218.41 5798061.18,3431366.56 5798056.09,3431474.07 5798044.47,3431568.02 5798028.97,3431644.53 5798012.51),(3433260.06 5797002.92,3433234.61 5797070.25,3433138.56 5797278.81,3433074.19 5797398.94,3433033.73 5797461.79,3432961.43 5797551.84,3432882.76 5797626.57,3432780.32 5797701.09,3432706.28 5797743.23,3432542.66 5797808.05,3432360.32 5797842.47,3432258.52 5797836.77,3432197.62 5797837.57,3432081.75 5797865.64,3431876.6 5797945.1,3431865.15 5797948.73),(3431865.15 5797948.73,3431644.53 5798012.51),(3431865.15 5797948.73,3431815.75 5797807.76),(3433260.06 5797002.92,3433361.19 5796788.54,3433467.4 5796572.78,3433670.6 5796160.06),(3433670.6 5796160.06,3433709.27 5796096.88,3433744.46 5796021.84,3433861.98 5795869.38,3434029.1 5795680.43,3434229.42 5795456.34,3434239.36 5795425.11,3434296.02 5795363.18))'), 0, 0); - -SELECT 'multiline_04', ST_AsSVG(GeomFromEWKT('MULTILINESTRING((3429562.6 5799490.68,3429750.99 5799199.87,3429825.45 5799078.39,3429901.8 5798961.45,3429995.54 5798822.93,3430072.89 5798719.46,3430216 5798558.95,3430272.08 5798489.33,3430393.87 5798328.51,3430463.53 5798251.11,3430532.22 5798190.16,3430591.24 5798149.53,3430667.67 5798108.9,3430723.78 5798088.58,3430797.33 5798067.95,3430857.34 5798056.34,3430912.52 5798051.5,3430961.89 5798048.59,3431052.88 5798053.43,3431159.36 5798059.24,3431218.41 5798061.18,3431366.56 5798056.09,3431474.07 5798044.47,3431568.02 5798028.97,3431644.53 5798012.51),(3433260.06 5797002.92,3433234.61 5797070.25,3433138.56 5797278.81,3433074.19 5797398.94,3433033.73 5797461.79,3432961.43 5797551.84,3432882.76 5797626.57,3432780.32 5797701.09,3432706.28 5797743.23,3432542.66 5797808.05,3432360.32 5797842.47,3432258.52 5797836.77,3432197.62 5797837.57,3432081.75 5797865.64,3431876.6 5797945.1,3431865.15 5797948.73),(3431865.15 5797948.73,3431644.53 5798012.51),(3431865.15 5797948.73,3431815.75 5797807.76),(3433260.06 5797002.92,3433361.19 5796788.54,3433467.4 5796572.78,3433670.6 5796160.06),(3433670.6 5796160.06,3433709.27 5796096.88,3433744.46 5796021.84,3433861.98 5795869.38,3434029.1 5795680.43,3434229.42 5795456.34,3434239.36 5795425.11,3434296.02 5795363.18))'), 1, 0); - - - --- --- MultiPolygon --- - --- Geometry from frida project: --- Leyer Holz Park --- st_astext(geomunion(the_geom)) FROM park WHERE gfname='Leyer Holz'; - -SELECT 'multipolygon_01', ST_AsSVG(GeomFromEWKT('MULTIPOLYGON(((3429699.81 5795851.64,3429736.72 5795796.01,3429754.71 5795768.88,3429996.1 5795489.98,3430100.67 5795435.76,3430122.61 5795446.09,3430138.1 5795560.98,3430311.09 5795559.69,3430309.8 5795470.62,3430329.16 5795416.4,3430326.58 5795399.62,3430157.47 5795418.98,3430156.14 5795407.32,3430139.36 5795396.99,3429983.19 5795394.41,3429976.74 5795420.22,3429789.59 5795418.93,3429643.74 5795475.72,3429635.72 5795615.31,3429484.94 5795556.38,3429315.44 5795496.32,3429326.12 5795748.57,3429129.92 5795704.53,3429176.64 5795776.6,3429100.6 5795797.17,3428900.44 5795742.46,3428896.43 5795779.82,3428805.69 5795953.3,3428897.77 5796025.35,3428897.77 5796225.99,3428696.32 5796199.31,3428681.64 5796217.99,3428680.31 5796290.03,3428290.14 5796351.8,3428389.67 5796413.87,3428837.71 5796561.12,3428991.08 5796495.01,3429076.4 5796760.29,3429428.31 5796723.61,3429474.96 5796690.29,3429696.2 5796600.99,3429658.88 5796429.06,3429536.27 5796363.75,3429529.6 5796333.1,3429446.08 5796253.84,3429699.81 5795851.64)),((3429857.62 5799440.07,3429873.86 5799496.16,3429904.86 5799503.55,3429972.77 5799561.12,3430034.77 5799577.36,3430031.82 5799639.36,3430139.59 5799691.03,3430146.97 5799724.99,3430271.57 5799792.88,3430289.29 5799776.64,3430312.91 5799662.95,3430416.27 5799710.2,3430419.22 5799614.22,3430268.61 5799612.75,3430291.3 5799203.76,3430255.86 5799175.7,3430214.51 5799347,3430183.49 5799355.87,3430180.54 5799366.2,3430146.57 5799367.68,3430142.14 5799349.96,3430065.35 5799375.06,3429961.97 5799426.75,3429857.62 5799440.07)))'), 0, 2); - -SELECT 'multipolygon_02', ST_AsSVG(GeomFromEWKT('MULTIPOLYGON(((3429699.81 5795851.64,3429736.72 5795796.01,3429754.71 5795768.88,3429996.1 5795489.98,3430100.67 5795435.76,3430122.61 5795446.09,3430138.1 5795560.98,3430311.09 5795559.69,3430309.8 5795470.62,3430329.16 5795416.4,3430326.58 5795399.62,3430157.47 5795418.98,3430156.14 5795407.32,3430139.36 5795396.99,3429983.19 5795394.41,3429976.74 5795420.22,3429789.59 5795418.93,3429643.74 5795475.72,3429635.72 5795615.31,3429484.94 5795556.38,3429315.44 5795496.32,3429326.12 5795748.57,3429129.92 5795704.53,3429176.64 5795776.6,3429100.6 5795797.17,3428900.44 5795742.46,3428896.43 5795779.82,3428805.69 5795953.3,3428897.77 5796025.35,3428897.77 5796225.99,3428696.32 5796199.31,3428681.64 5796217.99,3428680.31 5796290.03,3428290.14 5796351.8,3428389.67 5796413.87,3428837.71 5796561.12,3428991.08 5796495.01,3429076.4 5796760.29,3429428.31 5796723.61,3429474.96 5796690.29,3429696.2 5796600.99,3429658.88 5796429.06,3429536.27 5796363.75,3429529.6 5796333.1,3429446.08 5796253.84,3429699.81 5795851.64)),((3429857.62 5799440.07,3429873.86 5799496.16,3429904.86 5799503.55,3429972.77 5799561.12,3430034.77 5799577.36,3430031.82 5799639.36,3430139.59 5799691.03,3430146.97 5799724.99,3430271.57 5799792.88,3430289.29 5799776.64,3430312.91 5799662.95,3430416.27 5799710.2,3430419.22 5799614.22,3430268.61 5799612.75,3430291.3 5799203.76,3430255.86 5799175.7,3430214.51 5799347,3430183.49 5799355.87,3430180.54 5799366.2,3430146.57 5799367.68,3430142.14 5799349.96,3430065.35 5799375.06,3429961.97 5799426.75,3429857.62 5799440.07)))'), 1, 2); - -SELECT 'multipolygon_03', ST_AsSVG(GeomFromEWKT('MULTIPOLYGON(((3429699.81 5795851.64,3429736.72 5795796.01,3429754.71 5795768.88,3429996.1 5795489.98,3430100.67 5795435.76,3430122.61 5795446.09,3430138.1 5795560.98,3430311.09 5795559.69,3430309.8 5795470.62,3430329.16 5795416.4,3430326.58 5795399.62,3430157.47 5795418.98,3430156.14 5795407.32,3430139.36 5795396.99,3429983.19 5795394.41,3429976.74 5795420.22,3429789.59 5795418.93,3429643.74 5795475.72,3429635.72 5795615.31,3429484.94 5795556.38,3429315.44 5795496.32,3429326.12 5795748.57,3429129.92 5795704.53,3429176.64 5795776.6,3429100.6 5795797.17,3428900.44 5795742.46,3428896.43 5795779.82,3428805.69 5795953.3,3428897.77 5796025.35,3428897.77 5796225.99,3428696.32 5796199.31,3428681.64 5796217.99,3428680.31 5796290.03,3428290.14 5796351.8,3428389.67 5796413.87,3428837.71 5796561.12,3428991.08 5796495.01,3429076.4 5796760.29,3429428.31 5796723.61,3429474.96 5796690.29,3429696.2 5796600.99,3429658.88 5796429.06,3429536.27 5796363.75,3429529.6 5796333.1,3429446.08 5796253.84,3429699.81 5795851.64)),((3429857.62 5799440.07,3429873.86 5799496.16,3429904.86 5799503.55,3429972.77 5799561.12,3430034.77 5799577.36,3430031.82 5799639.36,3430139.59 5799691.03,3430146.97 5799724.99,3430271.57 5799792.88,3430289.29 5799776.64,3430312.91 5799662.95,3430416.27 5799710.2,3430419.22 5799614.22,3430268.61 5799612.75,3430291.3 5799203.76,3430255.86 5799175.7,3430214.51 5799347,3430183.49 5799355.87,3430180.54 5799366.2,3430146.57 5799367.68,3430142.14 5799349.96,3430065.35 5799375.06,3429961.97 5799426.75,3429857.62 5799440.07)))'), 0, 0); - -SELECT 'multipolygon_04', ST_AsSVG(GeomFromEWKT('MULTIPOLYGON(((3429699.81 5795851.64,3429736.72 5795796.01,3429754.71 5795768.88,3429996.1 5795489.98,3430100.67 5795435.76,3430122.61 5795446.09,3430138.1 5795560.98,3430311.09 5795559.69,3430309.8 5795470.62,3430329.16 5795416.4,3430326.58 5795399.62,3430157.47 5795418.98,3430156.14 5795407.32,3430139.36 5795396.99,3429983.19 5795394.41,3429976.74 5795420.22,3429789.59 5795418.93,3429643.74 5795475.72,3429635.72 5795615.31,3429484.94 5795556.38,3429315.44 5795496.32,3429326.12 5795748.57,3429129.92 5795704.53,3429176.64 5795776.6,3429100.6 5795797.17,3428900.44 5795742.46,3428896.43 5795779.82,3428805.69 5795953.3,3428897.77 5796025.35,3428897.77 5796225.99,3428696.32 5796199.31,3428681.64 5796217.99,3428680.31 5796290.03,3428290.14 5796351.8,3428389.67 5796413.87,3428837.71 5796561.12,3428991.08 5796495.01,3429076.4 5796760.29,3429428.31 5796723.61,3429474.96 5796690.29,3429696.2 5796600.99,3429658.88 5796429.06,3429536.27 5796363.75,3429529.6 5796333.1,3429446.08 5796253.84,3429699.81 5795851.64)),((3429857.62 5799440.07,3429873.86 5799496.16,3429904.86 5799503.55,3429972.77 5799561.12,3430034.77 5799577.36,3430031.82 5799639.36,3430139.59 5799691.03,3430146.97 5799724.99,3430271.57 5799792.88,3430289.29 5799776.64,3430312.91 5799662.95,3430416.27 5799710.2,3430419.22 5799614.22,3430268.61 5799612.75,3430291.3 5799203.76,3430255.86 5799175.7,3430214.51 5799347,3430183.49 5799355.87,3430180.54 5799366.2,3430146.57 5799367.68,3430142.14 5799349.96,3430065.35 5799375.06,3429961.97 5799426.75,3429857.62 5799440.07)))'), 1, 0); - - --- --- GeometryCollection --- - --- SELECT astext(collect((SELECT collect(the_geom) FROM poi WHERE poitypname='Schule'), (SELECT collect(st_linemerge(the_geom)) FROM river WHERE glname='Stichkanal'))); - --- Geometry from frida project: -SELECT 'geometrycollection_01', ST_AsSVG(GeomFromEWKT('GEOMETRYCOLLECTION(MULTIPOINT(3433276.43 5795308.93,3428545.3 5795827.75,3431576.99 5799084.19,3431724.2 5797152.59,3431984.2 5796564.79,3435147.61 5797649.58,3434660.86 5796941.74,3434674.52 5797030.54,3435714.36 5797022.6,3436368.88 5796951.04,3436730.03 5796768.6,3435538.55 5796267.1,3435847.22 5795917.96,3434312.09 5794846.02,3433121.69 5793670.73,3433176.36 5793489.29,3434316.04 5793940.09,3433222.92 5793040.49,3433416.13 5792891.62,3430717.47 5792600.58,3435384.08 5792877.68,3435229.15 5792177.25,3435120 5792319.07,3435088.72 5792111.21,3434484.89 5792110.2,3435777.91 5792419.49,3435717.37 5794318.12,3436895.13 5794569.43,3437621.86 5793931.6,3435597.14 5793467.9,3435246.51 5793394.63,3434722.1 5793374.87,3434712.16 5793810.3,3434773.28 5793816.87,3434629.91 5793855.31,3434992.34 5794140.1,3434927.13 5794252.29,3434958.58 5794286.16,3435120.48 5794163.36,3435850.1 5791727.49,3435930.75 5791636.32,3436268.87 5791882.68,3437110.23 5791664.12,3435960.34 5790928.2,3433545.81 5789755.43,3439096.86 5790884.26,3438576.87 5795046.69,3438396.95 5794858.59,3438193.25 5794695.6,3438447.92 5796130.77,3440688.22 5793670.37),MULTILINESTRING((3429562.6 5799490.68,3429750.99 5799199.87,3429825.45 5799078.39,3429901.8 5798961.45,3429995.54 5798822.93,3430072.89 5798719.46,3430216 5798558.95,3430272.08 5798489.33,3430393.87 5798328.51,3430463.53 5798251.11,3430532.22 5798190.16,3430591.24 5798149.53,3430667.67 5798108.9,3430723.78 5798088.58,3430797.33 5798067.95,3430857.34 5798056.34,3430912.52 5798051.5,3430961.89 5798048.59,3431052.88 5798053.43,3431159.36 5798059.24,3431218.41 5798061.18,3431366.56 5798056.09,3431474.07 5798044.47,3431568.02 5798028.97,3431644.53 5798012.51),(3433260.06 5797002.92,3433234.61 5797070.25,3433138.56 5797278.81,3433074.19 5797398.94,3433033.73 5797461.79,3432961.43 5797551.84,3432882.76 5797626.57,3432780.32 5797701.09,3432706.28 5797743.23,3432542.66 5797808.05,3432360.32 5797842.47,3432258.52 5797836.77,3432197.62 5797837.57,3432081.75 5797865.64,3431876.6 5797945.1,3431865.15 5797948.73),(3431865.15 5797948.73,3431644.53 5798012.51),(3431865.15 5797948.73,3431815.75 5797807.76),(3433260.06 5797002.92,3433361.19 5796788.54,3433467.4 5796572.78,3433670.6 5796160.06),(3433670.6 5796160.06,3433709.27 5796096.88,3433744.46 5796021.84,3433861.98 5795869.38,3434029.1 5795680.43,3434229.42 5795456.34,3434239.36 5795425.11,3434296.02 5795363.18)))'), 0, 2); - - -SELECT 'geometrycollection_02', ST_AsSVG(GeomFromEWKT('GEOMETRYCOLLECTION(MULTIPOINT(3433276.43 5795308.93,3428545.3 5795827.75,3431576.99 5799084.19,3431724.2 5797152.59,3431984.2 5796564.79,3435147.61 5797649.58,3434660.86 5796941.74,3434674.52 5797030.54,3435714.36 5797022.6,3436368.88 5796951.04,3436730.03 5796768.6,3435538.55 5796267.1,3435847.22 5795917.96,3434312.09 5794846.02,3433121.69 5793670.73,3433176.36 5793489.29,3434316.04 5793940.09,3433222.92 5793040.49,3433416.13 5792891.62,3430717.47 5792600.58,3435384.08 5792877.68,3435229.15 5792177.25,3435120 5792319.07,3435088.72 5792111.21,3434484.89 5792110.2,3435777.91 5792419.49,3435717.37 5794318.12,3436895.13 5794569.43,3437621.86 5793931.6,3435597.14 5793467.9,3435246.51 5793394.63,3434722.1 5793374.87,3434712.16 5793810.3,3434773.28 5793816.87,3434629.91 5793855.31,3434992.34 5794140.1,3434927.13 5794252.29,3434958.58 5794286.16,3435120.48 5794163.36,3435850.1 5791727.49,3435930.75 5791636.32,3436268.87 5791882.68,3437110.23 5791664.12,3435960.34 5790928.2,3433545.81 5789755.43,3439096.86 5790884.26,3438576.87 5795046.69,3438396.95 5794858.59,3438193.25 5794695.6,3438447.92 5796130.77,3440688.22 5793670.37),MULTILINESTRING((3429562.6 5799490.68,3429750.99 5799199.87,3429825.45 5799078.39,3429901.8 5798961.45,3429995.54 5798822.93,3430072.89 5798719.46,3430216 5798558.95,3430272.08 5798489.33,3430393.87 5798328.51,3430463.53 5798251.11,3430532.22 5798190.16,3430591.24 5798149.53,3430667.67 5798108.9,3430723.78 5798088.58,3430797.33 5798067.95,3430857.34 5798056.34,3430912.52 5798051.5,3430961.89 5798048.59,3431052.88 5798053.43,3431159.36 5798059.24,3431218.41 5798061.18,3431366.56 5798056.09,3431474.07 5798044.47,3431568.02 5798028.97,3431644.53 5798012.51),(3433260.06 5797002.92,3433234.61 5797070.25,3433138.56 5797278.81,3433074.19 5797398.94,3433033.73 5797461.79,3432961.43 5797551.84,3432882.76 5797626.57,3432780.32 5797701.09,3432706.28 5797743.23,3432542.66 5797808.05,3432360.32 5797842.47,3432258.52 5797836.77,3432197.62 5797837.57,3432081.75 5797865.64,3431876.6 5797945.1,3431865.15 5797948.73),(3431865.15 5797948.73,3431644.53 5798012.51),(3431865.15 5797948.73,3431815.75 5797807.76),(3433260.06 5797002.92,3433361.19 5796788.54,3433467.4 5796572.78,3433670.6 5796160.06),(3433670.6 5796160.06,3433709.27 5796096.88,3433744.46 5796021.84,3433861.98 5795869.38,3434029.1 5795680.43,3434229.42 5795456.34,3434239.36 5795425.11,3434296.02 5795363.18)))'), 1, 2); - - -SELECT 'geometrycollection_03', ST_AsSVG(GeomFromEWKT('GEOMETRYCOLLECTION(MULTIPOINT(3433276.43 5795308.93,3428545.3 5795827.75,3431576.99 5799084.19,3431724.2 5797152.59,3431984.2 5796564.79,3435147.61 5797649.58,3434660.86 5796941.74,3434674.52 5797030.54,3435714.36 5797022.6,3436368.88 5796951.04,3436730.03 5796768.6,3435538.55 5796267.1,3435847.22 5795917.96,3434312.09 5794846.02,3433121.69 5793670.73,3433176.36 5793489.29,3434316.04 5793940.09,3433222.92 5793040.49,3433416.13 5792891.62,3430717.47 5792600.58,3435384.08 5792877.68,3435229.15 5792177.25,3435120 5792319.07,3435088.72 5792111.21,3434484.89 5792110.2,3435777.91 5792419.49,3435717.37 5794318.12,3436895.13 5794569.43,3437621.86 5793931.6,3435597.14 5793467.9,3435246.51 5793394.63,3434722.1 5793374.87,3434712.16 5793810.3,3434773.28 5793816.87,3434629.91 5793855.31,3434992.34 5794140.1,3434927.13 5794252.29,3434958.58 5794286.16,3435120.48 5794163.36,3435850.1 5791727.49,3435930.75 5791636.32,3436268.87 5791882.68,3437110.23 5791664.12,3435960.34 5790928.2,3433545.81 5789755.43,3439096.86 5790884.26,3438576.87 5795046.69,3438396.95 5794858.59,3438193.25 5794695.6,3438447.92 5796130.77,3440688.22 5793670.37),MULTILINESTRING((3429562.6 5799490.68,3429750.99 5799199.87,3429825.45 5799078.39,3429901.8 5798961.45,3429995.54 5798822.93,3430072.89 5798719.46,3430216 5798558.95,3430272.08 5798489.33,3430393.87 5798328.51,3430463.53 5798251.11,3430532.22 5798190.16,3430591.24 5798149.53,3430667.67 5798108.9,3430723.78 5798088.58,3430797.33 5798067.95,3430857.34 5798056.34,3430912.52 5798051.5,3430961.89 5798048.59,3431052.88 5798053.43,3431159.36 5798059.24,3431218.41 5798061.18,3431366.56 5798056.09,3431474.07 5798044.47,3431568.02 5798028.97,3431644.53 5798012.51),(3433260.06 5797002.92,3433234.61 5797070.25,3433138.56 5797278.81,3433074.19 5797398.94,3433033.73 5797461.79,3432961.43 5797551.84,3432882.76 5797626.57,3432780.32 5797701.09,3432706.28 5797743.23,3432542.66 5797808.05,3432360.32 5797842.47,3432258.52 5797836.77,3432197.62 5797837.57,3432081.75 5797865.64,3431876.6 5797945.1,3431865.15 5797948.73),(3431865.15 5797948.73,3431644.53 5798012.51),(3431865.15 5797948.73,3431815.75 5797807.76),(3433260.06 5797002.92,3433361.19 5796788.54,3433467.4 5796572.78,3433670.6 5796160.06),(3433670.6 5796160.06,3433709.27 5796096.88,3433744.46 5796021.84,3433861.98 5795869.38,3434029.1 5795680.43,3434229.42 5795456.34,3434239.36 5795425.11,3434296.02 5795363.18)))'), 0, 0); - - -SELECT 'geometrycollection_04', ST_AsSVG(GeomFromEWKT('GEOMETRYCOLLECTION(MULTIPOINT(3433276.43 5795308.93,3428545.3 5795827.75,3431576.99 5799084.19,3431724.2 5797152.59,3431984.2 5796564.79,3435147.61 5797649.58,3434660.86 5796941.74,3434674.52 5797030.54,3435714.36 5797022.6,3436368.88 5796951.04,3436730.03 5796768.6,3435538.55 5796267.1,3435847.22 5795917.96,3434312.09 5794846.02,3433121.69 5793670.73,3433176.36 5793489.29,3434316.04 5793940.09,3433222.92 5793040.49,3433416.13 5792891.62,3430717.47 5792600.58,3435384.08 5792877.68,3435229.15 5792177.25,3435120 5792319.07,3435088.72 5792111.21,3434484.89 5792110.2,3435777.91 5792419.49,3435717.37 5794318.12,3436895.13 5794569.43,3437621.86 5793931.6,3435597.14 5793467.9,3435246.51 5793394.63,3434722.1 5793374.87,3434712.16 5793810.3,3434773.28 5793816.87,3434629.91 5793855.31,3434992.34 5794140.1,3434927.13 5794252.29,3434958.58 5794286.16,3435120.48 5794163.36,3435850.1 5791727.49,3435930.75 5791636.32,3436268.87 5791882.68,3437110.23 5791664.12,3435960.34 5790928.2,3433545.81 5789755.43,3439096.86 5790884.26,3438576.87 5795046.69,3438396.95 5794858.59,3438193.25 5794695.6,3438447.92 5796130.77,3440688.22 5793670.37),MULTILINESTRING((3429562.6 5799490.68,3429750.99 5799199.87,3429825.45 5799078.39,3429901.8 5798961.45,3429995.54 5798822.93,3430072.89 5798719.46,3430216 5798558.95,3430272.08 5798489.33,3430393.87 5798328.51,3430463.53 5798251.11,3430532.22 5798190.16,3430591.24 5798149.53,3430667.67 5798108.9,3430723.78 5798088.58,3430797.33 5798067.95,3430857.34 5798056.34,3430912.52 5798051.5,3430961.89 5798048.59,3431052.88 5798053.43,3431159.36 5798059.24,3431218.41 5798061.18,3431366.56 5798056.09,3431474.07 5798044.47,3431568.02 5798028.97,3431644.53 5798012.51),(3433260.06 5797002.92,3433234.61 5797070.25,3433138.56 5797278.81,3433074.19 5797398.94,3433033.73 5797461.79,3432961.43 5797551.84,3432882.76 5797626.57,3432780.32 5797701.09,3432706.28 5797743.23,3432542.66 5797808.05,3432360.32 5797842.47,3432258.52 5797836.77,3432197.62 5797837.57,3432081.75 5797865.64,3431876.6 5797945.1,3431865.15 5797948.73),(3431865.15 5797948.73,3431644.53 5798012.51),(3431865.15 5797948.73,3431815.75 5797807.76),(3433260.06 5797002.92,3433361.19 5796788.54,3433467.4 5796572.78,3433670.6 5796160.06),(3433670.6 5796160.06,3433709.27 5796096.88,3433744.46 5796021.84,3433861.98 5795869.38,3434029.1 5795680.43,3434229.42 5795456.34,3434239.36 5795425.11,3434296.02 5795363.18)))'), 1, 0); --- --- Unsupported Geometry --- (From AsKml units test) --- -SELECT 'invalid_01', ST_AsSVG(GeomFromEWKT('SRID=4326;CIRCULARSTRING(-2 0,0 2,2 0,0 2,2 4)')); -SELECT 'invalid_02', ST_AsSVG(GeomFromEWKT('SRID=4326;COMPOUNDCURVE(CIRCULARSTRING(0 0,1 1,1 0),(1 0,0 1))')); -SELECT 'invalid_03', ST_AsSVG(GeomFromEWKT('SRID=4326;CURVEPOLYGON(CIRCULARSTRING(-2 0,-1 -1,0 0,1 -1,2 0,0 2,-2 0),(-1 0,0 0.5,1 0,0 1,-1 0))')); -SELECT 'invalid_04', ST_AsSVG(GeomFromEWKT('SRID=4326;MULTICURVE((5 5,3 5,3 3,0 3),CIRCULARSTRING(0 0,2 1,2 2))')); -SELECT 'invalid_05', ST_AsSVG(GeomFromEWKT('SRID=4326;MULTISURFACE(CURVEPOLYGON(CIRCULARSTRING(-2 0,-1 -1,0 0,1 -1,2 0,0 2,-2 0),(-1 0,0 0.5,1 0,0 1,-1 0)),((7 8,10 10,6 14,4 11,7 8)))')); - - --- --- 3D Data --- -SELECT '3D_01', ST_AsSVG(GeomFromEWKT('SRID=4326;POINT(1 1 1)')); -SELECT '3D_02', ST_AsSVG(GeomFromEWKT('SRID=4326;POINT(1 1 1)'), 0); -SELECT '3D_03', ST_AsSVG(GeomFromEWKT('SRID=4326;LINESTRING(1 1 1, 2 2 2, 3 3 3, 4 4 4)'), 0); -SELECT '3D_04', ST_AsSVG(GeomFromEWKT('SRID=4326;POLYGON((1 1 1, 2 2 2, 3 3 3, 4 4 4, 5 5 5, 5 0 0, 1 1 1))'), 0); - - --- EMPTY GEOMETRYCOLLECTION #409 -SELECT '#409', ST_AsSVG(GeomFromEWKT('GEOMETRYCOLLECTION EMPTY')); +SELECT 'precision_01', ST_AsSVG(GeomFromEWKT('POINT(1.1111111 1.1111111)'), 1, -2); +SELECT 'precision_02', ST_AsSVG(GeomFromEWKT('POINT(1.1111111 1.1111111)'), 1, 19); --- --- Delete inserted spatial data --- -DELETE FROM spatial_ref_sys WHERE srid = 4326; -DELETE FROM spatial_ref_sys WHERE srid = 27572; -DELETE FROM spatial_ref_sys WHERE srid = 31467; diff --git a/regress/svg_expected b/regress/svg_expected index 7bf12d4ed..f65ffdee5 100644 --- a/regress/svg_expected +++ b/regress/svg_expected @@ -1,44 +1,7 @@ -simple_point|cx="1" cy="-1" empty_geom| option_01|M 1 -1 L 4 -4 5 -7 option_02|M 1 -1 l 3 -3 1 -3 option_03|M 1 -1 L 4 -4 5 -7 option_04|M 1 -1 l 3 -3 1 -3 -precision_01|cx="1.1111111" cy="-1.1111111" +precision_01|x="1" y="-1" precision_02|x="1.1111111" y="-1.1111111" -precision_03|x="1.1111111" y="-1.1111111" -precision_04|x="1.1111111" y="-1.1111111" -line_01|M 3429562.6 -5799490.68 L 3429750.99 -5799199.87 3429825.45 -5799078.39 3429901.8 -5798961.45 3429995.54 -5798822.93 3430072.89 -5798719.46 3430216 -5798558.95 3430272.08 -5798489.33 3430393.87 -5798328.51 3430463.53 -5798251.11 3430532.22 -5798190.16 3430591.24 -5798149.53 3430667.67 -5798108.9 3430723.78 -5798088.58 3430797.33 -5798067.95 3430857.34 -5798056.34 3430912.52 -5798051.5 3430961.89 -5798048.59 3431052.88 -5798053.43 3431159.36 -5798059.24 3431218.41 -5798061.18 3431366.56 -5798056.09 3431474.07 -5798044.47 3431568.02 -5798028.97 3431644.53 -5798012.51 -line_02|M 3429562.6 -5799490.68 l 188.39 290.81 74.46 121.48 76.35 116.94 93.74 138.52 77.35 103.47 143.11 160.51 56.08 69.62 121.79 160.82 69.66 77.4 68.69 60.95 59.02 40.63 76.43 40.63 56.11 20.32 73.55 20.63 60.01 11.61 55.18 4.84 49.37 2.91 90.99 -4.84 106.48 -5.81 59.05 -1.94 148.15 5.09 107.51 11.62 93.95 15.5 76.51 16.46 -line_03|M 3429563 -5799491 L 3429751 -5799200 3429825 -5799078 3429902 -5798961 3429996 -5798823 3430073 -5798719 3430216 -5798559 3430272 -5798489 3430394 -5798329 3430464 -5798251 3430532 -5798190 3430591 -5798150 3430668 -5798109 3430724 -5798089 3430797 -5798068 3430857 -5798056 3430913 -5798052 3430962 -5798049 3431053 -5798053 3431159 -5798059 3431218 -5798061 3431367 -5798056 3431474 -5798044 3431568 -5798029 3431645 -5798013 -line_04|M 3429563 -5799491 l 188 291 74 121 76 117 94 139 77 103 143 161 56 70 122 161 70 77 69 61 59 41 76 41 56 20 74 21 60 12 55 5 49 3 91 -5 106 -6 59 -2 148 5 108 12 94 16 77 16 -polygon_01|M 3429857.62 -5799440.07 L 3429873.86 -5799496.16 3429904.86 -5799503.55 3429972.77 -5799561.12 3430034.77 -5799577.36 3430031.82 -5799639.36 3430139.59 -5799691.03 3430146.97 -5799724.99 3430271.57 -5799792.88 3430289.29 -5799776.64 3430312.91 -5799662.95 3430416.27 -5799710.2 3430419.22 -5799614.22 3430268.61 -5799612.75 3430291.3 -5799203.76 3430255.86 -5799175.7 3430214.51 -5799347 3430183.49 -5799355.87 3430180.54 -5799366.2 3430146.57 -5799367.68 3430142.14 -5799349.96 3430065.35 -5799375.06 3429961.97 -5799426.75 Z -polygon_02|M 3429857.62 -5799440.07 l 16.24 -56.09 31 -7.39 67.91 -57.57 62 -16.24 -2.95 -62 107.77 -51.67 7.38 -33.96 124.6 -67.89 17.72 16.24 23.62 113.69 103.36 -47.25 2.95 95.98 -150.61 1.47 22.69 408.99 -35.44 28.06 -41.35 -171.3 -31.02 -8.87 -2.95 -10.33 -33.97 -1.48 -4.43 17.72 -76.79 -25.1 -103.38 -51.69 z -polygon_03|M 3429858 -5799440 L 3429874 -5799496 3429905 -5799504 3429973 -5799561 3430035 -5799577 3430032 -5799639 3430140 -5799691 3430147 -5799725 3430272 -5799793 3430289 -5799777 3430313 -5799663 3430416 -5799710 3430419 -5799614 3430269 -5799613 3430291 -5799204 3430256 -5799176 3430215 -5799347 3430183 -5799356 3430181 -5799366 3430147 -5799368 3430142 -5799350 3430065 -5799375 3429962 -5799427 Z -polygon_04|M 3429858 -5799440 l 16 -56 31 -7 68 -58 62 -16 -3 -62 108 -52 7 -34 125 -68 18 16 24 114 103 -47 3 96 -151 1 23 409 -35 28 -41 -171 -31 -9 -3 -10 -34 -1 -4 18 -77 -25 -103 -52 z -multipoint_01|cx="3433276.43" cy="-5795308.93",cx="3428545.3" cy="-5795827.75",cx="3431576.99" cy="-5799084.19",cx="3431724.2" cy="-5797152.59",cx="3431984.2" cy="-5796564.79",cx="3435147.61" cy="-5797649.58",cx="3434660.86" cy="-5796941.74",cx="3434674.52" cy="-5797030.54",cx="3435714.36" cy="-5797022.6",cx="3436368.88" cy="-5796951.04",cx="3436730.03" cy="-5796768.6",cx="3435538.55" cy="-5796267.1",cx="3435847.22" cy="-5795917.96",cx="3434312.09" cy="-5794846.02",cx="3433121.69" cy="-5793670.73",cx="3433176.36" cy="-5793489.29",cx="3434316.04" cy="-5793940.09",cx="3433222.92" cy="-5793040.49",cx="3433416.13" cy="-5792891.62",cx="3430717.47" cy="-5792600.58",cx="3435384.08" cy="-5792877.68",cx="3435229.15" cy="-5792177.25",cx="3435120" cy="-5792319.07",cx="3435088.72" cy="-5792111.21",cx="3434484.89" cy="-5792110.2",cx="3435777.91" cy="-5792419.49",cx="3435717.37" cy="-5794318.12",cx="3436895.13" cy="-5794569.43",cx="3437621.86" cy="-5793931.6",cx="3435597.14" cy="-5793467.9",cx="3435246.51" cy="-5793394.63",cx="3434722.1" cy="-5793374.87",cx="3434712.16" cy="-5793810.3",cx="3434773.28" cy="-5793816.87",cx="3434629.91" cy="-5793855.31",cx="3434992.34" cy="-5794140.1",cx="3434927.13" cy="-5794252.29",cx="3434958.58" cy="-5794286.16",cx="3435120.48" cy="-5794163.36",cx="3435850.1" cy="-5791727.49",cx="3435930.75" cy="-5791636.32",cx="3436268.87" cy="-5791882.68",cx="3437110.23" cy="-5791664.12",cx="3435960.34" cy="-5790928.2",cx="3433545.81" cy="-5789755.43",cx="3439096.86" cy="-5790884.26",cx="3438576.87" cy="-5795046.69",cx="3438396.95" cy="-5794858.59",cx="3438193.25" cy="-5794695.6",cx="3438447.92" cy="-5796130.77",cx="3440688.22" cy="-5793670.37" -multipoint_02|x="3433276.43" y="-5795308.93",x="3428545.3" y="-5795827.75",x="3431576.99" y="-5799084.19",x="3431724.2" y="-5797152.59",x="3431984.2" y="-5796564.79",x="3435147.61" y="-5797649.58",x="3434660.86" y="-5796941.74",x="3434674.52" y="-5797030.54",x="3435714.36" y="-5797022.6",x="3436368.88" y="-5796951.04",x="3436730.03" y="-5796768.6",x="3435538.55" y="-5796267.1",x="3435847.22" y="-5795917.96",x="3434312.09" y="-5794846.02",x="3433121.69" y="-5793670.73",x="3433176.36" y="-5793489.29",x="3434316.04" y="-5793940.09",x="3433222.92" y="-5793040.49",x="3433416.13" y="-5792891.62",x="3430717.47" y="-5792600.58",x="3435384.08" y="-5792877.68",x="3435229.15" y="-5792177.25",x="3435120" y="-5792319.07",x="3435088.72" y="-5792111.21",x="3434484.89" y="-5792110.2",x="3435777.91" y="-5792419.49",x="3435717.37" y="-5794318.12",x="3436895.13" y="-5794569.43",x="3437621.86" y="-5793931.6",x="3435597.14" y="-5793467.9",x="3435246.51" y="-5793394.63",x="3434722.1" y="-5793374.87",x="3434712.16" y="-5793810.3",x="3434773.28" y="-5793816.87",x="3434629.91" y="-5793855.31",x="3434992.34" y="-5794140.1",x="3434927.13" y="-5794252.29",x="3434958.58" y="-5794286.16",x="3435120.48" y="-5794163.36",x="3435850.1" y="-5791727.49",x="3435930.75" y="-5791636.32",x="3436268.87" y="-5791882.68",x="3437110.23" y="-5791664.12",x="3435960.34" y="-5790928.2",x="3433545.81" y="-5789755.43",x="3439096.86" y="-5790884.26",x="3438576.87" y="-5795046.69",x="3438396.95" y="-5794858.59",x="3438193.25" y="-5794695.6",x="3438447.92" y="-5796130.77",x="3440688.22" y="-5793670.37" -multipoint_03|cx="3433276" cy="-5795309",cx="3428545" cy="-5795828",cx="3431577" cy="-5799084",cx="3431724" cy="-5797153",cx="3431984" cy="-5796565",cx="3435148" cy="-5797650",cx="3434661" cy="-5796942",cx="3434675" cy="-5797031",cx="3435714" cy="-5797023",cx="3436369" cy="-5796951",cx="3436730" cy="-5796769",cx="3435539" cy="-5796267",cx="3435847" cy="-5795918",cx="3434312" cy="-5794846",cx="3433122" cy="-5793671",cx="3433176" cy="-5793489",cx="3434316" cy="-5793940",cx="3433223" cy="-5793040",cx="3433416" cy="-5792892",cx="3430717" cy="-5792601",cx="3435384" cy="-5792878",cx="3435229" cy="-5792177",cx="3435120" cy="-5792319",cx="3435089" cy="-5792111",cx="3434485" cy="-5792110",cx="3435778" cy="-5792419",cx="3435717" cy="-5794318",cx="3436895" cy="-5794569",cx="3437622" cy="-5793932",cx="3435597" cy="-5793468",cx="3435247" cy="-5793395",cx="3434722" cy="-5793375",cx="3434712" cy="-5793810",cx="3434773" cy="-5793817",cx="3434630" cy="-5793855",cx="3434992" cy="-5794140",cx="3434927" cy="-5794252",cx="3434959" cy="-5794286",cx="3435120" cy="-5794163",cx="3435850" cy="-5791727",cx="3435931" cy="-5791636",cx="3436269" cy="-5791883",cx="3437110" cy="-5791664",cx="3435960" cy="-5790928",cx="3433546" cy="-5789755",cx="3439097" cy="-5790884",cx="3438577" cy="-5795047",cx="3438397" cy="-5794859",cx="3438193" cy="-5794696",cx="3438448" cy="-5796131",cx="3440688" cy="-5793670" -multipoint_04|x="3433276" y="-5795309",x="3428545" y="-5795828",x="3431577" y="-5799084",x="3431724" y="-5797153",x="3431984" y="-5796565",x="3435148" y="-5797650",x="3434661" y="-5796942",x="3434675" y="-5797031",x="3435714" y="-5797023",x="3436369" y="-5796951",x="3436730" y="-5796769",x="3435539" y="-5796267",x="3435847" y="-5795918",x="3434312" y="-5794846",x="3433122" y="-5793671",x="3433176" y="-5793489",x="3434316" y="-5793940",x="3433223" y="-5793040",x="3433416" y="-5792892",x="3430717" y="-5792601",x="3435384" y="-5792878",x="3435229" y="-5792177",x="3435120" y="-5792319",x="3435089" y="-5792111",x="3434485" y="-5792110",x="3435778" y="-5792419",x="3435717" y="-5794318",x="3436895" y="-5794569",x="3437622" y="-5793932",x="3435597" y="-5793468",x="3435247" y="-5793395",x="3434722" y="-5793375",x="3434712" y="-5793810",x="3434773" y="-5793817",x="3434630" y="-5793855",x="3434992" y="-5794140",x="3434927" y="-5794252",x="3434959" y="-5794286",x="3435120" y="-5794163",x="3435850" y="-5791727",x="3435931" y="-5791636",x="3436269" y="-5791883",x="3437110" y="-5791664",x="3435960" y="-5790928",x="3433546" y="-5789755",x="3439097" y="-5790884",x="3438577" y="-5795047",x="3438397" y="-5794859",x="3438193" y="-5794696",x="3438448" y="-5796131",x="3440688" y="-5793670" -multiline_01|M 3429562.6 -5799490.68 L 3429750.99 -5799199.87 3429825.45 -5799078.39 3429901.8 -5798961.45 3429995.54 -5798822.93 3430072.89 -5798719.46 3430216 -5798558.95 3430272.08 -5798489.33 3430393.87 -5798328.51 3430463.53 -5798251.11 3430532.22 -5798190.16 3430591.24 -5798149.53 3430667.67 -5798108.9 3430723.78 -5798088.58 3430797.33 -5798067.95 3430857.34 -5798056.34 3430912.52 -5798051.5 3430961.89 -5798048.59 3431052.88 -5798053.43 3431159.36 -5798059.24 3431218.41 -5798061.18 3431366.56 -5798056.09 3431474.07 -5798044.47 3431568.02 -5798028.97 3431644.53 -5798012.51 M 3433260.06 -5797002.92 L 3433234.61 -5797070.25 3433138.56 -5797278.81 3433074.19 -5797398.94 3433033.73 -5797461.79 3432961.43 -5797551.84 3432882.76 -5797626.57 3432780.32 -5797701.09 3432706.28 -5797743.23 3432542.66 -5797808.05 3432360.32 -5797842.47 3432258.52 -5797836.77 3432197.62 -5797837.57 3432081.75 -5797865.64 3431876.6 -5797945.1 3431865.15 -5797948.73 M 3431865.15 -5797948.73 L 3431644.53 -5798012.51 M 3431865.15 -5797948.73 L 3431815.75 -5797807.76 M 3433260.06 -5797002.92 L 3433361.19 -5796788.54 3433467.4 -5796572.78 3433670.6 -5796160.06 M 3433670.6 -5796160.06 L 3433709.27 -5796096.88 3433744.46 -5796021.84 3433861.98 -5795869.38 3434029.1 -5795680.43 3434229.42 -5795456.34 3434239.36 -5795425.11 3434296.02 -5795363.18 -multiline_02|M 3429562.6 -5799490.68 l 188.39 290.81 74.46 121.48 76.35 116.94 93.74 138.52 77.35 103.47 143.11 160.51 56.08 69.62 121.79 160.82 69.66 77.4 68.69 60.95 59.02 40.63 76.43 40.63 56.11 20.32 73.55 20.63 60.01 11.61 55.18 4.84 49.37 2.91 90.99 -4.84 106.48 -5.81 59.05 -1.94 148.15 5.09 107.51 11.62 93.95 15.5 76.51 16.46 M 3433260.06 -5797002.92 l -25.45 -67.33 -96.05 -208.56 -64.37 -120.13 -40.46 -62.85 -72.3 -90.05 -78.67 -74.73 -102.44 -74.52 -74.04 -42.14 -163.62 -64.82 -182.34 -34.42 -101.8 5.7 -60.9 -0.8 -115.87 -28.07 -205.15 -79.46 -11.45 -3.63 M 3431865.15 -5797948.73 l -220.62 -63.78 M 3431865.15 -5797948.73 l -49.4 140.97 M 3433260.06 -5797002.92 l 101.13 214.38 106.21 215.76 203.2 412.72 M 3433670.6 -5796160.06 l 38.67 63.18 35.19 75.04 117.52 152.46 167.12 188.95 200.32 224.09 9.94 31.23 56.66 61.93 -multiline_03|M 3429563 -5799491 L 3429751 -5799200 3429825 -5799078 3429902 -5798961 3429996 -5798823 3430073 -5798719 3430216 -5798559 3430272 -5798489 3430394 -5798329 3430464 -5798251 3430532 -5798190 3430591 -5798150 3430668 -5798109 3430724 -5798089 3430797 -5798068 3430857 -5798056 3430913 -5798052 3430962 -5798049 3431053 -5798053 3431159 -5798059 3431218 -5798061 3431367 -5798056 3431474 -5798044 3431568 -5798029 3431645 -5798013 M 3433260 -5797003 L 3433235 -5797070 3433139 -5797279 3433074 -5797399 3433034 -5797462 3432961 -5797552 3432883 -5797627 3432780 -5797701 3432706 -5797743 3432543 -5797808 3432360 -5797842 3432259 -5797837 3432198 -5797838 3432082 -5797866 3431877 -5797945 3431865 -5797949 M 3431865 -5797949 L 3431645 -5798013 M 3431865 -5797949 L 3431816 -5797808 M 3433260 -5797003 L 3433361 -5796789 3433467 -5796573 3433671 -5796160 M 3433671 -5796160 L 3433709 -5796097 3433744 -5796022 3433862 -5795869 3434029 -5795680 3434229 -5795456 3434239 -5795425 3434296 -5795363 -multiline_04|M 3429563 -5799491 l 188 291 74 121 76 117 94 139 77 103 143 161 56 70 122 161 70 77 69 61 59 41 76 41 56 20 74 21 60 12 55 5 49 3 91 -5 106 -6 59 -2 148 5 108 12 94 16 77 16 M 3433260 -5797003 l -25 -67 -96 -209 -64 -120 -40 -63 -72 -90 -79 -75 -102 -75 -74 -42 -164 -65 -182 -34 -102 6 -61 -1 -116 -28 -205 -79 -11 -4 M 3431865 -5797949 l -221 -64 M 3431865 -5797949 l -49 141 M 3433260 -5797003 l 101 214 106 216 203 413 M 3433671 -5796160 l 39 63 35 75 118 152 167 189 200 224 10 31 57 62 -multipolygon_01|M 3429699.81 -5795851.64 L 3429736.72 -5795796.01 3429754.71 -5795768.88 3429996.1 -5795489.98 3430100.67 -5795435.76 3430122.61 -5795446.09 3430138.1 -5795560.98 3430311.09 -5795559.69 3430309.8 -5795470.62 3430329.16 -5795416.4 3430326.58 -5795399.62 3430157.47 -5795418.98 3430156.14 -5795407.32 3430139.36 -5795396.99 3429983.19 -5795394.41 3429976.74 -5795420.22 3429789.59 -5795418.93 3429643.74 -5795475.72 3429635.72 -5795615.31 3429484.94 -5795556.38 3429315.44 -5795496.32 3429326.12 -5795748.57 3429129.92 -5795704.53 3429176.64 -5795776.6 3429100.6 -5795797.17 3428900.44 -5795742.46 3428896.43 -5795779.82 3428805.69 -5795953.3 3428897.77 -5796025.35 3428897.77 -5796225.99 3428696.32 -5796199.31 3428681.64 -5796217.99 3428680.31 -5796290.03 3428290.14 -5796351.8 3428389.67 -5796413.87 3428837.71 -5796561.12 3428991.08 -5796495.01 3429076.4 -5796760.29 3429428.31 -5796723.61 3429474.96 -5796690.29 3429696.2 -5796600.99 3429658.88 -5796429.06 3429536.27 -5796363.75 3429529.6 -5796333.1 3429446.08 -5796253.84 Z M 3429857.62 -5799440.07 L 3429873.86 -5799496.16 3429904.86 -5799503.55 3429972.77 -5799561.12 3430034.77 -5799577.36 3430031.82 -5799639.36 3430139.59 -5799691.03 3430146.97 -5799724.99 3430271.57 -5799792.88 3430289.29 -5799776.64 3430312.91 -5799662.95 3430416.27 -5799710.2 3430419.22 -5799614.22 3430268.61 -5799612.75 3430291.3 -5799203.76 3430255.86 -5799175.7 3430214.51 -5799347 3430183.49 -5799355.87 3430180.54 -5799366.2 3430146.57 -5799367.68 3430142.14 -5799349.96 3430065.35 -5799375.06 3429961.97 -5799426.75 Z -multipolygon_02|M 3429699.81 -5795851.64 l 36.91 55.63 17.99 27.13 241.39 278.9 104.57 54.22 21.94 -10.33 15.49 -114.89 172.99 1.29 -1.29 89.07 19.36 54.22 -2.58 16.78 -169.11 -19.36 -1.33 11.66 -16.78 10.33 -156.17 2.58 -6.45 -25.81 -187.15 1.29 -145.85 -56.79 -8.02 -139.59 -150.78 58.93 -169.5 60.06 10.68 -252.25 -196.2 44.04 46.72 -72.07 -76.04 -20.57 -200.16 54.71 -4.01 -37.36 -90.74 -173.48 92.08 -72.05 0 -200.64 -201.45 26.68 -14.68 -18.68 -1.33 -72.04 -390.17 -61.77 99.53 -62.07 448.04 -147.25 153.37 66.11 85.32 -265.28 351.91 36.68 46.65 33.32 221.24 89.3 -37.32 171.93 -122.61 65.31 -6.67 30.65 -83.52 79.26 z M 3429857.62 -5799440.07 l 16.24 -56.09 31 -7.39 67.91 -57.57 62 -16.24 -2.95 -62 107.77 -51.67 7.38 -33.96 124.6 -67.89 17.72 16.24 23.62 113.69 103.36 -47.25 2.95 95.98 -150.61 1.47 22.69 408.99 -35.44 28.06 -41.35 -171.3 -31.02 -8.87 -2.95 -10.33 -33.97 -1.48 -4.43 17.72 -76.79 -25.1 -103.38 -51.69 z -multipolygon_03|M 3429700 -5795852 L 3429737 -5795796 3429755 -5795769 3429996 -5795490 3430101 -5795436 3430123 -5795446 3430138 -5795561 3430311 -5795560 3430310 -5795471 3430329 -5795416 3430327 -5795400 3430157 -5795419 3430156 -5795407 3430139 -5795397 3429983 -5795394 3429977 -5795420 3429790 -5795419 3429644 -5795476 3429636 -5795615 3429485 -5795556 3429315 -5795496 3429326 -5795749 3429130 -5795705 3429177 -5795777 3429101 -5795797 3428900 -5795742 3428896 -5795780 3428806 -5795953 3428898 -5796025 3428898 -5796226 3428696 -5796199 3428682 -5796218 3428680 -5796290 3428290 -5796352 3428390 -5796414 3428838 -5796561 3428991 -5796495 3429076 -5796760 3429428 -5796724 3429475 -5796690 3429696 -5796601 3429659 -5796429 3429536 -5796364 3429530 -5796333 3429446 -5796254 Z M 3429858 -5799440 L 3429874 -5799496 3429905 -5799504 3429973 -5799561 3430035 -5799577 3430032 -5799639 3430140 -5799691 3430147 -5799725 3430272 -5799793 3430289 -5799777 3430313 -5799663 3430416 -5799710 3430419 -5799614 3430269 -5799613 3430291 -5799204 3430256 -5799176 3430215 -5799347 3430183 -5799356 3430181 -5799366 3430147 -5799368 3430142 -5799350 3430065 -5799375 3429962 -5799427 Z -multipolygon_04|M 3429700 -5795852 l 37 56 18 27 241 279 105 54 22 -10 15 -115 173 1 -1 89 19 54 -3 17 -169 -19 -1 12 -17 10 -156 3 -6 -26 -187 1 -146 -57 -8 -140 -151 59 -170 60 11 -252 -196 44 47 -72 -76 -21 -200 55 -4 -37 -91 -173 92 -72 0 -201 -201 27 -15 -19 -1 -72 -390 -62 100 -62 448 -147 153 66 85 -265 352 37 47 33 221 89 -37 172 -123 65 -7 31 -84 79 z M 3429858 -5799440 l 16 -56 31 -7 68 -58 62 -16 -3 -62 108 -52 7 -34 125 -68 18 16 24 114 103 -47 3 96 -151 1 23 409 -35 28 -41 -171 -31 -9 -3 -10 -34 -1 -4 18 -77 -25 -103 -52 z -geometrycollection_01|cx="3433276.43" cy="-5795308.93",cx="3428545.3" cy="-5795827.75",cx="3431576.99" cy="-5799084.19",cx="3431724.2" cy="-5797152.59",cx="3431984.2" cy="-5796564.79",cx="3435147.61" cy="-5797649.58",cx="3434660.86" cy="-5796941.74",cx="3434674.52" cy="-5797030.54",cx="3435714.36" cy="-5797022.6",cx="3436368.88" cy="-5796951.04",cx="3436730.03" cy="-5796768.6",cx="3435538.55" cy="-5796267.1",cx="3435847.22" cy="-5795917.96",cx="3434312.09" cy="-5794846.02",cx="3433121.69" cy="-5793670.73",cx="3433176.36" cy="-5793489.29",cx="3434316.04" cy="-5793940.09",cx="3433222.92" cy="-5793040.49",cx="3433416.13" cy="-5792891.62",cx="3430717.47" cy="-5792600.58",cx="3435384.08" cy="-5792877.68",cx="3435229.15" cy="-5792177.25",cx="3435120" cy="-5792319.07",cx="3435088.72" cy="-5792111.21",cx="3434484.89" cy="-5792110.2",cx="3435777.91" cy="-5792419.49",cx="3435717.37" cy="-5794318.12",cx="3436895.13" cy="-5794569.43",cx="3437621.86" cy="-5793931.6",cx="3435597.14" cy="-5793467.9",cx="3435246.51" cy="-5793394.63",cx="3434722.1" cy="-5793374.87",cx="3434712.16" cy="-5793810.3",cx="3434773.28" cy="-5793816.87",cx="3434629.91" cy="-5793855.31",cx="3434992.34" cy="-5794140.1",cx="3434927.13" cy="-5794252.29",cx="3434958.58" cy="-5794286.16",cx="3435120.48" cy="-5794163.36",cx="3435850.1" cy="-5791727.49",cx="3435930.75" cy="-5791636.32",cx="3436268.87" cy="-5791882.68",cx="3437110.23" cy="-5791664.12",cx="3435960.34" cy="-5790928.2",cx="3433545.81" cy="-5789755.43",cx="3439096.86" cy="-5790884.26",cx="3438576.87" cy="-5795046.69",cx="3438396.95" cy="-5794858.59",cx="3438193.25" cy="-5794695.6",cx="3438447.92" cy="-5796130.77",cx="3440688.22" cy="-5793670.37";M 3429562.6 -5799490.68 L 3429750.99 -5799199.87 3429825.45 -5799078.39 3429901.8 -5798961.45 3429995.54 -5798822.93 3430072.89 -5798719.46 3430216 -5798558.95 3430272.08 -5798489.33 3430393.87 -5798328.51 3430463.53 -5798251.11 3430532.22 -5798190.16 3430591.24 -5798149.53 3430667.67 -5798108.9 3430723.78 -5798088.58 3430797.33 -5798067.95 3430857.34 -5798056.34 3430912.52 -5798051.5 3430961.89 -5798048.59 3431052.88 -5798053.43 3431159.36 -5798059.24 3431218.41 -5798061.18 3431366.56 -5798056.09 3431474.07 -5798044.47 3431568.02 -5798028.97 3431644.53 -5798012.51 M 3433260.06 -5797002.92 L 3433234.61 -5797070.25 3433138.56 -5797278.81 3433074.19 -5797398.94 3433033.73 -5797461.79 3432961.43 -5797551.84 3432882.76 -5797626.57 3432780.32 -5797701.09 3432706.28 -5797743.23 3432542.66 -5797808.05 3432360.32 -5797842.47 3432258.52 -5797836.77 3432197.62 -5797837.57 3432081.75 -5797865.64 3431876.6 -5797945.1 3431865.15 -5797948.73 M 3431865.15 -5797948.73 L 3431644.53 -5798012.51 M 3431865.15 -5797948.73 L 3431815.75 -5797807.76 M 3433260.06 -5797002.92 L 3433361.19 -5796788.54 3433467.4 -5796572.78 3433670.6 -5796160.06 M 3433670.6 -5796160.06 L 3433709.27 -5796096.88 3433744.46 -5796021.84 3433861.98 -5795869.38 3434029.1 -5795680.43 3434229.42 -5795456.34 3434239.36 -5795425.11 3434296.02 -5795363.18 -geometrycollection_02|x="3433276.43" y="-5795308.93",x="3428545.3" y="-5795827.75",x="3431576.99" y="-5799084.19",x="3431724.2" y="-5797152.59",x="3431984.2" y="-5796564.79",x="3435147.61" y="-5797649.58",x="3434660.86" y="-5796941.74",x="3434674.52" y="-5797030.54",x="3435714.36" y="-5797022.6",x="3436368.88" y="-5796951.04",x="3436730.03" y="-5796768.6",x="3435538.55" y="-5796267.1",x="3435847.22" y="-5795917.96",x="3434312.09" y="-5794846.02",x="3433121.69" y="-5793670.73",x="3433176.36" y="-5793489.29",x="3434316.04" y="-5793940.09",x="3433222.92" y="-5793040.49",x="3433416.13" y="-5792891.62",x="3430717.47" y="-5792600.58",x="3435384.08" y="-5792877.68",x="3435229.15" y="-5792177.25",x="3435120" y="-5792319.07",x="3435088.72" y="-5792111.21",x="3434484.89" y="-5792110.2",x="3435777.91" y="-5792419.49",x="3435717.37" y="-5794318.12",x="3436895.13" y="-5794569.43",x="3437621.86" y="-5793931.6",x="3435597.14" y="-5793467.9",x="3435246.51" y="-5793394.63",x="3434722.1" y="-5793374.87",x="3434712.16" y="-5793810.3",x="3434773.28" y="-5793816.87",x="3434629.91" y="-5793855.31",x="3434992.34" y="-5794140.1",x="3434927.13" y="-5794252.29",x="3434958.58" y="-5794286.16",x="3435120.48" y="-5794163.36",x="3435850.1" y="-5791727.49",x="3435930.75" y="-5791636.32",x="3436268.87" y="-5791882.68",x="3437110.23" y="-5791664.12",x="3435960.34" y="-5790928.2",x="3433545.81" y="-5789755.43",x="3439096.86" y="-5790884.26",x="3438576.87" y="-5795046.69",x="3438396.95" y="-5794858.59",x="3438193.25" y="-5794695.6",x="3438447.92" y="-5796130.77",x="3440688.22" y="-5793670.37";M 3429562.6 -5799490.68 l 188.39 290.81 74.46 121.48 76.35 116.94 93.74 138.52 77.35 103.47 143.11 160.51 56.08 69.62 121.79 160.82 69.66 77.4 68.69 60.95 59.02 40.63 76.43 40.63 56.11 20.32 73.55 20.63 60.01 11.61 55.18 4.84 49.37 2.91 90.99 -4.84 106.48 -5.81 59.05 -1.94 148.15 5.09 107.51 11.62 93.95 15.5 76.51 16.46 M 3433260.06 -5797002.92 l -25.45 -67.33 -96.05 -208.56 -64.37 -120.13 -40.46 -62.85 -72.3 -90.05 -78.67 -74.73 -102.44 -74.52 -74.04 -42.14 -163.62 -64.82 -182.34 -34.42 -101.8 5.7 -60.9 -0.8 -115.87 -28.07 -205.15 -79.46 -11.45 -3.63 M 3431865.15 -5797948.73 l -220.62 -63.78 M 3431865.15 -5797948.73 l -49.4 140.97 M 3433260.06 -5797002.92 l 101.13 214.38 106.21 215.76 203.2 412.72 M 3433670.6 -5796160.06 l 38.67 63.18 35.19 75.04 117.52 152.46 167.12 188.95 200.32 224.09 9.94 31.23 56.66 61.93 -geometrycollection_03|cx="3433276" cy="-5795309",cx="3428545" cy="-5795828",cx="3431577" cy="-5799084",cx="3431724" cy="-5797153",cx="3431984" cy="-5796565",cx="3435148" cy="-5797650",cx="3434661" cy="-5796942",cx="3434675" cy="-5797031",cx="3435714" cy="-5797023",cx="3436369" cy="-5796951",cx="3436730" cy="-5796769",cx="3435539" cy="-5796267",cx="3435847" cy="-5795918",cx="3434312" cy="-5794846",cx="3433122" cy="-5793671",cx="3433176" cy="-5793489",cx="3434316" cy="-5793940",cx="3433223" cy="-5793040",cx="3433416" cy="-5792892",cx="3430717" cy="-5792601",cx="3435384" cy="-5792878",cx="3435229" cy="-5792177",cx="3435120" cy="-5792319",cx="3435089" cy="-5792111",cx="3434485" cy="-5792110",cx="3435778" cy="-5792419",cx="3435717" cy="-5794318",cx="3436895" cy="-5794569",cx="3437622" cy="-5793932",cx="3435597" cy="-5793468",cx="3435247" cy="-5793395",cx="3434722" cy="-5793375",cx="3434712" cy="-5793810",cx="3434773" cy="-5793817",cx="3434630" cy="-5793855",cx="3434992" cy="-5794140",cx="3434927" cy="-5794252",cx="3434959" cy="-5794286",cx="3435120" cy="-5794163",cx="3435850" cy="-5791727",cx="3435931" cy="-5791636",cx="3436269" cy="-5791883",cx="3437110" cy="-5791664",cx="3435960" cy="-5790928",cx="3433546" cy="-5789755",cx="3439097" cy="-5790884",cx="3438577" cy="-5795047",cx="3438397" cy="-5794859",cx="3438193" cy="-5794696",cx="3438448" cy="-5796131",cx="3440688" cy="-5793670";M 3429563 -5799491 L 3429751 -5799200 3429825 -5799078 3429902 -5798961 3429996 -5798823 3430073 -5798719 3430216 -5798559 3430272 -5798489 3430394 -5798329 3430464 -5798251 3430532 -5798190 3430591 -5798150 3430668 -5798109 3430724 -5798089 3430797 -5798068 3430857 -5798056 3430913 -5798052 3430962 -5798049 3431053 -5798053 3431159 -5798059 3431218 -5798061 3431367 -5798056 3431474 -5798044 3431568 -5798029 3431645 -5798013 M 3433260 -5797003 L 3433235 -5797070 3433139 -5797279 3433074 -5797399 3433034 -5797462 3432961 -5797552 3432883 -5797627 3432780 -5797701 3432706 -5797743 3432543 -5797808 3432360 -5797842 3432259 -5797837 3432198 -5797838 3432082 -5797866 3431877 -5797945 3431865 -5797949 M 3431865 -5797949 L 3431645 -5798013 M 3431865 -5797949 L 3431816 -5797808 M 3433260 -5797003 L 3433361 -5796789 3433467 -5796573 3433671 -5796160 M 3433671 -5796160 L 3433709 -5796097 3433744 -5796022 3433862 -5795869 3434029 -5795680 3434229 -5795456 3434239 -5795425 3434296 -5795363 -geometrycollection_04|x="3433276" y="-5795309",x="3428545" y="-5795828",x="3431577" y="-5799084",x="3431724" y="-5797153",x="3431984" y="-5796565",x="3435148" y="-5797650",x="3434661" y="-5796942",x="3434675" y="-5797031",x="3435714" y="-5797023",x="3436369" y="-5796951",x="3436730" y="-5796769",x="3435539" y="-5796267",x="3435847" y="-5795918",x="3434312" y="-5794846",x="3433122" y="-5793671",x="3433176" y="-5793489",x="3434316" y="-5793940",x="3433223" y="-5793040",x="3433416" y="-5792892",x="3430717" y="-5792601",x="3435384" y="-5792878",x="3435229" y="-5792177",x="3435120" y="-5792319",x="3435089" y="-5792111",x="3434485" y="-5792110",x="3435778" y="-5792419",x="3435717" y="-5794318",x="3436895" y="-5794569",x="3437622" y="-5793932",x="3435597" y="-5793468",x="3435247" y="-5793395",x="3434722" y="-5793375",x="3434712" y="-5793810",x="3434773" y="-5793817",x="3434630" y="-5793855",x="3434992" y="-5794140",x="3434927" y="-5794252",x="3434959" y="-5794286",x="3435120" y="-5794163",x="3435850" y="-5791727",x="3435931" y="-5791636",x="3436269" y="-5791883",x="3437110" y="-5791664",x="3435960" y="-5790928",x="3433546" y="-5789755",x="3439097" y="-5790884",x="3438577" y="-5795047",x="3438397" y="-5794859",x="3438193" y="-5794696",x="3438448" y="-5796131",x="3440688" y="-5793670";M 3429563 -5799491 l 188 291 74 121 76 117 94 139 77 103 143 161 56 70 122 161 70 77 69 61 59 41 76 41 56 20 74 21 60 12 55 5 49 3 91 -5 106 -6 59 -2 148 5 108 12 94 16 77 16 M 3433260 -5797003 l -25 -67 -96 -209 -64 -120 -40 -63 -72 -90 -79 -75 -102 -75 -74 -42 -164 -65 -182 -34 -102 6 -61 -1 -116 -28 -205 -79 -11 -4 M 3431865 -5797949 l -221 -64 M 3431865 -5797949 l -49 141 M 3433260 -5797003 l 101 214 106 216 203 413 M 3433671 -5796160 l 39 63 35 75 118 152 167 189 200 224 10 31 57 62 -ERROR: ST_AsSVG: 'CircularString' geometry type not supported. -ERROR: ST_AsSVG: 'CompoundString' geometry type not supported. -ERROR: ST_AsSVG: 'CurvePolygon' geometry type not supported. -ERROR: ST_AsSVG: 'MultiCurve' geometry type not supported. -ERROR: ST_AsSVG: 'MultiSurface' geometry type not supported. -3D_01|cx="1" cy="-1" -3D_02|cx="1" cy="-1" -3D_03|M 1 -1 L 2 -2 3 -3 4 -4 -3D_04|M 1 -1 L 2 -2 3 -3 4 -4 5 -5 5 0 Z -#409|