]> granicus.if.org Git - postgis/commitdiff
Move ST_AsGeoJson from postgis to liblwgeom dir. Use as most as cunit test as possibl...
authorOlivier Courtin <olivier.courtin@camptocamp.com>
Mon, 22 Feb 2010 14:03:19 +0000 (14:03 +0000)
committerOlivier Courtin <olivier.courtin@camptocamp.com>
Mon, 22 Feb 2010 14:03:19 +0000 (14:03 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@5283 b70326c6-7e19-0410-871a-916f4a2858ee

12 files changed:
liblwgeom/Makefile.in
liblwgeom/cunit/Makefile.in
liblwgeom/cunit/cu_out_geojson.c [new file with mode: 0644]
liblwgeom/cunit/cu_out_geojson.h [new file with mode: 0644]
liblwgeom/cunit/cu_tester.c
liblwgeom/cunit/cu_tester.h
liblwgeom/liblwgeom.h
liblwgeom/lwout_geojson.c [new file with mode: 0644]
postgis/geography_inout.c
postgis/lwgeom_geojson.c
regress/geojson.sql
regress/geojson_expected

index 04c155cb19a64b6307becf66c653db2a4cc1c7e5..7e4bc3a9bc9cb6e1426efc6a9c0f2f7b63e8ea88 100644 (file)
@@ -54,7 +54,8 @@ SA_OBJS = \
        lwgeodetic.o \
        lwtree.o \
        lwout_gml.o \
-       lwout_kml.o
+       lwout_kml.o \
+       lwout_geojson.o
 
 NM_OBJS = \
        lwspheroid.o 
index 24ba5aa499bfdf899b56ba7a1c2047640ff74a7f..ee18f3692c57da97813302e42c2a135c35195eee 100644 (file)
@@ -24,6 +24,7 @@ OBJS= \
        cu_homogenize.o \
        cu_out_gml.o \
        cu_out_kml.o \
+       cu_out_geojson.o \
        cu_tester.o 
 
 # If we couldn't find the cunit library then display a helpful message
diff --git a/liblwgeom/cunit/cu_out_geojson.c b/liblwgeom/cunit/cu_out_geojson.c
new file mode 100644 (file)
index 0000000..0c28786
--- /dev/null
@@ -0,0 +1,329 @@
+/**********************************************************************
+ * $Id$
+ *
+ * PostGIS - Spatial Types for PostgreSQL
+ * http://postgis.refractions.net
+ * Copyright 2010 Olivier Courtin <olivier.courtin@oslandia.com>
+ *
+ * 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_geojson.h"
+
+/*
+** Called from test harness to register the tests in this file.
+*/
+CU_pSuite register_out_geojson_suite(void)
+{
+       CU_pSuite pSuite;
+       pSuite = CU_add_suite("GeoJson Out Suite", init_out_geojson_suite, clean_out_geojson_suite);
+       if (NULL == pSuite)
+       {
+               CU_cleanup_registry();
+               return NULL;
+       }
+
+       if (
+           (NULL == CU_add_test(pSuite, "test_precision()", out_geojson_test_precision)) ||
+           (NULL == CU_add_test(pSuite, "test_dims()", out_geojson_test_dims)) ||
+           (NULL == CU_add_test(pSuite, "test_srid()", out_geojson_test_srid)) ||
+           (NULL == CU_add_test(pSuite, "test_bbox()", out_geojson_test_bbox)) ||
+           (NULL == CU_add_test(pSuite, "test_geoms()", out_geojson_test_geoms))
+       )
+       {
+               CU_cleanup_registry();
+               return NULL;
+       }
+       return pSuite;
+}
+
+/*
+** The suite initialization function.
+** Create any re-used objects.
+*/
+int init_out_geojson_suite(void)
+{
+       return 0;
+}
+
+/*
+** The suite cleanup function.
+** Frees any global objects.
+*/
+int clean_out_geojson_suite(void)
+{
+       return 0;
+}
+
+static void do_geojson_test(char * in, char * out, char * srs, int precision, int has_bbox)
+{
+       LWGEOM *g;
+       char * h;
+
+       g = lwgeom_from_ewkt(in, PARSER_CHECK_NONE);
+       h = lwgeom_to_geojson(lwgeom_serialize(g), srs, precision, has_bbox);
+
+       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_geojson_unsupported(char * in, char * out)
+{
+       LWGEOM *g;
+       char *h;
+
+       g = lwgeom_from_ewkt(in, PARSER_CHECK_NONE);
+       h = lwgeom_to_geojson(lwgeom_serialize(g), NULL, 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_geojson_test_precision(void)
+{
+       /* 0 precision, i.e a round */
+       do_geojson_test(
+           "POINT(1.1111111111111 1.1111111111111)",
+           "{\"type\":\"Point\",\"coordinates\":[1,1]}",
+           NULL, 0, 0);
+
+       /* 3 digits precision */
+       do_geojson_test(
+           "POINT(1.1111111111111 1.1111111111111)",
+           "{\"type\":\"Point\",\"coordinates\":[1.111,1.111]}",
+           NULL, 3, 0);
+
+       /* huge digits precision, limit is in fact 15 */
+       do_geojson_test(
+           "POINT(1.2345678901234 1.2345678901234)",
+           "{\"type\":\"Point\",\"coordinates\":[1.23456789,1.23456789]}",
+           NULL, 9, 0);
+
+       /* huge data */
+       do_geojson_test(
+           "POINT(1E300 -1E300)",
+           "{\"type\":\"Point\",\"coordinates\":[1e+300,-1e+300]}",
+           NULL, 0, 0);
+}
+
+
+void out_geojson_test_dims(void)
+{
+       /* 3D */
+       do_geojson_test(
+           "POINT(0 1 2)",
+           "{\"type\":\"Point\",\"coordinates\":[0,1,2]}",
+           NULL, 0, 0);
+
+       /* 3DM */
+       do_geojson_test(
+           "POINTM(0 1 2)",
+           "{\"type\":\"Point\",\"coordinates\":[0,1]}",
+           NULL, 0, 0);
+
+       /* 4D */
+       do_geojson_test(
+           "POINT(0 1 2 3)",
+           "{\"type\":\"Point\",\"coordinates\":[0,1,2]}",
+           NULL, 0, 0);
+}
+
+
+void out_geojson_test_srid(void)
+{
+       /* Linestring */
+       do_geojson_test(
+           "LINESTRING(0 1,2 3,4 5)",
+           "{\"type\":\"LineString\",\"crs\":{\"type\":\"name\",\"properties\":{\"name\":\"EPSG:4326\"}},\"coordinates\":[[0,1],[2,3],[4,5]]}",
+           "EPSG:4326", 0, 0);
+
+       /* Polygon */
+       do_geojson_test(
+           "POLYGON((0 1,2 3,4 5,0 1))",
+           "{\"type\":\"Polygon\",\"crs\":{\"type\":\"name\",\"properties\":{\"name\":\"EPSG:4326\"}},\"coordinates\":[[[0,1],[2,3],[4,5],[0,1]]]}",
+           "EPSG:4326", 0, 0);
+
+       /* Polygon - with internal ring */
+       do_geojson_test(
+           "POLYGON((0 1,2 3,4 5,0 1),(6 7,8 9,10 11,6 7))",
+           "{\"type\":\"Polygon\",\"crs\":{\"type\":\"name\",\"properties\":{\"name\":\"EPSG:4326\"}},\"coordinates\":[[[0,1],[2,3],[4,5],[0,1]],[[6,7],[8,9],[10,11],[6,7]]]}",
+           "EPSG:4326", 0, 0);
+
+       /* Multiline */
+       do_geojson_test(
+           "MULTILINESTRING((0 1,2 3,4 5),(6 7,8 9,10 11))",
+           "{\"type\":\"MultiLineString\",\"crs\":{\"type\":\"name\",\"properties\":{\"name\":\"EPSG:4326\"}},\"coordinates\":[[[0,1],[2,3],[4,5]],[[6,7],[8,9],[10,11]]]}",
+           "EPSG:4326", 0, 0);
+
+       /* MultiPolygon */
+       do_geojson_test(
+           "MULTIPOLYGON(((0 1,2 3,4 5,0 1)),((6 7,8 9,10 11,6 7)))",
+           "{\"type\":\"MultiPolygon\",\"crs\":{\"type\":\"name\",\"properties\":{\"name\":\"EPSG:4326\"}},\"coordinates\":[[[[0,1],[2,3],[4,5],[0,1]]],[[[6,7],[8,9],[10,11],[6,7]]]]}",
+           "EPSG:4326", 0, 0);
+
+       /* GeometryCollection */
+       do_geojson_test(
+           "GEOMETRYCOLLECTION(POINT(0 1),LINESTRING(2 3,4 5))",
+           "{\"type\":\"GeometryCollection\",\"crs\":{\"type\":\"name\",\"properties\":{\"name\":\"EPSG:4326\"}},\"geometries\":[{\"type\":\"Point\",\"coordinates\":[0,1]},{\"type\":\"LineString\",\"coordinates\":[[2,3],[4,5]]}]}",
+           "EPSG:4326", 0, 0);
+
+       /* Empty GeometryCollection */
+       do_geojson_test(
+           "GEOMETRYCOLLECTION EMPTY",
+           "{\"type\":\"GeometryCollection\",\"crs\":{\"type\":\"name\",\"properties\":{\"name\":\"EPSG:4326\"}},\"geometries\":[]}",
+           "EPSG:4326", 0, 0);
+
+       /* Nested GeometryCollection */
+       do_geojson_test(
+           "GEOMETRYCOLLECTION(POINT(0 1),GEOMETRYCOLLECTION(LINESTRING(2 3,4 5)))",
+           "{\"type\":\"GeometryCollection\",\"crs\":{\"type\":\"name\",\"properties\":{\"name\":\"EPSG:4326\"}},\"geometries\":[{\"type\":\"Point\",\"coordinates\":[0,1]},]}",
+           "EPSG:4326", 0, 0);
+}
+
+
+void out_geojson_test_bbox(void)
+{
+       /* Linestring */
+       do_geojson_test(
+           "LINESTRING(0 1,2 3,4 5)",
+           "{\"type\":\"LineString\",\"bbox\":[0,1,4,5],\"coordinates\":[[0,1],[2,3],[4,5]]}",
+           NULL, 0, 1);
+
+       /* Polygon */
+       do_geojson_test(
+           "POLYGON((0 1,2 3,4 5,0 1))",
+           "{\"type\":\"Polygon\",\"bbox\":[0,1,4,5],\"coordinates\":[[[0,1],[2,3],[4,5],[0,1]]]}",
+           NULL, 0, 1);
+
+#if 0
+       /* Polygon - with internal ring */
+       do_geojson_test(
+           "POLYGON((0 1,2 3,4 5,0 1),(6 7,8 9,10 11,6 7))",
+           "{\"type\":\"Polygon\",\"bbox\":[0,1,10,11],\"coordinates\":[[[0,1],[2,3],[4,5],[0,1]],[[6,7],[8,9],[10,11],[6,7]]]}",
+           NULL, 0, 1);
+#endif
+
+       /* Multiline */
+       do_geojson_test(
+           "MULTILINESTRING((0 1,2 3,4 5),(6 7,8 9,10 11))",
+           "{\"type\":\"MultiLineString\",\"bbox\":[0,1,10,11],\"coordinates\":[[[0,1],[2,3],[4,5]],[[6,7],[8,9],[10,11]]]}",
+           NULL, 0, 1);
+
+       /* MultiPolygon */
+       do_geojson_test(
+           "MULTIPOLYGON(((0 1,2 3,4 5,0 1)),((6 7,8 9,10 11,6 7)))",
+           "{\"type\":\"MultiPolygon\",\"bbox\":[0,1,10,11],\"coordinates\":[[[[0,1],[2,3],[4,5],[0,1]]],[[[6,7],[8,9],[10,11],[6,7]]]]}",
+           NULL, 0, 1);
+
+#if 0
+       /* GeometryCollection */
+       do_geojson_test(
+           "GEOMETRYCOLLECTION(POINT(0 1),LINESTRING(2 3,4 5))",
+           "{\"type\":\"GeometryCollection\",\"geometries\":[{\"type\":\"Point\",\"coordinates\":[0,1]},{\"type\":\"LineString\",\"coordinates\":[[2,3],[4,5]]}]}",
+           NULL, 0, 1);
+
+       /* Empty GeometryCollection */
+       do_geojson_test(
+           "GEOMETRYCOLLECTION EMPTY",
+           "{\"type\":\"GeometryCollection\",\"geometries\":[]}",
+           NULL, 0, 1);
+
+       /* Nested GeometryCollection */
+       do_geojson_test(
+           "GEOMETRYCOLLECTION(POINT(0 1),GEOMETRYCOLLECTION(LINESTRING(2 3,4 5)))",
+           "{\"type\":\"GeometryCollection\",\"geometries\":[{\"type\":\"Point\",\"coordinates\":[0,1]},]}",
+           NULL, 0, 1);
+#endif
+}
+
+void out_geojson_test_geoms(void)
+{
+       /* Linestring */
+       do_geojson_test(
+           "LINESTRING(0 1,2 3,4 5)",
+           "{\"type\":\"LineString\",\"coordinates\":[[0,1],[2,3],[4,5]]}",
+           NULL, 0, 0);
+
+       /* Polygon */
+       do_geojson_test(
+           "POLYGON((0 1,2 3,4 5,0 1))",
+           "{\"type\":\"Polygon\",\"coordinates\":[[[0,1],[2,3],[4,5],[0,1]]]}",
+           NULL, 0, 0);
+
+       /* Polygon - with internal ring */
+       do_geojson_test(
+           "POLYGON((0 1,2 3,4 5,0 1),(6 7,8 9,10 11,6 7))",
+           "{\"type\":\"Polygon\",\"coordinates\":[[[0,1],[2,3],[4,5],[0,1]],[[6,7],[8,9],[10,11],[6,7]]]}",
+           NULL, 0, 0);
+
+       /* Multiline */
+       do_geojson_test(
+           "MULTILINESTRING((0 1,2 3,4 5),(6 7,8 9,10 11))",
+           "{\"type\":\"MultiLineString\",\"coordinates\":[[[0,1],[2,3],[4,5]],[[6,7],[8,9],[10,11]]]}",
+           NULL, 0, 0);
+
+       /* MultiPolygon */
+       do_geojson_test(
+           "MULTIPOLYGON(((0 1,2 3,4 5,0 1)),((6 7,8 9,10 11,6 7)))",
+           "{\"type\":\"MultiPolygon\",\"coordinates\":[[[[0,1],[2,3],[4,5],[0,1]]],[[[6,7],[8,9],[10,11],[6,7]]]]}",
+           NULL, 0, 0);
+
+       /* GeometryCollection */
+       do_geojson_test(
+           "GEOMETRYCOLLECTION(POINT(0 1),LINESTRING(2 3,4 5))",
+           "{\"type\":\"GeometryCollection\",\"geometries\":[{\"type\":\"Point\",\"coordinates\":[0,1]},{\"type\":\"LineString\",\"coordinates\":[[2,3],[4,5]]}]}",
+           NULL, 0, 0);
+
+       /* Empty GeometryCollection */
+       do_geojson_test(
+           "GEOMETRYCOLLECTION EMPTY",
+           "{\"type\":\"GeometryCollection\",\"geometries\":[]}",
+           NULL, 0, 0);
+
+       /* Nested GeometryCollection */
+       do_geojson_test(
+           "GEOMETRYCOLLECTION(POINT(0 1),GEOMETRYCOLLECTION(LINESTRING(2 3,4 5)))",
+           "{\"type\":\"GeometryCollection\",\"geometries\":[{\"type\":\"Point\",\"coordinates\":[0,1]},]}",
+           NULL, 0, 0);
+
+       /* CircularString */
+       do_geojson_unsupported(
+           "CIRCULARSTRING(-2 0,0 2,2 0,0 2,2 4)",
+           "lwgeom_to_geojson: 'CircularString' geometry type not supported");
+
+       /* CompoundString */
+       do_geojson_unsupported(
+           "COMPOUNDCURVE(CIRCULARSTRING(0 0,1 1,1 0),(1 0,0 1))",
+           "lwgeom_to_geojson: 'CompoundString' geometry type not supported");
+
+       /* CurvePolygon */
+       do_geojson_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_geojson: 'CurvePolygon' geometry type not supported");
+
+       /* MultiCurve */
+       do_geojson_unsupported(
+           "MULTICURVE((5 5,3 5,3 3,0 3),CIRCULARSTRING(0 0,2 1,2 2))",
+           "lwgeom_to_geojson: 'MultiCurve' geometry type not supported");
+
+       /* GML2 - MultiSurface */
+       do_geojson_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_geojson: 'MultiSurface' geometry type not supported");
+}
diff --git a/liblwgeom/cunit/cu_out_geojson.h b/liblwgeom/cunit/cu_out_geojson.h
new file mode 100644 (file)
index 0000000..99c8c12
--- /dev/null
@@ -0,0 +1,29 @@
+/**********************************************************************
+ * $Id:$
+ *
+ * PostGIS - Spatial Types for PostgreSQL
+ * http://postgis.refractions.net
+ * Copyright 2010 Olivier Courtin <olivier.courtin@oslandia.com>
+ *
+ * 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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "CUnit/Basic.h"
+
+#include "libgeom.h"
+#include "cu_tester.h"
+
+/**********************************************************************/
+
+
+/* Test functions */
+void out_geojson_test_precision(void);
+void out_geojson_test_geoms(void);
+void out_geojson_test_dims(void);
+void out_geojson_test_srid(void);
+void out_geojson_test_bbox(void);
index fd02e7d55cbb354ed77dc8599f1e70fc08d8fb38..6605744ac951ecffffb1399636b36beafbd9a88b 100644 (file)
@@ -120,6 +120,13 @@ int main()
                return CU_get_error();
        }
 
+       /* Add the kml suite to the registry */
+       if (NULL == register_out_geojson_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();
index 1cd146c3f36f37355818194dcce5bb16f69bc4fa..b001eee8ad7e0a93d8c3a744fc84a12db9060e0c 100644 (file)
@@ -9,6 +9,7 @@ CU_pSuite register_cg_suite(void);
 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);
 
 int init_measures_suite(void);
 int init_geodetic_suite(void);
@@ -17,6 +18,7 @@ int init_cg_suite(void);
 int init_homogenize_suite(void);
 int init_out_gml_suite(void);
 int init_out_kml_suite(void);
+int init_out_geojson_suite(void);
 
 int clean_measures_suite(void);
 int clean_geodetic_suite(void);
@@ -25,4 +27,5 @@ int clean_cg_suite(void);
 int clean_homogenize_suite(void);
 int clean_out_gml_suite(void);
 int clean_out_kml_suite(void);
+int clean_out_geojson_suite(void);
 
index f20f75f9d22fcb73e2c2abf75c3ae4dd87e7c40f..e098dac0ccf2b8d073c958616278c33db5c2f105 100644 (file)
@@ -1409,6 +1409,7 @@ extern LWCOLLECTION *lwcollection_segmentize2d(LWCOLLECTION *coll, double dist);
 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 uchar parse_hex(char *str);
diff --git a/liblwgeom/lwout_geojson.c b/liblwgeom/lwout_geojson.c
new file mode 100644 (file)
index 0000000..4e18e79
--- /dev/null
@@ -0,0 +1,812 @@
+/**********************************************************************
+ * $Id: lwgeom_geojson.c 4682 2009-10-27 21:39:35Z colivier $
+ *
+ * PostGIS - Spatial Types for PostgreSQL
+ * http://postgis.refractions.net
+ * Copyright 2001-2003 Refractions Research Inc.
+ * Copyright 2009-2010 Olivier Courtin <olivier.courtin@oslandia.com>
+ *
+ * This is free software; you can redistribute and/or modify it under
+ * the terms of hte GNU General Public Licence. See the COPYING file.
+ *
+ **********************************************************************/
+
+#include "liblwgeom.h"
+#include <math.h>      /* fabs */
+#include <string.h>    /* strlen */
+
+static char *asgeojson_point(LWPOINT *point, char *srs, BOX3D *bbox, int precision);
+static char *asgeojson_line(LWLINE *line, char *srs, BOX3D *bbox, int precision);
+static char *asgeojson_poly(LWPOLY *poly, char *srs, BOX3D *bbox, int precision);
+static char * asgeojson_multipoint(LWGEOM_INSPECTED *insp, char *srs, BOX3D *bbox, int precision);
+static char * asgeojson_multiline(LWGEOM_INSPECTED *insp, char *srs, BOX3D *bbox, int precision);
+static char * asgeojson_multipolygon(LWGEOM_INSPECTED *insp, char *srs, BOX3D *bbox, int precision);
+static char * asgeojson_collection(LWGEOM_INSPECTED *insp, char *srs, BOX3D *bbox, int precision);
+static size_t asgeojson_inspected_size(LWGEOM_INSPECTED *insp, BOX3D *bbox, int precision);
+static size_t asgeojson_inspected_buf(LWGEOM_INSPECTED *insp, char *output, BOX3D *bbox, int precision);
+
+static size_t pointArray_to_geojson(POINTARRAY *pa, char *buf, int precision);
+static size_t pointArray_geojson_size(POINTARRAY *pa, int precision);
+
+/**
+ * Takes a GEOMETRY and returns a GeoJson representation
+ */
+char *
+lwgeom_to_geojson(uchar *geom, char *srs, int precision, int has_bbox)
+{
+       int type;
+       LWPOINT *point;
+       LWLINE *line;
+       LWPOLY *poly;
+       LWGEOM_INSPECTED *insp;
+       BOX3D * bbox = NULL;
+       char * ret = NULL;
+
+       type = lwgeom_getType(geom[0]);
+
+       if (has_bbox) bbox = compute_serialized_box3d(geom);
+
+       switch (type)
+       {
+       case POINTTYPE:
+               point = lwpoint_deserialize(geom);
+               ret = asgeojson_point(point, srs, bbox, precision);
+               break;
+
+       case LINETYPE:
+               line = lwline_deserialize(geom);
+               ret = asgeojson_line(line, srs, bbox, precision);
+               break;
+
+       case POLYGONTYPE:
+               poly = lwpoly_deserialize(geom);
+               ret = asgeojson_poly(poly, srs, bbox, precision);
+               break;
+
+       case MULTIPOINTTYPE:
+               insp = lwgeom_inspect(geom);
+               ret = asgeojson_multipoint(insp, srs, bbox, precision);
+               break;
+
+       case MULTILINETYPE:
+               insp = lwgeom_inspect(geom);
+               ret = asgeojson_multiline(insp, srs, bbox, precision);
+               break;
+
+       case MULTIPOLYGONTYPE:
+               insp = lwgeom_inspect(geom);
+               ret = asgeojson_multipolygon(insp, srs, bbox, precision);
+               break;
+
+       case COLLECTIONTYPE:
+               insp = lwgeom_inspect(geom);
+               ret = asgeojson_collection(insp, srs, bbox, precision);
+               break;
+
+       default:
+               if (bbox)
+               {
+                       lwfree(bbox);
+                       bbox = NULL;
+               }
+               lwerror("lwgeom_to_geojson: '%s' geometry type not supported",
+                       lwgeom_typename(type));
+       }
+
+       if (bbox)
+       {
+               lwfree(bbox);
+               bbox = NULL;
+       }
+
+       return ret;
+}
+
+
+
+/**
+ * Handle SRS
+ */
+static size_t
+asgeojson_srs_size(char *srs)
+{
+       int size;
+
+       size = sizeof("'crs':{'type':'name',");
+       size += sizeof("'properties':{'name':''}},");
+       size += strlen(srs) * sizeof(char);
+
+       return size;
+}
+
+static size_t
+asgeojson_srs_buf(char *output, char *srs)
+{
+       char *ptr = output;
+
+       ptr += sprintf(ptr, "\"crs\":{\"type\":\"name\",");
+       ptr += sprintf(ptr, "\"properties\":{\"name\":\"%s\"}},", srs);
+
+       return (ptr-output);
+}
+
+
+
+/**
+ * Handle Bbox
+ */
+static size_t
+asgeojson_bbox_size(int hasz, int precision)
+{
+       int size;
+
+       if (!hasz)
+       {
+               size = sizeof("\"bbox\":[,,,],");
+               size += 2 * 2 * (OUT_MAX_DIGS_DOUBLE + precision);
+       }
+       else
+       {
+               size = sizeof("\"bbox\":[,,,,,],");
+               size += 2 * 3 * (OUT_MAX_DIGS_DOUBLE + precision);
+       }
+
+       return size;
+}
+
+static size_t
+asgeojson_bbox_buf(char *output, BOX3D *bbox, int hasz, int precision)
+{
+       char *ptr = output;
+
+       if (!hasz)
+               ptr += sprintf(ptr, "\"bbox\":[%.*f,%.*f,%.*f,%.*f],",
+                              precision, bbox->xmin, precision, bbox->ymin,
+                              precision, bbox->xmax, precision, bbox->ymax);
+       else
+               ptr += sprintf(ptr, "\"bbox\":[%.*f,%.*f,%.*f,%.*f,%.*f,%.*f],",
+                              precision, bbox->xmin, precision, bbox->ymin, precision, bbox->zmin,
+                              precision, bbox->xmax, precision, bbox->ymax, precision, bbox->zmax);
+
+       return (ptr-output);
+}
+
+
+
+/**
+ * Point Geometry
+ */
+
+static size_t
+asgeojson_point_size(LWPOINT *point, char *srs, BOX3D *bbox, int precision)
+{
+       int size;
+
+       size = pointArray_geojson_size(point->point, precision);
+       size += sizeof("{'type':'Point',");
+       size += sizeof("'coordinates':}");
+
+       if (srs) size += asgeojson_srs_size(srs);
+       if (bbox) size += asgeojson_bbox_size(TYPE_HASZ(point->type), precision);
+
+       return size;
+}
+
+static size_t
+asgeojson_point_buf(LWPOINT *point, char *srs, char *output, BOX3D *bbox, int precision)
+{
+       char *ptr = output;
+
+       ptr += sprintf(ptr, "{\"type\":\"Point\",");
+       if (srs) ptr += asgeojson_srs_buf(ptr, srs);
+       if (bbox) ptr += asgeojson_bbox_buf(ptr, bbox, TYPE_HASZ(point->type), precision);
+
+       ptr += sprintf(ptr, "\"coordinates\":");
+       ptr += pointArray_to_geojson(point->point, ptr, precision);
+       ptr += sprintf(ptr, "}");
+
+       return (ptr-output);
+}
+
+static char *
+asgeojson_point(LWPOINT *point, char *srs, BOX3D *bbox, int precision)
+{
+       char *output;
+       int size;
+
+       size = asgeojson_point_size(point, srs, bbox, precision);
+       output = lwalloc(size);
+       asgeojson_point_buf(point, srs, output, bbox, precision);
+       return output;
+}
+
+
+
+/**
+ * Line Geometry
+ */
+
+static size_t
+asgeojson_line_size(LWLINE *line, char *srs, BOX3D *bbox, int precision)
+{
+       int size;
+
+       size = sizeof("{'type':'LineString',");
+       if (srs) size += asgeojson_srs_size(srs);
+       if (bbox) size += asgeojson_bbox_size(TYPE_HASZ(line->type), precision);
+       size += sizeof("'coordinates':[]}");
+       size += pointArray_geojson_size(line->points, precision);
+
+       return size;
+}
+
+static size_t
+asgeojson_line_buf(LWLINE *line, char *srs, char *output, BOX3D *bbox, int precision)
+{
+       char *ptr=output;
+
+       ptr += sprintf(ptr, "{\"type\":\"LineString\",");
+       if (srs) ptr += asgeojson_srs_buf(ptr, srs);
+       if (bbox) ptr += asgeojson_bbox_buf(ptr, bbox, TYPE_HASZ(line->type), precision);
+       ptr += sprintf(ptr, "\"coordinates\":[");
+       ptr += pointArray_to_geojson(line->points, ptr, precision);
+       ptr += sprintf(ptr, "]}");
+
+       return (ptr-output);
+}
+
+static char *
+asgeojson_line(LWLINE *line, char *srs, BOX3D *bbox, int precision)
+{
+       char *output;
+       int size;
+
+       size = asgeojson_line_size(line, srs, bbox, precision);
+       output = lwalloc(size);
+       asgeojson_line_buf(line, srs, output, bbox, precision);
+
+       return output;
+}
+
+
+
+/**
+ * Polygon Geometry
+ */
+
+static size_t
+asgeojson_poly_size(LWPOLY *poly, char *srs, BOX3D *bbox, int precision)
+{
+       size_t size;
+       int i;
+
+       size = sizeof("{\"type\":\"Polygon\",");
+       if (srs) size += asgeojson_srs_size(srs);
+       if (bbox) size += asgeojson_bbox_size(TYPE_HASZ(poly->type), precision);
+       size += sizeof("\"coordinates\":[");
+       for (i=0, size=0; i<poly->nrings; i++)
+       {
+               size += pointArray_geojson_size(poly->rings[i], precision);
+               size += sizeof("[]");
+       }
+       size += sizeof(",") * i;
+       size += sizeof("]}");
+
+       return size;
+}
+
+static size_t
+asgeojson_poly_buf(LWPOLY *poly, char *srs, char *output, BOX3D *bbox, int precision)
+{
+       int i;
+       char *ptr=output;
+
+       ptr += sprintf(ptr, "{\"type\":\"Polygon\",");
+       if (srs) ptr += asgeojson_srs_buf(ptr, srs);
+       if (bbox) ptr += asgeojson_bbox_buf(ptr, bbox, TYPE_HASZ(poly->type), precision);
+       ptr += sprintf(ptr, "\"coordinates\":[");
+       for (i=0; i<poly->nrings; i++)
+       {
+               if (i) ptr += sprintf(ptr, ",");
+               ptr += sprintf(ptr, "[");
+               ptr += pointArray_to_geojson(poly->rings[i], ptr, precision);
+               ptr += sprintf(ptr, "]");
+       }
+       ptr += sprintf(ptr, "]}");
+
+       return (ptr-output);
+}
+
+static char *
+asgeojson_poly(LWPOLY *poly, char *srs, BOX3D *bbox, int precision)
+{
+       char *output;
+       int size;
+
+       size = asgeojson_poly_size(poly, srs, bbox, precision);
+       output = lwalloc(size);
+       asgeojson_poly_buf(poly, srs, output, bbox, precision);
+
+       return output;
+}
+
+
+
+/**
+ * Multipoint Geometry
+ */
+
+static size_t
+asgeojson_multipoint_size(LWGEOM_INSPECTED *insp, char *srs, BOX3D *bbox, int precision)
+{
+       LWPOINT * point;
+       int size;
+       int i;
+
+       size = sizeof("{'type':'MultiPoint',");
+       if (srs) size += asgeojson_srs_size(srs);
+       if (bbox) size += asgeojson_bbox_size(TYPE_HASZ(insp->type), precision);
+       size += sizeof("'coordinates':[]}");
+
+       for (i=0; i<insp->ngeometries; i++)
+       {
+               point = lwgeom_getpoint_inspected(insp, i);
+               size += pointArray_geojson_size(point->point, precision);
+               lwpoint_release(point);
+       }
+       size += sizeof(",") * i;
+
+       return size;
+}
+
+static size_t
+asgeojson_multipoint_buf(LWGEOM_INSPECTED *insp, char *srs, char *output, BOX3D *bbox, int precision)
+{
+       LWPOINT *point;
+       int i;
+       char *ptr=output;
+
+       ptr += sprintf(ptr, "{\"type\":\"MultiPoint\",");
+       if (srs) ptr += asgeojson_srs_buf(ptr, srs);
+       if (bbox) ptr += asgeojson_bbox_buf(ptr, bbox, TYPE_HASZ(insp->type), precision);
+       ptr += sprintf(ptr, "\"coordinates\":[");
+
+       for (i=0; i<insp->ngeometries; i++)
+       {
+               if (i) ptr += sprintf(ptr, ",");
+               point=lwgeom_getpoint_inspected(insp, i);
+               ptr += pointArray_to_geojson(point->point, ptr, precision);
+               lwpoint_release(point);
+       }
+       ptr += sprintf(ptr, "]}");
+
+       return (ptr - output);
+}
+
+static char *
+asgeojson_multipoint(LWGEOM_INSPECTED *insp, char *srs, BOX3D *bbox, int precision)
+{
+       char *output;
+       int size;
+
+       size = asgeojson_multipoint_size(insp, srs, bbox, precision);
+       output = lwalloc(size);
+       asgeojson_multipoint_buf(insp, srs, output, bbox, precision);
+
+       return output;
+}
+
+
+
+/**
+ * Multiline Geometry
+ */
+
+static size_t
+asgeojson_multiline_size(LWGEOM_INSPECTED *insp, char *srs, BOX3D *bbox, int precision)
+{
+       LWLINE * line;
+       int size;
+       int i;
+
+       size = sizeof("{'type':'MultiLineString',");
+       if (srs) size += asgeojson_srs_size(srs);
+       if (bbox) size += asgeojson_bbox_size(TYPE_HASZ(insp->type), precision);
+       size += sizeof("'coordinates':[]}");
+
+       for (i=0 ; i<insp->ngeometries; i++)
+       {
+               line = lwgeom_getline_inspected(insp, i);
+               size += pointArray_geojson_size(line->points, precision);
+               size += sizeof("[]");
+               lwline_release(line);
+       }
+       size += sizeof(",") * i;
+
+       return size;
+}
+
+static size_t
+asgeojson_multiline_buf(LWGEOM_INSPECTED *insp, char *srs, char *output, BOX3D *bbox, int precision)
+{
+       LWLINE *line;
+       int i;
+       char *ptr=output;
+
+       ptr += sprintf(ptr, "{\"type\":\"MultiLineString\",");
+       if (srs) ptr += asgeojson_srs_buf(ptr, srs);
+       if (bbox) ptr += asgeojson_bbox_buf(ptr, bbox, TYPE_HASZ(insp->type), precision);
+       ptr += sprintf(ptr, "\"coordinates\":[");
+
+       for (i=0; i<insp->ngeometries; i++)
+       {
+               if (i) ptr += sprintf(ptr, ",");
+               ptr += sprintf(ptr, "[");
+               line = lwgeom_getline_inspected(insp, i);
+               ptr += pointArray_to_geojson(line->points, ptr, precision);
+               ptr += sprintf(ptr, "]");
+
+               lwline_release(line);
+       }
+
+       ptr += sprintf(ptr, "]}");
+
+       return (ptr - output);
+}
+
+static char *
+asgeojson_multiline(LWGEOM_INSPECTED *insp, char *srs, BOX3D *bbox, int precision)
+{
+       char *output;
+       int size;
+
+       size = asgeojson_multiline_size(insp, srs, bbox, precision);
+       output = lwalloc(size);
+       asgeojson_multiline_buf(insp, srs, output, bbox, precision);
+
+       return output;
+}
+
+
+
+/**
+ * MultiPolygon Geometry
+ */
+
+static size_t
+asgeojson_multipolygon_size(LWGEOM_INSPECTED *insp, char *srs, BOX3D *bbox, int precision)
+{
+       LWPOLY *poly;
+       int size;
+       int i, j;
+
+       size = sizeof("{'type':'MultiPolygon',");
+       if (srs) size += asgeojson_srs_size(srs);
+       if (bbox) size += asgeojson_bbox_size(TYPE_HASZ(insp->type), precision);
+       size += sizeof("'coordinates':[]}");
+
+       for (i=0; i < insp->ngeometries; i++)
+       {
+               poly = lwgeom_getpoly_inspected(insp, i);
+               for (j=0 ; j <poly->nrings ; j++)
+               {
+                       size += pointArray_geojson_size(poly->rings[j], precision);
+                       size += sizeof("[]");
+               }
+               lwpoly_release(poly);
+               size += sizeof("[]");
+       }
+       size += sizeof(",") * i;
+       size += sizeof("]}");
+
+       return size;
+}
+
+static size_t
+asgeojson_multipolygon_buf(LWGEOM_INSPECTED *insp, char *srs, char *output, BOX3D *bbox, int precision)
+{
+       LWPOLY *poly;
+       int i, j;
+       char *ptr=output;
+
+       ptr += sprintf(ptr, "{\"type\":\"MultiPolygon\",");
+       if (srs) ptr += asgeojson_srs_buf(ptr, srs);
+       if (bbox) ptr += asgeojson_bbox_buf(ptr, bbox, TYPE_HASZ(insp->type), precision);
+       ptr += sprintf(ptr, "\"coordinates\":[");
+       for (i=0; i<insp->ngeometries; i++)
+       {
+               if (i) ptr += sprintf(ptr, ",");
+               ptr += sprintf(ptr, "[");
+               poly = lwgeom_getpoly_inspected(insp, i);
+               for (j=0 ; j < poly->nrings ; j++)
+               {
+                       if (j) ptr += sprintf(ptr, ",");
+                       ptr += sprintf(ptr, "[");
+                       ptr += pointArray_to_geojson(poly->rings[j], ptr, precision);
+                       ptr += sprintf(ptr, "]");
+               }
+               ptr += sprintf(ptr, "]");
+               lwpoly_release(poly);
+       }
+       ptr += sprintf(ptr, "]}");
+
+       return (ptr - output);
+}
+
+static char *
+asgeojson_multipolygon(LWGEOM_INSPECTED *insp, char *srs, BOX3D *bbox, int precision)
+{
+       char *output;
+       int size;
+
+       size = asgeojson_multipolygon_size(insp, srs, bbox, precision);
+       output = lwalloc(size);
+       asgeojson_multipolygon_buf(insp, srs, output, bbox, precision);
+
+       return output;
+}
+
+
+
+/**
+ * Collection Geometry
+ */
+
+static size_t
+asgeojson_collection_size(LWGEOM_INSPECTED *insp, char *srs, BOX3D *bbox, int precision)
+{
+       int i;
+       int size;
+       LWGEOM_INSPECTED *subinsp;
+       uchar *subgeom;
+
+       size = sizeof("{'type':'GeometryCollection',");
+       if (srs) size += asgeojson_srs_size(srs);
+       if (bbox) size += asgeojson_bbox_size(TYPE_HASZ(insp->type), precision);
+       size += sizeof("'geometries':");
+
+       for (i=0; i<insp->ngeometries; i++)
+       {
+               subgeom = lwgeom_getsubgeometry_inspected(insp, i);
+               subinsp = lwgeom_inspect(subgeom);
+               size += asgeojson_inspected_size(subinsp, bbox, precision);
+               lwinspected_release(subinsp);
+       }
+       size += sizeof(",") * i;
+       size += sizeof("]}");
+
+       return size;
+}
+
+static size_t
+asgeojson_collection_buf(LWGEOM_INSPECTED *insp, char *srs, char *output, BOX3D *bbox, int precision)
+{
+       int i;
+       char *ptr=output;
+       LWGEOM_INSPECTED *subinsp;
+       uchar *subgeom;
+
+       ptr += sprintf(ptr, "{\"type\":\"GeometryCollection\",");
+       if (srs) ptr += asgeojson_srs_buf(ptr, srs);
+       if (bbox) ptr += asgeojson_bbox_buf(ptr, bbox, TYPE_HASZ(insp->type), precision);
+       ptr += sprintf(ptr, "\"geometries\":[");
+
+       for (i=0; i<insp->ngeometries; i++)
+       {
+               if (i) ptr += sprintf(ptr, ",");
+               subgeom = lwgeom_getsubgeometry_inspected(insp, i);
+               subinsp = lwgeom_inspect(subgeom);
+               ptr += asgeojson_inspected_buf(subinsp, ptr, bbox, precision);
+               lwinspected_release(subinsp);
+       }
+
+       ptr += sprintf(ptr, "]}");
+
+       return (ptr - output);
+}
+
+static char *
+asgeojson_collection(LWGEOM_INSPECTED *insp, char *srs, BOX3D *bbox, int precision)
+{
+       char *output;
+       int size;
+
+       size = asgeojson_collection_size(insp, srs, bbox, precision);
+       output = lwalloc(size);
+       asgeojson_collection_buf(insp, srs, output, bbox, precision);
+
+       return output;
+}
+
+
+
+static size_t
+asgeojson_inspected_size(LWGEOM_INSPECTED *insp, BOX3D *bbox, 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 = asgeojson_point_size(point, NULL, bbox, precision);
+               lwpoint_release(point);
+               break;
+
+       case LINETYPE:
+               line=lwgeom_getline_inspected(insp, 0);
+               size = asgeojson_line_size(line, NULL, bbox, precision);
+               lwline_release(line);
+               break;
+
+       case POLYGONTYPE:
+               poly=lwgeom_getpoly_inspected(insp, 0);
+               size = asgeojson_poly_size(poly, NULL, bbox, precision);
+               lwpoly_release(poly);
+               break;
+
+       case MULTIPOINTTYPE:
+               size = asgeojson_multipoint_size(insp, NULL, bbox, precision);
+               break;
+
+       case MULTILINETYPE:
+               size = asgeojson_multiline_size(insp, NULL, bbox, precision);
+               break;
+
+       case MULTIPOLYGONTYPE:
+               size = asgeojson_multipolygon_size(insp, NULL, bbox, precision);
+               break;
+
+       default:
+               lwerror("GeoJson: geometry not supported.");
+       }
+
+       return size;
+}
+
+
+static size_t
+asgeojson_inspected_buf(LWGEOM_INSPECTED *insp, char *output, BOX3D *bbox, int precision)
+{
+       LWPOINT *point;
+       LWLINE *line;
+       LWPOLY *poly;
+       int type = lwgeom_getType(insp->serialized_form[0]);
+       char *ptr=output;
+
+       /* Compute 3D BBOX on the sub geometry */
+       if ( bbox )
+       {
+               lwfree(bbox);
+               bbox = NULL;
+               bbox = compute_serialized_box3d(
+                          lwgeom_getsubgeometry(insp->serialized_form, 0));
+       }
+
+       switch (type)
+       {
+       case POINTTYPE:
+               point=lwgeom_getpoint_inspected(insp, 0);
+               ptr += asgeojson_point_buf(point, NULL, ptr, bbox, precision);
+               lwpoint_release(point);
+               break;
+
+       case LINETYPE:
+               line=lwgeom_getline_inspected(insp, 0);
+               ptr += asgeojson_line_buf(line, NULL, ptr, bbox, precision);
+               lwline_release(line);
+               break;
+
+       case POLYGONTYPE:
+               poly=lwgeom_getpoly_inspected(insp, 0);
+               ptr += asgeojson_poly_buf(poly, NULL, ptr, bbox, precision);
+               lwpoly_release(poly);
+               break;
+
+       case MULTIPOINTTYPE:
+               ptr += asgeojson_multipoint_buf(insp, NULL, ptr, bbox, precision);
+               break;
+
+       case MULTILINETYPE:
+               ptr += asgeojson_multiline_buf(insp, NULL, ptr, bbox, precision);
+               break;
+
+       case MULTIPOLYGONTYPE:
+               ptr += asgeojson_multipolygon_buf(insp, NULL, ptr, bbox, precision);
+               break;
+
+       default:
+               if (bbox) lwfree(bbox);
+               lwerror("GeoJson: geometry not supported.");
+       }
+
+       return (ptr-output);
+}
+
+
+static size_t
+pointArray_to_geojson(POINTARRAY *pa, char *output, int precision)
+{
+       int i;
+       char *ptr;
+       char x[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
+       char y[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
+       char z[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
+
+       ptr = output;
+
+       if (!TYPE_HASZ(pa->dims))
+       {
+               for (i=0; i<pa->npoints; i++)
+               {
+                       POINT2D pt;
+                       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);
+
+                       if (fabs(pt.y) < OUT_MAX_DOUBLE)
+                               sprintf(y, "%.*f", precision, pt.y);
+                       else
+                               sprintf(y, "%g", pt.y);
+                       trim_trailing_zeros(y);
+
+                       if ( i ) ptr += sprintf(ptr, ",");
+                       ptr += sprintf(ptr, "[%s,%s]", x, y);
+               }
+       }
+       else
+       {
+               for (i=0; i<pa->npoints; i++)
+               {
+                       POINT4D pt;
+                       getPoint4d_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);
+
+                       if (fabs(pt.y) < OUT_MAX_DOUBLE)
+                               sprintf(y, "%.*f", precision, pt.y);
+                       else
+                               sprintf(y, "%g", pt.y);
+                       trim_trailing_zeros(y);
+
+                       if (fabs(pt.z) < OUT_MAX_DOUBLE)
+                               sprintf(z, "%.*f", precision, pt.z);
+                       else
+                               sprintf(z, "%g", pt.z);
+                       trim_trailing_zeros(z);
+
+                       if ( i ) ptr += sprintf(ptr, ",");
+                       ptr += sprintf(ptr, "[%s,%s,%s]", x, y, z);
+               }
+       }
+
+       return (ptr-output);
+}
+
+
+
+/**
+ * Returns maximum size of rendered pointarray in bytes.
+ */
+static size_t
+pointArray_geojson_size(POINTARRAY *pa, int precision)
+{
+       if (TYPE_NDIMS(pa->dims) == 2)
+               return (OUT_MAX_DIGS_DOUBLE + precision + sizeof(","))
+                      * 2 * pa->npoints + sizeof(",[]");
+
+       return (OUT_MAX_DIGS_DOUBLE + precision + sizeof(",,"))
+              * 3 * pa->npoints + sizeof(",[]");
+}
index f4064482bec8e5e0ca17d7fe2070f9ad34b75501..647a7a2f85c704bc8b10afe4c9253f525e471bca 100644 (file)
@@ -682,8 +682,8 @@ Datum geography_as_geojson(PG_FUNCTION_ARGS)
        int len;
        int version;
        int option = 0;
-       bool has_bbox = 0;
-       int precision = MAX_DOUBLE_PRECISION;
+       int has_bbox = 0;
+       int precision = OUT_MAX_DOUBLE_PRECISION;
        char * srs = NULL;
 
        /* Get the version */
@@ -705,8 +705,8 @@ Datum geography_as_geojson(PG_FUNCTION_ARGS)
        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;
        }
 
@@ -734,7 +734,7 @@ Datum geography_as_geojson(PG_FUNCTION_ARGS)
 
        if (option & 1) has_bbox = 1;
 
-       geojson = geometry_to_geojson(lwgeom_serialize(lwgeom), srs, has_bbox, precision);
+       geojson = lwgeom_to_geojson(lwgeom_serialize(lwgeom), srs, precision, has_bbox);
        PG_FREE_IF_COPY(lwgeom, 1);
        if (srs) pfree(srs);
 
@@ -743,7 +743,7 @@ Datum geography_as_geojson(PG_FUNCTION_ARGS)
        SET_VARSIZE(result, len);
        memcpy(VARDATA(result), geojson, len-VARHDRSZ);
 
-       pfree(geojson);
+       lwfree(geojson);
 
        PG_RETURN_POINTER(result);
 }
index ea0bd00d0b33f149eda0d4b49ac73aa362edccf4..746d3e7f6ec0e88f667dce5af78ea648e1ff82c2 100644 (file)
@@ -12,7 +12,7 @@
 /** @file
 * GeoJSON output routines.
 * Originally written by Olivier Courtin (Camptocamp)
-*
+* 
 **********************************************************************/
 
 #include "postgres.h"
 
 Datum LWGEOM_asGeoJson(PG_FUNCTION_ARGS);
 
-static char *asgeojson_point(LWPOINT *point, char *srs, BOX3D *bbox, int precision);
-static char *asgeojson_line(LWLINE *line, char *srs, BOX3D *bbox, int precision);
-static char *asgeojson_poly(LWPOLY *poly, char *srs, BOX3D *bbox, int precision);
-static char * asgeojson_multipoint(LWGEOM_INSPECTED *insp, char *srs, BOX3D *bbox, int precision);
-static char * asgeojson_multiline(LWGEOM_INSPECTED *insp, char *srs, BOX3D *bbox, int precision);
-static char * asgeojson_multipolygon(LWGEOM_INSPECTED *insp, char *srs, BOX3D *bbox, int precision);
-static char * asgeojson_collection(LWGEOM_INSPECTED *insp, char *srs, BOX3D *bbox, int precision);
-static size_t asgeojson_inspected_size(LWGEOM_INSPECTED *insp, BOX3D *bbox, int precision);
-static size_t asgeojson_inspected_buf(LWGEOM_INSPECTED *insp, char *output, BOX3D *bbox, int precision);
-
-static size_t pointArray_to_geojson(POINTARRAY *pa, char *buf, int precision);
-static size_t pointArray_geojson_size(POINTARRAY *pa, int precision);
-
-
 /**
  * Encode Feature in GeoJson
  */
@@ -50,8 +36,8 @@ Datum LWGEOM_asGeoJson(PG_FUNCTION_ARGS)
        int len;
        int version;
        int option = 0;
-       bool has_bbox = 0;
-       int precision = MAX_DOUBLE_PRECISION;
+       int has_bbox = 0;
+       int precision = OUT_MAX_DOUBLE_PRECISION;
        char * srs = NULL;
 
        /* Get the version */
@@ -70,8 +56,8 @@ Datum LWGEOM_asGeoJson(PG_FUNCTION_ARGS)
        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;
        }
 
