1select st_asgeojson(geomfromtext('POINT(1 1)'));
2st_asgeojson(geomfromtext('POINT(1 1)'))
3{"type": "Point", "coordinates": [1, 1]}
4select st_asgeojson(geomfromtext('LINESTRING(10 10,20 10,20 20,10 20,10 10)'));
5st_asgeojson(geomfromtext('LINESTRING(10 10,20 10,20 20,10 20,10 10)'))
6{"type": "LineString", "coordinates": [[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]}
7select st_asgeojson(geomfromtext('POLYGON((10 10,20 10,20 20,10 20,10 10))'));
8st_asgeojson(geomfromtext('POLYGON((10 10,20 10,20 20,10 20,10 10))'))
9{"type": "Polygon", "coordinates": [[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]}
10select st_asgeojson(geomfromtext('MULTIPOLYGON(((10 10,20 10,20 20,10 20,10 10)))'));
11st_asgeojson(geomfromtext('MULTIPOLYGON(((10 10,20 10,20 20,10 20,10 10)))'))
12{"type": "MultiPolygon", "coordinates": [[[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]]}
13select st_asgeojson(geomfromtext('multilinestring((10 10,20 10,20 20,10 20,10 10))'));
14st_asgeojson(geomfromtext('multilinestring((10 10,20 10,20 20,10 20,10 10))'))
15{"type": "MultiLineString", "coordinates": [[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]}
16select st_asgeojson(geomfromtext('multipoint(10 10,20 10,20 20,10 20,10 10)'));
17st_asgeojson(geomfromtext('multipoint(10 10,20 10,20 20,10 20,10 10)'))
18{"type": "MultiPoint", "coordinates": [[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]}
19select st_asgeojson(st_geomfromtext('GEOMETRYCOLLECTION(POINT(100 0),LINESTRING(101 0,102 1))'));
20st_asgeojson(st_geomfromtext('GEOMETRYCOLLECTION(POINT(100 0),LINESTRING(101 0,102 1))'))
21{"type": "GeometryCollection", "geometries": [{"type": "Point", "coordinates": [100, 0]}, {"type": "LineString", "coordinates": [[101, 0], [102, 1]]}]}
22SELECT st_astext(st_geomfromgeojson('{"type":"point","coordinates":[1,2]}'));
23st_astext(st_geomfromgeojson('{"type":"point","coordinates":[1,2]}'))
24POINT(1 2)
25SELECT st_astext(st_geomfromgeojson('{"type":"LineString","coordinates":[[1,2],[4,5],[7,8]]}'));
26st_astext(st_geomfromgeojson('{"type":"LineString","coordinates":[[1,2],[4,5],[7,8]]}'))
27LINESTRING(1 2,4 5,7 8)
28SELECT st_astext(st_geomfromgeojson('{"type": "polygon", "coordinates": [[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]}'));
29st_astext(st_geomfromgeojson('{"type": "polygon", "coordinates": [[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]}'))
30POLYGON((10 10,20 10,20 20,10 20,10 10))
31SELECT st_astext(st_geomfromgeojson('{"type":"multipoint","coordinates":[[1,2],[4,5],[7,8]]}'));
32st_astext(st_geomfromgeojson('{"type":"multipoint","coordinates":[[1,2],[4,5],[7,8]]}'))
33MULTIPOINT(1 2,4 5,7 8)
34SELECT st_astext(st_geomfromgeojson('{"type": "multilinestring", "coordinates": [[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]}'));
35st_astext(st_geomfromgeojson('{"type": "multilinestring", "coordinates": [[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]}'))
36MULTILINESTRING((10 10,20 10,20 20,10 20,10 10))
37SELECT st_astext(st_geomfromgeojson('{"type": "multipolygon", "coordinates": [[[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]]}'));
38st_astext(st_geomfromgeojson('{"type": "multipolygon", "coordinates": [[[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]]}'))
39MULTIPOLYGON(((10 10,20 10,20 20,10 20,10 10)))
40SELECT st_astext(st_geomfromgeojson('{"type": "GeometryCollection", "geometries": [{"type": "Point","coordinates": [100.0, 0.0]}, {"type": "LineString","coordinates": [[101.0, 0.0],[102.0, 1.0]]}]}'));
41st_astext(st_geomfromgeojson('{"type": "GeometryCollection", "geometries": [{"type": "Point","coordinates": [100.0, 0.0]}, {"type": "LineString","coordinates": [[101.0, 0.0],[102.0, 1.0]]}]}'))
42GEOMETRYCOLLECTION(POINT(100 0),LINESTRING(101 0,102 1))
43SELECT st_astext(st_geomfromgeojson('{"type":"point"}'));
44st_astext(st_geomfromgeojson('{"type":"point"}'))
45NULL
46Warnings:
47Warning	4048	Incorrect GeoJSON format specified for st_geomfromgeojson function.
48SELECT st_astext(st_geomfromgeojson('{"type":"point"'));
49st_astext(st_geomfromgeojson('{"type":"point"'))
50NULL
51Warnings:
52Warning	4037	Unexpected end of JSON text in argument 1 to function 'st_geomfromgeojson'
53SELECT st_astext(st_geomfromgeojson('{"type""point"}'));
54st_astext(st_geomfromgeojson('{"type""point"}'))
55NULL
56Warnings:
57Warning	4038	Syntax error in JSON text in argument 1 to function 'st_geomfromgeojson' at position 7
58SELECT st_astext(st_geomfromgeojson('{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] } }'));
59st_astext(st_geomfromgeojson('{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] } }'))
60POINT(102 0.5)
61SELECT st_astext(st_geomfromgeojson('{ "type": "FeatureCollection", "features": [{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] }, "properties": { "prop0": "value0" } }]}'));
62st_astext(st_geomfromgeojson('{ "type": "FeatureCollection", "features": [{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] }, "properties": { "prop0": "value0" } }]}'))
63GEOMETRYCOLLECTION(POINT(102 0.5))
64SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',5));
65ERROR HY000: Incorrect option value: '5' for function ST_GeomFromGeoJSON
66SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',1));
67ERROR 22023: Invalid GIS data provided to function ST_GeomFromGeoJSON.
68SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',2));
69ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',2))
70POINT(5.3 15)
71SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',3));
72ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',3))
73POINT(5.3 15)
74SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',4));
75ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',4))
76POINT(5.3 15)
77SELECT ST_AsGeoJSON(ST_GeomFromText('POINT(5.363 7.266)'),2);
78ST_AsGeoJSON(ST_GeomFromText('POINT(5.363 7.266)'),2)
79{"type": "Point", "coordinates": [5.36, 7.27]}
80SELECT ST_AsGeoJSON(ST_GeomFromText('POINT(5.363 7.266)'),1);
81ST_AsGeoJSON(ST_GeomFromText('POINT(5.363 7.266)'),1)
82{"type": "Point", "coordinates": [5.4, 7.3]}
83SELECT ST_AsGeoJSON(ST_GeomFromText('POINT(5.363 7.266)'),10);
84ST_AsGeoJSON(ST_GeomFromText('POINT(5.363 7.266)'),10)
85{"type": "Point", "coordinates": [5.363, 7.266]}
86SELECT ST_AsGeoJSON(ST_GeomFromText("POINT(10 11)"), 100, 1);
87ST_AsGeoJSON(ST_GeomFromText("POINT(10 11)"), 100, 1)
88{"bbox": [10, 11, 10, 11], "type": "Point", "coordinates": [10, 11]}
89SELECT ST_AsGeoJSON(ST_GeomFromText("POINT(10 11)"), 100, 5);
90ST_AsGeoJSON(ST_GeomFromText("POINT(10 11)"), 100, 5)
91{"bbox": [10, 11, 10, 11], "type": "Point", "coordinates": [10, 11]}
92SELECT st_astext(st_geomfromgeojson('{"type": "MultiLineString","coordinates": []}')) as a;
93a
94NULL
95Warnings:
96Warning	4076	Incorrect GeoJSON format - empty 'coordinates' array.
97SELECT st_astext(st_geomfromgeojson('{"type": "Polygon","coordinates": []}')) as a;
98a
99NULL
100Warnings:
101Warning	4076	Incorrect GeoJSON format - empty 'coordinates' array.
102SELECT st_astext(st_geomfromgeojson('{"type": "MultiPolygon","coordinates": []}')) as a;
103a
104NULL
105Warnings:
106Warning	4076	Incorrect GeoJSON format - empty 'coordinates' array.
107SELECT ST_GEOMFROMGEOJSON("{ \"type\": \"Feature\", \"geometry\": [10, 20] }");
108ST_GEOMFROMGEOJSON("{ \"type\": \"Feature\", \"geometry\": [10, 20] }")
109NULL
110SELECT ST_ASTEXT (ST_GEOMFROMGEOJSON ('{ "type": "GEOMETRYCOLLECTION", "coordinates": [102.0, 0.0]}'));
111ST_ASTEXT (ST_GEOMFROMGEOJSON ('{ "type": "GEOMETRYCOLLECTION", "coordinates": [102.0, 0.0]}'))
112NULL
113Warnings:
114Warning	4048	Incorrect GeoJSON format specified for st_geomfromgeojson function.
115SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON('{"type": ["POINT"], "coINates": [0,0] }'));
116ST_ASTEXT(ST_GEOMFROMGEOJSON('{"type": ["POINT"], "coINates": [0,0] }'))
117NULL
118Warnings:
119Warning	4048	Incorrect GeoJSON format specified for st_geomfromgeojson function.
120#
121# End of 10.2 tests
122#
123