PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches
cu_out_gml.c
Go to the documentation of this file.
1/**********************************************************************
2 *
3 * PostGIS - Spatial Types for PostgreSQL
4 * http://postgis.net
5 *
6 * Copyright 2010 Olivier Courtin <olivier.courtin@oslandia.com>
7 *
8 * This is free software; you can redistribute and/or modify it under
9 * the terms of the GNU General Public Licence. See the COPYING file.
10 *
11 **********************************************************************/
12
13#include <stdio.h>
14#include <stdlib.h>
15#include <string.h>
16#include "CUnit/Basic.h"
17
18#include "liblwgeom_internal.h"
19#include "cu_tester.h"
20
21static void do_gml2_test(char * in, char * out, char * srs, int precision)
22{
24 lwvarlena_t *v = lwgeom_to_gml2(g, srs, precision, "gml:");
25
27
28 lwgeom_free(g);
29 lwfree(v);
30}
31
32static void do_gml2_test_prefix(char * in, char * out, char * srs, int precision, const char *prefix)
33{
35 lwvarlena_t *v = lwgeom_to_gml2(g, srs, precision, prefix);
36
38
39 lwgeom_free(g);
40 lwfree(v);
41}
42
43static void do_gml3_test_opts(char * in, char * out, char * srs, int precision, int opts)
44{
46 lwvarlena_t *v = lwgeom_to_gml3(g, srs, precision, opts, "gml:", NULL);
47
49
50 lwgeom_free(g);
51 lwfree(v);
52}
53
54static void do_gml3_test(char * in, char * out, char * srs, int precision, int is_geodetic)
55{
56 int opts = LW_GML_IS_DIMS;
57 if ( is_geodetic ) opts |= LW_GML_IS_DEGREE;
58
60 lwvarlena_t *v = lwgeom_to_gml3(g, srs, precision, opts, "gml:", NULL);
61
63
64 lwgeom_free(g);
65 lwfree(v);
66}
67
68static void do_gml3_test_prefix(char * in, char * out, char * srs, int precision, int is_geodetic, const char *prefix)
69{
70 int opts = LW_GML_IS_DIMS;
71 if ( is_geodetic ) opts |= LW_GML_IS_DEGREE;
72
74 lwvarlena_t *v = lwgeom_to_gml3(g, srs, precision, opts, prefix, NULL);
75
77
78 lwgeom_free(g);
79 lwfree(v);
80}
81
82static void do_gml3_test_nodims(char * in, char * out, char * srs, int precision, int is_geodetic, int is_dims, const char *prefix)
83{
84 int opts = 0;
85 if ( is_geodetic ) opts |= LW_GML_IS_DEGREE;
86 if ( is_dims ) opts |= LW_GML_IS_DIMS;
87
89 lwvarlena_t *v = lwgeom_to_gml3(g, srs, precision, opts, prefix, NULL);
90
92
93 lwgeom_free(g);
94 lwfree(v);
95}
96
97static void do_gml2_unsupported(char * in, char * out)
98{
100 lwvarlena_t *v = lwgeom_to_gml2(g, NULL, 0, "");
101
104
105 lwfree(v);
106 lwgeom_free(g);
107}
108
109static void do_gml2_extent_test(char * in, char * out, char * srs,
110 double precision, char * prefix)
111{
113 lwvarlena_t *v = lwgeom_extent_to_gml2(g, srs, precision, prefix);
114 if (!v)
115 {
117 }
118 else
119 {
120 ASSERT_VARLENA_EQUAL(v, out);
121 }
122
124 lwfree(v);
125 lwgeom_free(g);
126}
127
128static void do_gml3_extent_test(char * in, char * out, char * srs,
129 double precision, int opts, char* prefix)
130{
132 lwvarlena_t *v = lwgeom_extent_to_gml3(g, srs, precision, opts, prefix);
133
134 ASSERT_VARLENA_EQUAL(v, out);
135
136 lwgeom_free(g);
137 lwfree(v);
138}
139
140static void out_gml_test_precision(void)
141{
142 /* GML2 - 0 precision, i.e a round */
144 "POINT(1.1111111111111 1.1111111111111)",
145 "<gml:Point><gml:coordinates>1,1</gml:coordinates></gml:Point>",
146 NULL, 0);
147
148 /* GML3 - 0 precision, i.e a round */
150 "POINT(1.1111111111111 1.1111111111111)",
151 "<gml:Point><gml:pos srsDimension=\"2\">1 1</gml:pos></gml:Point>",
152 NULL, 0, 0);
153
154
155 /* GML2 - 3 digits precision */
157 "POINT(1.1111111111111 1.1111111111111)",
158 "<gml:Point><gml:coordinates>1.111,1.111</gml:coordinates></gml:Point>",
159 NULL, 3);
160
161 /* GML3 - 3 digits precision */
163 "POINT(1.1111111111111 1.1111111111111)",
164 "<gml:Point><gml:pos srsDimension=\"2\">1.111 1.111</gml:pos></gml:Point>",
165 NULL, 3, 0);
166
167
168 /* GML2 - 9 digits precision */
170 "POINT(1.2345678901234 1.2345678901234)",
171 "<gml:Point><gml:coordinates>1.23456789,1.23456789</gml:coordinates></gml:Point>",
172 NULL, 9);
173
174 /* GML3 - 9 digits precision */
176 "POINT(1.2345678901234 1.2345678901234)",
177 "<gml:Point><gml:pos srsDimension=\"2\">1.23456789 1.23456789</gml:pos></gml:Point>",
178 NULL, 9, 0);
179
180
181 /* GML2 - huge data */
183 "POINT(1E300 -1E300)",
184 "<gml:Point><gml:coordinates>1e+300,-1e+300</gml:coordinates></gml:Point>",
185 NULL, 0);
186
187 /* GML3 - huge data */
189 "POINT(1E300 -1E300)",
190 "<gml:Point><gml:pos srsDimension=\"2\">1e+300 -1e+300</gml:pos></gml:Point>",
191 NULL, 0, 0);
192}
193
194static void out_gml_test_srid(void)
195{
196 /* GML2 - Point with SRID */
198 "POINT(0 1)",
199 "<gml:Point srsName=\"EPSG:4326\"><gml:coordinates>0,1</gml:coordinates></gml:Point>",
200 "EPSG:4326", 0);
201
202 /* GML3 - Point with SRID */
204 "POINT(0 1)",
205 "<gml:Point srsName=\"EPSG:4326\"><gml:pos srsDimension=\"2\">0 1</gml:pos></gml:Point>",
206 "EPSG:4326", 0, 0);
207
208
209 /* GML2 - Linestring with SRID */
211 "LINESTRING(0 1,2 3,4 5)",
212 "<gml:LineString srsName=\"EPSG:4326\"><gml:coordinates>0,1 2,3 4,5</gml:coordinates></gml:LineString>",
213 "EPSG:4326", 0);
214
215 /* GML3 - Linestring with SRID */
217 "LINESTRING(0 1,2 3,4 5)",
218 "<gml:Curve srsName=\"EPSG:4326\"><gml:segments><gml:LineStringSegment><gml:posList srsDimension=\"2\">0 1 2 3 4 5</gml:posList></gml:LineStringSegment></gml:segments></gml:Curve>",
219 "EPSG:4326", 0, 0);
220
221 /* GML3 - Linestring with SRID and short tag*/
223 "LINESTRING(0 1,2 3,4 5)",
224 "<gml:LineString srsName=\"EPSG:4326\"><gml:posList>0 1 2 3 4 5</gml:posList></gml:LineString>",
225 "EPSG:4326", 0, LW_GML_SHORTLINE);
226
227
228 /* GML2 Polygon with SRID */
230 "POLYGON((0 1,2 3,4 5,0 1))",
231 "<gml:Polygon srsName=\"EPSG:4326\"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>0,1 2,3 4,5 0,1</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon>",
232 "EPSG:4326", 0);
233
234 /* GML3 Polygon with SRID */
236 "POLYGON((0 1,2 3,4 5,0 1))",
237 "<gml:Polygon srsName=\"EPSG:4326\"><gml:exterior><gml:LinearRing><gml:posList srsDimension=\"2\">0 1 2 3 4 5 0 1</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon>",
238 "EPSG:4326", 0, 0);
239
240
241 /* GML2 MultiPoint with SRID */
243 "MULTIPOINT(0 1,2 3)",
244 "<gml:MultiPoint srsName=\"EPSG:4326\"><gml:pointMember><gml:Point><gml:coordinates>0,1</gml:coordinates></gml:Point></gml:pointMember><gml:pointMember><gml:Point><gml:coordinates>2,3</gml:coordinates></gml:Point></gml:pointMember></gml:MultiPoint>",
245 "EPSG:4326", 0);
246
247 /* GML3 MultiPoint with SRID */
249 "MULTIPOINT(0 1,2 3)",
250 "<gml:MultiPoint srsName=\"EPSG:4326\"><gml:pointMember><gml:Point><gml:pos srsDimension=\"2\">0 1</gml:pos></gml:Point></gml:pointMember><gml:pointMember><gml:Point><gml:pos srsDimension=\"2\">2 3</gml:pos></gml:Point></gml:pointMember></gml:MultiPoint>",
251 "EPSG:4326", 0, 0);
252
253
254 /* GML2 Multiline with SRID */
256 "MULTILINESTRING((0 1,2 3,4 5),(6 7,8 9,10 11))",
257 "<gml:MultiLineString srsName=\"EPSG:4326\"><gml:lineStringMember><gml:LineString><gml:coordinates>0,1 2,3 4,5</gml:coordinates></gml:LineString></gml:lineStringMember><gml:lineStringMember><gml:LineString><gml:coordinates>6,7 8,9 10,11</gml:coordinates></gml:LineString></gml:lineStringMember></gml:MultiLineString>",
258 "EPSG:4326", 0);
259
260
261 /* GML3 Multiline with SRID */
263 "MULTILINESTRING((0 1,2 3,4 5),(6 7,8 9,10 11))",
264 "<gml:MultiCurve srsName=\"EPSG:4326\"><gml:curveMember><gml:Curve><gml:segments><gml:LineStringSegment><gml:posList srsDimension=\"2\">0 1 2 3 4 5</gml:posList></gml:LineStringSegment></gml:segments></gml:Curve></gml:curveMember><gml:curveMember><gml:Curve><gml:segments><gml:LineStringSegment><gml:posList srsDimension=\"2\">6 7 8 9 10 11</gml:posList></gml:LineStringSegment></gml:segments></gml:Curve></gml:curveMember></gml:MultiCurve>",
265 "EPSG:4326", 0, 0);
266
267 /* GML3 Multiline with SRID and LineString tag */
269 "MULTILINESTRING((0 1,2 3,4 5),(6 7,8 9,10 11))",
270 "<gml:MultiCurve srsName=\"EPSG:4326\"><gml:curveMember><gml:LineString><gml:posList>0 1 2 3 4 5</gml:posList></gml:LineString></gml:curveMember><gml:curveMember><gml:LineString><gml:posList>6 7 8 9 10 11</gml:posList></gml:LineString></gml:curveMember></gml:MultiCurve>",
271 "EPSG:4326", 0, LW_GML_SHORTLINE);
272
273
274 /* GML2 MultiPolygon with SRID */
276 "MULTIPOLYGON(((0 1,2 3,4 5,0 1)),((6 7,8 9,10 11,6 7)))",
277 "<gml:MultiPolygon srsName=\"EPSG:4326\"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>0,1 2,3 4,5 0,1</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>6,7 8,9 10,11 6,7</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon>",
278 "EPSG:4326", 0);
279
280 /* GML3 MultiPolygon with SRID */
282 "MULTIPOLYGON(((0 1,2 3,4 5,0 1)),((6 7,8 9,10 11,6 7)))",
283 "<gml:MultiSurface srsName=\"EPSG:4326\"><gml:surfaceMember><gml:Polygon><gml:exterior><gml:LinearRing><gml:posList srsDimension=\"2\">0 1 2 3 4 5 0 1</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon></gml:surfaceMember><gml:surfaceMember><gml:Polygon><gml:exterior><gml:LinearRing><gml:posList srsDimension=\"2\">6 7 8 9 10 11 6 7</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon></gml:surfaceMember></gml:MultiSurface>",
284 "EPSG:4326", 0, 0);
285
286 /* GML3 PolyhedralSurface with SRID */
288 "POLYHEDRALSURFACE(((0 1,2 3,4 5,0 1)),((6 7,8 9,10 11,6 7)))",
289 "<gml:PolyhedralSurface srsName=\"EPSG:4326\"><gml:polygonPatches><gml:PolygonPatch><gml:exterior><gml:LinearRing><gml:posList srsDimension=\"2\">0 1 2 3 4 5 0 1</gml:posList></gml:LinearRing></gml:exterior></gml:PolygonPatch><gml:PolygonPatch><gml:exterior><gml:LinearRing><gml:posList srsDimension=\"2\">6 7 8 9 10 11 6 7</gml:posList></gml:LinearRing></gml:exterior></gml:PolygonPatch></gml:polygonPatches></gml:PolyhedralSurface>",
290 "EPSG:4326", 0, 0);
291
292 /* GML3 Tin with SRID */
294 "TIN(((0 1,2 3,4 5,0 1)),((6 7,8 9,10 11,6 7)))",
295 "<gml:Tin srsName=\"EPSG:4326\"><gml:trianglePatches><gml:Triangle><gml:exterior><gml:LinearRing><gml:posList srsDimension=\"2\">0 1 2 3 4 5 0 1</gml:posList></gml:LinearRing></gml:exterior></gml:Triangle><gml:Triangle><gml:exterior><gml:LinearRing><gml:posList srsDimension=\"2\">6 7 8 9 10 11 6 7</gml:posList></gml:LinearRing></gml:exterior></gml:Triangle></gml:trianglePatches></gml:Tin>",
296 "EPSG:4326", 0, 0);
297
298
299 /* GML2 GeometryCollection with SRID */
301 "GEOMETRYCOLLECTION(POINT(0 1),LINESTRING(2 3,4 5))",
302 "<gml:MultiGeometry srsName=\"EPSG:4326\"><gml:geometryMember><gml:Point><gml:coordinates>0,1</gml:coordinates></gml:Point></gml:geometryMember><gml:geometryMember><gml:LineString><gml:coordinates>2,3 4,5</gml:coordinates></gml:LineString></gml:geometryMember></gml:MultiGeometry>",
303 "EPSG:4326", 0);
304
305 /* GML3 GeometryCollection with SRID */
307 "GEOMETRYCOLLECTION(POINT(0 1),LINESTRING(2 3,4 5))",
308 "<gml:MultiGeometry srsName=\"EPSG:4326\"><gml:geometryMember><gml:Point><gml:pos srsDimension=\"2\">0 1</gml:pos></gml:Point></gml:geometryMember><gml:geometryMember><gml:Curve><gml:segments><gml:LineStringSegment><gml:posList srsDimension=\"2\">2 3 4 5</gml:posList></gml:LineStringSegment></gml:segments></gml:Curve></gml:geometryMember></gml:MultiGeometry>",
309 "EPSG:4326", 0, 0);
310}
311
312
313static void out_gml_test_geodetic(void)
314{
315 /* GML3 - Geodetic Point */
317 "POINT(0 1)",
318 "<gml:Point srsName=\"urn:ogc:def:crs:EPSG::4326\"><gml:pos srsDimension=\"2\">1 0</gml:pos></gml:Point>",
319 "urn:ogc:def:crs:EPSG::4326", 0, 1);
320
321 /* GML3 - 3D Geodetic Point */
323 "POINT(0 1 2)",
324 "<gml:Point srsName=\"urn:ogc:def:crs:EPSG::4326\"><gml:pos srsDimension=\"3\">1 0 2</gml:pos></gml:Point>",
325 "urn:ogc:def:crs:EPSG::4326", 0, 1);
326}
327
328
329static void out_gml_test_dims(void)
330{
331 /* GML2 - 3D */
333 "POINT(0 1 2)",
334 "<gml:Point><gml:coordinates>0,1,2</gml:coordinates></gml:Point>",
335 NULL, 0);
336
337 /* GML3 - 3D */
339 "POINT(0 1 2)",
340 "<gml:Point><gml:pos srsDimension=\"3\">0 1 2</gml:pos></gml:Point>",
341 NULL, 0, 0);
342
343
344 /* GML2 - 3DM */
346 "POINTM(0 1 2)",
347 "<gml:Point><gml:coordinates>0,1</gml:coordinates></gml:Point>",
348 NULL, 0);
349
350 /* GML3 - 3DM */
352 "POINTM(0 1 2)",
353 "<gml:Point><gml:pos srsDimension=\"2\">0 1</gml:pos></gml:Point>",
354 NULL, 0, 0);
355
356
357 /* GML2 - 4D */
359 "POINT(0 1 2 3)",
360 "<gml:Point><gml:coordinates>0,1,2</gml:coordinates></gml:Point>",
361 NULL, 0);
362
363 /* GML3 - 4D */
365 "POINT(0 1 2 3)",
366 "<gml:Point><gml:pos srsDimension=\"3\">0 1 2</gml:pos></gml:Point>",
367 NULL, 0, 0);
368}
369
370
371static void out_gml_test_geoms(void)
372{
373 /* GML2 - Linestring */
375 "LINESTRING(0 1,2 3,4 5)",
376 "<gml:LineString><gml:coordinates>0,1 2,3 4,5</gml:coordinates></gml:LineString>",
377 NULL, 0);
378
379 /* GML3 - Linestring */
381 "LINESTRING(0 1,2 3,4 5)",
382 "<gml:Curve><gml:segments><gml:LineStringSegment><gml:posList srsDimension=\"2\">0 1 2 3 4 5</gml:posList></gml:LineStringSegment></gml:segments></gml:Curve>",
383 NULL, 0, 0);
384
385
386 /* GML2 Polygon */
388 "POLYGON((0 1,2 3,4 5,0 1))",
389 "<gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>0,1 2,3 4,5 0,1</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon>",
390 NULL, 0);
391
392 /* GML3 Polygon */
394 "POLYGON((0 1,2 3,4 5,0 1))",
395 "<gml:Polygon><gml:exterior><gml:LinearRing><gml:posList srsDimension=\"2\">0 1 2 3 4 5 0 1</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon>",
396 NULL, 0, 0);
397
398 /* GML2 Polygon - with internal ring */
400 "POLYGON((0 1,2 3,4 5,0 1),(6 7,8 9,10 11,6 7))",
401 "<gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>0,1 2,3 4,5 0,1</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs><gml:innerBoundaryIs><gml:LinearRing><gml:coordinates>6,7 8,9 10,11 6,7</gml:coordinates></gml:LinearRing></gml:innerBoundaryIs></gml:Polygon>",
402 NULL, 0);
403
404 /* GML3 Polygon - with internal ring */
406 "POLYGON((0 1,2 3,4 5,0 1),(6 7,8 9,10 11,6 7))",
407 "<gml:Polygon><gml:exterior><gml:LinearRing><gml:posList srsDimension=\"2\">0 1 2 3 4 5 0 1</gml:posList></gml:LinearRing></gml:exterior><gml:interior><gml:LinearRing><gml:posList srsDimension=\"2\">6 7 8 9 10 11 6 7</gml:posList></gml:LinearRing></gml:interior></gml:Polygon>",
408 NULL, 0, 0);
409
410
411 /* GML3 Triangle */
413 "TRIANGLE((0 1,2 3,4 5,0 1))",
414 "<gml:Triangle><gml:exterior><gml:LinearRing><gml:posList srsDimension=\"2\">0 1 2 3 4 5 0 1</gml:posList></gml:LinearRing></gml:exterior></gml:Triangle>",
415 NULL, 0, 0);
416
417
418 /* GML2 MultiPoint */
420 "MULTIPOINT(0 1,2 3)",
421 "<gml:MultiPoint><gml:pointMember><gml:Point><gml:coordinates>0,1</gml:coordinates></gml:Point></gml:pointMember><gml:pointMember><gml:Point><gml:coordinates>2,3</gml:coordinates></gml:Point></gml:pointMember></gml:MultiPoint>",
422 NULL, 0);
423
424 /* GML3 MultiPoint */
426 "MULTIPOINT(0 1,2 3)",
427 "<gml:MultiPoint><gml:pointMember><gml:Point><gml:pos srsDimension=\"2\">0 1</gml:pos></gml:Point></gml:pointMember><gml:pointMember><gml:Point><gml:pos srsDimension=\"2\">2 3</gml:pos></gml:Point></gml:pointMember></gml:MultiPoint>",
428 NULL, 0, 0);
429
430
431 /* GML2 Multiline */
433 "MULTILINESTRING((0 1,2 3,4 5),(6 7,8 9,10 11))",
434 "<gml:MultiLineString><gml:lineStringMember><gml:LineString><gml:coordinates>0,1 2,3 4,5</gml:coordinates></gml:LineString></gml:lineStringMember><gml:lineStringMember><gml:LineString><gml:coordinates>6,7 8,9 10,11</gml:coordinates></gml:LineString></gml:lineStringMember></gml:MultiLineString>",
435 NULL, 0);
436
437 /* GML3 Multiline */
439 "MULTILINESTRING((0 1,2 3,4 5),(6 7,8 9,10 11))",
440 "<gml:MultiCurve><gml:curveMember><gml:Curve><gml:segments><gml:LineStringSegment><gml:posList srsDimension=\"2\">0 1 2 3 4 5</gml:posList></gml:LineStringSegment></gml:segments></gml:Curve></gml:curveMember><gml:curveMember><gml:Curve><gml:segments><gml:LineStringSegment><gml:posList srsDimension=\"2\">6 7 8 9 10 11</gml:posList></gml:LineStringSegment></gml:segments></gml:Curve></gml:curveMember></gml:MultiCurve>",
441 NULL, 0, 0);
442
443
444 /* GML2 MultiPolygon */
446 "MULTIPOLYGON(((0 1,2 3,4 5,0 1)),((6 7,8 9,10 11,6 7)))",
447 "<gml:MultiPolygon><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>0,1 2,3 4,5 0,1</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>6,7 8,9 10,11 6,7</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon>",
448 NULL, 0);
449
450 /* GML3 MultiPolygon */
452 "MULTIPOLYGON(((0 1,2 3,4 5,0 1)),((6 7,8 9,10 11,6 7)))",
453 "<gml:MultiSurface><gml:surfaceMember><gml:Polygon><gml:exterior><gml:LinearRing><gml:posList srsDimension=\"2\">0 1 2 3 4 5 0 1</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon></gml:surfaceMember><gml:surfaceMember><gml:Polygon><gml:exterior><gml:LinearRing><gml:posList srsDimension=\"2\">6 7 8 9 10 11 6 7</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon></gml:surfaceMember></gml:MultiSurface>",
454 NULL, 0, 0);
455
456
457 /* GML2 - GeometryCollection */
459 "GEOMETRYCOLLECTION(POINT(0 1),LINESTRING(2 3,4 5))",
460 "<gml:MultiGeometry><gml:geometryMember><gml:Point><gml:coordinates>0,1</gml:coordinates></gml:Point></gml:geometryMember><gml:geometryMember><gml:LineString><gml:coordinates>2,3 4,5</gml:coordinates></gml:LineString></gml:geometryMember></gml:MultiGeometry>",
461 NULL, 0);
462
463 /* GML3 - GeometryCollection */
465 "GEOMETRYCOLLECTION(POINT(0 1),LINESTRING(2 3,4 5))",
466 "<gml:MultiGeometry><gml:geometryMember><gml:Point><gml:pos srsDimension=\"2\">0 1</gml:pos></gml:Point></gml:geometryMember><gml:geometryMember><gml:Curve><gml:segments><gml:LineStringSegment><gml:posList srsDimension=\"2\">2 3 4 5</gml:posList></gml:LineStringSegment></gml:segments></gml:Curve></gml:geometryMember></gml:MultiGeometry>",
467 NULL, 0, 0);
468
469
470 /* GML2 - Nested GeometryCollection */
472 "GEOMETRYCOLLECTION(POINT(0 1),GEOMETRYCOLLECTION(LINESTRING(2 3,4 5)))",
473 "<gml:MultiGeometry><gml:geometryMember><gml:Point><gml:coordinates>0,1</gml:coordinates></gml:Point></gml:geometryMember><gml:geometryMember><gml:MultiGeometry><gml:geometryMember><gml:LineString><gml:coordinates>2,3 4,5</gml:coordinates></gml:LineString></gml:geometryMember></gml:MultiGeometry></gml:geometryMember></gml:MultiGeometry>",
474 NULL, 0);
475
476 /* GML3 - Nested GeometryCollection */
478 "GEOMETRYCOLLECTION(POINT(0 1),GEOMETRYCOLLECTION(LINESTRING(2 3,4 5)))",
479 "<gml:MultiGeometry><gml:geometryMember><gml:Point><gml:pos srsDimension=\"2\">0 1</gml:pos></gml:Point></gml:geometryMember><gml:geometryMember><gml:MultiGeometry><gml:geometryMember><gml:Curve><gml:segments><gml:LineStringSegment><gml:posList srsDimension=\"2\">2 3 4 5</gml:posList></gml:LineStringSegment></gml:segments></gml:Curve></gml:geometryMember></gml:MultiGeometry></gml:geometryMember></gml:MultiGeometry>",
480 NULL, 0, 0);
481
482 /* GML2 - CircularString */
484 "CIRCULARSTRING(-2 0,0 2,2 0,0 2,2 4)",
485 "lwgeom_to_gml2: 'CircularString' geometry type not supported");
486 /* GML3 - CircularString */
488 "CIRCULARSTRING(-2 0,0 2,2 0,0 2,2 4)",
489 "<gml:Curve><gml:segments><gml:ArcString><gml:posList srsDimension=\"2\">-2 0 0 2 2 0 0 2 2 4</gml:posList></gml:ArcString></gml:segments></gml:Curve>",
490 NULL, 0, 0 );
491
492 /* GML2 - CompoundCurve */
494 "COMPOUNDCURVE(CIRCULARSTRING(0 0,1 1,1 0),(1 0,0 1))",
495 "lwgeom_to_gml2: 'CompoundCurve' geometry type not supported");
496 /* GML3 - CompoundCurve */
497
499 "COMPOUNDCURVE(CIRCULARSTRING(0 0,1 1,1 0),(1 0,0 1))",
500 "<gml:Curve><gml:segments><gml:ArcString><gml:posList srsDimension=\"2\">0 0 1 1 1 0</gml:posList></gml:ArcString><gml:LineStringSegment><gml:posList srsDimension=\"2\">1 0 0 1</gml:posList></gml:LineStringSegment></gml:segments></gml:Curve>",
501 NULL, 0, 0 );
502
503 /* GML2 - CurvePolygon */
505 "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))",
506 "lwgeom_to_gml2: 'CurvePolygon' geometry type not supported");
507
508 /* GML3 - CurvePolygon */
510 "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))",
511 "<gml:Polygon><gml:exterior><gml:Ring><gml:curveMember><gml:Curve><gml:segments><gml:ArcString><gml:posList srsDimension=\"2\">-2 0 -1 -1 0 0 1 -1 2 0 0 2 -2 0</gml:posList></gml:ArcString></gml:segments></gml:Curve></gml:curveMember></gml:Ring></gml:exterior><gml:interior><gml:LinearRing><gml:posList srsDimension=\"2\">-1 0 0 0.5 1 0 0 1 -1 0</gml:posList></gml:LinearRing></gml:interior></gml:Polygon>",
512 NULL, 1, 0 );
514 "CURVEPOLYGON(COMPOUNDCURVE((763650.600000001 189057.100000001,7636.35 189045.199999999, 763650.548999999 189057.844000001,763650.600000001 189057.100000001)))",
515 "<gml:Polygon><gml:exterior><gml:Ring><gml:curveMember><gml:Curve><gml:segments><gml:LineStringSegment><gml:posList srsDimension=\"2\">763650.6 189057.1 7636.35 189045.2 763650.549 189057.844 763650.6 189057.1</gml:posList></gml:LineStringSegment></gml:segments></gml:Curve></gml:curveMember></gml:Ring></gml:exterior></gml:Polygon>",
516 NULL, 7, 0 );
517
518 /* GML2 - MultiCurve */
520 "MULTICURVE((5 5,3 5,3 3,0 3),CIRCULARSTRING(0 0,2 1,2 2))",
521 "lwgeom_to_gml2: 'MultiCurve' geometry type not supported");
522
523 /* GML3 - MultiCurve */
525 "MULTICURVE((5 5,3 5,3 3,0 3),CIRCULARSTRING(0 0,2 1,2 2))",
526 "<gml:MultiCurve><gml:curveMember><gml:Curve><gml:segments><gml:LineStringSegment><gml:posList srsDimension=\"2\">5 5 3 5 3 3 0 3</gml:posList></gml:LineStringSegment></gml:segments></gml:Curve></gml:curveMember><gml:curveMember><gml:Curve><gml:segments><gml:ArcString><gml:posList srsDimension=\"2\">0 0 2 1 2 2</gml:posList></gml:ArcString></gml:segments></gml:Curve></gml:curveMember></gml:MultiCurve>",
527 NULL, 0, 0 );
528
529 /* GML2 - MultiSurface */
531 "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)))",
532 "lwgeom_to_gml2: 'MultiSurface' geometry type not supported");
533
534 /* GML3 - MultiSurface */
536 "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)))",
537 "<gml:MultiSurface><gml:Polygon><gml:exterior><gml:Ring><gml:curveMember><gml:Curve><gml:segments><gml:ArcString><gml:posList srsDimension=\"2\">-2 0 -1 -1 0 0 1 -1 2 0 0 2 -2 0</gml:posList></gml:ArcString></gml:segments></gml:Curve></gml:curveMember></gml:Ring></gml:exterior><gml:interior><gml:LinearRing><gml:posList srsDimension=\"2\">-1 0 0 0.5 1 0 0 1 -1 0</gml:posList></gml:LinearRing></gml:interior></gml:Polygon><gml:Polygon><gml:exterior><gml:LinearRing><gml:posList srsDimension=\"2\">7 8 10 10 6 14 4 11 7 8</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon></gml:MultiSurface>",
538 NULL, 1, 0 );
539
540 /* GML2 - PolyhedralSurface */
542 "POLYHEDRALSURFACE(((0 1,2 3,4 5,0 1)))",
543 "Cannot convert PolyhedralSurface to GML2. Try ST_AsGML(3, <geometry>) to generate GML3.");
544
545 /* GML2 - Tin */
547 "TIN(((0 1,2 3,4 5,0 1)))",
548 "Cannot convert Tin to GML2. Try ST_AsGML(3, <geometry>) to generate GML3.");
549}
550
552{
553 /* GML2 - Linestring */
555 "LINESTRING(0 1,2 3,4 5)",
556 "<custom:LineString><custom:coordinates>0,1 2,3 4,5</custom:coordinates></custom:LineString>",
557 NULL, 0, "custom:");
558
559 /* GML3 - Linestring */
561 "LINESTRING(0 1,2 3,4 5)",
562 "<custom:Curve><custom:segments><custom:LineStringSegment><custom:posList srsDimension=\"2\">0 1 2 3 4 5</custom:posList></custom:LineStringSegment></custom:segments></custom:Curve>",
563 NULL, 0, 0, "custom:");
564
565
566 /* GML2 Polygon */
568 "POLYGON((0 1,2 3,4 5,0 1))",
569 "<custom:Polygon><custom:outerBoundaryIs><custom:LinearRing><custom:coordinates>0,1 2,3 4,5 0,1</custom:coordinates></custom:LinearRing></custom:outerBoundaryIs></custom:Polygon>",
570 NULL, 0, "custom:");
571
572 /* GML3 Polygon */
574 "POLYGON((0 1,2 3,4 5,0 1))",
575 "<custom:Polygon><custom:exterior><custom:LinearRing><custom:posList srsDimension=\"2\">0 1 2 3 4 5 0 1</custom:posList></custom:LinearRing></custom:exterior></custom:Polygon>",
576 NULL, 0, 0, "custom:");
577
578
579 /* GML2 Polygon - with internal ring */
581 "POLYGON((0 1,2 3,4 5,0 1),(6 7,8 9,10 11,6 7))",
582 "<custom:Polygon><custom:outerBoundaryIs><custom:LinearRing><custom:coordinates>0,1 2,3 4,5 0,1</custom:coordinates></custom:LinearRing></custom:outerBoundaryIs><custom:innerBoundaryIs><custom:LinearRing><custom:coordinates>6,7 8,9 10,11 6,7</custom:coordinates></custom:LinearRing></custom:innerBoundaryIs></custom:Polygon>",
583 NULL, 0, "custom:");
584
585 /* GML3 Polygon - with internal ring */
587 "POLYGON((0 1,2 3,4 5,0 1),(6 7,8 9,10 11,6 7))",
588 "<custom:Polygon><custom:exterior><custom:LinearRing><custom:posList srsDimension=\"2\">0 1 2 3 4 5 0 1</custom:posList></custom:LinearRing></custom:exterior><custom:interior><custom:LinearRing><custom:posList srsDimension=\"2\">6 7 8 9 10 11 6 7</custom:posList></custom:LinearRing></custom:interior></custom:Polygon>",
589 NULL, 0, 0, "custom:");
590
591 /* GML3 Triangle */
593 "TRIANGLE((0 1,2 3,4 5,0 1))",
594 "<custom:Triangle><custom:exterior><custom:LinearRing><custom:posList srsDimension=\"2\">0 1 2 3 4 5 0 1</custom:posList></custom:LinearRing></custom:exterior></custom:Triangle>",
595 NULL, 0, 0, "custom:");
596
597
598 /* GML2 MultiPoint */
600 "MULTIPOINT(0 1,2 3)",
601 "<custom:MultiPoint><custom:pointMember><custom:Point><custom:coordinates>0,1</custom:coordinates></custom:Point></custom:pointMember><custom:pointMember><custom:Point><custom:coordinates>2,3</custom:coordinates></custom:Point></custom:pointMember></custom:MultiPoint>",
602 NULL, 0, "custom:");
603
604 /* GML3 MultiPoint */
606 "MULTIPOINT(0 1,2 3)",
607 "<custom:MultiPoint><custom:pointMember><custom:Point><custom:pos srsDimension=\"2\">0 1</custom:pos></custom:Point></custom:pointMember><custom:pointMember><custom:Point><custom:pos srsDimension=\"2\">2 3</custom:pos></custom:Point></custom:pointMember></custom:MultiPoint>",
608 NULL, 0, 0, "custom:");
609
610
611 /* GML2 Multiline */
613 "MULTILINESTRING((0 1,2 3,4 5),(6 7,8 9,10 11))",
614 "<custom:MultiLineString><custom:lineStringMember><custom:LineString><custom:coordinates>0,1 2,3 4,5</custom:coordinates></custom:LineString></custom:lineStringMember><custom:lineStringMember><custom:LineString><custom:coordinates>6,7 8,9 10,11</custom:coordinates></custom:LineString></custom:lineStringMember></custom:MultiLineString>",
615 NULL, 0, "custom:");
616
617 /* GML3 Multiline */
619 "MULTILINESTRING((0 1,2 3,4 5),(6 7,8 9,10 11))",
620 "<custom:MultiCurve><custom:curveMember><custom:Curve><custom:segments><custom:LineStringSegment><custom:posList srsDimension=\"2\">0 1 2 3 4 5</custom:posList></custom:LineStringSegment></custom:segments></custom:Curve></custom:curveMember><custom:curveMember><custom:Curve><custom:segments><custom:LineStringSegment><custom:posList srsDimension=\"2\">6 7 8 9 10 11</custom:posList></custom:LineStringSegment></custom:segments></custom:Curve></custom:curveMember></custom:MultiCurve>",
621 NULL, 0, 0, "custom:");
622
623
624 /* GML2 MultiPolygon */
626 "MULTIPOLYGON(((0 1,2 3,4 5,0 1)),((6 7,8 9,10 11,6 7)))",
627 "<custom:MultiPolygon><custom:polygonMember><custom:Polygon><custom:outerBoundaryIs><custom:LinearRing><custom:coordinates>0,1 2,3 4,5 0,1</custom:coordinates></custom:LinearRing></custom:outerBoundaryIs></custom:Polygon></custom:polygonMember><custom:polygonMember><custom:Polygon><custom:outerBoundaryIs><custom:LinearRing><custom:coordinates>6,7 8,9 10,11 6,7</custom:coordinates></custom:LinearRing></custom:outerBoundaryIs></custom:Polygon></custom:polygonMember></custom:MultiPolygon>",
628 NULL, 0, "custom:");
629
630 /* GML3 MultiPolygon */
632 "MULTIPOLYGON(((0 1,2 3,4 5,0 1)),((6 7,8 9,10 11,6 7)))",
633 "<custom:MultiSurface><custom:surfaceMember><custom:Polygon><custom:exterior><custom:LinearRing><custom:posList srsDimension=\"2\">0 1 2 3 4 5 0 1</custom:posList></custom:LinearRing></custom:exterior></custom:Polygon></custom:surfaceMember><custom:surfaceMember><custom:Polygon><custom:exterior><custom:LinearRing><custom:posList srsDimension=\"2\">6 7 8 9 10 11 6 7</custom:posList></custom:LinearRing></custom:exterior></custom:Polygon></custom:surfaceMember></custom:MultiSurface>",
634 NULL, 0, 0, "custom:");
635
636 /* GML3 PolyhedralSurface */
638 "POLYHEDRALSURFACE(((0 1,2 3,4 5,0 1)),((6 7,8 9,10 11,6 7)))",
639 "<custom:PolyhedralSurface><custom:polygonPatches><custom:PolygonPatch><custom:exterior><custom:LinearRing><custom:posList srsDimension=\"2\">0 1 2 3 4 5 0 1</custom:posList></custom:LinearRing></custom:exterior></custom:PolygonPatch><custom:PolygonPatch><custom:exterior><custom:LinearRing><custom:posList srsDimension=\"2\">6 7 8 9 10 11 6 7</custom:posList></custom:LinearRing></custom:exterior></custom:PolygonPatch></custom:polygonPatches></custom:PolyhedralSurface>",
640 NULL, 0, 0, "custom:");
641
642 /* GML3 Tin */
644 "TIN(((0 1,2 3,4 5,0 1)),((6 7,8 9,10 11,6 7)))",
645 "<custom:Tin><custom:trianglePatches><custom:Triangle><custom:exterior><custom:LinearRing><custom:posList srsDimension=\"2\">0 1 2 3 4 5 0 1</custom:posList></custom:LinearRing></custom:exterior></custom:Triangle><custom:Triangle><custom:exterior><custom:LinearRing><custom:posList srsDimension=\"2\">6 7 8 9 10 11 6 7</custom:posList></custom:LinearRing></custom:exterior></custom:Triangle></custom:trianglePatches></custom:Tin>",
646 NULL, 0, 0, "custom:");
647
648 /* GML2 - GeometryCollection */
650 "GEOMETRYCOLLECTION(POINT(0 1),LINESTRING(2 3,4 5))",
651 "<custom:MultiGeometry><custom:geometryMember><custom:Point><custom:coordinates>0,1</custom:coordinates></custom:Point></custom:geometryMember><custom:geometryMember><custom:LineString><custom:coordinates>2,3 4,5</custom:coordinates></custom:LineString></custom:geometryMember></custom:MultiGeometry>",
652 NULL, 0, "custom:");
653
654 /* GML3 - GeometryCollection */
656 "GEOMETRYCOLLECTION(POINT(0 1),LINESTRING(2 3,4 5))",
657 "<custom:MultiGeometry><custom:geometryMember><custom:Point><custom:pos srsDimension=\"2\">0 1</custom:pos></custom:Point></custom:geometryMember><custom:geometryMember><custom:Curve><custom:segments><custom:LineStringSegment><custom:posList srsDimension=\"2\">2 3 4 5</custom:posList></custom:LineStringSegment></custom:segments></custom:Curve></custom:geometryMember></custom:MultiGeometry>",
658 NULL, 0, 0, "custom:");
659
660 /* GML2 - Nested GeometryCollection */
662 "GEOMETRYCOLLECTION(POINT(0 1),GEOMETRYCOLLECTION(LINESTRING(2 3,4 5)))",
663 "<custom:MultiGeometry><custom:geometryMember><custom:Point><custom:coordinates>0,1</custom:coordinates></custom:Point></custom:geometryMember><custom:geometryMember><custom:MultiGeometry><custom:geometryMember><custom:LineString><custom:coordinates>2,3 4,5</custom:coordinates></custom:LineString></custom:geometryMember></custom:MultiGeometry></custom:geometryMember></custom:MultiGeometry>",
664 NULL, 0, "custom:");
665
666 /* GML3 - Nested GeometryCollection */
668 "GEOMETRYCOLLECTION(POINT(0 1),GEOMETRYCOLLECTION(LINESTRING(2 3,4 5)))",
669 "<custom:MultiGeometry><custom:geometryMember><custom:Point><custom:pos srsDimension=\"2\">0 1</custom:pos></custom:Point></custom:geometryMember><custom:geometryMember><custom:MultiGeometry><custom:geometryMember><custom:Curve><custom:segments><custom:LineStringSegment><custom:posList srsDimension=\"2\">2 3 4 5</custom:posList></custom:LineStringSegment></custom:segments></custom:Curve></custom:geometryMember></custom:MultiGeometry></custom:geometryMember></custom:MultiGeometry>",
670 NULL, 0, 0, "custom:");
671
672 /*------------- empty prefixes below ------------------------ */
673
674 /* GML2 - Linestring */
676 "LINESTRING(0 1,2 3,4 5)",
677 "<LineString><coordinates>0,1 2,3 4,5</coordinates></LineString>",
678 NULL, 0, "");
679
680 /* GML3 - Linestring */
682 "LINESTRING(0 1,2 3,4 5)",
683 "<Curve><segments><LineStringSegment><posList srsDimension=\"2\">0 1 2 3 4 5</posList></LineStringSegment></segments></Curve>",
684 NULL, 0, 0, "");
685
686
687 /* GML2 Polygon */
689 "POLYGON((0 1,2 3,4 5,0 1))",
690 "<Polygon><outerBoundaryIs><LinearRing><coordinates>0,1 2,3 4,5 0,1</coordinates></LinearRing></outerBoundaryIs></Polygon>",
691 NULL, 0, "");
692
693 /* GML3 Polygon */
695 "POLYGON((0 1,2 3,4 5,0 1))",
696 "<Polygon><exterior><LinearRing><posList srsDimension=\"2\">0 1 2 3 4 5 0 1</posList></LinearRing></exterior></Polygon>",
697 NULL, 0, 0, "");
698
699
700 /* GML2 Polygon - with internal ring */
702 "POLYGON((0 1,2 3,4 5,0 1),(6 7,8 9,10 11,6 7))",
703 "<Polygon><outerBoundaryIs><LinearRing><coordinates>0,1 2,3 4,5 0,1</coordinates></LinearRing></outerBoundaryIs><innerBoundaryIs><LinearRing><coordinates>6,7 8,9 10,11 6,7</coordinates></LinearRing></innerBoundaryIs></Polygon>",
704 NULL, 0, "");
705
706 /* GML3 Polygon - with internal ring */
708 "POLYGON((0 1,2 3,4 5,0 1),(6 7,8 9,10 11,6 7))",
709 "<Polygon><exterior><LinearRing><posList srsDimension=\"2\">0 1 2 3 4 5 0 1</posList></LinearRing></exterior><interior><LinearRing><posList srsDimension=\"2\">6 7 8 9 10 11 6 7</posList></LinearRing></interior></Polygon>",
710 NULL, 0, 0, "");
711
712 /* GML3 Triangle */
714 "TRIANGLE((0 1,2 3,4 5,0 1))",
715 "<Triangle><exterior><LinearRing><posList srsDimension=\"2\">0 1 2 3 4 5 0 1</posList></LinearRing></exterior></Triangle>",
716 NULL, 0, 0, "");
717
718
719 /* GML2 MultiPoint */
721 "MULTIPOINT(0 1,2 3)",
722 "<MultiPoint><pointMember><Point><coordinates>0,1</coordinates></Point></pointMember><pointMember><Point><coordinates>2,3</coordinates></Point></pointMember></MultiPoint>",
723 NULL, 0, "");
724
725 /* GML3 MultiPoint */
727 "MULTIPOINT(0 1,2 3)",
728 "<MultiPoint><pointMember><Point><pos srsDimension=\"2\">0 1</pos></Point></pointMember><pointMember><Point><pos srsDimension=\"2\">2 3</pos></Point></pointMember></MultiPoint>",
729 NULL, 0, 0, "");
730
731
732 /* GML2 Multiline */
734 "MULTILINESTRING((0 1,2 3,4 5),(6 7,8 9,10 11))",
735 "<MultiLineString><lineStringMember><LineString><coordinates>0,1 2,3 4,5</coordinates></LineString></lineStringMember><lineStringMember><LineString><coordinates>6,7 8,9 10,11</coordinates></LineString></lineStringMember></MultiLineString>",
736 NULL, 0, "");
737
738 /* GML3 Multiline */
740 "MULTILINESTRING((0 1,2 3,4 5),(6 7,8 9,10 11))",
741 "<MultiCurve><curveMember><Curve><segments><LineStringSegment><posList srsDimension=\"2\">0 1 2 3 4 5</posList></LineStringSegment></segments></Curve></curveMember><curveMember><Curve><segments><LineStringSegment><posList srsDimension=\"2\">6 7 8 9 10 11</posList></LineStringSegment></segments></Curve></curveMember></MultiCurve>",
742 NULL, 0, 0, "");
743
744
745 /* GML2 MultiPolygon */
747 "MULTIPOLYGON(((0 1,2 3,4 5,0 1)),((6 7,8 9,10 11,6 7)))",
748 "<MultiPolygon><polygonMember><Polygon><outerBoundaryIs><LinearRing><coordinates>0,1 2,3 4,5 0,1</coordinates></LinearRing></outerBoundaryIs></Polygon></polygonMember><polygonMember><Polygon><outerBoundaryIs><LinearRing><coordinates>6,7 8,9 10,11 6,7</coordinates></LinearRing></outerBoundaryIs></Polygon></polygonMember></MultiPolygon>",
749 NULL, 0, "");
750
751 /* GML3 MultiPolygon */
753 "MULTIPOLYGON(((0 1,2 3,4 5,0 1)),((6 7,8 9,10 11,6 7)))",
754 "<MultiSurface><surfaceMember><Polygon><exterior><LinearRing><posList srsDimension=\"2\">0 1 2 3 4 5 0 1</posList></LinearRing></exterior></Polygon></surfaceMember><surfaceMember><Polygon><exterior><LinearRing><posList srsDimension=\"2\">6 7 8 9 10 11 6 7</posList></LinearRing></exterior></Polygon></surfaceMember></MultiSurface>",
755 NULL, 0, 0, "");
756
757 /* GML3 PolyhedralSurface */
759 "POLYHEDRALSURFACE(((0 1,2 3,4 5,0 1)),((6 7,8 9,10 11,6 7)))",
760 "<PolyhedralSurface><polygonPatches><PolygonPatch><exterior><LinearRing><posList srsDimension=\"2\">0 1 2 3 4 5 0 1</posList></LinearRing></exterior></PolygonPatch><PolygonPatch><exterior><LinearRing><posList srsDimension=\"2\">6 7 8 9 10 11 6 7</posList></LinearRing></exterior></PolygonPatch></polygonPatches></PolyhedralSurface>",
761 NULL, 0, 0, "");
762
763 /* GML3 PolyhedralSurface */
765 "TIN(((0 1,2 3,4 5,0 1)),((6 7,8 9,10 11,6 7)))",
766 "<Tin><trianglePatches><Triangle><exterior><LinearRing><posList srsDimension=\"2\">0 1 2 3 4 5 0 1</posList></LinearRing></exterior></Triangle><Triangle><exterior><LinearRing><posList srsDimension=\"2\">6 7 8 9 10 11 6 7</posList></LinearRing></exterior></Triangle></trianglePatches></Tin>",
767 NULL, 0, 0, "");
768
769 /* GML2 - GeometryCollection */
771 "GEOMETRYCOLLECTION(POINT(0 1),LINESTRING(2 3,4 5))",
772 "<MultiGeometry><geometryMember><Point><coordinates>0,1</coordinates></Point></geometryMember><geometryMember><LineString><coordinates>2,3 4,5</coordinates></LineString></geometryMember></MultiGeometry>",
773 NULL, 0, "");
774
775 /* GML3 - GeometryCollection */
777 "GEOMETRYCOLLECTION(POINT(0 1),LINESTRING(2 3,4 5))",
778 "<MultiGeometry><geometryMember><Point><pos srsDimension=\"2\">0 1</pos></Point></geometryMember><geometryMember><Curve><segments><LineStringSegment><posList srsDimension=\"2\">2 3 4 5</posList></LineStringSegment></segments></Curve></geometryMember></MultiGeometry>",
779 NULL, 0, 0, "");
780
781 /* GML2 - Nested GeometryCollection */
783 "GEOMETRYCOLLECTION(POINT(0 1),GEOMETRYCOLLECTION(LINESTRING(2 3,4 5)))",
784 "<MultiGeometry><geometryMember><Point><coordinates>0,1</coordinates></Point></geometryMember><geometryMember><MultiGeometry><geometryMember><LineString><coordinates>2,3 4,5</coordinates></LineString></geometryMember></MultiGeometry></geometryMember></MultiGeometry>",
785 NULL, 0, "");
786
787 /* GML3 - Nested GeometryCollection */
789 "GEOMETRYCOLLECTION(POINT(0 1),GEOMETRYCOLLECTION(LINESTRING(2 3,4 5)))",
790 "<MultiGeometry><geometryMember><Point><pos srsDimension=\"2\">0 1</pos></Point></geometryMember><geometryMember><MultiGeometry><geometryMember><Curve><segments><LineStringSegment><posList srsDimension=\"2\">2 3 4 5</posList></LineStringSegment></segments></Curve></geometryMember></MultiGeometry></geometryMember></MultiGeometry>",
791 NULL, 0, 0, "");
792
793
794
795}
796
797
799{
800 /* GML3 - Linestring */
802 "LINESTRING(0 1,2 3,4 5)",
803 "<Curve><segments><LineStringSegment><posList>0 1 2 3 4 5</posList></LineStringSegment></segments></Curve>",
804 NULL, 0, 0, 0, "");
805
806
807 /* GML3 Polygon */
809 "POLYGON((0 1,2 3,4 5,0 1))",
810 "<Polygon><exterior><LinearRing><posList>0 1 2 3 4 5 0 1</posList></LinearRing></exterior></Polygon>",
811 NULL, 0, 0, 0, "");
812
813
814 /* GML3 Polygon - with internal ring */
816 "POLYGON((0 1,2 3,4 5,0 1),(6 7,8 9,10 11,6 7))",
817 "<Polygon><exterior><LinearRing><posList>0 1 2 3 4 5 0 1</posList></LinearRing></exterior><interior><LinearRing><posList>6 7 8 9 10 11 6 7</posList></LinearRing></interior></Polygon>",
818 NULL, 0, 0, 0, "");
819
820 /* GML3 Triangle */
822 "TRIANGLE((0 1,2 3,4 5,0 1))",
823 "<Triangle><exterior><LinearRing><posList>0 1 2 3 4 5 0 1</posList></LinearRing></exterior></Triangle>",
824 NULL, 0, 0, 0, "");
825
826
827 /* GML3 MultiPoint */
829 "MULTIPOINT(0 1,2 3)",
830 "<MultiPoint><pointMember><Point><pos>0 1</pos></Point></pointMember><pointMember><Point><pos>2 3</pos></Point></pointMember></MultiPoint>",
831 NULL, 0, 0, 0, "");
832
833
834 /* GML3 Multiline */
836 "MULTILINESTRING((0 1,2 3,4 5),(6 7,8 9,10 11))",
837 "<MultiCurve><curveMember><Curve><segments><LineStringSegment><posList>0 1 2 3 4 5</posList></LineStringSegment></segments></Curve></curveMember><curveMember><Curve><segments><LineStringSegment><posList>6 7 8 9 10 11</posList></LineStringSegment></segments></Curve></curveMember></MultiCurve>",
838 NULL, 0, 0, 0, "");
839
840
841 /* GML3 MultiPolygon */
843 "MULTIPOLYGON(((0 1,2 3,4 5,0 1)),((6 7,8 9,10 11,6 7)))",
844 "<MultiSurface><surfaceMember><Polygon><exterior><LinearRing><posList>0 1 2 3 4 5 0 1</posList></LinearRing></exterior></Polygon></surfaceMember><surfaceMember><Polygon><exterior><LinearRing><posList>6 7 8 9 10 11 6 7</posList></LinearRing></exterior></Polygon></surfaceMember></MultiSurface>",
845 NULL, 0, 0, 0, "");
846
847 /* GML3 PolyhedralSurface */
849 "POLYHEDRALSURFACE(((0 1,2 3,4 5,0 1)),((6 7,8 9,10 11,6 7)))",
850 "<PolyhedralSurface><polygonPatches><PolygonPatch><exterior><LinearRing><posList>0 1 2 3 4 5 0 1</posList></LinearRing></exterior></PolygonPatch><PolygonPatch><exterior><LinearRing><posList>6 7 8 9 10 11 6 7</posList></LinearRing></exterior></PolygonPatch></polygonPatches></PolyhedralSurface>",
851 NULL, 0, 0, 0, "");
852
853 /* GML3 Tin */
855 "TIN(((0 1,2 3,4 5,0 1)),((6 7,8 9,10 11,6 7)))",
856 "<Tin><trianglePatches><Triangle><exterior><LinearRing><posList>0 1 2 3 4 5 0 1</posList></LinearRing></exterior></Triangle><Triangle><exterior><LinearRing><posList>6 7 8 9 10 11 6 7</posList></LinearRing></exterior></Triangle></trianglePatches></Tin>",
857 NULL, 0, 0, 0, "");
858
859 /* GML3 - GeometryCollection */
861 "GEOMETRYCOLLECTION(POINT(0 1),LINESTRING(2 3,4 5))",
862 "<MultiGeometry><geometryMember><Point><pos>0 1</pos></Point></geometryMember><geometryMember><Curve><segments><LineStringSegment><posList>2 3 4 5</posList></LineStringSegment></segments></Curve></geometryMember></MultiGeometry>",
863 NULL, 0, 0, 0, "");
864
865 /* GML3 - Nested GeometryCollection */
867 "GEOMETRYCOLLECTION(POINT(0 1),GEOMETRYCOLLECTION(LINESTRING(2 3,4 5)))",
868 "<MultiGeometry><geometryMember><Point><pos>0 1</pos></Point></geometryMember><geometryMember><MultiGeometry><geometryMember><Curve><segments><LineStringSegment><posList>2 3 4 5</posList></LineStringSegment></segments></Curve></geometryMember></MultiGeometry></geometryMember></MultiGeometry>",
869 NULL, 0, 0, 0, "");
870}
871
872static void out_gml2_extent(void)
873{
874 /* GML2: Point */
876 "POINT(-15 60)",
877 "<Box><coordinates>-15,60 -15,60</coordinates></Box>",
878 NULL, 15, "");
880 "POINT(-15 60)",
881 "<gml:Box><gml:coordinates>-15,60 -15,60</gml:coordinates></gml:Box>",
882 NULL, 15, "gml:");
884 "POINT(-15 60)",
885 "<Box srsName=\"urn:ogc:def:crs:EPSG::4326\"><coordinates>-15,60 -15,60</coordinates></Box>",
886 "urn:ogc:def:crs:EPSG::4326", 15, "");
887
888 /* GML2: Multipoint */
890 "MULTIPOINT(2 3, -5 -6)",
891 "<Box><coordinates>-5,-6 2,3</coordinates></Box>",
892 NULL, 15, "");
893
894 /* GML2: Linestring */
896 "LINESTRING(0 1,2 3,4 5)",
897 "<Box><coordinates>0,1 4,5</coordinates></Box>",
898 NULL, 15, "");
899
900 /* GML2: MultiLinestring */
902 "MULTILINESTRING((0 1,2 3),(4 5, 10 6))",
903 "<Box><coordinates>0,1 10,6</coordinates></Box>",
904 NULL, 15, "");
905
906 /* GML2: Polygon */
908 "POLYGON((1 7,7 14, 14 7, 1 7))",
909 "<Box><coordinates>1,7 14,14</coordinates></Box>",
910 NULL, 15, "");
911
912 /* GML2: MultiPolygon */
914 "MULTIPOLYGON(((1 7,7 14, 14 7, 1 7)),((-4 -6, -15 3, 0 0, -4 -6)))",
915 "<Box><coordinates>-15,-6 14,14</coordinates></Box>",
916 NULL, 15, "");
917
918 /* GML2: MultiSurface */
920 "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)))",
921 "<Box><coordinates>-2,-1 10,14</coordinates></Box>",
922 NULL, 15, "");
923
924 /* GML2: empty */
926 "GEOMETRYCOLLECTION EMPTY",
927 "<Box/>",
928 NULL, 15, "");
929
930 /* GML2: empty with srsName */
932 "GEOMETRYCOLLECTION EMPTY",
933 "<Box srsName=\"urn:ogc:def:crs:EPSG::4326\"/>",
934 "urn:ogc:def:crs:EPSG::4326", 15, "");
935
936}
937
938static void out_gml3_extent(void)
939{
940 /* GML3: Point */
942 "POINT(-15 60)",
943 "<Envelope><lowerCorner>-15 60</lowerCorner><upperCorner>-15 60</upperCorner></Envelope>",
944 NULL, 15, 0, "");
946 "POINT(-15 60)",
947 "<gml:Envelope><gml:lowerCorner>-15 60</gml:lowerCorner><gml:upperCorner>-15 60</gml:upperCorner></gml:Envelope>",
948 NULL, 15, 0, "gml:");
950 "POINT(-15 60)",
951 "<Envelope srsName=\"urn:ogc:def:crs:EPSG::4326\"><lowerCorner>-15 60</lowerCorner><upperCorner>-15 60</upperCorner></Envelope>",
952 "urn:ogc:def:crs:EPSG::4326", 15, 0, "");
953
954 /* GML3: Multipoint */
956 "MULTIPOINT(2 3, -5 -6)",
957 "<Envelope><lowerCorner>-5 -6</lowerCorner><upperCorner>2 3</upperCorner></Envelope>",
958 NULL, 15, 0, "");
959
960 /* GML3: Linestring */
962 "LINESTRING(0 1,2 3,4 5)",
963 "<Envelope><lowerCorner>0 1</lowerCorner><upperCorner>4 5</upperCorner></Envelope>",
964 NULL, 15, 0, "");
965
966 /* GML3: MultiLinestring */
968 "MULTILINESTRING((0 1,2 3),(4 5, 10 6))",
969 "<Envelope><lowerCorner>0 1</lowerCorner><upperCorner>10 6</upperCorner></Envelope>",
970 NULL, 15, 0, "");
972 "MULTILINESTRING((0 1,2 3),(4 5, 10 6))",
973 "<Envelope><lowerCorner>1 0</lowerCorner><upperCorner>6 10</upperCorner></Envelope>",
974 NULL, 15, LW_GML_IS_DEGREE, "");
976 "MULTILINESTRING((0 1,2 3),(4 5, 10 6))",
977 "<Envelope srsDimension=\"2\"><lowerCorner>1 0</lowerCorner><upperCorner>6 10</upperCorner></Envelope>",
978 NULL, 15, LW_GML_IS_DEGREE|LW_GML_IS_DIMS, "");
980 "MULTILINESTRING((0 1 10,2 3 30),(4 5 50, 10 6 -70))",
981 "<Envelope srsDimension=\"3\"><lowerCorner>1 0 -70</lowerCorner><upperCorner>6 10 50</upperCorner></Envelope>",
982 NULL, 15, LW_GML_IS_DEGREE|LW_GML_IS_DIMS, "");
983
984 /* GML3: Polygon */
986 "POLYGON((1 7,7 14, 14 7, 1 7))",
987 "<Envelope><lowerCorner>1 7</lowerCorner><upperCorner>14 14</upperCorner></Envelope>",
988 NULL, 15, 0, "");
989
990 /* GML3: MultiPolygon */
992 "MULTIPOLYGON(((1 7,7 14, 14 7, 1 7)),((-4 -6, -15 3, 0 0, -4 -6)))",
993 "<Envelope><lowerCorner>-15 -6</lowerCorner><upperCorner>14 14</upperCorner></Envelope>",
994 NULL, 15, 0, "");
995
996 /* GML3: MultiSurface */
998 "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)))",
999 "<Envelope><lowerCorner>-2 -1</lowerCorner><upperCorner>10 14</upperCorner></Envelope>",
1000 NULL, 15, 0, "");
1001
1002 /* GML3: empty */
1004 "GEOMETRYCOLLECTION EMPTY",
1005 "<Envelope/>",
1006 NULL, 15, 0, "");
1007
1008 /* GML3: empty with srsName */
1010 "GEOMETRYCOLLECTION EMPTY",
1011 "<Envelope srsName=\"urn:ogc:def:crs:EPSG::4326\"/>",
1012 "urn:ogc:def:crs:EPSG::4326", 15, 0, "");
1013
1014}
1015
1016/*
1017** Used by test harness to register the tests in this file.
1018*/
1019void out_gml_suite_setup(void);
1021{
1022 CU_pSuite suite = CU_add_suite("gml_output", NULL, NULL);
1032}
static uint8_t precision
Definition cu_in_twkb.c:25
static void do_gml3_test(char *in, char *out, char *srs, int precision, int is_geodetic)
Definition cu_out_gml.c:54
static void out_gml_test_srid(void)
Definition cu_out_gml.c:194
static void out_gml2_extent(void)
Definition cu_out_gml.c:872
static void do_gml2_extent_test(char *in, char *out, char *srs, double precision, char *prefix)
Definition cu_out_gml.c:109
static void out_gml_test_geoms_nodims(void)
Definition cu_out_gml.c:798
static void out_gml_test_geodetic(void)
Definition cu_out_gml.c:313
static void out_gml3_extent(void)
Definition cu_out_gml.c:938
static void do_gml2_test_prefix(char *in, char *out, char *srs, int precision, const char *prefix)
Definition cu_out_gml.c:32
static void do_gml2_unsupported(char *in, char *out)
Definition cu_out_gml.c:97
void out_gml_suite_setup(void)
static void out_gml_test_dims(void)
Definition cu_out_gml.c:329
static void do_gml3_test_opts(char *in, char *out, char *srs, int precision, int opts)
Definition cu_out_gml.c:43
static void out_gml_test_precision(void)
Definition cu_out_gml.c:140
static void do_gml3_extent_test(char *in, char *out, char *srs, double precision, int opts, char *prefix)
Definition cu_out_gml.c:128
static void out_gml_test_geoms(void)
Definition cu_out_gml.c:371
static void out_gml_test_geoms_prefix(void)
Definition cu_out_gml.c:551
static void do_gml3_test_prefix(char *in, char *out, char *srs, int precision, int is_geodetic, const char *prefix)
Definition cu_out_gml.c:68
static void do_gml2_test(char *in, char *out, char *srs, int precision)
Definition cu_out_gml.c:21
static void do_gml3_test_nodims(char *in, char *out, char *srs, int precision, int is_geodetic, int is_dims, const char *prefix)
Definition cu_out_gml.c:82
void cu_error_msg_reset()
char cu_error_msg[MAX_CUNIT_ERROR_LENGTH+1]
#define ASSERT_VARLENA_EQUAL(v, s)
#define PG_ADD_TEST(suite, testfunc)
#define ASSERT_STRING_EQUAL(o, e)
lwvarlena_t * lwgeom_extent_to_gml3(const LWGEOM *geom, const char *srs, int precision, int opts, const char *prefix)
Definition lwout_gml.c:1081
#define LW_GML_IS_DEGREE
For GML3 only, declare that data are lat/lon.
Definition liblwgeom.h:1714
void lwgeom_free(LWGEOM *geom)
Definition lwgeom.c:1246
#define LW_PARSER_CHECK_NONE
Definition liblwgeom.h:2149
#define LW_GML_SHORTLINE
For GML3, use <LineString> rather than <Curve> for lines.
Definition liblwgeom.h:1716
void lwfree(void *mem)
Definition lwutil.c:248
lwvarlena_t * lwgeom_to_gml2(const LWGEOM *geom, const char *srs, int precision, const char *prefix)
Definition lwout_gml.c:920
#define LW_GML_IS_DIMS
Macros for specifying GML options.
Definition liblwgeom.h:1712
lwvarlena_t * lwgeom_extent_to_gml2(const LWGEOM *geom, const char *srs, int precision, const char *prefix)
Definition lwout_gml.c:1063
lwvarlena_t * lwgeom_to_gml3(const LWGEOM *geom, const char *srs, int precision, int opts, const char *prefix, const char *id)
Definition lwout_gml.c:978
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition lwin_wkt.c:940