@@ -93,7 +79,9 @@ Datum LWGEOM_asGeoJson(PG_FUNCTION_ARGS)
                        if (option & 4) srs = getSRSbySRID(SRID, false);
                        if (!srs)
                        {
-                               elog(ERROR, "SRID %i unknown in spatial_ref_sys table", SRID);
+                               elog(   ERROR, 
+                                       "SRID %i unknown in spatial_ref_sys table",
+                                       SRID);
                                PG_RETURN_NULL();
                        }
                }
@@ -101,7 +89,8 @@ Datum LWGEOM_asGeoJson(PG_FUNCTION_ARGS)
 
        if (option & 1) has_bbox = 1;
 
-       geojson = geometry_to_geojson(SERIALIZED_FORM(geom), srs, has_bbox, precision);
+       geojson = lwgeom_to_geojson(SERIALIZED_FORM(geom), srs, precision, has_bbox);
+
        PG_FREE_IF_COPY(geom, 1);
        if (srs) pfree(srs);
 
@@ -110,791 +99,7 @@ Datum LWGEOM_asGeoJson(PG_FUNCTION_ARGS)
        SET_VARSIZE(result, len);
        memcpy(VARDATA(result), geojson, len-VARHDRSZ);
 
-       pfree(geojson);
+       lwfree(geojson);
 
        PG_RETURN_POINTER(result);
 }
-
-
-/**
- * Takes a GEOMETRY and returns a GeoJson representation
- */
-char *
-geometry_to_geojson(uchar *geom, char *srs, bool has_bbox, int precision)
-{
-       int type;
-       LWPOINT *point;
-       LWLINE *line;
-       LWPOLY *poly;
-       LWGEOM_INSPECTED *insp;
-       BOX3D * bbox = NULL;
-       char * ret = NULL;
-
-       type = lwgeom_getType(geom[0]);
-
-       if (has_bbox) bbox = compute_serialized_box3d(geom);
-
-       switch (type)
-       {
-       case POINTTYPE:
-               point = lwpoint_deserialize(geom);
-               ret = asgeojson_point(point, srs, bbox, precision);
-               break;
-
-       case LINETYPE:
-               line = lwline_deserialize(geom);
-               ret = asgeojson_line(line, srs, bbox, precision);
-               break;
-
-       case POLYGONTYPE:
-               poly = lwpoly_deserialize(geom);
-               ret = asgeojson_poly(poly, srs, bbox, precision);
-               break;
-
-       case MULTIPOINTTYPE:
-               insp = lwgeom_inspect(geom);
-               ret = asgeojson_multipoint(insp, srs, bbox, precision);
-               break;
-
-       case MULTILINETYPE:
-               insp = lwgeom_inspect(geom);
-               ret = asgeojson_multiline(insp, srs, bbox, precision);
-               break;
-
-       case MULTIPOLYGONTYPE:
-               insp = lwgeom_inspect(geom);
-               ret = asgeojson_multipolygon(insp, srs, bbox, precision);
-               break;
-
-       case COLLECTIONTYPE:
-               insp = lwgeom_inspect(geom);
-               ret = asgeojson_collection(insp, srs, bbox, precision);
-               break;
-
-       default:
-               if (bbox)
-               {
-                       lwfree(bbox);
-                       bbox = NULL;
-               }
-               lwerror("GeoJson: '%s' geometry type not supported.",
-                       lwgeom_typename(type));
-       }
-
-       if (bbox)
-       {
-               lwfree(bbox);
-               bbox = NULL;
-       }
-
-       return ret;
-}
-
-
-
-/**
- * Handle SRS
- */
-static size_t
-asgeojson_srs_size(char *srs)
-{
-       int size;
-
-       size = sizeof("'crs':{'type':'name',");
-       size += sizeof("'properties':{'name':''}},");
-       size += strlen(srs) * sizeof(char);
-
-       return size;
-}
-
-static size_t
-asgeojson_srs_buf(char *output, char *srs)
-{
-       char *ptr = output;
-
-       ptr += sprintf(ptr, "\"crs\":{\"type\":\"name\",");
-       ptr += sprintf(ptr, "\"properties\":{\"name\":\"%s\"}},", srs);
-
-       return (ptr-output);
-}
-
-
-
-/**
- * Handle Bbox
- */
-static size_t
-asgeojson_bbox_size(bool hasz, int precision)
-{
-       int size;
-
-       if (!hasz)
-       {
-               size = sizeof("\"bbox\":[,,,],");
-               size += 2 * 2 * (MAX_DIGS_DOUBLE + precision);
-       }
-       else
-       {
-               size = sizeof("\"bbox\":[,,,,,],");
-               size += 2 * 3 * (MAX_DIGS_DOUBLE + precision);
-       }
-
-       return size;
-}
-
-static size_t
-asgeojson_bbox_buf(char *output, BOX3D *bbox, bool hasz, int precision)
-{
-       char *ptr = output;
-
-       if (!hasz)
-               ptr += sprintf(ptr, "\"bbox\":[%.*f,%.*f,%.*f,%.*f],",
-                              precision, bbox->xmin, precision, bbox->ymin,
-                              precision, bbox->xmax, precision, bbox->ymax);
-       else
-               ptr += sprintf(ptr, "\"bbox\":[%.*f,%.*f,%.*f,%.*f,%.*f,%.*f],",
-                              precision, bbox->xmin, precision, bbox->ymin, precision, bbox->zmin,
-                              precision, bbox->xmax, precision, bbox->ymax, precision, bbox->zmax);
-
-       return (ptr-output);
-}
-
-
-
-/**
- * Point Geometry
- */
-
-static size_t
-asgeojson_point_size(LWPOINT *point, char *srs, BOX3D *bbox, int precision)
-{
-       int size;
-
-       size = pointArray_geojson_size(point->point, precision);
-       size += sizeof("{'type':'Point',");
-       size += sizeof("'coordinates':}");
-
-       if (srs) size += asgeojson_srs_size(srs);
-       if (bbox) size += asgeojson_bbox_size(TYPE_HASZ(point->type), precision);
-
-       return size;
-}
-
-static size_t
-asgeojson_point_buf(LWPOINT *point, char *srs, char *output, BOX3D *bbox, int precision)
-{
-       char *ptr = output;
-
-       ptr += sprintf(ptr, "{\"type\":\"Point\",");
-       if (srs) ptr += asgeojson_srs_buf(ptr, srs);
-       if (bbox) ptr += asgeojson_bbox_buf(ptr, bbox, TYPE_HASZ(point->type), precision);
-
-       ptr += sprintf(ptr, "\"coordinates\":");
-       ptr += pointArray_to_geojson(point->point, ptr, precision);
-       ptr += sprintf(ptr, "}");
-
-       return (ptr-output);
-}
-
-static char *
-asgeojson_point(LWPOINT *point, char *srs, BOX3D *bbox, int precision)
-{
-       char *output;
-       int size;
-
-       size = asgeojson_point_size(point, srs, bbox, precision);
-       output = palloc(size);
-       asgeojson_point_buf(point, srs, output, bbox, precision);
-       return output;
-}
-
-
-
-/**
- * Line Geometry
- */
-
-static size_t
-asgeojson_line_size(LWLINE *line, char *srs, BOX3D *bbox, int precision)
-{
-       int size;
-
-       size = sizeof("{'type':'LineString',");
-       if (srs) size += asgeojson_srs_size(srs);
-       if (bbox) size += asgeojson_bbox_size(TYPE_HASZ(line->type), precision);
-       size += sizeof("'coordinates':[]}");
-       size += pointArray_geojson_size(line->points, precision);
-
-       return size;
-}
-
-static size_t
-asgeojson_line_buf(LWLINE *line, char *srs, char *output, BOX3D *bbox, int precision)
-{
-       char *ptr=output;
-
-       ptr += sprintf(ptr, "{\"type\":\"LineString\",");
-       if (srs) ptr += asgeojson_srs_buf(ptr, srs);
-       if (bbox) ptr += asgeojson_bbox_buf(ptr, bbox, TYPE_HASZ(line->type), precision);
-       ptr += sprintf(ptr, "\"coordinates\":[");
-       ptr += pointArray_to_geojson(line->points, ptr, precision);
-       ptr += sprintf(ptr, "]}");
-
-       return (ptr-output);
-}
-
-static char *
-asgeojson_line(LWLINE *line, char *srs, BOX3D *bbox, int precision)
-{
-       char *output;
-       int size;
-
-       size = asgeojson_line_size(line, srs, bbox, precision);
-       output = palloc(size);
-       asgeojson_line_buf(line, srs, output, bbox, precision);
-
-       return output;
-}
-
-
-
-/**
- * Polygon Geometry
- */
-
-static size_t
-asgeojson_poly_size(LWPOLY *poly, char *srs, BOX3D *bbox, int precision)
-{
-       size_t size;
-       int i;
-
-       size = sizeof("{\"type\":\"Polygon\",");
-       if (srs) size += asgeojson_srs_size(srs);
-       if (bbox) size += asgeojson_bbox_size(TYPE_HASZ(poly->type), precision);
-       size += sizeof("\"coordinates\":[");
-       for (i=0, size=0; i<poly->nrings; i++)
-       {
-               size += pointArray_geojson_size(poly->rings[i], precision);
-               size += sizeof("[]");
-       }
-       size += sizeof(",") * i;
-       size += sizeof("]}");
-
-       return size;
-}
-
-static size_t
-asgeojson_poly_buf(LWPOLY *poly, char *srs, char *output, BOX3D *bbox, int precision)
-{
-       int i;
-       char *ptr=output;
-
-       ptr += sprintf(ptr, "{\"type\":\"Polygon\",");
-       if (srs) ptr += asgeojson_srs_buf(ptr, srs);
-       if (bbox) ptr += asgeojson_bbox_buf(ptr, bbox, TYPE_HASZ(poly->type), precision);
-       ptr += sprintf(ptr, "\"coordinates\":[");
-       for (i=0; i<poly->nrings; i++)
-       {
-               if (i) ptr += sprintf(ptr, ",");
-               ptr += sprintf(ptr, "[");
-               ptr += pointArray_to_geojson(poly->rings[i], ptr, precision);
-               ptr += sprintf(ptr, "]");
-       }
-       ptr += sprintf(ptr, "]}");
-
-       return (ptr-output);
-}
-
-static char *
-asgeojson_poly(LWPOLY *poly, char *srs, BOX3D *bbox, int precision)
-{
-       char *output;
-       int size;
-
-       size = asgeojson_poly_size(poly, srs, bbox, precision);
-       output = palloc(size);
-       asgeojson_poly_buf(poly, srs, output, bbox, precision);
-
-       return output;
-}
-
-
-
-/**
- * Multipoint Geometry
- */
-
-static size_t
-asgeojson_multipoint_size(LWGEOM_INSPECTED *insp, char *srs, BOX3D *bbox, int precision)
-{
-       LWPOINT * point;
-       int size;
-       int i;
-
-       size = sizeof("{'type':'MultiPoint',");
-       if (srs) size += asgeojson_srs_size(srs);
-       if (bbox) size += asgeojson_bbox_size(TYPE_HASZ(insp->type), precision);
-       size += sizeof("'coordinates':[]}");
-
-       for (i=0; i<insp->ngeometries; i++)
-       {
-               point = lwgeom_getpoint_inspected(insp, i);
-               size += pointArray_geojson_size(point->point, precision);
-               lwpoint_release(point);
-       }
-       size += sizeof(",") * i;
-
-       return size;
-}
-
-static size_t
-asgeojson_multipoint_buf(LWGEOM_INSPECTED *insp, char *srs, char *output, BOX3D *bbox, int precision)
-{
-       LWPOINT *point;
-       int i;
-       char *ptr=output;
-
-       ptr += sprintf(ptr, "{\"type\":\"MultiPoint\",");
-       if (srs) ptr += asgeojson_srs_buf(ptr, srs);
-       if (bbox) ptr += asgeojson_bbox_buf(ptr, bbox, TYPE_HASZ(insp->type), precision);
-       ptr += sprintf(ptr, "\"coordinates\":[");
-
-       for (i=0; i<insp->ngeometries; i++)
-       {
-               if (i) ptr += sprintf(ptr, ",");
-               point=lwgeom_getpoint_inspected(insp, i);
-               ptr += pointArray_to_geojson(point->point, ptr, precision);
-               lwpoint_release(point);
-       }
-       ptr += sprintf(ptr, "]}");
-
-       return (ptr - output);
-}
-
-static char *
-asgeojson_multipoint(LWGEOM_INSPECTED *insp, char *srs, BOX3D *bbox, int precision)
-{
-       char *output;
-       int size;
-
-       size = asgeojson_multipoint_size(insp, srs, bbox, precision);
-       output = palloc(size);
-       asgeojson_multipoint_buf(insp, srs, output, bbox, precision);
-
-       return output;
-}
-
-
-
-/**
- * Multiline Geometry
- */
-
-static size_t
-asgeojson_multiline_size(LWGEOM_INSPECTED *insp, char *srs, BOX3D *bbox, int precision)
-{
-       LWLINE * line;
-       int size;
-       int i;
-
-       size = sizeof("{'type':'MultiLineString',");
-       if (srs) size += asgeojson_srs_size(srs);
-       if (bbox) size += asgeojson_bbox_size(TYPE_HASZ(insp->type), precision);
-       size += sizeof("'coordinates':[]}");
-
-       for (i=0 ; i<insp->ngeometries; i++)
-       {
-               line = lwgeom_getline_inspected(insp, i);
-               size += pointArray_geojson_size(line->points, precision);
-               size += sizeof("[]");
-               lwline_release(line);
-       }
-       size += sizeof(",") * i;
-
-       return size;
-}
-
-static size_t
-asgeojson_multiline_buf(LWGEOM_INSPECTED *insp, char *srs, char *output, BOX3D *bbox, int precision)
-{
-       LWLINE *line;
-       int i;
-       char *ptr=output;
-
-       ptr += sprintf(ptr, "{\"type\":\"MultiLineString\",");
-       if (srs) ptr += asgeojson_srs_buf(ptr, srs);
-       if (bbox) ptr += asgeojson_bbox_buf(ptr, bbox, TYPE_HASZ(insp->type), precision);
-       ptr += sprintf(ptr, "\"coordinates\":[");
-
-       for (i=0; i<insp->ngeometries; i++)
-       {
-               if (i) ptr += sprintf(ptr, ",");
-               ptr += sprintf(ptr, "[");
-               line = lwgeom_getline_inspected(insp, i);
-               ptr += pointArray_to_geojson(line->points, ptr, precision);
-               ptr += sprintf(ptr, "]");
-
-               lwline_release(line);
-       }
-
-       ptr += sprintf(ptr, "]}");
-
-       return (ptr - output);
-}
-
-static char *
-asgeojson_multiline(LWGEOM_INSPECTED *insp, char *srs, BOX3D *bbox, int precision)
-{
-       char *output;
-       int size;
-
-       size = asgeojson_multiline_size(insp, srs, bbox, precision);
-       output = palloc(size);
-       asgeojson_multiline_buf(insp, srs, output, bbox, precision);
-
-       return output;
-}
-
-
-
-/**
- * MultiPolygon Geometry
- */
-
-static size_t
-asgeojson_multipolygon_size(LWGEOM_INSPECTED *insp, char *srs, BOX3D *bbox, int precision)
-{
-       LWPOLY *poly;
-       int size;
-       int i, j;
-
-       size = sizeof("{'type':'MultiPolygon',");
-       if (srs) size += asgeojson_srs_size(srs);
-       if (bbox) size += asgeojson_bbox_size(TYPE_HASZ(insp->type), precision);
-       size += sizeof("'coordinates':[]}");
-
-       for (i=0; i < insp->ngeometries; i++)
-       {
-               poly = lwgeom_getpoly_inspected(insp, i);
-               for (j=0 ; j <poly->nrings ; j++)
-               {
-                       size += pointArray_geojson_size(poly->rings[j], precision);
-                       size += sizeof("[]");
-               }
-               lwpoly_release(poly);
-               size += sizeof("[]");
-       }
-       size += sizeof(",") * i;
-       size += sizeof("]}");
-
-       return size;
-}
-
-static size_t
-asgeojson_multipolygon_buf(LWGEOM_INSPECTED *insp, char *srs, char *output, BOX3D *bbox, int precision)
-{
-       LWPOLY *poly;
-       int i, j;
-       char *ptr=output;
-
-       ptr += sprintf(ptr, "{\"type\":\"MultiPolygon\",");
-       if (srs) ptr += asgeojson_srs_buf(ptr, srs);
-       if (bbox) ptr += asgeojson_bbox_buf(ptr, bbox, TYPE_HASZ(insp->type), precision);
-       ptr += sprintf(ptr, "\"coordinates\":[");
-       for (i=0; i<insp->ngeometries; i++)
-       {
-               if (i) ptr += sprintf(ptr, ",");
-               ptr += sprintf(ptr, "[");
-               poly = lwgeom_getpoly_inspected(insp, i);
-               for (j=0 ; j < poly->nrings ; j++)
-               {
-                       if (j) ptr += sprintf(ptr, ",");
-                       ptr += sprintf(ptr, "[");
-                       ptr += pointArray_to_geojson(poly->rings[j], ptr, precision);
-                       ptr += sprintf(ptr, "]");
-               }
-               ptr += sprintf(ptr, "]");
-               lwpoly_release(poly);
-       }
-       ptr += sprintf(ptr, "]}");
-
-       return (ptr - output);
-}
-
-static char *
-asgeojson_multipolygon(LWGEOM_INSPECTED *insp, char *srs, BOX3D *bbox, int precision)
-{
-       char *output;
-       int size;
-
-       size = asgeojson_multipolygon_size(insp, srs, bbox, precision);
-       output = palloc(size);
-       asgeojson_multipolygon_buf(insp, srs, output, bbox, precision);
-
-       return output;
-}
-
-
-
-/**
- * Collection Geometry
- */
-
-static size_t
-asgeojson_collection_size(LWGEOM_INSPECTED *insp, char *srs, BOX3D *bbox, int precision)
-{
-       int i;
-       int size;
-       LWGEOM_INSPECTED *subinsp;
-       uchar *subgeom;
-
-       size = sizeof("{'type':'GeometryCollection',");
-       if (srs) size += asgeojson_srs_size(srs);
-       if (bbox) size += asgeojson_bbox_size(TYPE_HASZ(insp->type), precision);
-       size += sizeof("'geometries':");
-
-       for (i=0; i<insp->ngeometries; i++)
-       {
-               subgeom = lwgeom_getsubgeometry_inspected(insp, i);
-               subinsp = lwgeom_inspect(subgeom);
-               size += asgeojson_inspected_size(subinsp, bbox, precision);
-               lwinspected_release(subinsp);
-       }
-       size += sizeof(",") * i;
-       size += sizeof("]}");
-
-       return size;
-}
-
-static size_t
-asgeojson_collection_buf(LWGEOM_INSPECTED *insp, char *srs, char *output, BOX3D *bbox, int precision)
-{
-       int i;
-       char *ptr=output;
-       LWGEOM_INSPECTED *subinsp;
-       uchar *subgeom;
-
-       ptr += sprintf(ptr, "{\"type\":\"GeometryCollection\",");
-       if (srs) ptr += asgeojson_srs_buf(ptr, srs);
-       if (bbox) ptr += asgeojson_bbox_buf(ptr, bbox, TYPE_HASZ(insp->type), precision);
-       ptr += sprintf(ptr, "\"geometries\":[");
-
-       for (i=0; i<insp->ngeometries; i++)
-       {
-               if (i) ptr += sprintf(ptr, ",");
-               subgeom = lwgeom_getsubgeometry_inspected(insp, i);
-               subinsp = lwgeom_inspect(subgeom);
-               ptr += asgeojson_inspected_buf(subinsp, ptr, bbox, precision);
-               lwinspected_release(subinsp);
-       }
-
-       ptr += sprintf(ptr, "]}");
-
-       return (ptr - output);
-}
-
-static char *
-asgeojson_collection(LWGEOM_INSPECTED *insp, char *srs, BOX3D *bbox, int precision)
-{
-       char *output;
-       int size;
-
-       size = asgeojson_collection_size(insp, srs, bbox, precision);
-       output = palloc(size);
-       asgeojson_collection_buf(insp, srs, output, bbox, precision);
-
-       return output;
-}
-
-
-
-static size_t
-asgeojson_inspected_size(LWGEOM_INSPECTED *insp, BOX3D *bbox, 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 = asgeojson_point_size(point, NULL, bbox, precision);
-               lwpoint_release(point);
-               break;
-
-       case LINETYPE:
-               line=lwgeom_getline_inspected(insp, 0);
-               size = asgeojson_line_size(line, NULL, bbox, precision);
-               lwline_release(line);
-               break;
-
-       case POLYGONTYPE:
-               poly=lwgeom_getpoly_inspected(insp, 0);
-               size = asgeojson_poly_size(poly, NULL, bbox, precision);
-               lwpoly_release(poly);
-               break;
-
-       case MULTIPOINTTYPE:
-               size = asgeojson_multipoint_size(insp, NULL, bbox, precision);
-               break;
-
-       case MULTILINETYPE:
-               size = asgeojson_multiline_size(insp, NULL, bbox, precision);
-               break;
-
-       case MULTIPOLYGONTYPE:
-               size = asgeojson_multipolygon_size(insp, NULL, bbox, precision);
-               break;
-
-       default:
-               lwerror("GeoJson: geometry not supported.");
-       }
-
-       return size;
-}
-
-
-static size_t
-asgeojson_inspected_buf(LWGEOM_INSPECTED *insp, char *output, BOX3D *bbox, int precision)
-{
-       LWPOINT *point;
-       LWLINE *line;
-       LWPOLY *poly;
-       int type = lwgeom_getType(insp->serialized_form[0]);
-       char *ptr=output;
-
-       /* Compute 3D BBOX on the sub geometry */
-       if ( bbox )
-       {
-               lwfree(bbox);
-               bbox = NULL;
-               bbox = compute_serialized_box3d(
-                          lwgeom_getsubgeometry(insp->serialized_form, 0));
-       }
-
-       switch (type)
-       {
-       case POINTTYPE:
-               point=lwgeom_getpoint_inspected(insp, 0);
-               ptr += asgeojson_point_buf(point, NULL, ptr, bbox, precision);
-               lwpoint_release(point);
-               break;
-
-       case LINETYPE:
-               line=lwgeom_getline_inspected(insp, 0);
-               ptr += asgeojson_line_buf(line, NULL, ptr, bbox, precision);
-               lwline_release(line);
-               break;
-
-       case POLYGONTYPE:
-               poly=lwgeom_getpoly_inspected(insp, 0);
-               ptr += asgeojson_poly_buf(poly, NULL, ptr, bbox, precision);
-               lwpoly_release(poly);
-               break;
-
-       case MULTIPOINTTYPE:
-               ptr += asgeojson_multipoint_buf(insp, NULL, ptr, bbox, precision);
-               break;
-
-       case MULTILINETYPE:
-               ptr += asgeojson_multiline_buf(insp, NULL, ptr, bbox, precision);
-               break;
-
-       case MULTIPOLYGONTYPE:
-               ptr += asgeojson_multipolygon_buf(insp, NULL, ptr, bbox, precision);
-               break;
-
-       default:
-               if (bbox) lwfree(bbox);
-               lwerror("GeoJson: geometry not supported.");
-       }
-
-       return (ptr-output);
-}
-
-
-static size_t
-pointArray_to_geojson(POINTARRAY *pa, char *output, int precision)
-{
-       int i;
-       char *ptr;
-       char x[MAX_DIGS_DOUBLE+MAX_DOUBLE_PRECISION+1];
-       char y[MAX_DIGS_DOUBLE+MAX_DOUBLE_PRECISION+1];
-       char z[MAX_DIGS_DOUBLE+MAX_DOUBLE_PRECISION+1];
-
-       ptr = output;
-
-       if (!TYPE_HASZ(pa->dims))
-       {
-               for (i=0; i<pa->npoints; i++)
-               {
-                       POINT2D pt;
-                       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);
-
-                       if (fabs(pt.y) < MAX_DOUBLE)
-                               sprintf(y, "%.*f", precision, pt.y);
-                       else
-                               sprintf(y, "%g", pt.y);
-                       trim_trailing_zeros(y);
-
-                       if ( i ) ptr += sprintf(ptr, ",");
-                       ptr += sprintf(ptr, "[%s,%s]", x, y);
-               }
-       }
-       else
-       {
-               for (i=0; i<pa->npoints; i++)
-               {
-                       POINT4D pt;
-                       getPoint4d_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);
-
-                       if (fabs(pt.y) < MAX_DOUBLE)
-                               sprintf(y, "%.*f", precision, pt.y);
-                       else
-                               sprintf(y, "%g", pt.y);
-                       trim_trailing_zeros(y);
-
-                       if (fabs(pt.z) < MAX_DOUBLE)
-                               sprintf(z, "%.*f", precision, pt.z);
-                       else
-                               sprintf(z, "%g", pt.z);
-                       trim_trailing_zeros(z);
-
-                       if ( i ) ptr += sprintf(ptr, ",");
-                       ptr += sprintf(ptr, "[%s,%s,%s]", x, y, z);
-               }
-       }
-
-       return (ptr-output);
-}
-
-
-
-/**
- * Returns maximum size of rendered pointarray in bytes.
- */
-static size_t
-pointArray_geojson_size(POINTARRAY *pa, int precision)
-{
-       if (TYPE_NDIMS(pa->dims) == 2)
-               return (MAX_DIGS_DOUBLE + precision + sizeof(","))
-                      * 2 * pa->npoints + sizeof(",[]");
-
-       return (MAX_DIGS_DOUBLE + precision + sizeof(",,"))
-              * 3 * pa->npoints + sizeof(",[]");
-}
index dfdd56493c24eebd560e3aa668fa9793eeb7c545..167e99e95b4ae115d1b57ea002fcf3b4ed8eb741 100644 (file)
@@ -1,26 +1,15 @@
 --
 -- 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_AsGeoJson(GeomFromEWKT('POINT(1 1)'));
+INSERT INTO "spatial_ref_sys" ("srid","auth_name","auth_srid","proj4text") VALUES (4326,'EPSG',4326,'+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs ');
 
 
 -- Empty Geometry
 SELECT 'empty_geom', ST_AsGeoJson(GeomFromEWKT(NULL));
 
-
 -- Precision
-SELECT 'precision_01', ST_AsGeoJson(GeomFromEWKT('SRID=4326;POINT(1.1111111 1.1111111)'), 0);
-SELECT 'precision_02', ST_AsGeoJson(GeomFromEWKT('SRID=4326;POINT(1.1111111 1.1111111)'), 3);
-SELECT 'precision_03', ST_AsGeoJson(GeomFromEWKT('SRID=4326;POINT(1.1111111 1.1111111)'), -2);
-SELECT 'precision_04', ST_AsGeoJson(GeomFromEWKT('SRID=4326;POINT(1.1111111 1.1111111)'), 19);
+SELECT 'precision_01', ST_AsGeoJson(GeomFromEWKT('SRID=4326;POINT(1.1111111 1.1111111)'), -2);
+SELECT 'precision_02', ST_AsGeoJson(GeomFromEWKT('SRID=4326;POINT(1.1111111 1.1111111)'), 19);
 
 
 -- Version
@@ -29,16 +18,13 @@ SELECT 'version_02', ST_AsGeoJson(21, GeomFromEWKT('SRID=4326;POINT(1 1)'));
 SELECT 'version_03', ST_AsGeoJson(-4, GeomFromEWKT('SRID=4326;POINT(1 1)'));
 
 
--- Short CRS
+-- CRS
 SELECT 'crs_01', ST_AsGeoJson(GeomFromEWKT('SRID=4326;POINT(1 1)'), 0, 2);
 SELECT 'crs_02', ST_AsGeoJson(GeomFromEWKT('SRID=-1;POINT(1 1)'), 0, 2);
-SELECT 'crs_03', ST_AsGeoJson(GeomFromEWKT('SRID=27572;POINT(600000 2430000)'), 0, 2);
-SELECT 'crs_04', ST_AsGeoJson(GeomFromEWKT('SRID=100000;POINT(600000 2430000)'), 0, 2);
-
--- Long CRS
-SELECT 'crs_05', ST_AsGeoJson(GeomFromEWKT('SRID=4326;POINT(1 1)'), 0, 4);
-SELECT 'crs_06', ST_AsGeoJson(GeomFromEWKT('SRID=-1;POINT(1 1)'), 0, 4);
-SELECT 'crs_07', ST_AsGeoJson(GeomFromEWKT('SRID=27572;POINT(600000 2430000)'), 0, 4);
+SELECT 'crs_03', ST_AsGeoJson(GeomFromEWKT('SRID=4326;POINT(1 1)'), 0, 4);
+SELECT 'crs_04', ST_AsGeoJson(GeomFromEWKT('SRID=-1;POINT(1 1)'), 0, 4);
+SELECT 'crs_05', ST_AsGeoJson(GeomFromEWKT('SRID=1;POINT(1 1)'), 0, 2);
+SELECT 'crs_06', ST_AsGeoJson(GeomFromEWKT('SRID=1;POINT(1 1)'), 0, 4);
 
 -- Bbox
 SELECT 'bbox_01', ST_AsGeoJson(GeomFromEWKT('LINESTRING(1 1, 2 2, 3 3, 4 4)'), 0);
@@ -46,7 +32,6 @@ SELECT 'bbox_02', ST_AsGeoJson(GeomFromEWKT('LINESTRING(1 1, 2 2, 3 3, 4 4)'), 0
 SELECT 'bbox_03', ST_AsGeoJson(GeomFromEWKT('LINESTRING(1 1, 2 2, 3 3, 4 4)'), 0, 3);
 SELECT 'bbox_04', ST_AsGeoJson(GeomFromEWKT('LINESTRING(1 1, 2 2, 3 3, 4 4)'), 0, 5);
 
-
 -- CRS and Bbox
 SELECT 'options_01', ST_AsGeoJson(GeomFromEWKT('SRID=-1;LINESTRING(1 1, 2 2, 3 3, 4 4)'), 0, 0);
 SELECT 'options_02', ST_AsGeoJson(GeomFromEWKT('SRID=4326;LINESTRING(1 1, 2 2, 3 3, 4 4)'), 0);
@@ -67,139 +52,7 @@ SELECT 'options_15', ST_AsGeoJson(GeomFromEWKT('SRID=4326;LINESTRING(1 1, 2 2, 3
 
 
 
---
--- Line
---
-
--- Geometry from frida project: <http://frida.intevation.org/>
-SELECT 'line_01', ST_AsGeoJson(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)'), 2);
-
-SELECT 'line_02', ST_AsGeoJson(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);
-
-SELECT 'line_03', ST_AsGeoJson(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, 3);
-
-SELECT 'line_04', ST_AsGeoJson(GeomFromEWKT('SRID=31467;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_05', ST_AsGeoJson(GeomFromEWKT('SRID=31467;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, 3);
-
-
-
-
---
--- Polygon
---
-
--- Geometry from frida project: <http://frida.intevation.org/>
-
-SELECT 'polygon_01', ST_AsGeoJson(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))'), 2);
-
-SELECT 'polygon_02', ST_AsGeoJson(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);
-
-SELECT 'polygon_03', ST_AsGeoJson(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, 3);
-
-SELECT 'polygon_04', ST_AsGeoJson(GeomFromEWKT('SRID=31467;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_05', ST_AsGeoJson(GeomFromEWKT('SRID=31467;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, 3);
-
-
-
---
--- Multipoint
---
-
--- SELECT astext(collect(the_geom)) FROM poi WHERE poitypname='Schule';
--- Geometry from frida project: <http://frida.intevation.org/>
-
-SELECT 'multipoint_01', ST_AsGeoJson(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)'), 2);
-
-SELECT 'multipoint_02', ST_AsGeoJson(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);
-
-SELECT 'multipoint_03', ST_AsGeoJson(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, 3);
-
-SELECT 'multipoint_04', ST_AsGeoJson(GeomFromEWKT('SRID=31467;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_05', ST_AsGeoJson(GeomFromEWKT('SRID=31467;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, 3);
-
-
-
---
--- MultiLine
---
--- Geometry from frida project: <http://frida.intevation.org/>
--- SELECT st_astext(st_linemerge(the_geom)) FROM river WHERE glname='Stichkanal';
-
-SELECT 'multiline_01', ST_AsGeoJson(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))'), 2);
-
-SELECT 'multiline_02', ST_AsGeoJson(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);
-SELECT 'multiline_03', ST_AsGeoJson(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,3);
-
-SELECT 'multiline_04', ST_AsGeoJson(GeomFromEWKT('SRID=31467;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_05', ST_AsGeoJson(GeomFromEWKT('SRID=31467;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,3);
-
-
-
---
--- MultiPolygon
---
-
--- Geometry from frida project: <http://frida.intevation.org/>
--- Leyer Holz Park
--- st_astext(geomunion(the_geom)) FROM park WHERE gfname='Leyer Holz';
-
-SELECT 'multipolygon_01', ST_AsGeoJson(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)))'), 2);
-
-SELECT 'multipolygon_02', ST_AsGeoJson(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);
-
-SELECT 'multipolygon_03', ST_AsGeoJson(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, 3);
-
-SELECT 'multipolygon_04', ST_AsGeoJson(GeomFromEWKT('SRID=31467;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_05', ST_AsGeoJson(GeomFromEWKT('SRID=31467;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, 3);
-
-
-
---
--- 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: <http://frida.intevation.org/>
-SELECT 'geometrycollection_01', ST_AsGeoJson(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)))'), 2);
-
-
-SELECT 'geometrycollection_02', ST_AsGeoJson(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);
-
-SELECT 'geometrycollection_03', ST_AsGeoJson(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_04', ST_AsGeoJson(GeomFromEWKT('SRID=31467;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_05', ST_AsGeoJson(GeomFromEWKT('SRID=31467;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, 3);
-
---
--- Unsupported Geometry 
--- (From AsKml units test)
---
-SELECT 'invalid_01', ST_asGeoJson(GeomFromEWKT('SRID=4326;CIRCULARSTRING(-2 0,0 2,2 0,0 2,2 4)'));
-SELECT 'invalid_02', ST_asGeoJson(GeomFromEWKT('SRID=4326;COMPOUNDCURVE(CIRCULARSTRING(0 0,1 1,1 0),(1 0,0 1))'));
-SELECT 'invalid_03', ST_asGeoJson(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_asGeoJson(GeomFromEWKT('SRID=4326;MULTICURVE((5 5,3 5,3 3,0 3),CIRCULARSTRING(0 0,2 1,2 2))'));
-SELECT 'invalid_05', ST_asGeoJson(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_AsGeoJson(GeomFromEWKT('SRID=4326;POINT(1 1 1)'));
-SELECT '3D_02', ST_AsGeoJson(GeomFromEWKT('SRID=4326;POINT(1 1 1)'), 0, 3);
-SELECT '3D_03', ST_AsGeoJson(GeomFromEWKT('SRID=4326;LINESTRING(1 1 1, 2 2 2, 3 3 3, 4 4 4)'), 0, 3);
-SELECT '3D_04', ST_AsGeoJson(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, 3);
-
 --
 -- 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;
+DELETE FROM spatial_ref_sys;
index 94c7c2c55f86f33cdc7a896a59abc4398890ada3..2206aafa3eba57dc8d8e48cf2f695b1d3cfff4e1 100644 (file)
@@ -1,19 +1,15 @@
-simple_point|{"type":"Point","coordinates":[1,1]}
 empty_geom|
 precision_01|{"type":"Point","coordinates":[1,1]}
-precision_02|{"type":"Point","coordinates":[1.111,1.111]}
-precision_03|{"type":"Point","coordinates":[1,1]}
-precision_04|{"type":"Point","coordinates":[1.1111111,1.1111111]}
+precision_02|{"type":"Point","coordinates":[1.1111111,1.1111111]}
 version_01|{"type":"Point","coordinates":[1,1]}
 ERROR:  Only GeoJSON 1 is supported
 ERROR:  Only GeoJSON 1 is supported
 crs_01|{"type":"Point","crs":{"type":"name","properties":{"name":"EPSG:4326"}},"coordinates":[1,1]}
 crs_02|{"type":"Point","coordinates":[1,1]}
-crs_03|{"type":"Point","crs":{"type":"name","properties":{"name":"EPSG:27572"}},"coordinates":[600000,2430000]}
-ERROR:  SRID 100000 unknown in spatial_ref_sys table
-crs_05|{"type":"Point","crs":{"type":"name","properties":{"name":"urn:ogc:def:crs:EPSG:4326"}},"coordinates":[1,1]}
-crs_06|{"type":"Point","coordinates":[1,1]}
-crs_07|{"type":"Point","crs":{"type":"name","properties":{"name":"urn:ogc:def:crs:EPSG:27572"}},"coordinates":[600000,2430000]}
+crs_03|{"type":"Point","crs":{"type":"name","properties":{"name":"urn:ogc:def:crs:EPSG:4326"}},"coordinates":[1,1]}
+crs_04|{"type":"Point","coordinates":[1,1]}
+ERROR:  SRID 1 unknown in spatial_ref_sys table
+ERROR:  SRID 1 unknown in spatial_ref_sys table
 bbox_01|{"type":"LineString","coordinates":[[1,1],[2,2],[3,3],[4,4]]}
 bbox_02|{"type":"LineString","bbox":[1,1,4,4],"coordinates":[[1,1],[2,2],[3,3],[4,4]]}
 bbox_03|{"type":"LineString","bbox":[1,1,4,4],"coordinates":[[1,1],[2,2],[3,3],[4,4]]}
@@ -34,42 +30,3 @@ options_12|{"type":"LineString","coordinates":[[1,1],[2,2],[3,3],[4,4]]}
 options_13|{"type":"LineString","crs":{"type":"name","properties":{"name":"urn:ogc:def:crs:EPSG:4326"}},"coordinates":[[1,1],[2,2],[3,3],[4,4]]}
 options_14|{"type":"LineString","bbox":[1,1,4,4],"coordinates":[[1,1],[2,2],[3,3],[4,4]]}
 options_15|{"type":"LineString","crs":{"type":"name","properties":{"name":"urn:ogc:def:crs:EPSG:4326"}},"bbox":[1,1,4,4],"coordinates":[[1,1],[2,2],[3,3],[4,4]]}
-line_01|{"type":"LineString","coordinates":[[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]]}
-line_02|{"type":"LineString","coordinates":[[3429563,5799491],[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_03|{"type":"LineString","bbox":[3429563,5798013,3431645,5799491],"coordinates":[[3429563,5799491],[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|{"type":"LineString","crs":{"type":"name","properties":{"name":"EPSG:31467"}},"coordinates":[[3429563,5799491],[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_05|{"type":"LineString","crs":{"type":"name","properties":{"name":"EPSG:31467"}},"bbox":[3429563,5798013,3431645,5799491],"coordinates":[[3429563,5799491],[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]]}
-polygon_01|{"type":"Polygon","coordinates":[[[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]]]}
-polygon_02|{"type":"Polygon","coordinates":[[[3429858,5799440],[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],[3429858,5799440]]]}
-polygon_03|{"type":"Polygon","bbox":[3429858,5799176,3430419,5799793],"coordinates":[[[3429858,5799440],[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],[3429858,5799440]]]}
-polygon_04|{"type":"Polygon","crs":{"type":"name","properties":{"name":"EPSG:31467"}},"coordinates":[[[3429858,5799440],[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],[3429858,5799440]]]}
-polygon_05|{"type":"Polygon","crs":{"type":"name","properties":{"name":"EPSG:31467"}},"bbox":[3429858,5799176,3430419,5799793],"coordinates":[[[3429858,5799440],[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],[3429858,5799440]]]}
-multipoint_01|{"type":"MultiPoint","coordinates":[[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]]}
-multipoint_02|{"type":"MultiPoint","coordinates":[[3433276,5795309],[3428545,5795828],[3431577,5799084],[3431724,5797153],[3431984,5796565],[3435148,5797650],[3434661,5796942],[3434675,5797031],[3435714,5797023],[3436369,5796951],[3436730,5796769],[3435539,5796267],[3435847,5795918],[3434312,5794846],[3433122,5793671],[3433176,5793489],[3434316,5793940],[3433223,5793040],[3433416,5792892],[3430717,5792601],[3435384,5792878],[3435229,5792177],[3435120,5792319],[3435089,5792111],[3434485,5792110],[3435778,5792419],[3435717,5794318],[3436895,5794569],[3437622,5793932],[3435597,5793468],[3435247,5793395],[3434722,5793375],[3434712,5793810],[3434773,5793817],[3434630,5793855],[3434992,5794140],[3434927,5794252],[3434959,5794286],[3435120,5794163],[3435850,5791727],[3435931,5791636],[3436269,5791883],[3437110,5791664],[3435960,5790928],[3433546,5789755],[3439097,5790884],[3438577,5795047],[3438397,5794859],[3438193,5794696],[3438448,5796131],[3440688,5793670]]}
-multipoint_03|{"type":"MultiPoint","bbox":[3428545,5789755,3440688,5799084],"coordinates":[[3433276,5795309],[3428545,5795828],[3431577,5799084],[3431724,5797153],[3431984,5796565],[3435148,5797650],[3434661,5796942],[3434675,5797031],[3435714,5797023],[3436369,5796951],[3436730,5796769],[3435539,5796267],[3435847,5795918],[3434312,5794846],[3433122,5793671],[3433176,5793489],[3434316,5793940],[3433223,5793040],[3433416,5792892],[3430717,5792601],[3435384,5792878],[3435229,5792177],[3435120,5792319],[3435089,5792111],[3434485,5792110],[3435778,5792419],[3435717,5794318],[3436895,5794569],[3437622,5793932],[3435597,5793468],[3435247,5793395],[3434722,5793375],[3434712,5793810],[3434773,5793817],[3434630,5793855],[3434992,5794140],[3434927,5794252],[3434959,5794286],[3435120,5794163],[3435850,5791727],[3435931,5791636],[3436269,5791883],[3437110,5791664],[3435960,5790928],[3433546,5789755],[3439097,5790884],[3438577,5795047],[3438397,5794859],[3438193,5794696],[3438448,5796131],[3440688,5793670]]}
-multipoint_04|{"type":"MultiPoint","crs":{"type":"name","properties":{"name":"EPSG:31467"}},"coordinates":[[3433276,5795309],[3428545,5795828],[3431577,5799084],[3431724,5797153],[3431984,5796565],[3435148,5797650],[3434661,5796942],[3434675,5797031],[3435714,5797023],[3436369,5796951],[3436730,5796769],[3435539,5796267],[3435847,5795918],[3434312,5794846],[3433122,5793671],[3433176,5793489],[3434316,5793940],[3433223,5793040],[3433416,5792892],[3430717,5792601],[3435384,5792878],[3435229,5792177],[3435120,5792319],[3435089,5792111],[3434485,5792110],[3435778,5792419],[3435717,5794318],[3436895,5794569],[3437622,5793932],[3435597,5793468],[3435247,5793395],[3434722,5793375],[3434712,5793810],[3434773,5793817],[3434630,5793855],[3434992,5794140],[3434927,5794252],[3434959,5794286],[3435120,5794163],[3435850,5791727],[3435931,5791636],[3436269,5791883],[3437110,5791664],[3435960,5790928],[3433546,5789755],[3439097,5790884],[3438577,5795047],[3438397,5794859],[3438193,5794696],[3438448,5796131],[3440688,5793670]]}
-multipoint_05|{"type":"MultiPoint","crs":{"type":"name","properties":{"name":"EPSG:31467"}},"bbox":[3428545,5789755,3440688,5799084],"coordinates":[[3433276,5795309],[3428545,5795828],[3431577,5799084],[3431724,5797153],[3431984,5796565],[3435148,5797650],[3434661,5796942],[3434675,5797031],[3435714,5797023],[3436369,5796951],[3436730,5796769],[3435539,5796267],[3435847,5795918],[3434312,5794846],[3433122,5793671],[3433176,5793489],[3434316,5793940],[3433223,5793040],[3433416,5792892],[3430717,5792601],[3435384,5792878],[3435229,5792177],[3435120,5792319],[3435089,5792111],[3434485,5792110],[3435778,5792419],[3435717,5794318],[3436895,5794569],[3437622,5793932],[3435597,5793468],[3435247,5793395],[3434722,5793375],[3434712,5793810],[3434773,5793817],[3434630,5793855],[3434992,5794140],[3434927,5794252],[3434959,5794286],[3435120,5794163],[3435850,5791727],[3435931,5791636],[3436269,5791883],[3437110,5791664],[3435960,5790928],[3433546,5789755],[3439097,5790884],[3438577,5795047],[3438397,5794859],[3438193,5794696],[3438448,5796131],[3440688,5793670]]}
-multiline_01|{"type":"MultiLineString","coordinates":[[[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]]]}
-multiline_02|{"type":"MultiLineString","coordinates":[[[3429563,5799491],[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]],[[3433260,5797003],[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]],[[3431865,5797949],[3431645,5798013]],[[3431865,5797949],[3431816,5797808]],[[3433260,5797003],[3433361,5796789],[3433467,5796573],[3433671,5796160]],[[3433671,5796160],[3433709,5796097],[3433744,5796022],[3433862,5795869],[3434029,5795680],[3434229,5795456],[3434239,5795425],[3434296,5795363]]]}
-multiline_03|{"type":"MultiLineString","bbox":[3429563,5795363,3434296,5799491],"coordinates":[[[3429563,5799491],[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]],[[3433260,5797003],[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]],[[3431865,5797949],[3431645,5798013]],[[3431865,5797949],[3431816,5797808]],[[3433260,5797003],[3433361,5796789],[3433467,5796573],[3433671,5796160]],[[3433671,5796160],[3433709,5796097],[3433744,5796022],[3433862,5795869],[3434029,5795680],[3434229,5795456],[3434239,5795425],[3434296,5795363]]]}
-multiline_04|{"type":"MultiLineString","crs":{"type":"name","properties":{"name":"EPSG:31467"}},"coordinates":[[[3429563,5799491],[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]],[[3433260,5797003],[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]],[[3431865,5797949],[3431645,5798013]],[[3431865,5797949],[3431816,5797808]],[[3433260,5797003],[3433361,5796789],[3433467,5796573],[3433671,5796160]],[[3433671,5796160],[3433709,5796097],[3433744,5796022],[3433862,5795869],[3434029,5795680],[3434229,5795456],[3434239,5795425],[3434296,5795363]]]}
-multiline_05|{"type":"MultiLineString","crs":{"type":"name","properties":{"name":"EPSG:31467"}},"bbox":[3429563,5795363,3434296,5799491],"coordinates":[[[3429563,5799491],[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]],[[3433260,5797003],[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]],[[3431865,5797949],[3431645,5798013]],[[3431865,5797949],[3431816,5797808]],[[3433260,5797003],[3433361,5796789],[3433467,5796573],[3433671,5796160]],[[3433671,5796160],[3433709,5796097],[3433744,5796022],[3433862,5795869],[3434029,5795680],[3434229,5795456],[3434239,5795425],[3434296,5795363]]]}
-multipolygon_01|{"type":"MultiPolygon","coordinates":[[[[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]]]]}
-multipolygon_02|{"type":"MultiPolygon","coordinates":[[[[3429700,5795852],[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],[3429700,5795852]]],[[[3429858,5799440],[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],[3429858,5799440]]]]}
-multipolygon_03|{"type":"MultiPolygon","bbox":[3428290,5795394,3430419,5799793],"coordinates":[[[[3429700,5795852],[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],[3429700,5795852]]],[[[3429858,5799440],[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],[3429858,5799440]]]]}
-multipolygon_04|{"type":"MultiPolygon","crs":{"type":"name","properties":{"name":"EPSG:31467"}},"coordinates":[[[[3429700,5795852],[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],[3429700,5795852]]],[[[3429858,5799440],[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],[3429858,5799440]]]]}
-multipolygon_05|{"type":"MultiPolygon","crs":{"type":"name","properties":{"name":"EPSG:31467"}},"bbox":[3428290,5795394,3430419,5799793],"coordinates":[[[[3429700,5795852],[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],[3429700,5795852]]],[[[3429858,5799440],[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],[3429858,5799440]]]]}
-geometrycollection_01|{"type":"GeometryCollection","geometries":[{"type":"MultiPoint","coordinates":[[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]]},{"type":"MultiLineString","coordinates":[[[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]]]}]}
-geometrycollection_02|{"type":"GeometryCollection","geometries":[{"type":"MultiPoint","coordinates":[[3433276,5795309],[3428545,5795828],[3431577,5799084],[3431724,5797153],[3431984,5796565],[3435148,5797650],[3434661,5796942],[3434675,5797031],[3435714,5797023],[3436369,5796951],[3436730,5796769],[3435539,5796267],[3435847,5795918],[3434312,5794846],[3433122,5793671],[3433176,5793489],[3434316,5793940],[3433223,5793040],[3433416,5792892],[3430717,5792601],[3435384,5792878],[3435229,5792177],[3435120,5792319],[3435089,5792111],[3434485,5792110],[3435778,5792419],[3435717,5794318],[3436895,5794569],[3437622,5793932],[3435597,5793468],[3435247,5793395],[3434722,5793375],[3434712,5793810],[3434773,5793817],[3434630,5793855],[3434992,5794140],[3434927,5794252],[3434959,5794286],[3435120,5794163],[3435850,5791727],[3435931,5791636],[3436269,5791883],[3437110,5791664],[3435960,5790928],[3433546,5789755],[3439097,5790884],[3438577,5795047],[3438397,5794859],[3438193,5794696],[3438448,5796131],[3440688,5793670]]},{"type":"MultiLineString","coordinates":[[[3429563,5799491],[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]],[[3433260,5797003],[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]],[[3431865,5797949],[3431645,5798013]],[[3431865,5797949],[3431816,5797808]],[[3433260,5797003],[3433361,5796789],[3433467,5796573],[3433671,5796160]],[[3433671,5796160],[3433709,5796097],[3433744,5796022],[3433862,5795869],[3434029,5795680],[3434229,5795456],[3434239,5795425],[3434296,5795363]]]}]}
-geometrycollection_03|{"type":"GeometryCollection","geometries":[{"type":"MultiPoint","coordinates":[[3433276,5795309],[3428545,5795828],[3431577,5799084],[3431724,5797153],[3431984,5796565],[3435148,5797650],[3434661,5796942],[3434675,5797031],[3435714,5797023],[3436369,5796951],[3436730,5796769],[3435539,5796267],[3435847,5795918],[3434312,5794846],[3433122,5793671],[3433176,5793489],[3434316,5793940],[3433223,5793040],[3433416,5792892],[3430717,5792601],[3435384,5792878],[3435229,5792177],[3435120,5792319],[3435089,5792111],[3434485,5792110],[3435778,5792419],[3435717,5794318],[3436895,5794569],[3437622,5793932],[3435597,5793468],[3435247,5793395],[3434722,5793375],[3434712,5793810],[3434773,5793817],[3434630,5793855],[3434992,5794140],[3434927,5794252],[3434959,5794286],[3435120,5794163],[3435850,5791727],[3435931,5791636],[3436269,5791883],[3437110,5791664],[3435960,5790928],[3433546,5789755],[3439097,5790884],[3438577,5795047],[3438397,5794859],[3438193,5794696],[3438448,5796131],[3440688,5793670]]},{"type":"MultiLineString","coordinates":[[[3429563,5799491],[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]],[[3433260,5797003],[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]],[[3431865,5797949],[3431645,5798013]],[[3431865,5797949],[3431816,5797808]],[[3433260,5797003],[3433361,5796789],[3433467,5796573],[3433671,5796160]],[[3433671,5796160],[3433709,5796097],[3433744,5796022],[3433862,5795869],[3434029,5795680],[3434229,5795456],[3434239,5795425],[3434296,5795363]]]}]}
-geometrycollection_04|{"type":"GeometryCollection","crs":{"type":"name","properties":{"name":"EPSG:31467"}},"geometries":[{"type":"MultiPoint","coordinates":[[3433276,5795309],[3428545,5795828],[3431577,5799084],[3431724,5797153],[3431984,5796565],[3435148,5797650],[3434661,5796942],[3434675,5797031],[3435714,5797023],[3436369,5796951],[3436730,5796769],[3435539,5796267],[3435847,5795918],[3434312,5794846],[3433122,5793671],[3433176,5793489],[3434316,5793940],[3433223,5793040],[3433416,5792892],[3430717,5792601],[3435384,5792878],[3435229,5792177],[3435120,5792319],[3435089,5792111],[3434485,5792110],[3435778,5792419],[3435717,5794318],[3436895,5794569],[3437622,5793932],[3435597,5793468],[3435247,5793395],[3434722,5793375],[3434712,5793810],[3434773,5793817],[3434630,5793855],[3434992,5794140],[3434927,5794252],[3434959,5794286],[3435120,5794163],[3435850,5791727],[3435931,5791636],[3436269,5791883],[3437110,5791664],[3435960,5790928],[3433546,5789755],[3439097,5790884],[3438577,5795047],[3438397,5794859],[3438193,5794696],[3438448,5796131],[3440688,5793670]]},{"type":"MultiLineString","coordinates":[[[3429563,5799491],[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]],[[3433260,5797003],[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]],[[3431865,5797949],[3431645,5798013]],[[3431865,5797949],[3431816,5797808]],[[3433260,5797003],[3433361,5796789],[3433467,5796573],[3433671,5796160]],[[3433671,5796160],[3433709,5796097],[3433744,5796022],[3433862,5795869],[3434029,5795680],[3434229,5795456],[3434239,5795425],[3434296,5795363]]]}]}
-geometrycollection_05|{"type":"GeometryCollection","crs":{"type":"name","properties":{"name":"EPSG:31467"}},"bbox":[3428545,5789755,3440688,5799491],"geometries":[{"type":"MultiPoint","bbox":[3433276,5795309,3433276,5795309],"coordinates":[[3433276,5795309],[3428545,5795828],[3431577,5799084],[3431724,5797153],[3431984,5796565],[3435148,5797650],[3434661,5796942],[3434675,5797031],[3435714,5797023],[3436369,5796951],[3436730,5796769],[3435539,5796267],[3435847,5795918],[3434312,5794846],[3433122,5793671],[3433176,5793489],[3434316,5793940],[3433223,5793040],[3433416,5792892],[3430717,5792601],[3435384,5792878],[3435229,5792177],[3435120,5792319],[3435089,5792111],[3434485,5792110],[3435778,5792419],[3435717,5794318],[3436895,5794569],[3437622,5793932],[3435597,5793468],[3435247,5793395],[3434722,5793375],[3434712,5793810],[3434773,5793817],[3434630,5793855],[3434992,5794140],[3434927,5794252],[3434959,5794286],[3435120,5794163],[3435850,5791727],[3435931,5791636],[3436269,5791883],[3437110,5791664],[3435960,5790928],[3433546,5789755],[3439097,5790884],[3438577,5795047],[3438397,5794859],[3438193,5794696],[3438448,5796131],[3440688,5793670]]},{"type":"MultiLineString","bbox":[3429563,5798013,3431645,5799491],"coordinates":[[[3429563,5799491],[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]],[[3433260,5797003],[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]],[[3431865,5797949],[3431645,5798013]],[[3431865,5797949],[3431816,5797808]],[[3433260,5797003],[3433361,5796789],[3433467,5796573],[3433671,5796160]],[[3433671,5796160],[3433709,5796097],[3433744,5796022],[3433862,5795869],[3434029,5795680],[3434229,5795456],[3434239,5795425],[3434296,5795363]]]}]}
-ERROR:  GeoJson: 'CircularString' geometry type not supported.
-ERROR:  GeoJson: 'CompoundString' geometry type not supported.
-ERROR:  GeoJson: 'CurvePolygon' geometry type not supported.
-ERROR:  GeoJson: 'MultiCurve' geometry type not supported.
-ERROR:  GeoJson: 'MultiSurface' geometry type not supported.
-3D_01|{"type":"Point","coordinates":[1,1,1]}
-3D_02|{"type":"Point","crs":{"type":"name","properties":{"name":"EPSG:4326"}},"bbox":[1,1,1,1,1,1],"coordinates":[1,1,1]}
-3D_03|{"type":"LineString","crs":{"type":"name","properties":{"name":"EPSG:4326"}},"bbox":[1,1,1,4,4,4],"coordinates":[[1,1,1],[2,2,2],[3,3,3],[4,4,4]]}
-3D_04|{"type":"Polygon","crs":{"type":"name","properties":{"name":"EPSG:4326"}},"bbox":[1,0,0,5,5,5],"coordinates":[[[1,1,1],[2,2,2],[3,3,3],[4,4,4],[5,5,5],[5,0,0],[1,1,1]]]}