Debian Codegraph @

mysql-test/suite/gis/r/geojson_functions.result

raw
1 # Checking all valid GEOMETRY types
2 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 11)"));
3 ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 11)"))
4 {"type": "Point", "coordinates": [10.0, 11.0]}
5 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(-10 -11)"));
6 ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(-10 -11)"))
7 {"type": "Point", "coordinates": [-10.0, -11.0]}
8 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(1.7976931348623157E+308 1.7976931348623157E+308)"));
9 ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(1.7976931348623157E+308 1.7976931348623157E+308)"))
10 {"type": "Point", "coordinates": [1.7976931348623157e308, 1.7976931348623157e308]}
11 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(1.7976931348623157E-308 1.7976931348623157E-308)"));
12 ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(1.7976931348623157E-308 1.7976931348623157E-308)"))
13 {"type": "Point", "coordinates": [1.7976931348623155e-308, 1.7976931348623155e-308]}
14 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("LINESTRING(30 10, 10 30, 40 40)"));
15 ST_ASGEOJSON(ST_GEOMFROMTEXT("LINESTRING(30 10, 10 30, 40 40)"))
16 {"type": "LineString", "coordinates": [[30.0, 10.0], [10.0, 30.0], [40.0, 40.0]]}
17 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("LINESTRING(0 0, 0 10, 10 10, 10 0)"));
18 ST_ASGEOJSON(ST_GEOMFROMTEXT("LINESTRING(0 0, 0 10, 10 10, 10 0)"))
19 {"type": "LineString", "coordinates": [[0.0, 0.0], [0.0, 10.0], [10.0, 10.0], [10.0, 0.0]]}
20 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POLYGON((30 10, 40 40, 20 40, 10 20, 30 10))"));
21 ST_ASGEOJSON(ST_GEOMFROMTEXT("POLYGON((30 10, 40 40, 20 40, 10 20, 30 10))"))
22 {"type": "Polygon", "coordinates": [[[30.0, 10.0], [40.0, 40.0], [20.0, 40.0], [10.0, 20.0], [30.0, 10.0]]]}
23 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POLYGON((35 10, 45 45, 15 40, 10 20, 35 10),"
24 "(20 30, 35 35, 30 20, 20 30))"));
25 ST_ASGEOJSON(ST_GEOMFROMTEXT("POLYGON((35 10, 45 45, 15 40, 10 20, 35 10),"
26 "(20 30, 35 35, 30 20, 20 30))"))
27 {"type": "Polygon", "coordinates": [[[35.0, 10.0], [45.0, 45.0], [15.0, 40.0], [10.0, 20.0], [35.0, 10.0]], [[20.0, 30.0], [35.0, 35.0], [30.0, 20.0], [20.0, 30.0]]]}
28 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("MULTIPOINT(10 40, 40 30, 20 20, 30 10)"));
29 ST_ASGEOJSON(ST_GEOMFROMTEXT("MULTIPOINT(10 40, 40 30, 20 20, 30 10)"))
30 {"type": "MultiPoint", "coordinates": [[10.0, 40.0], [40.0, 30.0], [20.0, 20.0], [30.0, 10.0]]}
31 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("MULTIPOINT(0 0, 10 10, 20 20, 30 30, 40 40)"));
32 ST_ASGEOJSON(ST_GEOMFROMTEXT("MULTIPOINT(0 0, 10 10, 20 20, 30 30, 40 40)"))
33 {"type": "MultiPoint", "coordinates": [[0.0, 0.0], [10.0, 10.0], [20.0, 20.0], [30.0, 30.0], [40.0, 40.0]]}
34 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("MULTILINESTRING((10 10, 20 20, 10 40),"
35 "(40 40, 30 30, 40 20, 30 10))"));
36 ST_ASGEOJSON(ST_GEOMFROMTEXT("MULTILINESTRING((10 10, 20 20, 10 40),"
37 "(40 40, 30 30, 40 20, 30 10))"))
38 {"type": "MultiLineString", "coordinates": [[[10.0, 10.0], [20.0, 20.0], [10.0, 40.0]], [[40.0, 40.0], [30.0, 30.0], [40.0, 20.0], [30.0, 10.0]]]}
39 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("MULTILINESTRING((10 10, 20 20, 10 40),"
40 "(40 40, 30 30, 40 20, 30 10),"
41 "(10 10, 20 20, 50 50, 100 100))"));
42 ST_ASGEOJSON(ST_GEOMFROMTEXT("MULTILINESTRING((10 10, 20 20, 10 40),"
43 "(40 40, 30 30, 40 20, 30 10),"
44 "(10 10, 20 20, 50 50, 100 100))"))
45 {"type": "MultiLineString", "coordinates": [[[10.0, 10.0], [20.0, 20.0], [10.0, 40.0]], [[40.0, 40.0], [30.0, 30.0], [40.0, 20.0], [30.0, 10.0]], [[10.0, 10.0], [20.0, 20.0], [50.0, 50.0], [100.0, 100.0]]]}
46 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("MULTIPOLYGON(((40 40, 20 45, 45 30, 40 40)),"
47 "((20 35, 10 30, 10 10, 30 5, 45 20, 20 35)))"));
48 ST_ASGEOJSON(ST_GEOMFROMTEXT("MULTIPOLYGON(((40 40, 20 45, 45 30, 40 40)),"
49 "((20 35, 10 30, 10 10, 30 5, 45 20, 20 35)))"))
50 {"type": "MultiPolygon", "coordinates": [[[[40.0, 40.0], [20.0, 45.0], [45.0, 30.0], [40.0, 40.0]]], [[[20.0, 35.0], [10.0, 30.0], [10.0, 10.0], [30.0, 5.0], [45.0, 20.0], [20.0, 35.0]]]]}
51 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("MULTIPOLYGON(((40 40, 20 45, 45 30, 40 40)),"
52 "((20 35, 10 30, 10 10, 30 5, 45 20, 20 35),"
53 "(30 20, 20 15, 20 25, 30 20)))"));
54 ST_ASGEOJSON(ST_GEOMFROMTEXT("MULTIPOLYGON(((40 40, 20 45, 45 30, 40 40)),"
55 "((20 35, 10 30, 10 10, 30 5, 45 20, 20 35),"
56 "(30 20, 20 15, 20 25, 30 20)))"))
57 {"type": "MultiPolygon", "coordinates": [[[[40.0, 40.0], [20.0, 45.0], [45.0, 30.0], [40.0, 40.0]]], [[[20.0, 35.0], [10.0, 30.0], [10.0, 10.0], [30.0, 5.0], [45.0, 20.0], [20.0, 35.0]], [[30.0, 20.0], [20.0, 15.0], [20.0, 25.0], [30.0, 20.0]]]]}
58 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("GEOMETRYCOLLECTION()"));
59 ST_ASGEOJSON(ST_GEOMFROMTEXT("GEOMETRYCOLLECTION()"))
60 {"type": "GeometryCollection", "geometries": []}
61 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(POINT(10 20)))"));
62 ST_ASGEOJSON(ST_GEOMFROMTEXT("GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(POINT(10 20)))"))
63 {"type": "GeometryCollection", "geometries": [{"type": "GeometryCollection", "geometries": [{"type": "Point", "coordinates": [10.0, 20.0]}]}]}
64 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION()))"));
65 ST_ASGEOJSON(ST_GEOMFROMTEXT("GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION()))"))
66 {"type": "GeometryCollection", "geometries": [{"type": "GeometryCollection", "geometries": [{"type": "GeometryCollection", "geometries": []}]}]}
67 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("GEOMETRYCOLLECTION( "
68 "GEOMETRYCOLLECTION(POINT(10 20)),"
69 "GEOMETRYCOLLECTION(LINESTRING(0 0, 100 100)),"
70 "GEOMETRYCOLLECTION(POLYGON((0 0, 0 10, 10 10, 0 0)))"
71 ")"
72 ));
73 ST_ASGEOJSON(ST_GEOMFROMTEXT("GEOMETRYCOLLECTION( "
74 "GEOMETRYCOLLECTION(POINT(10 20)),"
75 "GEOMETRYCOLLECTION(LINESTRING(0 0, 100 100)),"
76 "GEOMETRYCO
77 {"type": "GeometryCollection", "geometries": [{"type": "GeometryCollection", "geometries": [{"type": "Point", "coordinates": [10.0, 20.0]}]}, {"type": "GeometryCollection", "geometries": [{"type": "LineString", "coordinates": [[0.0, 0.0], [100.0, 100.0]]}]}, {"type": "GeometryCollection", "geometries": [{"type": "Polygon", "coordinates": [[[0.0, 0.0], [0.0, 10.0], [10.0, 10.0], [0.0, 0.0]]]}]}]}
78 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("GEOMETRYCOLLECTION( "
79 "POINT(4 6),"
80 "LINESTRING(4 6,7 10),"
81 "POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10)),"
82 "MULTIPOINT (10 40, 40 30, 20 20, 30 10),"
83 "MULTILINESTRING ((10 10, 20 20, 10 40),"
84 "(40 40, 30 30, 40 20, 30 10)),"
85 "MULTIPOLYGON (((30 20, 45 40, 10 40, 30 20)),"
86 "((15 5, 40 10, 10 20, 5 10, 15 5)))"
87 ")"
88 ));
89 ST_ASGEOJSON(ST_GEOMFROMTEXT("GEOMETRYCOLLECTION( "
90 "POINT(4 6),"
91 "LINESTRING(4 6,7 10),"
92 "POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10)),"
93
94 {"type": "GeometryCollection", "geometries": [{"type": "Point", "coordinates": [4.0, 6.0]}, {"type": "LineString", "coordinates": [[4.0, 6.0], [7.0, 10.0]]}, {"type": "Polygon", "coordinates": [[[30.0, 10.0], [40.0, 40.0], [20.0, 40.0], [10.0, 20.0], [30.0, 10.0]]]}, {"type": "MultiPoint", "coordinates": [[10.0, 40.0], [40.0, 30.0], [20.0, 20.0], [30.0, 10.0]]}, {"type": "MultiLineString", "coordinates": [[[10.0, 10.0], [20.0, 20.0], [10.0, 40.0]], [[40.0, 40.0], [30.0, 30.0], [40.0, 20.0], [30.0, 10.0]]]}, {"type": "MultiPolygon", "coordinates": [[[[30.0, 20.0], [45.0, 40.0], [10.0, 40.0], [30.0, 20.0]]], [[[15.0, 5.0], [40.0, 10.0], [10.0, 20.0], [5.0, 10.0], [15.0, 5.0]]]]}]}
95 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("GEOMETRYCOLLECTION( "
96 "POINT(4 6),"
97 "GEOMETRYCOLLECTION("
98 "POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10)),"
99 "MULTIPOINT (10 40, 40 30, 20 20, 30 10),"
100 "MULTILINESTRING ((10 10, 20 20, 10 40),"
101 "(40 40, 30 30, 40 20, 30 10)),"
102 "MULTIPOLYGON (((30 20, 45 40, 10 40, 30 20)),"
103 "((15 5, 40 10, 10 20, 5 10, 15 5)))"
104 "),"
105 "POINT(6 4)"
106 ")"
107 ));
108 ST_ASGEOJSON(ST_GEOMFROMTEXT("GEOMETRYCOLLECTION( "
109 "POINT(4 6),"
110 "GEOMETRYCOLLECTION("
111 "POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10)),"
112
113 {"type": "GeometryCollection", "geometries": [{"type": "Point", "coordinates": [4.0, 6.0]}, {"type": "GeometryCollection", "geometries": [{"type": "Polygon", "coordinates": [[[30.0, 10.0], [40.0, 40.0], [20.0, 40.0], [10.0, 20.0], [30.0, 10.0]]]}, {"type": "MultiPoint", "coordinates": [[10.0, 40.0], [40.0, 30.0], [20.0, 20.0], [30.0, 10.0]]}, {"type": "MultiLineString", "coordinates": [[[10.0, 10.0], [20.0, 20.0], [10.0, 40.0]], [[40.0, 40.0], [30.0, 30.0], [40.0, 20.0], [30.0, 10.0]]]}, {"type": "MultiPolygon", "coordinates": [[[[30.0, 20.0], [45.0, 40.0], [10.0, 40.0], [30.0, 20.0]]], [[[15.0, 5.0], [40.0, 10.0], [10.0, 20.0], [5.0, 10.0], [15.0, 5.0]]]]}]}, {"type": "Point", "coordinates": [6.0, 4.0]}]}
114 # Checking NULL as one or more of the arguments.
115 SELECT ST_ASGEOJSON(NULL);
116 ST_ASGEOJSON(NULL)
117 NULL
118 SELECT ST_ASGEOJSON(NULL, NULL);
119 ST_ASGEOJSON(NULL, NULL)
120 NULL
121 SELECT ST_ASGEOJSON(NULL, 10);
122 ST_ASGEOJSON(NULL, 10)
123 NULL
124 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 11)"), NULL);
125 ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 11)"), NULL)
126 NULL
127 SELECT ST_ASGEOJSON(NULL, 10, 0);
128 ST_ASGEOJSON(NULL, 10, 0)
129 NULL
130 SELECT ST_ASGEOJSON(NULL, NULL, 0);
131 ST_ASGEOJSON(NULL, NULL, 0)
132 NULL
133 SELECT ST_ASGEOJSON(NULL, 10, NULL);
134 ST_ASGEOJSON(NULL, 10, NULL)
135 NULL
136 SELECT ST_ASGEOJSON(NULL, NULL, NULL);
137 ST_ASGEOJSON(NULL, NULL, NULL)
138 NULL
139 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 11)"), NULL, 0);
140 ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 11)"), NULL, 0)
141 NULL
142 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 11)"), 10, NULL);
143 ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 11)"), 10, NULL)
144 NULL
145 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 11)"), NULL, NULL);
146 ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 11)"), NULL, NULL)
147 NULL
148 # Checking options argument and maxdecimaldigits argument
149 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 11)", 4326), 100, 2);
150 ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 11)", 4326), 100, 2)
151 {"crs": {"type": "name", "properties": {"name": "EPSG:4326"}}, "type": "Point", "coordinates": [11.0, 10.0]}
152 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 11)", 4326), 100, 4);
153 ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 11)", 4326), 100, 4)
154 {"crs": {"type": "name", "properties": {"name": "urn:ogc:def:crs:EPSG::4326"}}, "type": "Point", "coordinates": [11.0, 10.0]}
155 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 11)", 4326), 100, 6);
156 ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 11)", 4326), 100, 6)
157 {"crs": {"type": "name", "properties": {"name": "urn:ogc:def:crs:EPSG::4326"}}, "type": "Point", "coordinates": [11.0, 10.0]}
158 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 11)", 0), 100, 5);
159 ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 11)", 0), 100, 5)
160 {"bbox": [10.0, 11.0, 10.0, 11.0], "type": "Point", "coordinates": [10.0, 11.0]}
161 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 11)", 0), 100, 2);
162 ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 11)", 0), 100, 2)
163 {"type": "Point", "coordinates": [10.0, 11.0]}
164 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 11)", -1), 100, 4);
165 ERROR 22003: SRID value is out of range in 'st_geomfromtext'
166 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 11)", -1000), 100, 6);
167 ERROR 22003: SRID value is out of range in 'st_geomfromtext'
168 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 11)", 4294967296), 100, 6);
169 ERROR 22003: SRID value is out of range in 'st_geomfromtext'
170 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 11)", 4294967295123), 100, 7);
171 ERROR 22003: SRID value is out of range in 'st_geomfromtext'
172 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10.123456789 11.123456789)", 0), 0, 0);
173 ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10.123456789 11.123456789)", 0), 0, 0)
174 {"type": "Point", "coordinates": [10.0, 11.0]}
175 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10.123456789 11.123456789)", 0), 4, 7);
176 ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10.123456789 11.123456789)", 0), 4, 7)
177 {"bbox": [10.1235, 11.1235, 10.1235, 11.1235], "type": "Point", "coordinates": [10.1235, 11.1235]}
178 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10.123456789 11.123456789)", 0), 10, 0);
179 ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10.123456789 11.123456789)", 0), 10, 0)
180 {"type": "Point", "coordinates": [10.123456789, 11.123456789]}
181 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10.123456789 11.123456789)", 0), 0);
182 ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10.123456789 11.123456789)", 0), 0)
183 {"type": "Point", "coordinates": [10.0, 11.0]}
184 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10.123456789 11.123456789)", 0), 4);
185 ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10.123456789 11.123456789)", 0), 4)
186 {"type": "Point", "coordinates": [10.1235, 11.1235]}
187 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10.123456789 11.123456789)", 0), 10);
188 ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10.123456789 11.123456789)", 0), 10)
189 {"type": "Point", "coordinates": [10.123456789, 11.123456789]}
190 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10.1234567890123456789 11.123456789)", 0), 10000);
191 ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10.1234567890123456789 11.123456789)", 0), 10000)
192 {"type": "Point", "coordinates": [10.123456789012346, 11.123456789]}
193 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10.1234567890123456789 11.123456789)", 0), 1000000);
194 ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10.1234567890123456789 11.123456789)", 0), 1000000)
195 {"type": "Point", "coordinates": [10.123456789012346, 11.123456789]}
196 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10.1234567890123456789 11.123456789)", 0), 2147483647);
197 ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10.1234567890123456789 11.123456789)", 0), 2147483647)
198 {"type": "Point", "coordinates": [10.123456789012346, 11.123456789]}
199 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10.1234567890123456789 11.1234567890123456789)", 0), 10, 0);
200 ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10.1234567890123456789 11.1234567890123456789)", 0), 10, 0)
201 {"type": "Point", "coordinates": [10.123456789, 11.123456789]}
202 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10.1234567890123456789 11.1234567890123456789)", 0), 10, 1);
203 ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10.1234567890123456789 11.1234567890123456789)", 0), 10, 1)
204 {"bbox": [10.123456789, 11.123456789, 10.123456789, 11.123456789], "type": "Point", "coordinates": [10.123456789, 11.123456789]}
205 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10.1234567890123456789 11.1234567890123456789)", 0), 10, 2);
206 ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10.1234567890123456789 11.1234567890123456789)", 0), 10, 2)
207 {"type": "Point", "coordinates": [10.123456789, 11.123456789]}
208 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10.1234567890123456789 11.1234567890123456789)", 0), 10, 3);
209 ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10.1234567890123456789 11.1234567890123456789)", 0), 10, 3)
210 {"bbox": [10.123456789, 11.123456789, 10.123456789, 11.123456789], "type": "Point", "coordinates": [10.123456789, 11.123456789]}
211 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10.1234567890123456789 11.1234567890123456789)", 0), 10, 4);
212 ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10.1234567890123456789 11.1234567890123456789)", 0), 10, 4)
213 {"type": "Point", "coordinates": [10.123456789, 11.123456789]}
214 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10.1234567890123456789 11.1234567890123456789)", 0), 10, 5);
215 ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10.1234567890123456789 11.1234567890123456789)", 0), 10, 5)
216 {"bbox": [10.123456789, 11.123456789, 10.123456789, 11.123456789], "type": "Point", "coordinates": [10.123456789, 11.123456789]}
217 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10.1234567890123456789 11.1234567890123456789)", 0), 10, 6);
218 ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10.1234567890123456789 11.1234567890123456789)", 0), 10, 6)
219 {"type": "Point", "coordinates": [10.123456789, 11.123456789]}
220 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10.1234567890123456789 11.1234567890123456789)", 0), 10, 7);
221 ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10.1234567890123456789 11.1234567890123456789)", 0), 10, 7)
222 {"bbox": [10.123456789, 11.123456789, 10.123456789, 11.123456789], "type": "Point", "coordinates": [10.123456789, 11.123456789]}
223 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 11)", "0"), 100, 1);
224 ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 11)", "0"), 100, 1)
225 {"bbox": [10.0, 11.0, 10.0, 11.0], "type": "Point", "coordinates": [10.0, 11.0]}
226 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 11)", "-1"), 100, 2);
227 ERROR 22003: SRID value is out of range in 'st_geomfromtext'
228 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 11)", "-1000"), 100, 3);
229 ERROR 22003: SRID value is out of range in 'st_geomfromtext'
230 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 11)", "4294967296"), 100, 5);
231 ERROR 22003: SRID value is out of range in 'st_geomfromtext'
232 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 11)", "4294967295123"), 100, 6);
233 ERROR 22003: SRID value is out of range in 'st_geomfromtext'
234 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 11)", (CAST(4326 AS CHAR))), 100, 7);
235 ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 11)", (CAST(4326 AS CHAR))), 100, 7)
236 {"crs": {"type": "name", "properties": {"name": "urn:ogc:def:crs:EPSG::4326"}}, "bbox": [11.0, 10.0, 11.0, 10.0], "type": "Point", "coordinates": [11.0, 10.0]}
237 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10.123456789 11.123456789)", 0), "0", 1);
238 ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10.123456789 11.123456789)", 0), "0", 1)
239 {"bbox": [10.0, 11.0, 10.0, 11.0], "type": "Point", "coordinates": [10.0, 11.0]}
240 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10.123456789 11.123456789)", 0), "4", 2);
241 ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10.123456789 11.123456789)", 0), "4", 2)
242 {"type": "Point", "coordinates": [10.1235, 11.1235]}
243 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10.123456789 11.123456789)", 0), "10", 3);
244 ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10.123456789 11.123456789)", 0), "10", 3)
245 {"bbox": [10.123456789, 11.123456789, 10.123456789, 11.123456789], "type": "Point", "coordinates": [10.123456789, 11.123456789]}
246 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10.1234567890123456789 11.1234567890123456789)", 0), "10000", 4);
247 ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10.1234567890123456789 11.1234567890123456789)", 0), "10000", 4)
248 {"type": "Point", "coordinates": [10.123456789012346, 11.123456789012346]}
249 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10.1234567890123456789 11.1234567890123456789)", 0), "1000000", 5);
250 ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10.1234567890123456789 11.1234567890123456789)", 0), "1000000", 5)
251 {"bbox": [10.123456789012346, 11.123456789012346, 10.123456789012346, 11.123456789012346], "type": "Point", "coordinates": [10.123456789012346, 11.123456789012346]}
252 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10.1234567890123456789 11.1234567890123456789)", 0), "2147483647", 6);
253 ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10.1234567890123456789 11.1234567890123456789)", 0), "2147483647", 6)
254 {"type": "Point", "coordinates": [10.123456789012346, 11.123456789012346]}
255 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10.1234567890123456789 11.1234567890123456789)", 0), (CAST(20 AS CHAR)), 7);
256 ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10.1234567890123456789 11.1234567890123456789)", 0), (CAST(20 AS CHAR)), 7)
257 {"bbox": [10.123456789012346, 11.123456789012346, 10.123456789012346, 11.123456789012346], "type": "Point", "coordinates": [10.123456789012346, 11.123456789012346]}
258 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10.1234567890123456789 11.1234567890123456789)", 0), 10, (CAST(7 AS CHAR)));
259 ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10.1234567890123456789 11.1234567890123456789)", 0), 10, (CAST(7 AS CHAR)))
260 {"bbox": [10.123456789, 11.123456789, 10.123456789, 11.123456789], "type": "Point", "coordinates": [10.123456789, 11.123456789]}
261 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 11)", " 4326.34 "), 100, 1);
262 ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 11)", " 4326.34 "), 100, 1)
263 {"bbox": [11.0, 10.0, 11.0, 10.0], "type": "Point", "coordinates": [11.0, 10.0]}
264 Warnings:
265 Warning 1292 Truncated incorrect INTEGER value: ' 4326.34 '
266 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 11)", "*&$%4326"), 100, 2);
267 ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 11)", "*&$%4326"), 100, 2)
268 {"type": "Point", "coordinates": [10.0, 11.0]}
269 Warnings:
270 Warning 1292 Truncated incorrect INTEGER value: '*&$%4326'
271 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 11)", 0), "12.34", 3);
272 ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 11)", 0), "12.34", 3)
273 {"bbox": [10.0, 11.0, 10.0, 11.0], "type": "Point", "coordinates": [10.0, 11.0]}
274 Warnings:
275 Warning 1292 Truncated incorrect INTEGER value: '12.34'
276 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 11)", 4326), "*&$%$123", 4);
277 ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 11)", 4326), "*&$%$123", 4)
278 {"crs": {"type": "name", "properties": {"name": "urn:ogc:def:crs:EPSG::4326"}}, "type": "Point", "coordinates": [11.0, 10.0]}
279 Warnings:
280 Warning 1292 Truncated incorrect INTEGER value: '*&$%$123'
281 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 11)", 4236), 10, "06.34");
282 ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 11)", 4236), 10, "06.34")
283 {"crs": {"type": "name", "properties": {"name": "urn:ogc:def:crs:EPSG::4236"}}, "type": "Point", "coordinates": [11.0, 10.0]}
284 Warnings:
285 Warning 1292 Truncated incorrect INTEGER value: '06.34'
286 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 11)", 4326), 10, "*&$%$123");
287 ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 11)", 4326), 10, "*&$%$123")
288 {"type": "Point", "coordinates": [11.0, 10.0]}
289 Warnings:
290 Warning 1292 Truncated incorrect INTEGER value: '*&$%$123'
291 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("MULTIPOLYGON(((40 40, 20 45, 45 30, 40 40)),"
292 "((20 35, 10 30, 10 10, 30 5, 45 20, 20 35),"
293 "(30 20, 20 15, 20 25, 30 20)))"), 10, 1);
294 ST_ASGEOJSON(ST_GEOMFROMTEXT("MULTIPOLYGON(((40 40, 20 45, 45 30, 40 40)),"
295 "((20 35, 10 30, 10 10, 30 5, 45 20, 20 35),"
296 "(30 20, 20 15, 20 25, 30 20)))"), 10, 1)
297 {"bbox": [10.0, 5.0, 45.0, 45.0], "type": "MultiPolygon", "coordinates": [[[[40.0, 40.0], [20.0, 45.0], [45.0, 30.0], [40.0, 40.0]]], [[[20.0, 35.0], [10.0, 30.0], [10.0, 10.0], [30.0, 5.0], [45.0, 20.0], [20.0, 35.0]], [[30.0, 20.0], [20.0, 15.0], [20.0, 25.0], [30.0, 20.0]]]]}
298 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("GEOMETRYCOLLECTION( "
299 "GEOMETRYCOLLECTION(POINT(10 20)),"
300 "GEOMETRYCOLLECTION(LINESTRING(0 0, 100 100)),"
301 "GEOMETRYCOLLECTION(POLYGON((0 0, 0 10, 10 10, 0 0)))"
302 ")"
303 ), 5, 1);
304 ST_ASGEOJSON(ST_GEOMFROMTEXT("GEOMETRYCOLLECTION( "
305 "GEOMETRYCOLLECTION(POINT(10 20)),"
306 "GEOMETRYCOLLECTION(LINESTRING(0 0, 100 100)),"
307 "GEOMETRYCO
308 {"bbox": [0.0, 0.0, 100.0, 100.0], "type": "GeometryCollection", "geometries": [{"bbox": [10.0, 20.0, 10.0, 20.0], "type": "GeometryCollection", "geometries": [{"bbox": [10.0, 20.0, 10.0, 20.0], "type": "Point", "coordinates": [10.0, 20.0]}]}, {"bbox": [0.0, 0.0, 100.0, 100.0], "type": "GeometryCollection", "geometries": [{"bbox": [0.0, 0.0, 100.0, 100.0], "type": "LineString", "coordinates": [[0.0, 0.0], [100.0, 100.0]]}]}, {"bbox": [0.0, 0.0, 10.0, 10.0], "type": "GeometryCollection", "geometries": [{"bbox": [0.0, 0.0, 10.0, 10.0], "type": "Polygon", "coordinates": [[[0.0, 0.0], [0.0, 10.0], [10.0, 10.0], [0.0, 0.0]]]}]}]}
309 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("GEOMETRYCOLLECTION("
310 "POINT(4 6),"
311 "GEOMETRYCOLLECTION("
312 "POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10)),"
313 "MULTIPOINT (10 40, 40 30, 20 20, 30 10),"
314 "MULTILINESTRING ((10 10, 20 20, 10 40),"
315 "(40 40, 30 30, 40 20, 30 10)),"
316 "MULTIPOLYGON (((30 20, 45 40, 10 40, 30 20)),"
317 "((15 5, 40 10, 10 20, 5 10, 15 5)))"
318 "),"
319 "POINT(6 4)"
320 ")"
321 ), 10, 1 );
322 ST_ASGEOJSON(ST_GEOMFROMTEXT("GEOMETRYCOLLECTION("
323 "POINT(4 6),"
324 "GEOMETRYCOLLECTION("
325 "POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10)),"
326
327 {"bbox": [4.0, 4.0, 45.0, 40.0], "type": "GeometryCollection", "geometries": [{"bbox": [4.0, 6.0, 4.0, 6.0], "type": "Point", "coordinates": [4.0, 6.0]}, {"bbox": [5.0, 5.0, 45.0, 40.0], "type": "GeometryCollection", "geometries": [{"bbox": [10.0, 10.0, 40.0, 40.0], "type": "Polygon", "coordinates": [[[30.0, 10.0], [40.0, 40.0], [20.0, 40.0], [10.0, 20.0], [30.0, 10.0]]]}, {"bbox": [10.0, 10.0, 40.0, 40.0], "type": "MultiPoint", "coordinates": [[10.0, 40.0], [40.0, 30.0], [20.0, 20.0], [30.0, 10.0]]}, {"bbox": [10.0, 10.0, 40.0, 40.0], "type": "MultiLineString", "coordinates": [[[10.0, 10.0], [20.0, 20.0], [10.0, 40.0]], [[40.0, 40.0], [30.0, 30.0], [40.0, 20.0], [30.0, 10.0]]]}, {"bbox": [5.0, 5.0, 45.0, 40.0], "type": "MultiPolygon", "coordinates": [[[[30.0, 20.0], [45.0, 40.0], [10.0, 40.0], [30.0, 20.0]]], [[[15.0, 5.0], [40.0, 10.0], [10.0, 20.0], [5.0, 10.0], [15.0, 5.0]]]]}]}, {"bbox": [6.0, 4.0, 6.0, 4.0], "type": "Point", "coordinates": [6.0, 4.0]}]}
328 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("GEOMETRYCOLLECTION()"), 10, 1);
329 ST_ASGEOJSON(ST_GEOMFROMTEXT("GEOMETRYCOLLECTION()"), 10, 1)
330 {"type": "GeometryCollection", "geometries": []}
331 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(1.7976931348623157E+308 1.7976931348623157E-308)"), 0, 1);
332 ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(1.7976931348623157E+308 1.7976931348623157E-308)"), 0, 1)
333 {"bbox": [1.7976931348623157e308, 0.0, 1.7976931348623157e308, 0.0], "type": "Point", "coordinates": [1.7976931348623157e308, 0.0]}
334 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(1.7976931348623157E+308 1.7976931348623157E-308)"), 10, 1);
335 ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(1.7976931348623157E+308 1.7976931348623157E-308)"), 10, 1)
336 {"bbox": [1.7976931348623157e308, 0.0, 1.7976931348623157e308, 0.0], "type": "Point", "coordinates": [1.7976931348623157e308, 0.0]}
337 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(1.7976931348623157E+308 1.7976931348623157E-308)"), 20, 1);
338 ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(1.7976931348623157E+308 1.7976931348623157E-308)"), 20, 1)
339 {"bbox": [1.7976931348623157e308, 0.0, 1.7976931348623157e308, 0.0], "type": "Point", "coordinates": [1.7976931348623157e308, 0.0]}
340 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(1.7976931348623157E+308 1.7976931348623157E-308)"), 30, 1);
341 ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(1.7976931348623157E+308 1.7976931348623157E-308)"), 30, 1)
342 {"bbox": [1.7976931348623157e308, 0.0, 1.7976931348623157e308, 0.0], "type": "Point", "coordinates": [1.7976931348623157e308, 0.0]}
343 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(1.7976931348623157E+308 1.7976931348623157E-308)"), 40, 1);
344 ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(1.7976931348623157E+308 1.7976931348623157E-308)"), 40, 1)
345 {"bbox": [1.7976931348623157e308, 0.0, 1.7976931348623157e308, 0.0], "type": "Point", "coordinates": [1.7976931348623157e308, 0.0]}
346 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(1.7976931348623157E+308 1.7976931348623157E-308)"), 1000, 1);
347 ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(1.7976931348623157E+308 1.7976931348623157E-308)"), 1000, 1)
348 {"bbox": [1.7976931348623157e308, 1.7976931348623155e-308, 1.7976931348623157e308, 1.7976931348623155e-308], "type": "Point", "coordinates": [1.7976931348623157e308, 1.7976931348623155e-308]}
349 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT('POINT(1.2345678901234567890 2.345678901234567890)'), SUM(3));
350 ERROR HY000: Incorrect type for argument max decimal digits in function st_asgeojson.
351 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT('POINT(1.2345678901234567890 2.345678901234567890)'), AVG(3));
352 ERROR HY000: Incorrect type for argument max decimal digits in function st_asgeojson.
353 # Check that function outputs correct character set
354 SET NAMES 'ascii';
355 SELECT CHARSET(ST_ASGEOJSON(POINT(-1.42, 283.12)));
356 CHARSET(ST_ASGEOJSON(POINT(-1.42, 283.12)))
357 utf8mb4
358 SET NAMES 'utf8';
359 Warnings:
360 Warning 3719 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
361 SELECT CHARSET(ST_ASGEOJSON(POINT(-1.42, 283.12)));
362 CHARSET(ST_ASGEOJSON(POINT(-1.42, 283.12)))
363 utf8mb4
364 # Invalid function calls
365 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("1"));
366 ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
367 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT"));
368 ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
369 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT()"));
370 ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
371 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10)"));
372 ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
373 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(a b)"));
374 ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
375 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 b)"));
376 ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
377 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(a 11)"));
378 ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
379 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10, 11)"));
380 ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
381 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POLYGON((40 40, 20 45, 45 30, 40 40)"), 10);
382 ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
383 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("MULTIPOLYGON(((40 40, 20 45, 45 30, 40 40)),"
384 "((20 35, 10 30, 10 10, 30 5, 45 20, 20 35),"), 10, 2);
385 ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
386 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("GEOMETRYCOLLECTION( "
387 "GEOMETRYCOLLECTION(POINT(10 20)),"
388 "GEOMETRYCOLLECTION(LINESTRING(0 0, 100 100)),"
389 "GEOMETRYCOLLECTION(POLYGON((0 0, 0 10, 10 10, 0 0))),"
390 ")"
391 ));
392 ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
393 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("MULTIPOINT()"), 10);
394 ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
395 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("MULTILINESTRING(())"), 10);
396 ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
397 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("MULTIPOLYGON((()))"), 10);
398 ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
399 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("LINESTRING(1)"), 10);
400 ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
401 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("MULTILINESTRING((0 0, 10 10),())"), 10);
402 ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
403 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 20)"), 2, -1);
404 ERROR HY000: Incorrect options value: '-1' for function st_asgeojson
405 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 20)"), 2, -1000);
406 ERROR HY000: Incorrect options value: '-1000' for function st_asgeojson
407 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 20)"), 2, 8);
408 ERROR HY000: Incorrect options value: '8' for function st_asgeojson
409 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 20)"), 2, 1000);
410 ERROR HY000: Incorrect options value: '1000' for function st_asgeojson
411 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 20)"), 2, "-1");
412 ERROR HY000: Incorrect options value: '-1' for function st_asgeojson
413 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 20)"), 2, "-1000");
414 ERROR HY000: Incorrect options value: '-1000' for function st_asgeojson
415 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 20)"), 2, "8");
416 ERROR HY000: Incorrect options value: '8' for function st_asgeojson
417 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 20)"), 2, "1000");
418 ERROR HY000: Incorrect options value: '1000' for function st_asgeojson
419 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 11)", 4236), 10, "16.34");
420 ERROR HY000: Incorrect options value: '16' for function st_asgeojson
421 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 20)"), -1, 0);
422 ERROR HY000: Incorrect max decimal digits value: '-1' for function st_asgeojson
423 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 20)"), -1000, 0);
424 ERROR HY000: Incorrect max decimal digits value: '-1000' for function st_asgeojson
425 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 20)"), 2147483648, 0);
426 ERROR HY000: Incorrect max decimal digits value: '2147483648' for function st_asgeojson
427 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 20)"), 2147483647000, 0);
428 ERROR HY000: Incorrect max decimal digits value: '2147483647000' for function st_asgeojson
429 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 20)"), "-1", 0);
430 ERROR HY000: Incorrect max decimal digits value: '-1' for function st_asgeojson
431 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 20)"), "-1000", 0);
432 ERROR HY000: Incorrect max decimal digits value: '-1000' for function st_asgeojson
433 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 20)"), "2147483648", 0);
434 ERROR HY000: Incorrect max decimal digits value: '2147483648' for function st_asgeojson
435 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 20)"), "2147483647000", 0);
436 ERROR HY000: Incorrect max decimal digits value: '2147483647000' for function st_asgeojson
437 SELECT ST_ASGEOJSON();
438 ERROR 42000: Incorrect parameter count in the call to native function 'ST_ASGEOJSON'
439 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 11)"), 10, 0, 0);
440 ERROR 42000: Incorrect parameter count in the call to native function 'ST_ASGEOJSON'
441 SELECT ST_ASGEOJSON(1);
442 ERROR HY000: Incorrect type for argument geometry in function st_asgeojson.
443 SELECT ST_ASGEOJSON(1, 2);
444 ERROR HY000: Incorrect type for argument geometry in function st_asgeojson.
445 SELECT ST_ASGEOJSON(1, 0, 1);
446 ERROR HY000: Incorrect type for argument geometry in function st_asgeojson.
447 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 20)"), 2.1, 0);
448 ERROR HY000: Incorrect type for argument max decimal digits in function st_asgeojson.
449 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 20)"), 10, 0.1);
450 ERROR HY000: Incorrect type for argument options in function st_asgeojson.
451 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 20)"), (CAST(10 AS BINARY)), 0);
452 ERROR HY000: Incorrect type for argument max decimal digits in function st_asgeojson.
453 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 20)"), 10, (CAST(4 AS BINARY)));
454 ERROR HY000: Incorrect type for argument options in function st_asgeojson.
455 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 20)"), (CAST(10 AS DECIMAL)), 0);
456 ERROR HY000: Incorrect type for argument max decimal digits in function st_asgeojson.
457 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 20)"), 10, (CAST(4 AS DECIMAL)));
458 ERROR HY000: Incorrect type for argument options in function st_asgeojson.
459 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 11)"), abc, 0);
460 ERROR 42S22: Unknown column 'abc' in 'field list'
461 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 11)"), 0, abc);
462 ERROR 42S22: Unknown column 'abc' in 'field list'
463 SELECT ST_ASGEOJSON("*&$%$123", abc, 0);
464 ERROR 42S22: Unknown column 'abc' in 'field list'
465 PREPARE stmt FROM "SELECT ST_ASGEOJSON(?, 10, 0)";
466 PREPARE stmt FROM "SELECT ST_ASGEOJSON(POINT(10, 10), ?, 0)";
467 PREPARE stmt FROM "SELECT ST_ASGEOJSON(POINT(10, 10), 10, ?)";
468 PREPARE stmt FROM "SELECT ST_ASGEOJSON(?, ?, 0)";
469 PREPARE stmt FROM "SELECT ST_ASGEOJSON(?, 10, ?)";
470 PREPARE stmt FROM "SELECT ST_ASGEOJSON(POINT(10, 10), ?, ?)";
471 PREPARE stmt FROM "SELECT ST_ASGEOJSON(?, ?, ?)";
472 CREATE TABLE t1 (g GEOMETRY);
473 # Check that packet overflow is handled correctly.
474 SET @old_max_allowed_packet= @@global.max_allowed_packet;
475 INSERT INTO t1 VALUES (ST_GEOMFROMTEXT(
476 " LINESTRING(1 2, 3 4, 5 6, 7 8, 9 10, 11 12, 13 14, 15 16, 17 18, 19 20, "
477 " 21 22, 23 24, 25 26, 27 28, 29 30, 31 32, 33 34, 35 36, 37 38, 39 40, "
478 " 41 42, 43 44, 45 46, 47 48, 49 50) "
479 ));
480 SELECT ST_ASTEXT(g) FROM t1;
481 ST_ASTEXT(g)
482 LINESTRING(1 2,3 4,5 6,7 8,9 10,11 12,13 14,15 16,17 18,19 20,21 22,23 24,25 26,27 28,29 30,31 32,33 34,35 36,37 38,39 40,41 42,43 44,45 46,47 48,49 50)
483 UPDATE t1 SET g = GEOMETRYCOLLECTION(g, g, g, g, g, g, g, g, g, g);
484 UPDATE t1 SET g = GEOMETRYCOLLECTION(g, g, g, g, g, g, g, g, g, g);
485 SELECT LENGTH(ST_ASTEXT(g)) FROM t1;
486 LENGTH(ST_ASTEXT(g))
487 15519
488 SELECT LENGTH(ST_ASGEOJSON(g)) FROM t1;
489 LENGTH(ST_ASGEOJSON(g))
490 38726
491 SET @@global.max_allowed_packet = 27648;
492 SELECT LENGTH(ST_ASGEOJSON(g)) FROM t1;
493 LENGTH(ST_ASGEOJSON(g))
494 NULL
495 Warnings:
496 Warning 1301 Result of st_asgeojson() was larger than max_allowed_packet (27648) - truncated
497 SELECT ST_ASGEOJSON(g) FROM t1;
498 ST_ASGEOJSON(g)
499 NULL
500 Warnings:
501 Warning 1301 Result of st_asgeojson() was larger than max_allowed_packet (27648) - truncated
502 SET @@global.max_allowed_packet = @old_max_allowed_packet;
503 DELETE FROM t1;
504 INSERT INTO t1 VALUES ("");
505 ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
506 SELECT ST_ASGEOJSON(g) FROM t1;
507 ST_ASGEOJSON(g)
508 DELETE FROM t1;
509 INSERT INTO t1 VALUES (0x00000000010200000000000000000024400000000000002440);
510 ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
511 SELECT ST_ASGEOJSON(g) FROM t1;
512 ST_ASGEOJSON(g)
513 DELETE FROM t1;
514 INSERT INTO t1 VALUES (0x00000000010300000000000000000024400000000000002440);
515 ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
516 SELECT ST_ASGEOJSON(g) FROM t1;
517 ST_ASGEOJSON(g)
518 DELETE FROM t1;
519 INSERT INTO t1 VALUES (0x00000000010300000000000000000024400000000000002440);
520 ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
521 SELECT ST_ASGEOJSON(g) FROM t1;
522 ST_ASGEOJSON(g)
523 DELETE FROM t1;
524 INSERT INTO t1 VALUES (0x0000000001040000000100000001010000000000000000000000000000);
525 ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
526 SELECT ST_ASGEOJSON(g) FROM t1;
527 ST_ASGEOJSON(g)
528 DELETE FROM t1;
529 INSERT INTO t1 VALUES (0x000000000107000000010000000107000000010000000101000000000000000000244000000000000024);
530 ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
531 SELECT ST_ASGEOJSON(g) FROM t1;
532 ST_ASGEOJSON(g)
533 DELETE FROM t1;
534 INSERT INTO t1 VALUES (0x00000000010300000001000000050000000000000000003E4000000000000024400000000000004440000000000000444000000000000034400000000000004440000000000000244000000000000034400000000000003E4000000000000024);
535 ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
536 SELECT ST_ASGEOJSON(g) FROM t1;
537 ST_ASGEOJSON(g)
538 DELETE FROM t1;
539 INSERT INTO t1 VALUES (0x00000000010300000001000000000000000000000000003E4000000000000024400000000000004440000000000000444000000000000034400000000000004440000000000000244000000000000034400000000000003E400000000000002440);
540 ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
541 SELECT ST_ASGEOJSON(g) FROM t1;
542 ST_ASGEOJSON(g)
543 DELETE FROM t1;
544 INSERT INTO t1 VALUES (0x00000000010200000001000000000000000000244000000000000024);
545 ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
546 SELECT ST_ASGEOJSON(g) FROM t1;
547 ST_ASGEOJSON(g)
548 DELETE FROM t1;
549 INSERT INTO t1 VALUES (0x0000000001050000000000000001020000000100000000000000000024400000000000003440);
550 ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
551 SELECT ST_ASGEOJSON(g) FROM t1;
552 ST_ASGEOJSON(g)
553 DELETE FROM t1;
554 INSERT INTO t1 VALUES (0x0000000001050000000200000001020000000100000000000000000024400000000000003440);
555 ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
556 SELECT ST_ASGEOJSON(g) FROM t1;
557 ST_ASGEOJSON(g)
558 DELETE FROM t1;
559 INSERT INTO t1 VALUES (0x000000000107000000010000000107000000010000000107000000010000000107000000010000000107000000010000000107000000010000000107000000);
560 ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
561 SELECT ST_ASGEOJSON(g) FROM t1;
562 ST_ASGEOJSON(g)
563 DROP TABLE t1;
564 # Checking all valid GeoJSON types
565 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
566 "{ \"type\": \"Point\", \"coordinates\": [102.0, 0.0]}"));
567 ST_ASTEXT(ST_GEOMFROMGEOJSON(
568 "{ \"type\": \"Point\", \"coordinates\": [102.0, 0.0]}"))
569 POINT(0 102)
570 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
571 "{ \"type\": \"LineString\", \"coordinates\": "
572 "[ [102.0, 0.0], [103.0, 1.0], [104.0, 0.0], [105.0, 1.0] ] }"));
573 ST_ASTEXT(ST_GEOMFROMGEOJSON(
574 "{ \"type\": \"LineString\", \"coordinates\": "
575 "[ [102.0, 0.0], [103.0, 1.0], [104.0, 0.0], [105.0, 1.0] ] }"))
576 LINESTRING(0 102,1 103,0 104,1 105)
577 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
578 "{ \"type\": \"MultiPoint\", \"coordinates\": "
579 "[ [-105.01, 39.57],[-80.66, 35.0] ] }"));
580 ST_ASTEXT(ST_GEOMFROMGEOJSON(
581 "{ \"type\": \"MultiPoint\", \"coordinates\": "
582 "[ [-105.01, 39.57],[-80.66, 35.0] ] }"))
583 MULTIPOINT((39.57 -105.01),(35 -80.66))
584 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
585 " { \"type\": \"MultiLineString\", \"coordinates\": "
586 " [ "
587 " [ "
588 " [-101.5, 39.662], "
589 " [-101.75, 39.2415], "
590 " [-101.23, 39.2415], "
591 " [-101.749, 39.7984], "
592 " [-101.5, 39.011] "
593 " ], "
594 " [ "
595 " [-99.23, 38.6605], "
596 " [-99.56, 38.727], "
597 " [-99.25, 38.018] "
598 " ], "
599 " [ "
600 " [-98.499, 38.913], "
601 " [-98.499, 38.913], "
602 " [-98.38, 38.15], "
603 " [-97.5, 38.629] "
604 " ] "
605 " ] "
606 " }"));
607 ST_ASTEXT(ST_GEOMFROMGEOJSON(
608 " { \"type\": \"MultiLineString\", \"coordinates\": "
609 " [ "
610 " [ "
611 " [-101.5, 39.662],
612 MULTILINESTRING((39.662 -101.5,39.2415 -101.75,39.2415 -101.23,39.7984 -101.749,39.011 -101.5),(38.6605 -99.23,38.727 -99.56,38.018 -99.25),(38.913 -98.499,38.913 -98.499,38.15 -98.38,38.629 -97.5))
613 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
614 " { \"type\": \"Polygon\", \"coordinates\": "
615 " [ "
616 " [ "
617 " [41.83, 71.01], "
618 " [56.95, 33.75], "
619 " [21.79, 36.56], "
620 " [41.83, 71.01] "
621 " ] "
622 " ] "
623 " }"));
624 ST_ASTEXT(ST_GEOMFROMGEOJSON(
625 " { \"type\": \"Polygon\", \"coordinates\": "
626 " [ "
627 " [ "
628 " [41.83, 71.01], "
629 " [56.95, 33.
630 POLYGON((71.01 41.83,33.75 56.95,36.56 21.79,71.01 41.83))
631 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
632 " { \"type\": \"Polygon\", \"coordinates\": "
633 " [ "
634 " [ "
635 " [41.83, 71.01], "
636 " [56.95, 33.75], "
637 " [21.79, 36.56], "
638 " [41.83, 71.01] "
639 " ], "
640 " [ "
641 " [15.40, 15.40], "
642 " [15.40, 25.40], "
643 " [25.40, 25.40], "
644 " [15.40, 15.40] "
645 " ] "
646 " ] "
647 " }"));
648 ST_ASTEXT(ST_GEOMFROMGEOJSON(
649 " { \"type\": \"Polygon\", \"coordinates\": "
650 " [ "
651 " [ "
652 " [41.83, 71.01], "
653 " [56.95, 33.
654 POLYGON((71.01 41.83,33.75 56.95,36.56 21.79,71.01 41.83),(15.4 15.4,25.4 15.4,25.4 25.4,15.4 15.4))
655 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
656 " { \"type\": \"MultiPolygon\", \"coordinates\": "
657 " [ "
658 " [ "
659 " [ "
660 " [102.0, 2.0], "
661 " [103.0, 2.0], "
662 " [103.0, 3.0], "
663 " [102.0, 3.0], "
664 " [102.0, 2.0] "
665 " ] "
666 " ], "
667 " [ "
668 " [ "
669 " [100.0, 0.0], "
670 " [101.0, 0.0], "
671 " [101.0, 1.0], "
672 " [100.0, 1.0], "
673 " [100.0, 0.0] "
674 " ] "
675 " ] "
676 " ] "
677 " }"));
678 ST_ASTEXT(ST_GEOMFROMGEOJSON(
679 " { \"type\": \"MultiPolygon\", \"coordinates\": "
680 " [ "
681 " [ "
682 " [ "
683 "
684 MULTIPOLYGON(((2 102,2 103,3 103,3 102,2 102)),((0 100,0 101,1 101,1 100,0 100)))
685 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
686 " { \"type\": \"MultiPolygon\", \"coordinates\": "
687 " [ "
688 " [ "
689 " [ "
690 " [102.0, 2.0], "
691 " [103.0, 2.0], "
692 " [103.0, 3.0], "
693 " [102.0, 3.0], "
694 " [102.0, 2.0] "
695 " ], "
696 " [ "
697 " [1.0, 0.0], "
698 " [0.0, 0.0], "
699 " [0.0, 1.0], "
700 " [1.0, 0.0] "
701 " ] "
702 " ], "
703 " [ "
704 " [ "
705 " [100.0, 0.0], "
706 " [101.0, 0.0], "
707 " [101.0, 1.0], "
708 " [100.0, 1.0], "
709 " [100.0, 0.0] "
710 " ] "
711 " ] "
712 " ] "
713 " }"));
714 ST_ASTEXT(ST_GEOMFROMGEOJSON(
715 " { \"type\": \"MultiPolygon\", \"coordinates\": "
716 " [ "
717 " [ "
718 " [ "
719 "
720 MULTIPOLYGON(((2 102,2 103,3 103,3 102,2 102),(0 1,0 0,1 0,0 1)),((0 100,0 101,1 101,1 100,0 100)))
721 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
722 " { \"type\": \"GeometryCollection\", \"geometries\": "
723 " [ ] "
724 " }"));
725 ST_ASTEXT(ST_GEOMFROMGEOJSON(
726 " { \"type\": \"GeometryCollection\", \"geometries\": "
727 " [ ] "
728 " }"))
729 GEOMETRYCOLLECTION EMPTY
730 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
731 " { \"type\": \"GeometryCollection\", \"geometries\": "
732 " [ "
733 " { \"type\": \"GeometryCollection\", \"geometries\": "
734 " [ "
735 " { \"type\": \"GeometryCollection\", \"geometries\": "
736 " [ ] "
737 " } "
738 " ] "
739 " } "
740 " ] "
741 " }"));
742 ST_ASTEXT(ST_GEOMFROMGEOJSON(
743 " { \"type\": \"GeometryCollection\", \"geometries\": "
744 " [ "
745 " { \"type\": \"GeometryCollection\", \"geometries\": "
746 " [
747 GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION EMPTY))
748 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
749 " { \"type\": \"GeometryCollection\", \"geometries\": "
750 " [ "
751 " { \"type\": \"LineString\", \"coordinates\": "
752 " [ "
753 " [102.0, 0.0], "
754 " [103.0, 1.0], "
755 " [104.0, 0.0], "
756 " [105.0, 1.0] "
757 " ] "
758 " }, "
759 " { \"type\": \"LineString\", \"coordinates\": "
760 " [ "
761 " [102.0, 0.0], "
762 " [103.0, 1.0], "
763 " [104.0, 0.0], "
764 " [105.0, 1.0] "
765 " ] "
766 " } "
767 " ] "
768 " }"));
769 ST_ASTEXT(ST_GEOMFROMGEOJSON(
770 " { \"type\": \"GeometryCollection\", \"geometries\": "
771 " [ "
772 " { \"type\": \"LineString\", \"coordinates\": "
773 " [
774 GEOMETRYCOLLECTION(LINESTRING(0 102,1 103,0 104,1 105),LINESTRING(0 102,1 103,0 104,1 105))
775 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
776 " { \"type\": \"GeometryCollection\", \"geometries\": "
777 " [ "
778 " { \"type\": \"LineString\", \"coordinates\": "
779 " [ "
780 " [102.0, 0.0], "
781 " [103.0, 1.0], "
782 " [104.0, 0.0], "
783 " [105.0, 1.0] "
784 " ] "
785 " }, "
786 " { \"type\": \"LineString\", \"coordinates\": "
787 " [ "
788 " [102.0, 0.0], "
789 " [103.0, 1.0], "
790 " [104.0, 0.0], "
791 " [105.0, 1.0] "
792 " ] "
793 " }, "
794 " { \"type\": \"Point\", \"coordinates\": "
795 " [102.0, 0.0] "
796 " } "
797 " ] "
798 " }"));
799 ST_ASTEXT(ST_GEOMFROMGEOJSON(
800 " { \"type\": \"GeometryCollection\", \"geometries\": "
801 " [ "
802 " { \"type\": \"LineString\", \"coordinates\": "
803 " [
804 GEOMETRYCOLLECTION(LINESTRING(0 102,1 103,0 104,1 105),LINESTRING(0 102,1 103,0 104,1 105),POINT(0 102))
805 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
806 " { \"type\": \"GeometryCollection\", \"geometries\": "
807 " [ "
808 " { \"type\": \"Point\", \"coordinates\": "
809 " [102.0, 0.5] "
810 " }, "
811 " { \"type\": \"Point\", \"coordinates\": "
812 " [102.0, 0.5] "
813 " }, "
814 " { \"type\": \"GeometryCollection\", \"geometries\": "
815 " [ "
816 " { \"type\": \"Point\", \"coordinates\": "
817 " [102.0, 0.5] "
818 " }, "
819 " { \"type\": \"Point\", \"coordinates\": "
820 " [102.0, 0.5] "
821 " } "
822 " ] "
823 " }, "
824 " { \"type\": \"Point\", \"coordinates\": "
825 " [102.0, 0.5] "
826 " } "
827 " ] "
828 " }"));
829 ST_ASTEXT(ST_GEOMFROMGEOJSON(
830 " { \"type\": \"GeometryCollection\", \"geometries\": "
831 " [ "
832 " { \"type\": \"Point\", \"coordinates\": "
833 " [102.0, 0.5]
834 GEOMETRYCOLLECTION(POINT(0.5 102),POINT(0.5 102),GEOMETRYCOLLECTION(POINT(0.5 102),POINT(0.5 102)),POINT(0.5 102))
835 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
836 " { \"type\": \"GeometryCollection\", \"geometries\": "
837 " [ "
838 " { \"type\": \"MultiPoint\", \"coordinates\": "
839 " [ "
840 " [-105.01, 39.57], "
841 " [-80.66, 35.0] "
842 " ] "
843 " }, "
844 " { \"type\": \"Point\", \"coordinates\": "
845 " [102.0, 0.5] "
846 " }, "
847 " { \"type\": \"Point\", \"coordinates\": "
848 " [102.0, 0.5] "
849 " }, "
850 " { \"type\": \"GeometryCollection\", \"geometries\": "
851 " [ "
852 " { \"type\": \"Point\", \"coordinates\": "
853 " [102.0, 0.5] "
854 " }, "
855 " { \"type\": \"Point\", \"coordinates\": "
856 " [102.0, 0.5] "
857 " } "
858 " ] "
859 " }, "
860 " { \"type\": \"Point\", \"coordinates\": "
861 " [102.0, 0.5] "
862 " } "
863 " ] "
864 " }"));
865 ST_ASTEXT(ST_GEOMFROMGEOJSON(
866 " { \"type\": \"GeometryCollection\", \"geometries\": "
867 " [ "
868 " { \"type\": \"MultiPoint\", \"coordinates\": "
869 " [
870 GEOMETRYCOLLECTION(MULTIPOINT((39.57 -105.01),(35 -80.66)),POINT(0.5 102),POINT(0.5 102),GEOMETRYCOLLECTION(POINT(0.5 102),POINT(0.5 102)),POINT(0.5 102))
871 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
872 " { \"type\": \"GeometryCollection\", \"geometries\": "
873 " [ "
874 " { \"type\": \"Point\", \"coordinates\": "
875 " [-105.01621, 39.57422] "
876 " }, "
877 " { \"type\": \"MultiPoint\", \"coordinates\": "
878 " [ "
879 " [-105.01, 39.57], "
880 " [-80.66, 35.05] "
881 " ] "
882 " }, "
883 " { \"type\": \"LineString\", \"coordinates\": "
884 " [ "
885 " [-101.5, 39.662], "
886 " [-101.75, 39.2415], "
887 " [-101.64, 39.2415] "
888 " ] "
889 " }, "
890 " { \"type\": \"MultiLineString\", \"coordinates\": "
891 " [ "
892 " [ "
893 " [-101.5, 39.662], "
894 " [-101.75, 39.2415], "
895 " [-101.23, 39.2415], "
896 " [-101.749, 39.7984], "
897 " [-101.5, 39.011] "
898 " ], "
899 " [ "
900 " [-99.23, 38.6605], "
901 " [-99.56, 38.727], "
902 " [-99.25, 38.018] "
903 " ], "
904 " [ "
905 " [-98.499, 38.913], "
906 " [-98.499, 38.913], "
907 " [-98.38, 38.15], "
908 " [-97.5, 38.629] "
909 " ] "
910 " ] "
911 " }, "
912 " { \"type\": \"Polygon\", \"coordinates\": "
913 " [ "
914 " [ "
915 " [41.83,71.01], "
916 " [56.95,33.75], "
917 " [21.79,36.56], "
918 " [41.83,71.01] "
919 " ] "
920 " ] "
921 " }, "
922 " { \"type\": \"MultiPolygon\", \"coordinates\": "
923 " [ "
924 " [ "
925 " [ "
926 " [102.0, 2.0], "
927 " [103.0, 2.0], "
928 " [103.0, 3.0], "
929 " [102.0, 3.0], "
930 " [102.0, 2.0] "
931 " ] "
932 " ], "
933 " [ "
934 " [ "
935 " [100.0, 0.0], "
936 " [101.0, 0.0], "
937 " [101.0, 1.0], "
938 " [100.0, 1.0], "
939 " [100.0, 0.0] "
940 " ] "
941 " ] "
942 " ] "
943 " } "
944 " ] "
945 " }"));
946 ST_ASTEXT(ST_GEOMFROMGEOJSON(
947 " { \"type\": \"GeometryCollection\", \"geometries\": "
948 " [ "
949 " { \"type\": \"Point\", \"coordinates\": "
950 " [-105.01621, 39.57422]
951 GEOMETRYCOLLECTION(POINT(39.57422 -105.01621),MULTIPOINT((39.57 -105.01),(35.05 -80.66)),LINESTRING(39.662 -101.5,39.2415 -101.75,39.2415 -101.64),MULTILINESTRING((39.662 -101.5,39.2415 -101.75,39.2415 -101.23,39.7984 -101.749,39.011 -101.5),(38.6605 -99.23,38.727 -99.56,38.018 -99.25),(38.913 -98.499,38.913 -98.499,38.15 -98.38,38.629 -97.5)),POLYGON((71.01 41.83,33.75 56.95,36.56 21.79,71.01 41.83)),MULTIPOLYGON(((2 102,2 103,3 103,3 102,2 102)),((0 100,0 101,1 101,1 100,0 100))))
952 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
953 " { "
954 " \"type\": \"Feature\", \"id\": \"stadium\", \"geometry\": "
955 " { \"type\": \"Point\", \"coordinates\": "
956 " [-104.99404, 39.75621] "
957 " }, "
958 " \"properties\": "
959 " { "
960 " \"name\": \"Coors Field\", "
961 " \"amenity\": \"Baseball Stadium\", "
962 " \"popupContent\": \"This is where the Rockies play!\" "
963 " } "
964 " }"));
965 ST_ASTEXT(ST_GEOMFROMGEOJSON(
966 " { "
967 " \"type\": \"Feature\", \"id\": \"stadium\", \"geometry\": "
968 " { \"type\": \"Point\", \"coordinates\": "
969 " [-104.99404, 39
970 POINT(39.75621 -104.99404)
971 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
972 " { \"type\": \"FeatureCollection\", \"features\": "
973 " [ "
974 " { \"type\": \"Feature\", \"geometry\": "
975 " { \"type\": \"Point\", \"coordinates\": "
976 " [-80.83775386582222, 35.24980190252168] "
977 " }, "
978 " \"properties\": "
979 " { "
980 " \"name\": \"DOUBLE OAKS CENTER\", "
981 " \"address\": \"1326 WOODWARD AV\" "
982 " } "
983 " }, "
984 " { \"type\": \"Feature\", \"geometry\": "
985 " { \"type\": \"Point\", \"coordinates\": "
986 " [-80.83827000459532, 35.25674709224663] "
987 " }, "
988 " \"properties\": "
989 " { "
990 " \"name\": \"DOUBLE OAKS NEIGHBORHOOD PARK\", "
991 " \"address\": \"2605 DOUBLE OAKS RD\" "
992 " } "
993 " } "
994 " ] "
995 " }"));
996 ST_ASTEXT(ST_GEOMFROMGEOJSON(
997 " { \"type\": \"FeatureCollection\", \"features\": "
998 " [ "
999 " { \"type\": \"Feature\", \"geometry\": "
1000 " { \"type\": \"Point\", \"coordinates\":
1001 GEOMETRYCOLLECTION(POINT(35.24980190252168 -80.83775386582222),POINT(35.25674709224663 -80.83827000459532))
1002 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1003 " { \"type\": \"FeatureCollection\", \"features\": "
1004 " [ "
1005 " { \"type\": \"Feature\", \"geometry\": "
1006 " { \"type\": \"Point\", \"coordinates\": "
1007 " [-80.83775386582222, 35.24980190252168] "
1008 " }, "
1009 " \"properties\": "
1010 " { "
1011 " \"name\": \"DOUBLE OAKS CENTER\", "
1012 " \"address\": \"1326 WOODWARD AV\" "
1013 " } "
1014 " }, "
1015 " { \"type\": \"Feature\", \"geometry\": "
1016 " { \"type\": \"Point\", \"coordinates\": "
1017 " [-80.83827000459532, 35.25674709224663] "
1018 " }, "
1019 " \"properties\": "
1020 " { "
1021 " \"name\": \"DOUBLE OAKS NEIGHBORHOOD PARK\", "
1022 " \"address\": \"2605 DOUBLE OAKS RD\" "
1023 " } "
1024 " }, "
1025 " { \"type\": \"Feature\", \"geometry\": "
1026 " null, "
1027 " \"properties\": "
1028 " { "
1029 " \"descr\": \"A NULL/EMPTY POINT\" "
1030 " } "
1031 " }, "
1032 " { \"type\": \"Feature\", \"geometry\": "
1033 " { \"type\": \"Point\", \"coordinates\": "
1034 " [-87.83827000459532, 42.0] "
1035 " }, "
1036 " \"properties\": "
1037 " { "
1038 " \"name\": \"DOUBLE OAKS NEIGHBORHOOD PARK\", "
1039 " \"address\": \"2605 DOUBLE OAKS RD\" "
1040 " } "
1041 " } "
1042 " ] "
1043 " }"));
1044 ST_ASTEXT(ST_GEOMFROMGEOJSON(
1045 " { \"type\": \"FeatureCollection\", \"features\": "
1046 " [ "
1047 " { \"type\": \"Feature\", \"geometry\": "
1048 " { \"type\": \"Point\", \"coordinates\":
1049 GEOMETRYCOLLECTION(POINT(35.24980190252168 -80.83775386582222),POINT(35.25674709224663 -80.83827000459532),POINT(42 -87.83827000459532))
1050 # Checking that E notation is supported.
1051 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1052 "{ \"type\": \"Point\", \"coordinates\": [1.23e3, 2.2e-1]}", 1, 0));
1053 ST_ASTEXT(ST_GEOMFROMGEOJSON(
1054 "{ \"type\": \"Point\", \"coordinates\": [1.23e3, 2.2e-1]}", 1, 0))
1055 POINT(1230 0.22)
1056 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1057 "{ \"type\": \"Point\", \"coordinates\": [1e-300, 1e300]}", 1, 0));
1058 ST_ASTEXT(ST_GEOMFROMGEOJSON(
1059 "{ \"type\": \"Point\", \"coordinates\": [1e-300, 1e300]}", 1, 0))
1060 POINT(1e-300 1e300)
1061 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1062 "{ \"type\": \"Point\", \"coordinates\": [1.7976931348623157E+308, -1.7976931348623157E+308]}", 1, 0));
1063 ST_ASTEXT(ST_GEOMFROMGEOJSON(
1064 "{ \"type\": \"Point\", \"coordinates\": [1.7976931348623157E+308, -1.7976931348623157E+308]}", 1, 0))
1065 POINT(1.7976931348623157e308 -1.7976931348623157e308)
1066 # Checking for NULL arguments and GeoJSON null objects
1067 SELECT ST_GEOMFROMGEOJSON(NULL);
1068 ST_GEOMFROMGEOJSON(NULL)
1069 NULL
1070 SELECT ST_GEOMFROMGEOJSON(NULL, 1);
1071 ST_GEOMFROMGEOJSON(NULL, 1)
1072 NULL
1073 SELECT ST_GEOMFROMGEOJSON("{ \"type\": \"Point\", \"coordinates\": [102.0, 0.0]}",
1074 NULL);
1075 ST_GEOMFROMGEOJSON("{ \"type\": \"Point\", \"coordinates\": [102.0, 0.0]}",
1076 NULL)
1077 NULL
1078 SELECT ST_GEOMFROMGEOJSON(NULL, NULL, NULL);
1079 ST_GEOMFROMGEOJSON(NULL, NULL, NULL)
1080 NULL
1081 SELECT ST_GEOMFROMGEOJSON("{ \"type\": \"Point\", \"coordinates\": [102.0, 0.0]}",
1082 NULL, NULL);
1083 ST_GEOMFROMGEOJSON("{ \"type\": \"Point\", \"coordinates\": [102.0, 0.0]}",
1084 NULL, NULL)
1085 NULL
1086 SELECT ST_GEOMFROMGEOJSON(NULL, 1, NULL);
1087 ST_GEOMFROMGEOJSON(NULL, 1, NULL)
1088 NULL
1089 SELECT ST_GEOMFROMGEOJSON(NULL, NULL, 4326);
1090 ST_GEOMFROMGEOJSON(NULL, NULL, 4326)
1091 NULL
1092 SELECT ST_GEOMFROMGEOJSON("{ \"type\": \"Point\", \"coordinates\": [102.0, 0.0]}",
1093 1, NULL);
1094 ST_GEOMFROMGEOJSON("{ \"type\": \"Point\", \"coordinates\": [102.0, 0.0]}",
1095 1, NULL)
1096 NULL
1097 SELECT ST_GEOMFROMGEOJSON("{ \"type\": \"Point\", \"coordinates\": [102.0, 0.0]}",
1098 NULL, 4326);
1099 ST_GEOMFROMGEOJSON("{ \"type\": \"Point\", \"coordinates\": [102.0, 0.0]}",
1100 NULL, 4326)
1101 NULL
1102 SELECT ST_GEOMFROMGEOJSON(NULL, 1, 4326);
1103 ST_GEOMFROMGEOJSON(NULL, 1, 4326)
1104 NULL
1105 SELECT ST_GEOMFROMGEOJSON(
1106 " { \"type\": \"Feature\", \"geometry\": null, \"properties\": "
1107 " { \"foo\": \"bar\" } "
1108 " }");
1109 ST_GEOMFROMGEOJSON(
1110 " { \"type\": \"Feature\", \"geometry\": null, \"properties\": "
1111 " { \"foo\": \"bar\" } "
1112 " }")
1113 NULL
1114 # Checking for case sensitivity/insensitivity
1115 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1116 " { "
1117 " \"type\": \"Feature\", \"GeOmEtRy\": "
1118 " { \"TYPE\": \"Point\", \"COORDINATES\": "
1119 " [-104.99404, 39.75621] "
1120 " }, "
1121 " \"PrOPERtiES\": "
1122 " { "
1123 " \"name\": \"Coors Field\", "
1124 " \"amenity\": \"Baseball Stadium\", "
1125 " \"popupContent\": \"This is where the Rockies play!\" "
1126 " } "
1127 " }"));
1128 ST_ASTEXT(ST_GEOMFROMGEOJSON(
1129 " { "
1130 " \"type\": \"Feature\", \"GeOmEtRy\": "
1131 " { \"TYPE\": \"Point\", \"COORDINATES\": "
1132 " [-104.99404, 39
1133 POINT(39.75621 -104.99404)
1134 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1135 "{ \"TyPe\": \"Point\", \"cOoRdInAtEs\": [102.0, 0.0]}"));
1136 ST_ASTEXT(ST_GEOMFROMGEOJSON(
1137 "{ \"TyPe\": \"Point\", \"cOoRdInAtEs\": [102.0, 0.0]}"))
1138 POINT(0 102)
1139 SELECT ST_GEOMFROMGEOJSON(
1140 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
1141 " \"CRS\": "
1142 " { \"TYPE\": \"name\", \"PROPERTIES\": "
1143 " { \"NAME\": \"urn:ogc:def:crs:EPSG::1234\" } "
1144 " } "
1145 " }");
1146 ERROR SR001: There's no spatial reference system with SRID 1234.
1147 SELECT ST_SRID(ST_GEOMFROMGEOJSON(
1148 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
1149 " \"crs\": "
1150 " { \"type\": \"name\", \"properties\": "
1151 " { \"name\": \"urn:ogc:def:crs:OGC:1.3:crs84\" } "
1152 " } "
1153 " }", 1));
1154 ST_SRID(ST_GEOMFROMGEOJSON(
1155 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
1156 " \"crs\": "
1157 " { \"type\": \"name\", \"properties\": "
1158 " { \"name\"
1159 4326
1160 SELECT ST_SRID(ST_GEOMFROMGEOJSON(
1161 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
1162 " \"crs\": "
1163 " { \"type\": \"name\", \"properties\": "
1164 " { \"name\": \"urn:ogc:def:crs:OGC:1.3:crs84\" } "
1165 " } "
1166 " }", 1, 10));
1167 ERROR SR001: There's no spatial reference system with SRID 10.
1168 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1169 "{ \"type\": \"point\", \"coordinates\": [102.0, 0.0]}"));
1170 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1171 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1172 "{ \"type\": \"multiPoint\", \"coordinates\": [102.0, 0.0]}"));
1173 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1174 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1175 "{ \"type\": \"Linestring\", \"coordinates\": [102.0, 0.0]}"));
1176 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1177 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1178 "{ \"type\": \"multiLinestring\", \"coordinates\": [102.0, 0.0]}"));
1179 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1180 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1181 "{ \"type\": \"polygon\", \"coordinates\": [102.0, 0.0]}"));
1182 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1183 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1184 "{ \"type\": \"MultiPolyGoN\", \"coordinates\": [102.0, 0.0]}"));
1185 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1186 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1187 "{ \"type\": \"GEOMETRYCOLLECTION\", \"coordinates\": [102.0, 0.0]}"));
1188 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1189 # Checking invalid/incorrect JSON and GeoJSON inputs
1190 SELECT ST_GEOMFROMGEOJSON("");
1191 ERROR 22032: Invalid JSON text in argument 1 to function st_geomfromgeojson: "The document is empty." at position 0.
1192 SELECT ST_GEOMFROMGEOJSON("{}");
1193 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson: Missing required member 'type'
1194 SELECT ST_GEOMFROMGEOJSON("()");
1195 ERROR 22032: Invalid JSON text in argument 1 to function st_geomfromgeojson: "Invalid value." at position 0.
1196 SELECT ST_GEOMFROMGEOJSON("[]");
1197 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1198 SELECT ST_GEOMFROMGEOJSON("NULL");
1199 ERROR 22032: Invalid JSON text in argument 1 to function st_geomfromgeojson: "Invalid value." at position 0.
1200 SELECT ST_GEOMFROMGEOJSON(
1201 "{ "
1202 " \"type\": \"FeatureCollection\", "
1203 " \"features\": [ "
1204 " { "
1205 " \"type\": \"FeatureCollection\", "
1206 " \"features\": [] "
1207 " }, "
1208 " { "
1209 " \"type\": \"Feature\", "
1210 " \"geometry\": { \"type\": \"Point\", \"coordinates\": [10, 10] }, "
1211 " \"properties\": null "
1212 " } "
1213 " ] "
1214 "}");
1215 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1216 SELECT ST_GEOMFROMGEOJSON(CAST(
1217 "{ "
1218 " \"type\": \"FeatureCollection\", "
1219 " \"features\": [ "
1220 " { "
1221 " \"type\": \"FeatureCollection\", "
1222 " \"features\": [] "
1223 " }, "
1224 " { "
1225 " \"type\": \"Feature\", "
1226 " \"geometry\": { \"type\": \"Point\", \"coordinates\": [10, 10] }, "
1227 " \"properties\": null "
1228 " } "
1229 " ] "
1230 "}" AS BINARY));
1231 ERROR HY000: Incorrect type for argument geojson in function st_geomfromgeojson.
1232 SELECT ST_GEOMFROMGEOJSON(CAST(
1233 "{ "
1234 " \"type\": \"FeatureCollection\", "
1235 " \"features\": [ "
1236 " { "
1237 " \"type\": \"FeatureCollection\", "
1238 " \"features\": [] "
1239 " }, "
1240 " { "
1241 " \"type\": \"Feature\", "
1242 " \"geometry\": { \"type\": \"Point\", \"coordinates\": [10, 10] }, "
1243 " \"properties\": null "
1244 " } "
1245 " ] "
1246 "}" AS DATE));
1247 ERROR HY000: Incorrect type for argument geojson in function st_geomfromgeojson.
1248 # Checking correct handling of different coordinate dimensions (option one (default option))
1249 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1250 "{ \"type\": \"Point\", \"coordinates\": [] }"));
1251 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1252 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1253 "{ \"type\": \"Point\", \"coordinates\": [10] }"));
1254 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1255 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1256 "{ \"type\": \"Point\", \"coordinates\": [10, 15] }"));
1257 ST_ASTEXT(ST_GEOMFROMGEOJSON(
1258 "{ \"type\": \"Point\", \"coordinates\": [10, 15] }"))
1259 POINT(15 10)
1260 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1261 "{ \"type\": \"Point\", \"coordinates\": [10, 15, 20] }"));
1262 ERROR HY000: Unsupported number of coordinate dimensions in function st_geomfromgeojson: Found 3, expected 2
1263 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1264 "{ \"type\": \"Point\", \"coordinates\": [10, 15, 20, 25] }"));
1265 ERROR HY000: Unsupported number of coordinate dimensions in function st_geomfromgeojson: Found 4, expected 2
1266 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1267 "{ \"type\": \"Point\", \"coordinates\": [] }", 1));
1268 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1269 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1270 "{ \"type\": \"Point\", \"coordinates\": [10] }", 1));
1271 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1272 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1273 "{ \"type\": \"Point\", \"coordinates\": [10, 15] }", 1));
1274 ST_ASTEXT(ST_GEOMFROMGEOJSON(
1275 "{ \"type\": \"Point\", \"coordinates\": [10, 15] }", 1))
1276 POINT(15 10)
1277 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1278 "{ \"type\": \"Point\", \"coordinates\": [10, 15, 20] }", 1));
1279 ERROR HY000: Unsupported number of coordinate dimensions in function st_geomfromgeojson: Found 3, expected 2
1280 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1281 "{ \"type\": \"Point\", \"coordinates\": [10, 15, 20, 25] }", 1));
1282 ERROR HY000: Unsupported number of coordinate dimensions in function st_geomfromgeojson: Found 4, expected 2
1283 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1284 "{ \"type\": \"Point\", \"coordinates\": [] }", "1"));
1285 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1286 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1287 "{ \"type\": \"Point\", \"coordinates\": [10] }", "1"));
1288 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1289 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1290 "{ \"type\": \"Point\", \"coordinates\": [10, 15] }", "1"));
1291 ST_ASTEXT(ST_GEOMFROMGEOJSON(
1292 "{ \"type\": \"Point\", \"coordinates\": [10, 15] }", "1"))
1293 POINT(15 10)
1294 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1295 "{ \"type\": \"Point\", \"coordinates\": [10, 15, 20] }", "1"));
1296 ERROR HY000: Unsupported number of coordinate dimensions in function st_geomfromgeojson: Found 3, expected 2
1297 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1298 "{ \"type\": \"Point\", \"coordinates\": [10, 15, 20, 25] }", "1"));
1299 ERROR HY000: Unsupported number of coordinate dimensions in function st_geomfromgeojson: Found 4, expected 2
1300 # Checking correct handling of different coordinate dimensions (option two)
1301 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1302 "{ \"type\": \"Point\", \"coordinates\": [] }", 2));
1303 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1304 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1305 "{ \"type\": \"Point\", \"coordinates\": [10] }", 2));
1306 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1307 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1308 "{ \"type\": \"Point\", \"coordinates\": [10, 15] }", 2));
1309 ST_ASTEXT(ST_GEOMFROMGEOJSON(
1310 "{ \"type\": \"Point\", \"coordinates\": [10, 15] }", 2))
1311 POINT(15 10)
1312 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1313 "{ \"type\": \"Point\", \"coordinates\": [10, 15, 20] }", 2));
1314 ST_ASTEXT(ST_GEOMFROMGEOJSON(
1315 "{ \"type\": \"Point\", \"coordinates\": [10, 15, 20] }", 2))
1316 POINT(15 10)
1317 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1318 "{ \"type\": \"Point\", \"coordinates\": [10, 15, 20, 25] }", 2));
1319 ST_ASTEXT(ST_GEOMFROMGEOJSON(
1320 "{ \"type\": \"Point\", \"coordinates\": [10, 15, 20, 25] }", 2))
1321 POINT(15 10)
1322 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1323 "{ \"type\": \"Point\", \"coordinates\": [] }", "2"));
1324 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1325 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1326 "{ \"type\": \"Point\", \"coordinates\": [10] }", "2"));
1327 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1328 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1329 "{ \"type\": \"Point\", \"coordinates\": [10, 15] }", "2"));
1330 ST_ASTEXT(ST_GEOMFROMGEOJSON(
1331 "{ \"type\": \"Point\", \"coordinates\": [10, 15] }", "2"))
1332 POINT(15 10)
1333 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1334 "{ \"type\": \"Point\", \"coordinates\": [10, 15, 20] }", "2"));
1335 ST_ASTEXT(ST_GEOMFROMGEOJSON(
1336 "{ \"type\": \"Point\", \"coordinates\": [10, 15, 20] }", "2"))
1337 POINT(15 10)
1338 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1339 "{ \"type\": \"Point\", \"coordinates\": [10, 15, 20, 25] }", "2"));
1340 ST_ASTEXT(ST_GEOMFROMGEOJSON(
1341 "{ \"type\": \"Point\", \"coordinates\": [10, 15, 20, 25] }", "2"))
1342 POINT(15 10)
1343 # Checking correct handling of different coordinate dimensions (option three)
1344 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1345 "{ \"type\": \"Point\", \"coordinates\": [] }", 3));
1346 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1347 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1348 "{ \"type\": \"Point\", \"coordinates\": [10] }", 3));
1349 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1350 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1351 "{ \"type\": \"Point\", \"coordinates\": [10, 15] }", 3));
1352 ST_ASTEXT(ST_GEOMFROMGEOJSON(
1353 "{ \"type\": \"Point\", \"coordinates\": [10, 15] }", 3))
1354 POINT(15 10)
1355 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1356 "{ \"type\": \"Point\", \"coordinates\": [10, 15, 20] }", 3));
1357 ST_ASTEXT(ST_GEOMFROMGEOJSON(
1358 "{ \"type\": \"Point\", \"coordinates\": [10, 15, 20] }", 3))
1359 POINT(15 10)
1360 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1361 "{ \"type\": \"Point\", \"coordinates\": [10, 15, 20, 25] }", 3));
1362 ST_ASTEXT(ST_GEOMFROMGEOJSON(
1363 "{ \"type\": \"Point\", \"coordinates\": [10, 15, 20, 25] }", 3))
1364 POINT(15 10)
1365 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1366 "{ \"type\": \"Point\", \"coordinates\": [] }", "3"));
1367 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1368 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1369 "{ \"type\": \"Point\", \"coordinates\": [10] }", "3"));
1370 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1371 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1372 "{ \"type\": \"Point\", \"coordinates\": [10, 15] }", "3"));
1373 ST_ASTEXT(ST_GEOMFROMGEOJSON(
1374 "{ \"type\": \"Point\", \"coordinates\": [10, 15] }", "3"))
1375 POINT(15 10)
1376 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1377 "{ \"type\": \"Point\", \"coordinates\": [10, 15, 20] }", "3"));
1378 ST_ASTEXT(ST_GEOMFROMGEOJSON(
1379 "{ \"type\": \"Point\", \"coordinates\": [10, 15, 20] }", "3"))
1380 POINT(15 10)
1381 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1382 "{ \"type\": \"Point\", \"coordinates\": [10, 15, 20, 25] }", "3"));
1383 ST_ASTEXT(ST_GEOMFROMGEOJSON(
1384 "{ \"type\": \"Point\", \"coordinates\": [10, 15, 20, 25] }", "3"))
1385 POINT(15 10)
1386 # Checking correct handling of different coordinate dimensions (option four)
1387 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1388 "{ \"type\": \"Point\", \"coordinates\": [] }", 4));
1389 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1390 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1391 "{ \"type\": \"Point\", \"coordinates\": [10] }", 4));
1392 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1393 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1394 "{ \"type\": \"Point\", \"coordinates\": [10, 15] }", 4));
1395 ST_ASTEXT(ST_GEOMFROMGEOJSON(
1396 "{ \"type\": \"Point\", \"coordinates\": [10, 15] }", 4))
1397 POINT(15 10)
1398 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1399 "{ \"type\": \"Point\", \"coordinates\": [10, 15, 20] }", 4));
1400 ST_ASTEXT(ST_GEOMFROMGEOJSON(
1401 "{ \"type\": \"Point\", \"coordinates\": [10, 15, 20] }", 4))
1402 POINT(15 10)
1403 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1404 "{ \"type\": \"Point\", \"coordinates\": [10, 15, 20, 25] }", 4));
1405 ST_ASTEXT(ST_GEOMFROMGEOJSON(
1406 "{ \"type\": \"Point\", \"coordinates\": [10, 15, 20, 25] }", 4))
1407 POINT(15 10)
1408 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1409 "{ \"type\": \"Point\", \"coordinates\": [] }", "4"));
1410 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1411 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1412 "{ \"type\": \"Point\", \"coordinates\": [10] }", "4"));
1413 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1414 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1415 "{ \"type\": \"Point\", \"coordinates\": [10, 15] }", "4"));
1416 ST_ASTEXT(ST_GEOMFROMGEOJSON(
1417 "{ \"type\": \"Point\", \"coordinates\": [10, 15] }", "4"))
1418 POINT(15 10)
1419 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1420 "{ \"type\": \"Point\", \"coordinates\": [10, 15, 20] }", "4"));
1421 ST_ASTEXT(ST_GEOMFROMGEOJSON(
1422 "{ \"type\": \"Point\", \"coordinates\": [10, 15, 20] }", "4"))
1423 POINT(15 10)
1424 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1425 "{ \"type\": \"Point\", \"coordinates\": [10, 15, 20, 25] }", "4"));
1426 ST_ASTEXT(ST_GEOMFROMGEOJSON(
1427 "{ \"type\": \"Point\", \"coordinates\": [10, 15, 20, 25] }", "4"))
1428 POINT(15 10)
1429 # Checking with valid ST_SRID value
1430 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1431 "{ \"type\": \"Point\", \"coordinates\": [10, 15] }", 1, 0));
1432 ST_ASTEXT(ST_GEOMFROMGEOJSON(
1433 "{ \"type\": \"Point\", \"coordinates\": [10, 15] }", 1, 0))
1434 POINT(10 15)
1435 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1436 "{ \"type\": \"Point\", \"coordinates\": [10, 15, 20] }", 2, 0));
1437 ST_ASTEXT(ST_GEOMFROMGEOJSON(
1438 "{ \"type\": \"Point\", \"coordinates\": [10, 15, 20] }", 2, 0))
1439 POINT(10 15)
1440 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1441 "{ \"type\": \"Point\", \"coordinates\": [10, 15, 20] }", 3, 0));
1442 ST_ASTEXT(ST_GEOMFROMGEOJSON(
1443 "{ \"type\": \"Point\", \"coordinates\": [10, 15, 20] }", 3, 0))
1444 POINT(10 15)
1445 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1446 "{ \"type\": \"Point\", \"coordinates\": [10, 15, 20, 25] }", 4, 0));
1447 ST_ASTEXT(ST_GEOMFROMGEOJSON(
1448 "{ \"type\": \"Point\", \"coordinates\": [10, 15, 20, 25] }", 4, 0))
1449 POINT(10 15)
1450 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1451 "{ \"type\": \"Point\", \"coordinates\": [10, 15] }", 1, "0"));
1452 ST_ASTEXT(ST_GEOMFROMGEOJSON(
1453 "{ \"type\": \"Point\", \"coordinates\": [10, 15] }", 1, "0"))
1454 POINT(10 15)
1455 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1456 "{ \"type\": \"Point\", \"coordinates\": [102.0, 0.0]}", SUM(1), SUM(4326)));
1457 ERROR HY000: Incorrect type for argument SRID in function st_geomfromgeojson.
1458 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1459 "{ \"type\": \"Point\", \"coordinates\": [102.0, 0.0]}", AVG(1), AVG(4326)));
1460 ERROR HY000: Incorrect type for argument SRID in function st_geomfromgeojson.
1461 # Various GeoJSON specification details
1462 SELECT ST_GEOMFROMGEOJSON("{ type: \"Point\", \"coordinates\": [42, 42] }");
1463 ERROR 22032: Invalid JSON text in argument 1 to function st_geomfromgeojson: "Missing a name for object member." at position 2.
1464 SELECT ST_GEOMFROMGEOJSON(
1465 " { \"label\": \"foo\", \"data\": "
1466 " { \"type\": \"Point\", \"coordinates\": "
1467 " [10, 12] "
1468 " } "
1469 " }");
1470 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson: Missing required member 'type'
1471 SELECT ST_GEOMFROMGEOJSON("{ \"type\": Point, \"coordinates\": [10, 10] }");
1472 ERROR 22032: Invalid JSON text in argument 1 to function st_geomfromgeojson: "Invalid value." at position 10.
1473 SELECT ST_GEOMFROMGEOJSON("{ \"type\": [ \"Point\" ], \"coordinates\": [10, 10] }");
1474 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson: Member 'type' must be of type 'string'
1475 SELECT ST_GEOMFROMGEOJSON("{ \"typ\": \"Point\", \"coordinates\": [10, 10] }");
1476 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson: Missing required member 'type'
1477 # Checking "type" member with invalid string
1478 SELECT ST_GEOMFROMGEOJSON("{ \"type\": \"point\", \"coordinates\": [10, 10] }");
1479 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1480 SELECT ST_GEOMFROMGEOJSON("{ \"type\": \"POINT\", \"coordinates\": [10, 10] }");
1481 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1482 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1483 "{ \"type\": \"linestring\", \"coordinates\": "
1484 "[ [102.0, 0.0], [103.0, 1.0], [104.0, 0.0], [105.0, 1.0] ] }"));
1485 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1486 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1487 "{ \"type\": \"LINESTRING\", \"coordinates\": "
1488 "[ [102.0, 0.0], [103.0, 1.0], [104.0, 0.0], [105.0, 1.0] ] }"));
1489 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1490 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1491 " { \"type\": \"polygon\", \"coordinates\": "
1492 " [ "
1493 " [ "
1494 " [41.83, 71.01], "
1495 " [56.95, 33.75], "
1496 " [21.79, 36.56], "
1497 " [41.83, 71.01] "
1498 " ] "
1499 " ] "
1500 " }"));
1501 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1502 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1503 " { \"type\": \"POLYGON\", \"coordinates\": "
1504 " [ "
1505 " [ "
1506 " [41.83, 71.01], "
1507 " [56.95, 33.75], "
1508 " [21.79, 36.56], "
1509 " [41.83, 71.01] "
1510 " ] "
1511 " ] "
1512 " }"));
1513 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1514 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1515 "{ \"type\": \"multipoint\", \"coordinates\": "
1516 "[ [-105.01,39.57],[-80.66,35.0] ] }"));
1517 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1518 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1519 "{ \"type\": \"MULTIPOINT\", \"coordinates\": "
1520 "[ [-105.01,39.57],[-80.66,35.0] ] }"));
1521 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1522 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1523 " { \"type\": \"multilinestring\", \"coordinates\": "
1524 " [ "
1525 " [ "
1526 " [-101.5, 39.662], "
1527 " [-101.75, 39.2415], "
1528 " [-101.23, 39.2415], "
1529 " [-101.749, 39.7984], "
1530 " [-101.5, 39.011] "
1531 " ], "
1532 " [ "
1533 " [-99.23, 38.6605], "
1534 " [-99.56, 38.727], "
1535 " [-99.25, 38.018] "
1536 " ], "
1537 " [ "
1538 " [-98.499, 38.913], "
1539 " [-98.499, 38.913], "
1540 " [-98.38, 38.15], "
1541 " [-97.5, 38.629] "
1542 " ] "
1543 " ] "
1544 " }"));
1545 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1546 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1547 " { \"type\": \"MULTILINESTRING\", \"coordinates\": "
1548 " [ "
1549 " [ "
1550 " [-101.5, 39.662], "
1551 " [-101.75, 39.2415], "
1552 " [-101.23, 39.2415], "
1553 " [-101.749, 39.7984], "
1554 " [-101.5, 39.011] "
1555 " ], "
1556 " [ "
1557 " [-99.23, 38.6605], "
1558 " [-99.56, 38.727], "
1559 " [-99.25, 38.018] "
1560 " ], "
1561 " [ "
1562 " [-98.499, 38.913], "
1563 " [-98.499, 38.913], "
1564 " [-98.38, 38.15], "
1565 " [-97.5, 38.629] "
1566 " ] "
1567 " ] "
1568 " }"));
1569 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1570 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1571 " { \"type\": \"multipolygon\", \"coordinates\": "
1572 " [ "
1573 " [ "
1574 " [ "
1575 " [102.0, 2.0], "
1576 " [103.0, 2.0], "
1577 " [103.0, 3.0], "
1578 " [102.0, 3.0], "
1579 " [102.0, 2.0] "
1580 " ] "
1581 " ], "
1582 " [ "
1583 " [ "
1584 " [100.0, 0.0], "
1585 " [101.0, 0.0], "
1586 " [101.0, 1.0], "
1587 " [100.0, 1.0], "
1588 " [100.0, 0.0] "
1589 " ] "
1590 " ] "
1591 " ] "
1592 " }"));
1593 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1594 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1595 " { \"type\": \"MULTIPOLYGON\", \"coordinates\": "
1596 " [ "
1597 " [ "
1598 " [ "
1599 " [102.0, 2.0], "
1600 " [103.0, 2.0], "
1601 " [103.0, 3.0], "
1602 " [102.0, 3.0], "
1603 " [102.0, 2.0] "
1604 " ] "
1605 " ], "
1606 " [ "
1607 " [ "
1608 " [100.0, 0.0], "
1609 " [101.0, 0.0], "
1610 " [101.0, 1.0], "
1611 " [100.0, 1.0], "
1612 " [100.0, 0.0] "
1613 " ] "
1614 " ] "
1615 " ] "
1616 " }"));
1617 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1618 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1619 " { \"type\": \"geometrycollection\", \"geometries\": "
1620 " [ "
1621 " { \"type\": \"LineString\", \"coordinates\": "
1622 " [ "
1623 " [102.0, 0.0], "
1624 " [103.0, 1.0], "
1625 " [104.0, 0.0], "
1626 " [105.0, 1.0] "
1627 " ] "
1628 " }, "
1629 " { \"type\": \"LineString\", \"coordinates\": "
1630 " [ "
1631 " [102.0, 0.0], "
1632 " [103.0, 1.0], "
1633 " [104.0, 0.0], "
1634 " [105.0, 1.0] "
1635 " ] "
1636 " } "
1637 " ] "
1638 " }"));
1639 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1640 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1641 " { \"type\": \"GEOMETRYCOLLECTION\", \"geometries\": "
1642 " [ "
1643 " { \"type\": \"LineString\", \"coordinates\": "
1644 " [ "
1645 " [102.0, 0.0], "
1646 " [103.0, 1.0], "
1647 " [104.0, 0.0], "
1648 " [105.0, 1.0] "
1649 " ] "
1650 " }, "
1651 " { \"type\": \"LineString\", \"coordinates\": "
1652 " [ "
1653 " [102.0, 0.0], "
1654 " [103.0, 1.0], "
1655 " [104.0, 0.0], "
1656 " [105.0, 1.0] "
1657 " ] "
1658 " } "
1659 " ] "
1660 " }"));
1661 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1662 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1663 " { "
1664 " \"type\": \"feature\", \"id\": \"stadium\", \"geometry\": "
1665 " { \"type\": \"Point\", \"coordinates\": "
1666 " [-104.99404, 39.75621] "
1667 " }, "
1668 " \"properties\": "
1669 " { "
1670 " \"name\": \"Coors Field\", "
1671 " \"amenity\": \"Baseball Stadium\", "
1672 " \"popupContent\": \"This is where the Rockies play!\" "
1673 " } "
1674 " }"));
1675 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1676 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1677 " { "
1678 " \"type\": \"FEATURE\", \"id\": \"stadium\", \"geometry\": "
1679 " { \"type\": \"Point\", \"coordinates\": "
1680 " [-104.99404, 39.75621] "
1681 " }, "
1682 " \"properties\": "
1683 " { "
1684 " \"name\": \"Coors Field\", "
1685 " \"amenity\": \"Baseball Stadium\", "
1686 " \"popupContent\": \"This is where the Rockies play!\" "
1687 " } "
1688 " }"));
1689 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1690 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1691 " { \"type\": \"featurecollection\", \"features\": "
1692 " [ "
1693 " { \"type\": \"Feature\", \"geometry\": "
1694 " { \"type\": \"Point\", \"coordinates\": "
1695 " [-80.83775386582222, 35.24980190252168] "
1696 " }, "
1697 " \"properties\": "
1698 " { "
1699 " \"name\": \"DOUBLE OAKS CENTER\", "
1700 " \"address\": \"1326 WOODWARD AV\" "
1701 " } "
1702 " }, "
1703 " { \"type\": \"Feature\", \"geometry\": "
1704 " { \"type\": \"Point\", \"coordinates\": "
1705 " [-80.83827000459532, 35.25674709224663] "
1706 " }, "
1707 " \"properties\": "
1708 " { "
1709 " \"name\": \"DOUBLE OAKS NEIGHBORHOOD PARK\", "
1710 " \"address\": \"2605 DOUBLE OAKS RD\" "
1711 " } "
1712 " } "
1713 " ] "
1714 " }"));
1715 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1716 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1717 " { \"type\": \"FEATURECOLLECTION\", \"features\": "
1718 " [ "
1719 " { \"type\": \"Feature\", \"geometry\": "
1720 " { \"type\": \"Point\", \"coordinates\": "
1721 " [-80.83775386582222, 35.24980190252168] "
1722 " }, "
1723 " \"properties\": "
1724 " { "
1725 " \"name\": \"DOUBLE OAKS CENTER\", "
1726 " \"address\": \"1326 WOODWARD AV\" "
1727 " } "
1728 " }, "
1729 " { \"type\": \"Feature\", \"geometry\": "
1730 " { \"type\": \"Point\", \"coordinates\": "
1731 " [-80.83827000459532, 35.25674709224663] "
1732 " }, "
1733 " \"properties\": "
1734 " { "
1735 " \"name\": \"DOUBLE OAKS NEIGHBORHOOD PARK\", "
1736 " \"address\": \"2605 DOUBLE OAKS RD\" "
1737 " } "
1738 " } "
1739 " ] "
1740 " }"));
1741 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1742 SELECT ST_GEOMFROMGEOJSON("{ \"type\": \"Feature\", \"coordinates\": [10, 10] }");
1743 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson: Missing required member 'geometry'
1744 SELECT ST_GEOMFROMGEOJSON("{ \"type\": \"FeatureCollection\", \"coordinates\": [10, 10] }");
1745 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson: Missing required member 'features'
1746 SELECT ST_GEOMFROMGEOJSON(
1747 "{ \"type\": \"Point\",\"coordinates\": \"[42, 42]\" }");
1748 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson: Member 'coordinates' must be of type 'array'
1749 SELECT ST_GEOMFROMGEOJSON(
1750 "{ \"type\": \"Point\",\"cordinates\": [42, 42] }");
1751 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson: Missing required member 'coordinates'
1752 SELECT ST_GEOMFROMGEOJSON(
1753 "{ \"type\": \"Point\",\"cordinates\": \"42, 42\" }");
1754 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson: Missing required member 'coordinates'
1755 SELECT ST_GEOMFROMGEOJSON(
1756 " { \"type\": \"GeometryCollection\", \"geometrie\": "
1757 " [ "
1758 " { \"type\": \"Point\", \"coordinates\": "
1759 " [0, 0] "
1760 " } "
1761 " ] "
1762 " }");
1763 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson: Missing required member 'geometries'
1764 SELECT ST_GEOMFROMGEOJSON("{ \"type\": \"GeometryCollection\", \"geometries\": { \"type\": \"Point\", \"coordinates\": [0, 0] } }");
1765 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson: Member 'geometries' must be of type 'array'
1766 SELECT ST_GEOMFROMGEOJSON("{ \"type\": \"Feature\", \"geometry\": { \"type\": \"Point\", \"coordinates\": [0, 0] } }");
1767 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson: Missing required member 'properties'
1768 # Testing CRS Parsing and ST_SRID handling
1769 SELECT ST_SRID(ST_GEOMFROMGEOJSON(
1770 "{ \"type\": \"Point\", \"coordinates\": [10, 20] }"));
1771 ST_SRID(ST_GEOMFROMGEOJSON(
1772 "{ \"type\": \"Point\", \"coordinates\": [10, 20] }"))
1773 4326
1774 SELECT ST_SRID(ST_GEOMFROMGEOJSON(
1775 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
1776 " \"crs\": "
1777 " { \"type\": \"name\", \"properties\": "
1778 " { \"name\": \"urn:ogc:def:crs:EPSG::1234\" } "
1779 " } "
1780 " }"));
1781 ERROR SR001: There's no spatial reference system with SRID 1234.
1782 SELECT ST_SRID(ST_GEOMFROMGEOJSON(
1783 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
1784 " \"crs\": "
1785 " { \"type\": \"name\", \"properties\": "
1786 " { \"name\": \"urn:ogc:def:crs:EPSG::1\" } "
1787 " } "
1788 " }"));
1789 ERROR SR001: There's no spatial reference system with SRID 1.
1790 SELECT ST_SRID(ST_GEOMFROMGEOJSON(
1791 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
1792 " \"crs\": "
1793 " { \"type\": \"name\", \"properties\": "
1794 " { \"name\": \"urn:ogc:def:crs:EPSG::4294967295\" } "
1795 " } "
1796 " }"));
1797 ERROR SR001: There's no spatial reference system with SRID 4294967295.
1798 SELECT ST_SRID(ST_GEOMFROMGEOJSON(
1799 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
1800 " \"crs\": "
1801 " { \"type\": \"name\", \"properties\": "
1802 " { \"name\": \"EPSG:234\" } "
1803 " } "
1804 " }"));
1805 ERROR SR001: There's no spatial reference system with SRID 234.
1806 SELECT ST_SRID(ST_GEOMFROMGEOJSON(
1807 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
1808 " \"crs\": "
1809 " { \"type\": \"name\", \"properties\": "
1810 " { \"name\": \"EPSG:1\" } "
1811 " } "
1812 " }"));
1813 ERROR SR001: There's no spatial reference system with SRID 1.
1814 SELECT ST_SRID(ST_GEOMFROMGEOJSON(
1815 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
1816 " \"crs\": "
1817 " { \"type\": \"name\", \"properties\": "
1818 " { \"name\": \"EPSG:4294967295\" } "
1819 " } "
1820 " }"));
1821 ERROR SR001: There's no spatial reference system with SRID 4294967295.
1822 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1823 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
1824 " \"crs\": null "
1825 " }"));
1826 ST_ASTEXT(ST_GEOMFROMGEOJSON(
1827 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
1828 " \"crs\": null "
1829 " }"))
1830 POINT(20 10)
1831 SELECT ST_GEOMFROMGEOJSON(
1832 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
1833 " \"crs\": "
1834 " { \"type\": \"name\", \"properties\": "
1835 " { \"name\": \"EPSG:4294967296\" } "
1836 " } "
1837 " }");
1838 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1839 SELECT ST_GEOMFROMGEOJSON(
1840 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
1841 " \"crs\": "
1842 " { \"type\": \"name\", \"properties\": "
1843 " { \"name\": \"EPSG:0\" } "
1844 " } "
1845 " }");
1846 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1847 SELECT ST_GEOMFROMGEOJSON(
1848 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
1849 " \"crs\": "
1850 " { \"type\": \"name\", \"properties\": "
1851 " { \"name\": \"EPSG:-1\" } "
1852 " } "
1853 " }");
1854 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1855 SELECT ST_GEOMFROMGEOJSON(
1856 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
1857 " \"crs\": "
1858 " { \"type\": \"name\", \"properties\": "
1859 " { \"name\": \"EPSG:-2147483648\" } "
1860 " } "
1861 " }");
1862 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1863 SELECT ST_GEOMFROMGEOJSON(
1864 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
1865 " \"crs\": "
1866 " { \"type\": \"name\", \"properties\": "
1867 " { \"name\": \"urn:ogc:def:crs:EPSG::0\" } "
1868 " } "
1869 " }");
1870 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1871 SELECT ST_GEOMFROMGEOJSON(
1872 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
1873 " \"crs\": "
1874 " { \"type\": \"name\", \"properties\": "
1875 " { \"name\": \"urn:ogc:def:crs:EPSG::-1\" } "
1876 " } "
1877 " }");
1878 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1879 SELECT ST_GEOMFROMGEOJSON(
1880 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
1881 " \"crs\": "
1882 " { \"type\": \"name\", \"properties\": "
1883 " { \"name\": \"urn:ogc:def:crs:EPSG::-2147483648\" } "
1884 " } "
1885 " }");
1886 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1887 SELECT ST_GEOMFROMGEOJSON(
1888 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
1889 " \"crs\": "
1890 " { \"type\": \"name\", \"properties\": "
1891 " { \"name\": \"urn:ogc:def:crs:EPSG:4326\" } "
1892 " } "
1893 " }");
1894 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1895 SELECT ST_GEOMFROMGEOJSON(
1896 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
1897 " \"crs\": "
1898 " { \"type\": \"name\", \"properties\": "
1899 " { \"name\": \"ogc:def:crs:EPSG::4326\" } "
1900 " } "
1901 " }");
1902 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1903 SELECT ST_GEOMFROMGEOJSON(
1904 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
1905 " \"crs\": "
1906 " { \"type\": \"name\", \"properties\": "
1907 " { \"name\": \"ogc:def:crs:EPSG::\" } "
1908 " } "
1909 " }");
1910 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1911 SELECT ST_GEOMFROMGEOJSON(
1912 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
1913 " \"crs\": "
1914 " { \"type\": \"name\", \"properties\": "
1915 " { \"name\": \"urn:ogc:def:crs:EPSG::\" } "
1916 " } "
1917 " }");
1918 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1919 SELECT ST_GEOMFROMGEOJSON(
1920 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
1921 " \"crs\": "
1922 " { \"type\": \"name\", \"properties\": "
1923 " { \"name\": \"\" } "
1924 " } "
1925 " }");
1926 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1927 SELECT ST_GEOMFROMGEOJSON(
1928 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
1929 " \"crs\": "
1930 " { \"type\": \"name\", \"properties\": "
1931 " { \"name\": \"EPSG=1\" } "
1932 " } "
1933 " }");
1934 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1935 SELECT ST_GEOMFROMGEOJSON(
1936 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
1937 " \"crs\": "
1938 " { \"type\": \"name\", \"properties\": "
1939 " { \"name\": \":1\" } "
1940 " } "
1941 " }");
1942 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1943 SELECT ST_GEOMFROMGEOJSON(
1944 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
1945 " \"crs\": "
1946 " { \"type\": \"name\", \"properties\": "
1947 " { \"name\": \"EPS:1\" } "
1948 " } "
1949 " }");
1950 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1951 SELECT ST_GEOMFROMGEOJSON(
1952 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
1953 " \"crs\": "
1954 " { \"type\": \"link\", \"properties\": "
1955 " { \"href\": \"http://example.com/crs/42\", "
1956 " \"type\": \"proj4\" "
1957 " } "
1958 " } "
1959 " }");
1960 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
1961 SELECT ST_SRID(ST_GEOMFROMGEOJSON(
1962 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
1963 " \"crs\": "
1964 " { \"type\": \"name\", \"properties\": "
1965 " { \"name\": \"EPS:1\" } "
1966 " } "
1967 " } ", 1 , 4326 ));
1968 ST_SRID(ST_GEOMFROMGEOJSON(
1969 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
1970 " \"crs\": "
1971 " { \"type\": \"name\", \"properties\": "
1972 " { \"name\": \"EPS:1\" }
1973 4326
1974 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
1975 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
1976 " \"crs\": "
1977 " { \"type\": \"name\", \"properties\": "
1978 " { \"name\": \"urn:ogc:def:crs:EPSG::1\" } "
1979 " } "
1980 " }", 1, 0));
1981 ST_ASTEXT(ST_GEOMFROMGEOJSON(
1982 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
1983 " \"crs\": "
1984 " { \"type\": \"name\", \"properties\": "
1985 " { \"name\": \"urn
1986 POINT(10 20)
1987 SELECT ST_SRID(ST_GEOMFROMGEOJSON(
1988 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
1989 " \"crs\": "
1990 " { \"type\": \"name\", \"properties\": "
1991 " { \"name\": \"urn:ogc:def:crs:EPSG::0\" } "
1992 " } "
1993 " }", 1, 4326));
1994 ST_SRID(ST_GEOMFROMGEOJSON(
1995 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
1996 " \"crs\": "
1997 " { \"type\": \"name\", \"properties\": "
1998 " { \"name\": \"urn:o
1999 4326
2000 SELECT ST_SRID(ST_GEOMFROMGEOJSON(
2001 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
2002 " \"crs\": "
2003 " { \"type\": \"name\", \"properties\": "
2004 " { \"name\": \"urn:ogc:def:crs:OGC:1.3:CRS100\" } "
2005 " } "
2006 " }", 1));
2007 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2008 SELECT ST_SRID(ST_GEOMFROMGEOJSON(
2009 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
2010 " \"crs\": "
2011 " { \"type\": \"name\", \"properties\": "
2012 " { \"name\": \"urn:ogc:def:crs:OGC:1.30:CRS84\" } "
2013 " } "
2014 " }", 1));
2015 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2016 SELECT ST_SRID(ST_GEOMFROMGEOJSON(
2017 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
2018 " \"crs\": "
2019 " { \"type\": \"name\", \"properties\": "
2020 " { : \"urn:ogc:def:crs:OGC:1.3:CRS84\" } "
2021 " } "
2022 " }", 1));
2023 ERROR 22032: Invalid JSON text in argument 1 to function st_geomfromgeojson: "Missing a name for object member." at position 196.
2024 SELECT ST_SRID(ST_GEOMFROMGEOJSON(
2025 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
2026 " \"crs\": "
2027 " { \"type\": \"name\", \"properties\": "
2028 " { \"name\": { \"urn:ogc:def:crs:OGC:1.3:CRS84\" } } "
2029 " } "
2030 " }", 1));
2031 ERROR 22032: Invalid JSON text in argument 1 to function st_geomfromgeojson: "Missing a colon after a name of object member." at position 238.
2032 SELECT ST_SRID(ST_GEOMFROMGEOJSON(
2033 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
2034 " \"crs\": "
2035 " { \"type\": \"name\": "
2036 " { \"name\": \"urn:ogc:def:crs:OGC:1.3:CRS84\" } "
2037 " } "
2038 " }", 1));
2039 ERROR 22032: Invalid JSON text in argument 1 to function st_geomfromgeojson: "Missing a comma or '}' after an object member." at position 148.
2040 SELECT ST_SRID(ST_GEOMFROMGEOJSON(
2041 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
2042 " \"crs\": "
2043 " { \"type\": \"properties\": "
2044 " { \"name\": \"urn:ogc:def:crs:OGC:1.3:CRS84\" } "
2045 " } "
2046 " }", 1));
2047 ERROR 22032: Invalid JSON text in argument 1 to function st_geomfromgeojson: "Missing a comma or '}' after an object member." at position 154.
2048 SELECT ST_SRID(ST_GEOMFROMGEOJSON(
2049 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
2050 " \"crs\": "
2051 " { \"type\": \"name\", \"properties\": "
2052 " { \"name\": \" \" } "
2053 " } "
2054 " }", 1));
2055 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2056 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
2057 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
2058 " \"crs\": "
2059 " [ "
2060 " { \"type\": \"name\", \"properties\": "
2061 " { \"name\": \"urn:ogc:def:crs:EPSG::1\" } "
2062 " } "
2063 " ] "
2064 " }", 1));
2065 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson: Member 'crs' must be of type 'object'
2066 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
2067 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
2068 " \"crs\": "
2069 " { \"type\": \"name\", \"properties\": "
2070 " { } "
2071 " } "
2072 " }", 1));
2073 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson: Missing required member 'name'
2074 SELECT ST_SRID(ST_GEOMFROMGEOJSON(
2075 " { \"type\": \"GeometryCollection\", \"geometries\": "
2076 " [ "
2077 " { \"type\": \"LineString\", \"coordinates\": "
2078 " [ "
2079 " [102.0, 0.0], "
2080 " [103.0, 1.0], "
2081 " [104.0, 0.0], "
2082 " [105.0, 1.0] "
2083 " ], "
2084 " \"crs\": "
2085 " { \"type\": \"name\", \"properties\": "
2086 " { \"name\": \"urn:ogc:def:crs:EPSG::2000\" } "
2087 " } "
2088 " }, "
2089 " { \"type\": \"LineString\", \"coordinates\": "
2090 " [ "
2091 " [102.0, 0.0], "
2092 " [103.0, 1.0], "
2093 " [104.0, 0.0], "
2094 " [105.0, 1.0] "
2095 " ], "
2096 " \"crs\": "
2097 " { \"type\": \"name\", \"properties\": "
2098 " { \"name\": \"urn:ogc:def:crs:EPSG::4326\" } "
2099 " } "
2100 " } "
2101 " ] "
2102 " }"));
2103 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson: Member 'crs' must be specified in the top level object.
2104 SELECT ST_GEOMFROMGEOJSON(
2105 "{ \"type\": \"Point\", \"coordinates\": [10, 20], \"crs\": { } }");
2106 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson: Missing required member 'type'
2107 SELECT ST_GEOMFROMGEOJSON(
2108 " { \"type\": \"Point\", \"coordinates\": [10, \"20\"] } ");
2109 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson: Member 'array coordinate' must be of type 'number'
2110 SELECT ST_GEOMFROMGEOJSON("", -9223372036854775808);
2111 ERROR HY000: Incorrect option value: '-9223372036854775808' for function st_geomfromgeojson
2112 SELECT ST_GEOMFROMGEOJSON("", 9223372036854775807);
2113 ERROR HY000: Incorrect option value: '9223372036854775807' for function st_geomfromgeojson
2114 SELECT ST_GEOMFROMGEOJSON("", 9223372036854775808);
2115 ERROR HY000: Incorrect option value: '9223372036854775808' for function st_geomfromgeojson
2116 SELECT ST_GEOMFROMGEOJSON("", 1, -9223372036854775808);
2117 ERROR 22003: SRID value is out of range in 'st_geomfromgeojson'
2118 SELECT ST_GEOMFROMGEOJSON("", 1, 9223372036854775807);
2119 ERROR 22003: SRID value is out of range in 'st_geomfromgeojson'
2120 SELECT ST_GEOMFROMGEOJSON("", 1, 9223372036854775808);
2121 ERROR 22003: SRID value is out of range in 'st_geomfromgeojson'
2122 # Checking invalid/incorrect option parameter input
2123 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
2124 "{ \"type\": \"Point\", \"coordinates\": [10, 15] }", 0));
2125 ERROR HY000: Incorrect option value: '0' for function st_geomfromgeojson
2126 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
2127 "{ \"type\": \"Point\", \"coordinates\": [10, 15] }", -10));
2128 ERROR HY000: Incorrect option value: '-10' for function st_geomfromgeojson
2129 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
2130 "{ \"type\": \"Point\", \"coordinates\": [10, 15] }", -1000));
2131 ERROR HY000: Incorrect option value: '-1000' for function st_geomfromgeojson
2132 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
2133 "{ \"type\": \"Point\", \"coordinates\": [10, 15] }", 5));
2134 ERROR HY000: Incorrect option value: '5' for function st_geomfromgeojson
2135 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
2136 "{ \"type\": \"Point\", \"coordinates\": [10, 15] }", 100));
2137 ERROR HY000: Incorrect option value: '100' for function st_geomfromgeojson
2138 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
2139 "{ \"type\": \"Point\", \"coordinates\": [10, 15] }", 10000));
2140 ERROR HY000: Incorrect option value: '10000' for function st_geomfromgeojson
2141 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
2142 "{ \"type\": \"Point\", \"coordinates\": [10, 15] }", "0"));
2143 ERROR HY000: Incorrect option value: '0' for function st_geomfromgeojson
2144 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
2145 "{ \"type\": \"Point\", \"coordinates\": [10, 15] }", "-10"));
2146 ERROR HY000: Incorrect option value: '-10' for function st_geomfromgeojson
2147 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
2148 "{ \"type\": \"Point\", \"coordinates\": [10, 15] }", "-1000"));
2149 ERROR HY000: Incorrect option value: '-1000' for function st_geomfromgeojson
2150 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
2151 "{ \"type\": \"Point\", \"coordinates\": [10, 15] }", "5"));
2152 ERROR HY000: Incorrect option value: '5' for function st_geomfromgeojson
2153 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
2154 "{ \"type\": \"Point\", \"coordinates\": [10, 15] }", "100"));
2155 ERROR HY000: Incorrect option value: '100' for function st_geomfromgeojson
2156 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
2157 "{ \"type\": \"Point\", \"coordinates\": [10, 15] }", "10000"));
2158 ERROR HY000: Incorrect option value: '10000' for function st_geomfromgeojson
2159 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
2160 "{ \"type\": \"Point\", \"coordinates\": [10, 15] }", 1.1));
2161 ERROR HY000: Incorrect type for argument options in function st_geomfromgeojson.
2162 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
2163 "{ \"type\": \"Point\", \"coordinates\": [10, 15] }", (CAST(1 AS DECIMAL))));
2164 ERROR HY000: Incorrect type for argument options in function st_geomfromgeojson.
2165 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
2166 "{ \"type\": \"Point\", \"coordinates\": [10, 15] }", (CAST(1 AS BINARY))));
2167 ERROR HY000: Incorrect type for argument options in function st_geomfromgeojson.
2168 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
2169 "{ \"type\": \"Point\", \"coordinates\": [10, 15] }", a));
2170 ERROR 42S22: Unknown column 'a' in 'field list'
2171 # Checking invalid/incorrect ST_SRID parameter input
2172 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
2173 "{ \"type\": \"Point\", \"coordinates\": [10, 15] }", 1, -1));
2174 ERROR 22003: SRID value is out of range in 'st_geomfromgeojson'
2175 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
2176 "{ \"type\": \"Point\", \"coordinates\": [10, 15] }", 1, -1000));
2177 ERROR 22003: SRID value is out of range in 'st_geomfromgeojson'
2178 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
2179 "{ \"type\": \"Point\", \"coordinates\": [10, 15] }", 1, 4294967296));
2180 ERROR 22003: SRID value is out of range in 'st_geomfromgeojson'
2181 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
2182 "{ \"type\": \"Point\", \"coordinates\": [10, 15] }", 1, 4294967295000));
2183 ERROR 22003: SRID value is out of range in 'st_geomfromgeojson'
2184 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
2185 "{ \"type\": \"Point\", \"coordinates\": [10, 15] }", 1, "-1"));
2186 ERROR 22003: SRID value is out of range in 'st_geomfromgeojson'
2187 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
2188 "{ \"type\": \"Point\", \"coordinates\": [10, 15] }", 1, "-1000"));
2189 ERROR 22003: SRID value is out of range in 'st_geomfromgeojson'
2190 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
2191 "{ \"type\": \"Point\", \"coordinates\": [10, 15] }", 1, "4294967296"));
2192 ERROR 22003: SRID value is out of range in 'st_geomfromgeojson'
2193 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
2194 "{ \"type\": \"Point\", \"coordinates\": [10, 15] }", 1, "4294967295000"));
2195 ERROR 22003: SRID value is out of range in 'st_geomfromgeojson'
2196 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
2197 "{ \"type\": \"Point\", \"coordinates\": [10, 15] }", 1, 1.1));
2198 ERROR HY000: Incorrect type for argument SRID in function st_geomfromgeojson.
2199 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
2200 "{ \"type\": \"Point\", \"coordinates\": [10, 15] }", 1, (CAST(1 AS DECIMAL))));
2201 ERROR HY000: Incorrect type for argument SRID in function st_geomfromgeojson.
2202 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
2203 "{ \"type\": \"Point\", \"coordinates\": [10, 15] }", 1, (CAST(1 AS BINARY))));
2204 ERROR HY000: Incorrect type for argument SRID in function st_geomfromgeojson.
2205 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
2206 "{ \"type\": \"Point\", \"coordinates\": [10, 15] }", 1, a));
2207 ERROR 42S22: Unknown column 'a' in 'field list'
2208 # Invalid function calls
2209 SELECT ST_GEOMFROMGEOJSON("{ \"type\": \"Feature\", \"geometry\": [10, 20] }");
2210 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson: Member 'geometry' must be of type 'object'
2211 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON());
2212 ERROR 42000: Incorrect parameter count in the call to native function 'ST_GEOMFROMGEOJSON'
2213 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
2214 "{ \"type\": \"Point\", \"coordinates\": [10, 15] }", 1, 0, 2));
2215 ERROR 42000: Incorrect parameter count in the call to native function 'ST_GEOMFROMGEOJSON'
2216 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
2217 "{ \"type\":: \"Point\", \"coordinates\": [10, 15] }", 1, 0));
2218 ERROR 22032: Invalid JSON text in argument 1 to function st_geomfromgeojson: "Invalid value." at position 9.
2219 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
2220 "{ \"type\": [ \"Point\" ], \"coordinates\": [10, 15] }", 1, 0));
2221 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson: Member 'type' must be of type 'string'
2222 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
2223 "{ \"type\": }", 1, 0));
2224 ERROR 22032: Invalid JSON text in argument 1 to function st_geomfromgeojson: "Invalid value." at position 11.
2225 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
2226 "{ \"type\": \"Geometry\", \"coordinates\": [10, 15] }", 1, 0));
2227 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2228 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
2229 "{ \"type\": { \"Point\" }, \"coordinates\": [10, 15] }", 1, 0));
2230 ERROR 22032: Invalid JSON text in argument 1 to function st_geomfromgeojson: "Missing a colon after a name of object member." at position 20.
2231 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
2232 "{ \"type\": \"LineString\", \"coordinates\": [[100.0, 0.0, 1.0, 2.0], [101.0, 0.0]] }"));
2233 ERROR HY000: Unsupported number of coordinate dimensions in function st_geomfromgeojson: Found 4, expected 2
2234 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
2235 " { \"type\": \"Polygon\", \"coordinates\": "
2236 " [ "
2237 " [ "
2238 " [100.0, 0.0, 1.0], "
2239 " [101.0, 0.0], "
2240 " [101.0, 1.0], "
2241 " [100.0, 0.0] "
2242 " ] "
2243 " ] "
2244 " }"));
2245 ERROR HY000: Unsupported number of coordinate dimensions in function st_geomfromgeojson: Found 3, expected 2
2246 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
2247 " { "
2248 " \"type\": \"Feature\", \"Point\": "
2249 " { \"type\": \"Point\", \"coordinates\": "
2250 " [-104.99404, 39.75621] "
2251 " }, "
2252 " \"properties\": "
2253 " { "
2254 " \"name\": \"Coors Field\", "
2255 " \"amenity\": \"Baseball Stadium\", "
2256 " \"popupContent\": \"This is where the Rockies play!\" "
2257 " } "
2258 " }"));
2259 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson: Missing required member 'geometry'
2260 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
2261 " { "
2262 " \"type\": \"Feature\", \"name\": , \"geometry\": "
2263 " { \"type\": \"Point\", \"coordinates\": "
2264 " [-104.99404, 39.75621] "
2265 " }, "
2266 " \"properties\": "
2267 " { "
2268 " \"name\": \"Coors Field\", "
2269 " \"amenity\": \"Baseball Stadium\", "
2270 " \"popupContent\": \"This is where the Rockies play!\" "
2271 " } "
2272 " }"));
2273 ERROR 22032: Invalid JSON text in argument 1 to function st_geomfromgeojson: "Invalid value." at position 94.
2274 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
2275 " { "
2276 " \"type\": \"Feature\", \"geometry\": "
2277 " { \"type\": \"Point\", \"coordinates\": "
2278 " [-104.99404, 39.75621] "
2279 " }, "
2280 " \"properties\": "
2281 " { "
2282 " \"name\": \"Coors Field\", \"abc\", "
2283 " \"amenity\": \"Baseball Stadium\", "
2284 " \"popupContent\": \"This is where the Rockies play!\" "
2285 " } "
2286 " }"));
2287 ERROR 22032: Invalid JSON text in argument 1 to function st_geomfromgeojson: "Missing a colon after a name of object member." at position 475.
2288 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
2289 " { "
2290 " \"type\": \"Feature\", \"geometry\": "
2291 " { \"type\": \"Point\", \"coordinates\": "
2292 " [-104.99404, 39.75621] "
2293 " }, "
2294 " \"properties\": "
2295 " { "
2296 " \"name\": \"Coors Field\", "
2297 " \"amenity\": \"Baseball Stadium\", "
2298 " \"type\": \"Point\", \"coordinates\": "
2299 " } "
2300 " }"));
2301 ERROR 22032: Invalid JSON text in argument 1 to function st_geomfromgeojson: "Invalid value." at position 626.
2302 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
2303 " { "
2304 " \"type\": \"Feature\", \"geometry\": "
2305 " { \"type\": \"Point\", \"coordinates\": "
2306 " [-104.99404, 39.75621] "
2307 " }, "
2308 " \"properties\": "
2309 " { "
2310 " \"name\": \"Coors Field\", "
2311 " \"amenity\": \"Baseball Stadium\", "
2312 " { \"type\": \"Point\", \"coordinates\": "
2313 " [-104.99404, 39.75621] "
2314 " }, "
2315 " } "
2316 " }"));
2317 ERROR 22032: Invalid JSON text in argument 1 to function st_geomfromgeojson: "Missing a name for object member." at position 569.
2318 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
2319 " { \"type\": \"Polygon\", \"coordinates\": "
2320 " [ "
2321 " [ "
2322 " [1, 1] "
2323 " ] "
2324 " ] "
2325 " }"));
2326 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2327 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
2328 " { \"type\": \"Polygon\", \"coordinates\": "
2329 " [ "
2330 " [ "
2331 " [1, 1], "
2332 " [2, 2] "
2333 " ] "
2334 " ] "
2335 " }"));
2336 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2337 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
2338 " { \"type\": \"Polygon\", \"coordinates\": "
2339 " [ "
2340 " [ "
2341 " [1, 1], "
2342 " [2, 2], "
2343 " [3, 3] "
2344 " ] "
2345 " ] "
2346 " }"));
2347 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2348 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
2349 " { \"type\": \"Polygon\", \"coordinates\": "
2350 " [ "
2351 " [ "
2352 " [1, 1], "
2353 " [1, 4], "
2354 " [4, 4], "
2355 " [1, 1] "
2356 " ], "
2357 " [ "
2358 " [2, 2] "
2359 " ] "
2360 " ] "
2361 " }"));
2362 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2363 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
2364 " { \"type\": \"Polygon\", \"coordinates\": "
2365 " [ "
2366 " [ "
2367 " [1, 1], "
2368 " [1, 4], "
2369 " [4, 4], "
2370 " [1, 1] "
2371 " ], "
2372 " [ "
2373 " [2, 2], "
2374 " [2, 3] "
2375 " ] "
2376 " ] "
2377 " }"));
2378 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2379 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
2380 " { \"type\": \"Polygon\", \"coordinates\": "
2381 " [ "
2382 " [ "
2383 " [1, 1], "
2384 " [1, 4], "
2385 " [4, 4], "
2386 " [1, 1] "
2387 " ], "
2388 " [ "
2389 " [2, 2], "
2390 " [2, 3], "
2391 " [3, 3] "
2392 " ] "
2393 " ] "
2394 " }"));
2395 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2396 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
2397 " { \"type\": \"Polygon\", \"coordinates\": "
2398 " [ "
2399 " [ "
2400 " [1, 1], "
2401 " 1, "
2402 " [4, 4], "
2403 " [1, 1] "
2404 " ], "
2405 " [ "
2406 " [2, 2], "
2407 " [2, 3], "
2408 " [3, 3] "
2409 " ] "
2410 " ] "
2411 " }"));
2412 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2413 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
2414 " { \"type\": \"Polygon\", \"coordinates\": "
2415 " [ "
2416 " [ "
2417 " [1, 1], "
2418 " [1, 4], "
2419 " [4, 4], "
2420 " [1, 1] "
2421 " ], "
2422 " [ "
2423 " [2, 2], "
2424 " 0, "
2425 " [3, 3] "
2426 " ] "
2427 " ] "
2428 " }"));
2429 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2430 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
2431 " { \"type\": \"Polygon\", \"coordinates\": "
2432 " [ "
2433 " [ "
2434 " [1, 1], "
2435 " [2, 2, 2], "
2436 " [3, 3, 3, 3], "
2437 " [1, 1] "
2438 " ] "
2439 " ] "
2440 " }"));
2441 ERROR HY000: Unsupported number of coordinate dimensions in function st_geomfromgeojson: Found 3, expected 2
2442 SELECT ST_GEOMFROMGEOJSON(
2443 "{ "
2444 " \"type\" : \"firstName\": \"John\" "
2445 "} "
2446 );
2447 ERROR 22032: Invalid JSON text in argument 1 to function st_geomfromgeojson: "Missing a comma or '}' after an object member." at position 61.
2448 PREPARE stmt FROM "SELECT ST_GEOMFROMGEOJSON(?, 0, 0)";
2449 PREPARE stmt FROM "SELECT ST_GEOMFROMGEOJSON('', ?, 0)";
2450 PREPARE stmt FROM "SELECT ST_GEOMFROMGEOJSON('', 0, ?)";
2451 PREPARE stmt FROM "SELECT ST_GEOMFROMGEOJSON(?, ?, 0)";
2452 PREPARE stmt FROM "SELECT ST_GEOMFROMGEOJSON(?, 0, ?)";
2453 PREPARE stmt FROM "SELECT ST_GEOMFROMGEOJSON('', ?, ?)";
2454 PREPARE stmt FROM "SELECT ST_GEOMFROMGEOJSON(?, ?, ?)";
2455 SELECT ST_GEOMFROMGEOJSON("{}foo");
2456 ERROR 22032: Invalid JSON text in argument 1 to function st_geomfromgeojson: "The document root must not be followed by other values." at position 2.
2457 SELECT ST_GEOMFROMGEOJSON("[12 foo 13]");
2458 ERROR 22032: Invalid JSON text in argument 1 to function st_geomfromgeojson: "Missing a comma or ']' after an array element." at position 4.
2459 SELECT ST_GEOMFROMGEOJSON("{ \"type\": nul123 } ");
2460 ERROR 22032: Invalid JSON text in argument 1 to function st_geomfromgeojson: "Invalid value." at position 13.
2461 SELECT ST_GEOMFROMGEOJSON("{ \"true\": true, \"false\": false } ");
2462 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson: Missing required member 'type'
2463 SELECT ST_GEOMFROMGEOJSON("{ \"true\": tru123 } ");
2464 ERROR 22032: Invalid JSON text in argument 1 to function st_geomfromgeojson: "Invalid value." at position 13.
2465 SELECT ST_GEOMFROMGEOJSON("{ \"false\": fals123 } ");
2466 ERROR 22032: Invalid JSON text in argument 1 to function st_geomfromgeojson: "Invalid value." at position 15.
2467 SELECT ST_GEOMFROMGEOJSON("{ \"hex\": \"\\u0Aa\" } ");
2468 ERROR 22032: Invalid JSON text in argument 1 to function st_geomfromgeojson: "Incorrect hex digit after \u escape in string." at position 10.
2469 SELECT ST_GEOMFROMGEOJSON("{ \"hex\": \"\\\\0000b\" } ");
2470 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson: Missing required member 'type'
2471 SELECT ST_GEOMFROMGEOJSON("{ \"hex\": \"\\uD811b\" } ");
2472 ERROR 22032: Invalid JSON text in argument 1 to function st_geomfromgeojson: "The surrogate pair in string is invalid." at position 10.
2473 SELECT ST_GEOMFROMGEOJSON("{ \"hex\": \"\\uD811\\uDB99\" } ");
2474 ERROR 22032: Invalid JSON text in argument 1 to function st_geomfromgeojson: "The surrogate pair in string is invalid." at position 10.
2475 SELECT ST_GEOMFROMGEOJSON("{ \"hex\": \"\\uD811\\uDC01\" } ");
2476 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson: Missing required member 'type'
2477 SELECT ST_GEOMFROMGEOJSON("{ \"hex\": \"\\e000G\" } ");
2478 ERROR 22032: Invalid JSON text in argument 1 to function st_geomfromgeojson: "Invalid escape character in string." at position 10.
2479 SELECT ST_GEOMFROMGEOJSON("{ \"test ");
2480 ERROR 22032: Invalid JSON text in argument 1 to function st_geomfromgeojson: "Missing a closing quotation mark in string." at position 8.
2481 SELECT ST_GEOMFROMGEOJSON("{ \"\nabel\": 123 ");
2482 ERROR 22032: Invalid JSON text in argument 1 to function st_geomfromgeojson: "Invalid encoding in string." at position 3.
2483 SELECT ST_GEOMFROMGEOJSON("[ -2147483651, 4294967395 ] ");
2484 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2485 SELECT ST_GEOMFROMGEOJSON("[ -9223372036854775900, 184467440737095516700] ");
2486 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2487 SELECT ST_GEOMFROMGEOJSON("["
2488 "900000000000000000000000000000000000000000000000000000000000000000000000000000"
2489 "000000000000000000000000000000000000000000000000000000000000000000000000000000"
2490 "000000000000000000000000000000000000000000000000000000000000000000000000000000"
2491 "000000000000000000000000000000000000000000000000000000000000000000000000000"
2492 "]");
2493 ERROR 22032: Invalid JSON text in argument 1 to function st_geomfromgeojson: "Number too big to be stored in double." at position 1.
2494 SELECT ST_GEOMFROMGEOJSON("[ 1. ] ");
2495 ERROR 22032: Invalid JSON text in argument 1 to function st_geomfromgeojson: "Miss fraction part in number." at position 4.
2496 SELECT ST_GEOMFROMGEOJSON("[ 1e1000 ] ");
2497 ERROR 22032: Invalid JSON text in argument 1 to function st_geomfromgeojson: "Number too big to be stored in double." at position 2.
2498 SELECT ST_GEOMFROMGEOJSON("[ 1e ] ");
2499 ERROR 22032: Invalid JSON text in argument 1 to function st_geomfromgeojson: "Miss exponent in number." at position 4.
2500 SELECT ST_GEOMFROMGEOJSON("[ -92233720368547759, 1844674407370955167] ");
2501 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2502 SELECT ST_GEOMFROMGEOJSON("[ -214748365, 429496739 ] ");
2503 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2504 SELECT ST_GEOMFROMGEOJSON("[ -0 ]");
2505 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2506 SELECT ST_GEOMFROMGEOJSON("{ \"\\u0000\" }");
2507 ERROR 22032: Invalid JSON text in argument 1 to function st_geomfromgeojson: "Missing a colon after a name of object member." at position 11.
2508 SELECT ST_GEOMFROMGEOJSON("{ \"\\u06FF\" }");
2509 ERROR 22032: Invalid JSON text in argument 1 to function st_geomfromgeojson: "Missing a colon after a name of object member." at position 11.
2510 SELECT ST_GEOMFROMGEOJSON("{ \"\\uFFFF\" }");
2511 ERROR 22032: Invalid JSON text in argument 1 to function st_geomfromgeojson: "Missing a colon after a name of object member." at position 11.
2512 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON("{ \"type\": \"Point\", \"coordinates\": [4294967295, 9223372036854775807] }", 1, 0));
2513 ST_ASTEXT(ST_GEOMFROMGEOJSON("{ \"type\": \"Point\", \"coordinates\": [4294967295, 9223372036854775807] }", 1, 0))
2514 POINT(4294967295 9.223372036854776e18)
2515 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON("{ \"type\": \"Point\", \"coordinates\": [18446744073709551615, 9223372036854775807] }", 1, 0));
2516 ST_ASTEXT(ST_GEOMFROMGEOJSON("{ \"type\": \"Point\", \"coordinates\": [18446744073709551615, 9223372036854775807] }", 1, 0))
2517 POINT(1.8446744073709552e19 9.223372036854776e18)
2518 SELECT ST_AsGeoJSON(ST_GeomFromGeoJSON('{"type":"Point","coordinates":[2e308,-0]}'));
2519 ERROR 22032: Invalid JSON text in argument 1 to function st_geomfromgeojson: "Number too big to be stored in double." at position 31.
2520 # Checking that Point with wrong coordinate array depth are invalidated.
2521 SELECT ST_GEOMFROMGEOJSON(
2522 "{ "
2523 " \"type\": \"Point\", "
2524 " \"coordinates\": [ ] "
2525 "} "
2526 );
2527 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2528 SELECT ST_GEOMFROMGEOJSON(
2529 "{ "
2530 " \"type\": \"Point\", "
2531 " \"coordinates\": [ [ 1, 2 ] ] "
2532 "} "
2533 );
2534 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2535 SELECT ST_GEOMFROMGEOJSON(
2536 "{ "
2537 " \"type\": \"Point\", "
2538 " \"coordinates\": [ [ ] ] "
2539 "} "
2540 );
2541 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2542 SELECT ST_GEOMFROMGEOJSON(
2543 "{ "
2544 " \"type\": \"Point\", "
2545 " \"coordinates\": [ [ [ ] ] ] "
2546 "} "
2547 );
2548 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2549 # Checking that LineString with wrong coordinate
2550 # array depth are invalidated.
2551 SELECT ST_GEOMFROMGEOJSON(
2552 "{ "
2553 " \"type\": \"LineString\", "
2554 " \"coordinates\": [ ] "
2555 "} "
2556 );
2557 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2558 SELECT ST_GEOMFROMGEOJSON(
2559 "{ "
2560 " \"type\": \"LineString\", "
2561 " \"coordinates\": [ [ ] ] "
2562 "} "
2563 );
2564 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2565 SELECT ST_GEOMFROMGEOJSON(
2566 "{ "
2567 " \"type\": \"LineString\", "
2568 " \"coordinates\": [ 101.0, 1.0 ] "
2569 "} "
2570 );
2571 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2572 SELECT ST_GEOMFROMGEOJSON(
2573 "{ "
2574 " \"type\": \"LineString\", "
2575 " \"coordinates\": [ [ [ 101.0, 1.0 ] ] ] "
2576 "} "
2577 );
2578 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2579 # Checking that Polygon with wrong coordinate
2580 # array depth are invalidated.
2581 SELECT ST_GEOMFROMGEOJSON(
2582 "{ "
2583 " \"type\": \"Polygon\", "
2584 " \"coordinates\": [ ] "
2585 "} "
2586 );
2587 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2588 SELECT ST_GEOMFROMGEOJSON(
2589 "{ "
2590 " \"type\": \"Polygon\", "
2591 " \"coordinates\": [ [ ] ] "
2592 "} "
2593 );
2594 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2595 SELECT ST_GEOMFROMGEOJSON(
2596 "{ "
2597 " \"type\": \"Polygon\", "
2598 " \"coordinates\": [ [ [ ] ] ] "
2599 "} "
2600 );
2601 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2602 SELECT ST_GEOMFROMGEOJSON(
2603 "{ "
2604 " \"type\": \"Polygon\", "
2605 " \"coordinates\": [ [ [ [ ] ] ] ] "
2606 "} "
2607 );
2608 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2609 SELECT ST_GEOMFROMGEOJSON(
2610 "{ "
2611 " \"type\": \"Polygon\", "
2612 " \"coordinates\": [ 100.0, 0.0 ] "
2613 "} "
2614 );
2615 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2616 SELECT ST_GEOMFROMGEOJSON(
2617 "{ "
2618 " \"type\": \"Polygon\", "
2619 " \"coordinates\": [ [ 100.0, 0.0 ] ] "
2620 "} "
2621 );
2622 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2623 SELECT ST_GEOMFROMGEOJSON(
2624 "{ "
2625 " \"type\": \"Polygon\", "
2626 " \"coordinates\": [ [ [ [ 100.0, 0.0 ] ] ] ] "
2627 "} "
2628 );
2629 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2630 SELECT ST_GEOMFROMGEOJSON(
2631 "{ "
2632 " \"type\": \"Polygon\", "
2633 " \"coordinates\": [ [ [ [ ] ] ] ] "
2634 "} "
2635 );
2636 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2637 # Checking that Polygon rings with less than four points are invalidated.
2638 SELECT ST_GEOMFROMGEOJSON(
2639 "{ "
2640 " \"type\": \"Polygon\", "
2641 " \"coordinates\": [ [ [ 100.0, 0.0 ] ] ] "
2642 "} "
2643 );
2644 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2645 SELECT ST_GEOMFROMGEOJSON(
2646 "{ "
2647 " \"type\": \"Polygon\", "
2648 " \"coordinates\": "
2649 " [ [ "
2650 " [ 100.0, 0.0 ], "
2651 " [ 100.0, 0.0 ] "
2652 " ] ] "
2653 "} "
2654 );
2655 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2656 SELECT ST_GEOMFROMGEOJSON(
2657 "{ "
2658 " \"type\": \"Polygon\", "
2659 " \"coordinates\": "
2660 " [ [ "
2661 " [ 100.0, 0.0 ], "
2662 " [ 100.0, 0.0 ], "
2663 " [ 100.0, 0.0 ] "
2664 " ] ] "
2665 "} "
2666 );
2667 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2668 # Checking that Polygons with unclosed rings are invalidated.
2669 SELECT ST_GEOMFROMGEOJSON(
2670 "{ "
2671 " \"type\": \"Polygon\", "
2672 " \"coordinates\": "
2673 " [ [ "
2674 " [ 100.0, 0.0 ], "
2675 " [ 101.0, 0.0 ], "
2676 " [ 102.0, 0.0 ], "
2677 " [ 100.1, 0.0 ] "
2678 " ] ] "
2679 "} "
2680 );
2681 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2682 SELECT ST_GEOMFROMGEOJSON(
2683 "{ "
2684 " \"type\": \"Polygon\", "
2685 " \"coordinates\": "
2686 " [ [ "
2687 " [ 100.0, 0.0 ], "
2688 " [ 101.0, 0.0 ], "
2689 " [ 102.0, 0.0 ], "
2690 " [ 100.0, 0.1 ] "
2691 " ] ] "
2692 "} "
2693 );
2694 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2695 SELECT ST_GEOMFROMGEOJSON(
2696 "{ "
2697 " \"type\": \"Polygon\", "
2698 " \"coordinates\": "
2699 " [ "
2700 " [ "
2701 " [ 100.0, 0.0 ], "
2702 " [ 101.0, 0.0 ], "
2703 " [ 102.0, 0.0 ], "
2704 " [ 100.0, 0.0 ] "
2705 " ], "
2706 " [ "
2707 " [ 10.0, 2.0 ], "
2708 " [ 11.0, 2.2 ], "
2709 " [ 12.0, 2.3 ], "
2710 " [ 10.0, 2.1 ] "
2711 " ] "
2712 " ] "
2713 "} "
2714 );
2715 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2716 SELECT ST_GEOMFROMGEOJSON(
2717 "{ "
2718 " \"type\": \"Polygon\", "
2719 " \"coordinates\": "
2720 " [ "
2721 " [ "
2722 " [ 100.0, 0.0 ], "
2723 " [ 101.0, 0.0 ], "
2724 " [ 102.0, 0.0 ], "
2725 " [ 100.0, 0.0 ] "
2726 " ], "
2727 " [ "
2728 " [ 10.0, 2.0 ], "
2729 " [ 11.0, 2.2 ], "
2730 " [ 12.0, 2.3 ], "
2731 " [ 10.1, 2.0 ] "
2732 " ] "
2733 " ] "
2734 "} "
2735 );
2736 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2737 # Checking that MultiPoint with wrong coordinate
2738 # array depth are invalidated.
2739 SELECT ST_GEOMFROMGEOJSON(
2740 "{ "
2741 " \"type\": \"MultiPoint\", "
2742 " \"coordinates\": [ ] "
2743 "} "
2744 );
2745 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2746 SELECT ST_GEOMFROMGEOJSON(
2747 "{ "
2748 " \"type\": \"MultiPoint\", "
2749 " \"coordinates\": [ [ ] ] "
2750 "} "
2751 );
2752 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2753 SELECT ST_GEOMFROMGEOJSON(
2754 "{ "
2755 " \"type\": \"MultiPoint\", "
2756 " \"coordinates\": [ [ [ ] ] ] "
2757 "} "
2758 );
2759 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2760 SELECT ST_GEOMFROMGEOJSON(
2761 "{ "
2762 " \"type\": \"MultiPoint\", "
2763 " \"coordinates\": [ 100.0, 0.0 ] "
2764 "} "
2765 );
2766 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2767 SELECT ST_GEOMFROMGEOJSON(
2768 "{ "
2769 " \"type\": \"MultiPoint\", "
2770 " \"coordinates\": [ [ [ 100.0, 0.0 ] ] ] "
2771 "} "
2772 );
2773 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2774 # Checking that MultiLineString with wrong coordinate
2775 # array depth are invalidated.
2776 SELECT ST_GEOMFROMGEOJSON(
2777 "{ "
2778 " \"type\": \"MultiLineString\", "
2779 " \"coordinates\": [ ] "
2780 "} "
2781 );
2782 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2783 SELECT ST_GEOMFROMGEOJSON(
2784 "{ "
2785 " \"type\": \"MultiLineString\", "
2786 " \"coordinates\": [ [ ] ] "
2787 "} "
2788 );
2789 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2790 SELECT ST_GEOMFROMGEOJSON(
2791 "{ "
2792 " \"type\": \"MultiLineString\", "
2793 " \"coordinates\": [ [ [ ] ] ] "
2794 "} "
2795 );
2796 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2797 SELECT ST_GEOMFROMGEOJSON(
2798 "{ "
2799 " \"type\": \"MultiLineString\", "
2800 " \"coordinates\": [ [ [ [ ] ] ] ] "
2801 "} "
2802 );
2803 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2804 SELECT ST_GEOMFROMGEOJSON(
2805 "{ "
2806 " \"type\": \"MultiLineString\", "
2807 " \"coordinates\": [ 100.0, 0.0 ] "
2808 "} "
2809 );
2810 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2811 SELECT ST_GEOMFROMGEOJSON(
2812 "{ "
2813 " \"type\": \"MultiLineString\", "
2814 " \"coordinates\": [ [ 100.0, 0.0 ] ] "
2815 "} "
2816 );
2817 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2818 SELECT ST_GEOMFROMGEOJSON(
2819 "{ "
2820 " \"type\": \"MultiLineString\", "
2821 " \"coordinates\": [ [ [ [ 100.0, 0.0 ] ] ] ] "
2822 "} "
2823 );
2824 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2825 # Checking that MultiPolygon with wrong coordinate
2826 # array depth are invalidated.
2827 SELECT ST_GEOMFROMGEOJSON(
2828 "{ "
2829 " \"type\": \"MultiPolygon\", "
2830 " \"coordinates\": [ ] "
2831 "} "
2832 );
2833 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2834 SELECT ST_GEOMFROMGEOJSON(
2835 "{ "
2836 " \"type\": \"MultiPolygon\", "
2837 " \"coordinates\": [ [ ] ] "
2838 "} "
2839 );
2840 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2841 SELECT ST_GEOMFROMGEOJSON(
2842 "{ "
2843 " \"type\": \"MultiPolygon\", "
2844 " \"coordinates\": [ [ [ ] ] ] "
2845 "} "
2846 );
2847 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2848 SELECT ST_GEOMFROMGEOJSON(
2849 "{ "
2850 " \"type\": \"MultiPolygon\", "
2851 " \"coordinates\": [ [ [ [ ] ] ] ] "
2852 "} "
2853 );
2854 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2855 SELECT ST_GEOMFROMGEOJSON(
2856 "{ "
2857 " \"type\": \"MultiPolygon\", "
2858 " \"coordinates\": [ 102.0, 2.0 ] "
2859 "} "
2860 );
2861 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2862 SELECT ST_GEOMFROMGEOJSON(
2863 "{ "
2864 " \"type\": \"MultiPolygon\", "
2865 " \"coordinates\": "
2866 " [ "
2867 " [ 102.0, 2.0 ], "
2868 " [ 103.0, 2.0 ], "
2869 " [ 103.0, 3.0 ], "
2870 " [ 102.0, 3.0 ], "
2871 " [ 102.0, 2.0 ], "
2872 " [ 100.0, 0.0 ], "
2873 " [ 101.0, 0.0 ], "
2874 " [ 101.0, 1.0 ], "
2875 " [ 100.0, 1.0 ], "
2876 " [ 100.0, 0.0 ] "
2877 " ] "
2878 "} "
2879 );
2880 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2881 SELECT ST_GEOMFROMGEOJSON(
2882 "{ "
2883 " \"type\": \"MultiPolygon\", "
2884 " \"coordinates\": "
2885 " [ "
2886 " [ "
2887 " [ 102.0, 2.0 ], "
2888 " [ 103.0, 2.0 ], "
2889 " [ 103.0, 3.0 ], "
2890 " [ 102.0, 3.0 ], "
2891 " [ 102.0, 2.0 ] "
2892 " ], "
2893 " [ "
2894 " [ 100.0, 0.0 ], "
2895 " [ 101.0, 0.0 ], "
2896 " [ 101.0, 1.0 ], "
2897 " [ 100.0, 1.0 ], "
2898 " [ 100.0, 0.0 ] "
2899 " ] "
2900 " ] "
2901 "} "
2902 );
2903 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2904 SELECT ST_GEOMFROMGEOJSON(
2905 "{ "
2906 " \"type\": \"MultiPolygon\", "
2907 " \"coordinates\": "
2908 " [ "
2909 " [ "
2910 " [ "
2911 " [ "
2912 " [ 102.0, 2.0 ], "
2913 " [ 103.0, 2.0 ], "
2914 " [ 103.0, 3.0 ], "
2915 " [ 102.0, 3.0 ], "
2916 " [ 102.0, 2.0 ] "
2917 " ] "
2918 " ] "
2919 " ], "
2920 " [ "
2921 " [ 100.0, 0.0 ], "
2922 " [ 101.0, 0.0 ], "
2923 " [ 101.0, 1.0 ], "
2924 " [ 100.0, 1.0 ], "
2925 " [ 100.0, 0.0 ] "
2926 " ] "
2927 " ] "
2928 "} "
2929 );
2930 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2931 # Checking that MultiPolygon rings with less than four points
2932 # are invalidated.
2933 SELECT ST_GEOMFROMGEOJSON(
2934 "{ "
2935 " \"type\": \"MultiPolygon\", "
2936 " \"coordinates\": [ [ [ [ 102.0, 2.0 ] ] ] ] "
2937 "} "
2938 );
2939 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2940 SELECT ST_GEOMFROMGEOJSON(
2941 "{ "
2942 " \"type\": \"MultiPolygon\", "
2943 " \"coordinates\": "
2944 " [ "
2945 " [ "
2946 " [ "
2947 " [ 103.0, 3.0 ], "
2948 " [ 102.0, 2.0 ] "
2949 " ] "
2950 " ] "
2951 " ] "
2952 "} "
2953 );
2954 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2955 SELECT ST_GEOMFROMGEOJSON(
2956 "{ "
2957 " \"type\": \"MultiPolygon\", "
2958 " \"coordinates\": "
2959 " [ "
2960 " [ "
2961 " [ "
2962 " [ 102.0, 2.0 ], "
2963 " [ 103.0, 3.0 ], "
2964 " [ 102.0, 2.0 ] "
2965 " ] "
2966 " ] "
2967 " ] "
2968 "} "
2969 );
2970 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2971 # Checking that MultiPolygon with unclosed rings are invalidated.
2972 SELECT ST_GEOMFROMGEOJSON(
2973 "{ "
2974 " \"type\": \"MultiPolygon\", "
2975 " \"coordinates\": "
2976 " [ "
2977 " [ "
2978 " [ "
2979 " [ 102.0, 2.0 ], "
2980 " [ 103.0, 2.0 ], "
2981 " [ 103.0, 3.0 ], "
2982 " [ 102.1, 2.0 ] "
2983 " ] "
2984 " ] "
2985 " ] "
2986 "} "
2987 );
2988 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
2989 SELECT ST_GEOMFROMGEOJSON(
2990 "{ "
2991 " \"type\": \"MultiPolygon\", "
2992 " \"coordinates\": "
2993 " [ "
2994 " [ "
2995 " [ "
2996 " [ 102.0, 2.0 ], "
2997 " [ 103.0, 2.0 ], "
2998 " [ 103.0, 3.0 ], "
2999 " [ 102.0, 2.1 ] "
3000 " ] "
3001 " ] "
3002 " ] "
3003 "} "
3004 );
3005 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
3006 # Checking that GeometryCollection with non-objects in array
3007 # are invalidated.
3008 SELECT ST_GEOMFROMGEOJSON(
3009 "{ "
3010 " \"type\": \"GeometryCollection\", "
3011 " \"geometries\": [ [ ] ] "
3012 "} "
3013 );
3014 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson: Member 'geometries' must be of type 'object array'
3015 SELECT ST_GEOMFROMGEOJSON(
3016 "{ "
3017 " \"type\": \"GeometryCollection\", "
3018 " \"geometries\": [10, 20] "
3019 "} "
3020 );
3021 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson: Member 'geometries' must be of type 'object array'
3022 SELECT ST_GEOMFROMGEOJSON(
3023 "{ "
3024 " \"type\": \"GeometryCollection\", "
3025 " \"geometries\": [\"foo\", \"bar\"] "
3026 "} "
3027 );
3028 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson: Member 'geometries' must be of type 'object array'
3029 SELECT ST_GEOMFROMGEOJSON(
3030 "{ "
3031 " \"type\": \"GeometryCollection\", "
3032 " \"geometries\": [ foo ] "
3033 "} "
3034 );
3035 ERROR 22032: Invalid JSON text in argument 1 to function st_geomfromgeojson: "Invalid value." at position 89.
3036 SELECT ST_GEOMFROMGEOJSON(
3037 "{ "
3038 " \"type\": \"GeometryCollection\", "
3039 " \"geometries\": [ null ] "
3040 "} "
3041 );
3042 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson: Member 'geometries' must be of type 'object array'
3043 SELECT ST_GEOMFROMGEOJSON(
3044 "{ "
3045 " \"type\": \"GeometryCollection\", "
3046 " \"geometries\": "
3047 " [ "
3048 " { \"type\": \"Point\", \"coordinates\": [1, 2] }, "
3049 " [ ] "
3050 " ] "
3051 "} "
3052 );
3053 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson: Member 'geometries' must be of type 'object array'
3054 # Nested GeoJSON functions
3055 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 11)"), 5, 0)));
3056 ST_ASTEXT(ST_GEOMFROMGEOJSON(ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(10 11)"), 5, 0)))
3057 POINT(11 10)
3058 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(-10 -11)"), 5, 1)));
3059 ST_ASTEXT(ST_GEOMFROMGEOJSON(ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(-10 -11)"), 5, 1)))
3060 POINT(-11 -10)
3061 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(1.7976931348623157E+308 1.7976931348623157E+308)"), 100, 2), 1, 0));
3062 ST_ASTEXT(ST_GEOMFROMGEOJSON(ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(1.7976931348623157E+308 1.7976931348623157E+308)"), 100, 2), 1, 0))
3063 POINT(1.7976931348623157e308 1.7976931348623157e308)
3064 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(1.7976931348623157E-308 1.7976931348623157E-308)"), 100, 3), 1, 0));
3065 ST_ASTEXT(ST_GEOMFROMGEOJSON(ST_ASGEOJSON(ST_GEOMFROMTEXT("POINT(1.7976931348623157E-308 1.7976931348623157E-308)"), 100, 3), 1, 0))
3066 POINT(0 0)
3067 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(ST_ASGEOJSON(ST_GEOMFROMTEXT("LINESTRING(30 10, 10 30, 40 40)"), 10, 4)));
3068 ST_ASTEXT(ST_GEOMFROMGEOJSON(ST_ASGEOJSON(ST_GEOMFROMTEXT("LINESTRING(30 10, 10 30, 40 40)"), 10, 4)))
3069 LINESTRING(10 30,30 10,40 40)
3070 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(ST_ASGEOJSON(ST_GEOMFROMTEXT("LINESTRING(0 0, 0 10, 10 10, 10 0)"), 10, 5)));
3071 ST_ASTEXT(ST_GEOMFROMGEOJSON(ST_ASGEOJSON(ST_GEOMFROMTEXT("LINESTRING(0 0, 0 10, 10 10, 10 0)"), 10, 5)))
3072 LINESTRING(0 0,10 0,10 10,0 10)
3073 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(ST_ASGEOJSON(ST_GEOMFROMTEXT("POLYGON((30 10, 40 40, 20 40, 10 20,30 10))"), 20, 6)));
3074 ST_ASTEXT(ST_GEOMFROMGEOJSON(ST_ASGEOJSON(ST_GEOMFROMTEXT("POLYGON((30 10, 40 40, 20 40, 10 20,30 10))"), 20, 6)))
3075 POLYGON((10 30,40 40,40 20,20 10,10 30))
3076 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(ST_ASGEOJSON(ST_GEOMFROMTEXT("POLYGON((35 10, 45 45, 15 40, 10 20, 35 10),"
3077 "(20 30, 35 35, 30 20,20 30))"), 20, 7)));
3078 ST_ASTEXT(ST_GEOMFROMGEOJSON(ST_ASGEOJSON(ST_GEOMFROMTEXT("POLYGON((35 10, 45 45, 15 40, 10 20, 35 10),"
3079 "(20 30, 35 35, 30 20,20 30))"), 20, 7)))
3080 POLYGON((10 35,45 45,40 15,20 10,10 35),(30 20,35 35,20 30,30 20))
3081 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(ST_ASGEOJSON(ST_GEOMFROMTEXT("MULTIPOINT(10 40, 40 30, 20 20, 30 10)"))));
3082 ST_ASTEXT(ST_GEOMFROMGEOJSON(ST_ASGEOJSON(ST_GEOMFROMTEXT("MULTIPOINT(10 40, 40 30, 20 20, 30 10)"))))
3083 MULTIPOINT((40 10),(30 40),(20 20),(10 30))
3084 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(ST_ASGEOJSON(ST_GEOMFROMTEXT("MULTIPOINT(0 0, 10 10, 20 20, 30 30, 40 40)"))));
3085 ST_ASTEXT(ST_GEOMFROMGEOJSON(ST_ASGEOJSON(ST_GEOMFROMTEXT("MULTIPOINT(0 0, 10 10, 20 20, 30 30, 40 40)"))))
3086 MULTIPOINT((0 0),(10 10),(20 20),(30 30),(40 40))
3087 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(ST_ASGEOJSON(ST_GEOMFROMTEXT("MULTILINESTRING((10 10, 20 20, 10 40),"
3088 "(40 40, 30 30, 40 20, 30 10))"))));
3089 ST_ASTEXT(ST_GEOMFROMGEOJSON(ST_ASGEOJSON(ST_GEOMFROMTEXT("MULTILINESTRING((10 10, 20 20, 10 40),"
3090 "(40 40, 30 30, 40 20, 30 10))"))))
3091 MULTILINESTRING((10 10,20 20,40 10),(40 40,30 30,20 40,10 30))
3092 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(ST_ASGEOJSON(ST_GEOMFROMTEXT("MULTILINESTRING((10 10, 20 20, 10 40),"
3093 "(40 40, 30 30, 40 20, 30 10),"
3094 "(10 10, 20 20, 50 50, 100 100))")), 1, 0));
3095 ST_ASTEXT(ST_GEOMFROMGEOJSON(ST_ASGEOJSON(ST_GEOMFROMTEXT("MULTILINESTRING((10 10, 20 20, 10 40),"
3096 "(40 40, 30 30, 40 20, 30 10),"
3097 "(10 10, 20 20, 50 50, 100 100))")), 1, 0))
3098 MULTILINESTRING((10 10,20 20,10 40),(40 40,30 30,40 20,30 10),(10 10,20 20,50 50,100 100))
3099 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(ST_ASGEOJSON(ST_GEOMFROMTEXT("MULTIPOLYGON(((40 40, 20 45, 45 30, 40 40)),"
3100 "((20 35, 10 30, 10 10, 30 5, 45 20, 20 35)))"))));
3101 ST_ASTEXT(ST_GEOMFROMGEOJSON(ST_ASGEOJSON(ST_GEOMFROMTEXT("MULTIPOLYGON(((40 40, 20 45, 45 30, 40 40)),"
3102 "((20 35, 10 30, 10 10, 30 5, 45 20, 20 35)))"))))
3103 MULTIPOLYGON(((40 40,45 20,30 45,40 40)),((35 20,30 10,10 10,5 30,20 45,35 20)))
3104 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(ST_ASGEOJSON(ST_GEOMFROMTEXT("MULTIPOLYGON(((40 40, 20 45, 45 30, 40 40)),"
3105 "((20 35, 10 30, 10 10, 30 5, 45 20, 20 35),"
3106 "(30 20, 20 15, 20 25, 30 20)))"))));
3107 ST_ASTEXT(ST_GEOMFROMGEOJSON(ST_ASGEOJSON(ST_GEOMFROMTEXT("MULTIPOLYGON(((40 40, 20 45, 45 30, 40 40)),"
3108 "((20 35, 10 30, 10 10, 30 5, 45 20, 20 35),"
3109 "(30 20, 20 15, 20 25, 30 20)))")
3110 MULTIPOLYGON(((40 40,45 20,30 45,40 40)),((35 20,30 10,10 10,5 30,20 45,35 20),(20 30,15 20,25 20,20 30)))
3111 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(ST_ASGEOJSON(ST_GEOMFROMTEXT("GEOMETRYCOLLECTION()"))));
3112 ST_ASTEXT(ST_GEOMFROMGEOJSON(ST_ASGEOJSON(ST_GEOMFROMTEXT("GEOMETRYCOLLECTION()"))))
3113 GEOMETRYCOLLECTION EMPTY
3114 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(ST_ASGEOJSON(ST_GEOMFROMTEXT("GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(POINT(10 20)))"))));
3115 ST_ASTEXT(ST_GEOMFROMGEOJSON(ST_ASGEOJSON(ST_GEOMFROMTEXT("GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(POINT(10 20)))"))))
3116 GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(POINT(20 10)))
3117 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(ST_ASGEOJSON(ST_GEOMFROMTEXT("GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION()))"))));
3118 ST_ASTEXT(ST_GEOMFROMGEOJSON(ST_ASGEOJSON(ST_GEOMFROMTEXT("GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION()))"))))
3119 GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION EMPTY))
3120 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(ST_ASGEOJSON(ST_GEOMFROMTEXT("GEOMETRYCOLLECTION( "
3121 "GEOMETRYCOLLECTION(POINT(10 20)),"
3122 "GEOMETRYCOLLECTION(LINESTRING(0 0, 100 100)),"
3123 "GEOMETRYCOLLECTION(POLYGON((0 0, 0 10, 10 10, 0 0)))"
3124 ")"
3125 )), 1, 0));
3126 ST_ASTEXT(ST_GEOMFROMGEOJSON(ST_ASGEOJSON(ST_GEOMFROMTEXT("GEOMETRYCOLLECTION( "
3127 "GEOMETRYCOLLECTION(POINT(10 20)),"
3128 "GEOMETRYCOLLECTION(LINESTRING(0 0, 100 100)),"
3129
3130 GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(POINT(10 20)),GEOMETRYCOLLECTION(LINESTRING(0 0,100 100)),GEOMETRYCOLLECTION(POLYGON((0 0,0 10,10 10,0 0))))
3131 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(ST_ASGEOJSON(ST_GEOMFROMTEXT("GEOMETRYCOLLECTION( "
3132 "POINT(4 6),"
3133 "LINESTRING(4 6,7 10),"
3134 "POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10)),"
3135 "MULTIPOINT (10 40, 40 30, 20 20, 30 10),"
3136 "MULTILINESTRING ((10 10, 20 20, 10 40),"
3137 "(40 40, 30 30, 40 20, 30 10)),"
3138 "MULTIPOLYGON (((30 20, 45 40, 10 40, 30 20)),"
3139 "((15 5, 40 10, 10 20, 5 10, 15 5)))"
3140 ")"
3141 ))));
3142 ST_ASTEXT(ST_GEOMFROMGEOJSON(ST_ASGEOJSON(ST_GEOMFROMTEXT("GEOMETRYCOLLECTION( "
3143 "POINT(4 6),"
3144 "LINESTRING(4 6,7 10),"
3145 "POLYGON ((30 10, 40 40, 20 4
3146 GEOMETRYCOLLECTION(POINT(6 4),LINESTRING(6 4,10 7),POLYGON((10 30,40 40,40 20,20 10,10 30)),MULTIPOINT((40 10),(30 40),(20 20),(10 30)),MULTILINESTRING((10 10,20 20,40 10),(40 40,30 30,20 40,10 30)),MULTIPOLYGON(((20 30,40 45,40 10,20 30)),((5 15,10 40,20 10,10 5,5 15))))
3147 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(ST_ASGEOJSON(ST_GEOMFROMTEXT("GEOMETRYCOLLECTION( "
3148 "POINT(4 6),"
3149 "GEOMETRYCOLLECTION("
3150 "POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10)),"
3151 "MULTIPOINT (10 40, 40 30, 20 20, 30 10),"
3152 "MULTILINESTRING ((10 10, 20 20, 10 40),"
3153 "(40 40, 30 30, 40 20, 30 10)),"
3154 "MULTIPOLYGON (((30 20, 45 40, 10 40, 30 20)),"
3155 "((15 5, 40 10, 10 20, 5 10, 15 5)))"
3156 "),"
3157 "POINT(6 4)"
3158 ")"
3159 ))));
3160 ST_ASTEXT(ST_GEOMFROMGEOJSON(ST_ASGEOJSON(ST_GEOMFROMTEXT("GEOMETRYCOLLECTION( "
3161 "POINT(4 6),"
3162 "GEOMETRYCOLLECTION("
3163 "POLYGON ((30 10, 40 40, 20 4
3164 GEOMETRYCOLLECTION(POINT(6 4),GEOMETRYCOLLECTION(POLYGON((10 30,40 40,40 20,20 10,10 30)),MULTIPOINT((40 10),(30 40),(20 20),(10 30)),MULTILINESTRING((10 10,20 20,40 10),(40 40,30 30,20 40,10 30)),MULTIPOLYGON(((20 30,40 45,40 10,20 30)),((5 15,10 40,20 10,10 5,5 15)))),POINT(4 6))
3165 SELECT ST_ASGEOJSON(ST_GEOMFROMGEOJSON(
3166 "{ \"type\": \"Point\", \"coordinates\": [102.0, 0.0]}"));
3167 ST_ASGEOJSON(ST_GEOMFROMGEOJSON(
3168 "{ \"type\": \"Point\", \"coordinates\": [102.0, 0.0]}"))
3169 {"type": "Point", "coordinates": [102.0, 0.0]}
3170 SELECT ST_ASGEOJSON(ST_GEOMFROMGEOJSON(
3171 "{ \"type\": \"LineString\", \"coordinates\": "
3172 "[ [102.0, 0.0], [103.0, 1.0], [104.0, 0.0], [105.0, 1.0] ] }"));
3173 ST_ASGEOJSON(ST_GEOMFROMGEOJSON(
3174 "{ \"type\": \"LineString\", \"coordinates\": "
3175 "[ [102.0, 0.0], [103.0, 1.0], [104.0, 0.0], [105.0, 1.0] ] }"))
3176 {"type": "LineString", "coordinates": [[102.0, 0.0], [103.0, 1.0], [104.0, 0.0], [105.0, 1.0]]}
3177 SELECT ST_ASGEOJSON(ST_GEOMFROMGEOJSON(
3178 "{ \"type\": \"MultiPoint\", \"coordinates\": "
3179 "[ [-105.01, 39.57],[-80.66, 35.0] ] }"));
3180 ST_ASGEOJSON(ST_GEOMFROMGEOJSON(
3181 "{ \"type\": \"MultiPoint\", \"coordinates\": "
3182 "[ [-105.01, 39.57],[-80.66, 35.0] ] }"))
3183 {"type": "MultiPoint", "coordinates": [[-105.01, 39.57], [-80.66, 35.0]]}
3184 SELECT ST_ASGEOJSON(ST_GEOMFROMGEOJSON(
3185 " { \"type\": \"MultiLineString\", \"coordinates\": "
3186 " [ "
3187 " [ "
3188 " [-101.5, 39.662], "
3189 " [-101.75, 39.2415], "
3190 " [-101.23, 39.2415], "
3191 " [-101.749, 39.7984], "
3192 " [-101.5, 39.011] "
3193 " ], "
3194 " [ "
3195 " [-99.23, 38.6605], "
3196 " [-99.56, 38.727], "
3197 " [-99.25, 38.018] "
3198 " ], "
3199 " [ "
3200 " [-98.499, 38.913], "
3201 " [-98.499, 38.913], "
3202 " [-98.38, 38.15], "
3203 " [-97.5, 38.629] "
3204 " ] "
3205 " ] "
3206 " }"));
3207 ST_ASGEOJSON(ST_GEOMFROMGEOJSON(
3208 " { \"type\": \"MultiLineString\", \"coordinates\": "
3209 " [ "
3210 " [ "
3211 " [-101.5, 39.662],
3212 {"type": "MultiLineString", "coordinates": [[[-101.5, 39.662], [-101.75, 39.2415], [-101.23, 39.2415], [-101.749, 39.7984], [-101.5, 39.011]], [[-99.23, 38.6605], [-99.56, 38.727], [-99.25, 38.018]], [[-98.499, 38.913], [-98.499, 38.913], [-98.38, 38.15], [-97.5, 38.629]]]}
3213 SELECT ST_ASGEOJSON(ST_GEOMFROMGEOJSON(
3214 " { \"type\": \"Polygon\", \"coordinates\": "
3215 " [ "
3216 " [ "
3217 " [41.83, 71.01], "
3218 " [56.95, 33.75], "
3219 " [21.79, 36.56], "
3220 " [41.83, 71.01] "
3221 " ] "
3222 " ] "
3223 " }"));
3224 ST_ASGEOJSON(ST_GEOMFROMGEOJSON(
3225 " { \"type\": \"Polygon\", \"coordinates\": "
3226 " [ "
3227 " [ "
3228 " [41.83, 71.01], "
3229 " [56.95,
3230 {"type": "Polygon", "coordinates": [[[41.83, 71.01], [56.95, 33.75], [21.79, 36.56], [41.83, 71.01]]]}
3231 SELECT ST_ASGEOJSON(ST_GEOMFROMGEOJSON(
3232 " { \"type\": \"Polygon\", \"coordinates\": "
3233 " [ "
3234 " [ "
3235 " [41.83, 71.01], "
3236 " [56.95, 33.75], "
3237 " [21.79, 36.56], "
3238 " [41.83, 71.01] "
3239 " ], "
3240 " [ "
3241 " [15.40, 15.40], "
3242 " [15.40, 25.40], "
3243 " [25.40, 25.40], "
3244 " [15.40, 15.40] "
3245 " ] "
3246 " ] "
3247 " }"));
3248 ST_ASGEOJSON(ST_GEOMFROMGEOJSON(
3249 " { \"type\": \"Polygon\", \"coordinates\": "
3250 " [ "
3251 " [ "
3252 " [41.83, 71.01], "
3253 " [56.95,
3254 {"type": "Polygon", "coordinates": [[[41.83, 71.01], [56.95, 33.75], [21.79, 36.56], [41.83, 71.01]], [[15.4, 15.4], [15.4, 25.4], [25.4, 25.4], [15.4, 15.4]]]}
3255 SELECT ST_ASGEOJSON(ST_GEOMFROMGEOJSON(
3256 " { \"type\": \"MultiPolygon\", \"coordinates\": "
3257 " [ "
3258 " [ "
3259 " [ "
3260 " [102.0, 2.0], "
3261 " [103.0, 2.0], "
3262 " [103.0, 3.0], "
3263 " [102.0, 3.0], "
3264 " [102.0, 2.0] "
3265 " ] "
3266 " ], "
3267 " [ "
3268 " [ "
3269 " [100.0, 0.0], "
3270 " [101.0, 0.0], "
3271 " [101.0, 1.0], "
3272 " [100.0, 1.0], "
3273 " [100.0, 0.0] "
3274 " ] "
3275 " ] "
3276 " ] "
3277 " }"));
3278 ST_ASGEOJSON(ST_GEOMFROMGEOJSON(
3279 " { \"type\": \"MultiPolygon\", \"coordinates\": "
3280 " [ "
3281 " [ "
3282 " [ "
3283 {"type": "MultiPolygon", "coordinates": [[[[102.0, 2.0], [103.0, 2.0], [103.0, 3.0], [102.0, 3.0], [102.0, 2.0]]], [[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]]]]}
3284 SELECT ST_ASGEOJSON(ST_GEOMFROMGEOJSON(
3285 " { \"type\": \"MultiPolygon\", \"coordinates\": "
3286 " [ "
3287 " [ "
3288 " [ "
3289 " [102.0, 2.0], "
3290 " [103.0, 2.0], "
3291 " [103.0, 3.0], "
3292 " [102.0, 3.0], "
3293 " [102.0, 2.0] "
3294 " ], "
3295 " [ "
3296 " [1.0, 0.0], "
3297 " [0.0, 0.0], "
3298 " [0.0, 1.0], "
3299 " [1.0, 0.0] "
3300 " ] "
3301 " ], "
3302 " [ "
3303 " [ "
3304 " [100.0, 0.0], "
3305 " [101.0, 0.0], "
3306 " [101.0, 1.0], "
3307 " [100.0, 1.0], "
3308 " [100.0, 0.0] "
3309 " ] "
3310 " ] "
3311 " ] "
3312 " }"));
3313 ST_ASGEOJSON(ST_GEOMFROMGEOJSON(
3314 " { \"type\": \"MultiPolygon\", \"coordinates\": "
3315 " [ "
3316 " [ "
3317 " [ "
3318 {"type": "MultiPolygon", "coordinates": [[[[102.0, 2.0], [103.0, 2.0], [103.0, 3.0], [102.0, 3.0], [102.0, 2.0]], [[1.0, 0.0], [0.0, 0.0], [0.0, 1.0], [1.0, 0.0]]], [[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]]]]}
3319 SELECT ST_ASGEOJSON(ST_GEOMFROMGEOJSON(
3320 " { \"type\": \"GeometryCollection\", \"geometries\": "
3321 " [ ] "
3322 " }"));
3323 ST_ASGEOJSON(ST_GEOMFROMGEOJSON(
3324 " { \"type\": \"GeometryCollection\", \"geometries\": "
3325 " [ ] "
3326 " }"))
3327 {"type": "GeometryCollection", "geometries": []}
3328 SELECT ST_ASGEOJSON(ST_GEOMFROMGEOJSON(
3329 " { \"type\": \"GeometryCollection\", \"geometries\": "
3330 " [ "
3331 " { \"type\": \"GeometryCollection\", \"geometries\": "
3332 " [ "
3333 " { \"type\": \"GeometryCollection\", \"geometries\": "
3334 " [ ] "
3335 " } "
3336 " ] "
3337 " } "
3338 " ] "
3339 " }"));
3340 ST_ASGEOJSON(ST_GEOMFROMGEOJSON(
3341 " { \"type\": \"GeometryCollection\", \"geometries\": "
3342 " [ "
3343 " { \"type\": \"GeometryCollection\", \"geometries\": "
3344 " [
3345 {"type": "GeometryCollection", "geometries": [{"type": "GeometryCollection", "geometries": [{"type": "GeometryCollection", "geometries": []}]}]}
3346 SELECT ST_ASGEOJSON(ST_GEOMFROMGEOJSON(
3347 " { \"type\": \"GeometryCollection\", \"geometries\": "
3348 " [ "
3349 " { \"type\": \"LineString\", \"coordinates\": "
3350 " [ "
3351 " [102.0, 0.0], "
3352 " [103.0, 1.0], "
3353 " [104.0, 0.0], "
3354 " [105.0, 1.0] "
3355 " ] "
3356 " }, "
3357 " { \"type\": \"LineString\", \"coordinates\": "
3358 " [ "
3359 " [102.0, 0.0], "
3360 " [103.0, 1.0], "
3361 " [104.0, 0.0], "
3362 " [105.0, 1.0] "
3363 " ] "
3364 " } "
3365 " ] "
3366 " }"));
3367 ST_ASGEOJSON(ST_GEOMFROMGEOJSON(
3368 " { \"type\": \"GeometryCollection\", \"geometries\": "
3369 " [ "
3370 " { \"type\": \"LineString\", \"coordinates\": "
3371 " [
3372 {"type": "GeometryCollection", "geometries": [{"type": "LineString", "coordinates": [[102.0, 0.0], [103.0, 1.0], [104.0, 0.0], [105.0, 1.0]]}, {"type": "LineString", "coordinates": [[102.0, 0.0], [103.0, 1.0], [104.0, 0.0], [105.0, 1.0]]}]}
3373 SELECT ST_ASGEOJSON(ST_GEOMFROMGEOJSON(
3374 " { \"type\": \"GeometryCollection\", \"geometries\": "
3375 " [ "
3376 " { \"type\": \"LineString\", \"coordinates\": "
3377 " [ "
3378 " [102.0, 0.0], "
3379 " [103.0, 1.0], "
3380 " [104.0, 0.0], "
3381 " [105.0, 1.0] "
3382 " ] "
3383 " }, "
3384 " { \"type\": \"LineString\", \"coordinates\": "
3385 " [ "
3386 " [102.0, 0.0], "
3387 " [103.0, 1.0], "
3388 " [104.0, 0.0], "
3389 " [105.0, 1.0] "
3390 " ] "
3391 " }, "
3392 " { \"type\": \"Point\", \"coordinates\": "
3393 " [102.0, 0.0] "
3394 " } "
3395 " ] "
3396 " }"));
3397 ST_ASGEOJSON(ST_GEOMFROMGEOJSON(
3398 " { \"type\": \"GeometryCollection\", \"geometries\": "
3399 " [ "
3400 " { \"type\": \"LineString\", \"coordinates\": "
3401 " [
3402 {"type": "GeometryCollection", "geometries": [{"type": "LineString", "coordinates": [[102.0, 0.0], [103.0, 1.0], [104.0, 0.0], [105.0, 1.0]]}, {"type": "LineString", "coordinates": [[102.0, 0.0], [103.0, 1.0], [104.0, 0.0], [105.0, 1.0]]}, {"type": "Point", "coordinates": [102.0, 0.0]}]}
3403 SELECT ST_ASGEOJSON(ST_GEOMFROMGEOJSON(
3404 " { \"type\": \"GeometryCollection\", \"geometries\": "
3405 " [ "
3406 " { \"type\": \"Point\", \"coordinates\": "
3407 " [102.0, 0.5] "
3408 " }, "
3409 " { \"type\": \"Point\", \"coordinates\": "
3410 " [102.0, 0.5] "
3411 " }, "
3412 " { \"type\": \"GeometryCollection\", \"geometries\": "
3413 " [ "
3414 " { \"type\": \"Point\", \"coordinates\": "
3415 " [102.0, 0.5] "
3416 " }, "
3417 " { \"type\": \"Point\", \"coordinates\": "
3418 " [102.0, 0.5] "
3419 " } "
3420 " ] "
3421 " }, "
3422 " { \"type\": \"Point\", \"coordinates\": "
3423 " [102.0, 0.5] "
3424 " } "
3425 " ] "
3426 " }"));
3427 ST_ASGEOJSON(ST_GEOMFROMGEOJSON(
3428 " { \"type\": \"GeometryCollection\", \"geometries\": "
3429 " [ "
3430 " { \"type\": \"Point\", \"coordinates\": "
3431 " [102.0, 0.5]
3432 {"type": "GeometryCollection", "geometries": [{"type": "Point", "coordinates": [102.0, 0.5]}, {"type": "Point", "coordinates": [102.0, 0.5]}, {"type": "GeometryCollection", "geometries": [{"type": "Point", "coordinates": [102.0, 0.5]}, {"type": "Point", "coordinates": [102.0, 0.5]}]}, {"type": "Point", "coordinates": [102.0, 0.5]}]}
3433 SELECT ST_ASGEOJSON(ST_GEOMFROMGEOJSON(
3434 " { \"type\": \"GeometryCollection\", \"geometries\": "
3435 " [ "
3436 " { \"type\": \"MultiPoint\", \"coordinates\": "
3437 " [ "
3438 " [-105.01, 39.57], "
3439 " [-80.66, 35.0] "
3440 " ] "
3441 " }, "
3442 " { \"type\": \"Point\", \"coordinates\": "
3443 " [102.0, 0.5] "
3444 " }, "
3445 " { \"type\": \"Point\", \"coordinates\": "
3446 " [102.0, 0.5] "
3447 " }, "
3448 " { \"type\": \"GeometryCollection\", \"geometries\": "
3449 " [ "
3450 " { \"type\": \"Point\", \"coordinates\": "
3451 " [102.0, 0.5] "
3452 " }, "
3453 " { \"type\": \"Point\", \"coordinates\": "
3454 " [102.0, 0.5] "
3455 " } "
3456 " ] "
3457 " }, "
3458 " { \"type\": \"Point\", \"coordinates\": "
3459 " [102.0, 0.5] "
3460 " } "
3461 " ] "
3462 " }"));
3463 ST_ASGEOJSON(ST_GEOMFROMGEOJSON(
3464 " { \"type\": \"GeometryCollection\", \"geometries\": "
3465 " [ "
3466 " { \"type\": \"MultiPoint\", \"coordinates\": "
3467 " [
3468 {"type": "GeometryCollection", "geometries": [{"type": "MultiPoint", "coordinates": [[-105.01, 39.57], [-80.66, 35.0]]}, {"type": "Point", "coordinates": [102.0, 0.5]}, {"type": "Point", "coordinates": [102.0, 0.5]}, {"type": "GeometryCollection", "geometries": [{"type": "Point", "coordinates": [102.0, 0.5]}, {"type": "Point", "coordinates": [102.0, 0.5]}]}, {"type": "Point", "coordinates": [102.0, 0.5]}]}
3469 SELECT ST_ASGEOJSON(ST_GEOMFROMGEOJSON(
3470 " { \"type\": \"GeometryCollection\", \"geometries\": "
3471 " [ "
3472 " { \"type\": \"Point\", \"coordinates\": "
3473 " [-105.01621, 39.57422] "
3474 " }, "
3475 " { \"type\": \"MultiPoint\", \"coordinates\": "
3476 " [ "
3477 " [-105.01, 39.57], "
3478 " [-80.66, 35.05] "
3479 " ] "
3480 " }, "
3481 " { \"type\": \"LineString\", \"coordinates\": "
3482 " [ "
3483 " [-101.5, 39.662], "
3484 " [-101.75, 39.2415], "
3485 " [-101.64, 39.2415] "
3486 " ] "
3487 " }, "
3488 " { \"type\": \"MultiLineString\", \"coordinates\": "
3489 " [ "
3490 " [ "
3491 " [-101.5, 39.662], "
3492 " [-101.75, 39.2415], "
3493 " [-101.23, 39.2415], "
3494 " [-101.749, 39.7984], "
3495 " [-101.5, 39.011] "
3496 " ], "
3497 " [ "
3498 " [-99.23, 38.6605], "
3499 " [-99.56, 38.727], "
3500 " [-99.25, 38.018] "
3501 " ], "
3502 " [ "
3503 " [-98.499, 38.913], "
3504 " [-98.499, 38.913], "
3505 " [-98.38, 38.15], "
3506 " [-97.5, 38.629] "
3507 " ] "
3508 " ] "
3509 " }, "
3510 " { \"type\": \"Polygon\", \"coordinates\": "
3511 " [ "
3512 " [ "
3513 " [41.83,71.01], "
3514 " [56.95,33.75], "
3515 " [21.79,36.56], "
3516 " [41.83,71.01] "
3517 " ] "
3518 " ] "
3519 " }, "
3520 " { \"type\": \"MultiPolygon\", \"coordinates\": "
3521 " [ "
3522 " [ "
3523 " [ "
3524 " [102.0, 2.0], "
3525 " [103.0, 2.0], "
3526 " [103.0, 3.0], "
3527 " [102.0, 3.0], "
3528 " [102.0, 2.0] "
3529 " ] "
3530 " ], "
3531 " [ "
3532 " [ "
3533 " [100.0, 0.0], "
3534 " [101.0, 0.0], "
3535 " [101.0, 1.0], "
3536 " [100.0, 1.0], "
3537 " [100.0, 0.0] "
3538 " ] "
3539 " ] "
3540 " ] "
3541 " } "
3542 " ] "
3543 " }"));
3544 ST_ASGEOJSON(ST_GEOMFROMGEOJSON(
3545 " { \"type\": \"GeometryCollection\", \"geometries\": "
3546 " [ "
3547 " { \"type\": \"Point\", \"coordinates\": "
3548 " [-105.01621, 39.57422]
3549 {"type": "GeometryCollection", "geometries": [{"type": "Point", "coordinates": [-105.01621, 39.57422]}, {"type": "MultiPoint", "coordinates": [[-105.01, 39.57], [-80.66, 35.05]]}, {"type": "LineString", "coordinates": [[-101.5, 39.662], [-101.75, 39.2415], [-101.64, 39.2415]]}, {"type": "MultiLineString", "coordinates": [[[-101.5, 39.662], [-101.75, 39.2415], [-101.23, 39.2415], [-101.749, 39.7984], [-101.5, 39.011]], [[-99.23, 38.6605], [-99.56, 38.727], [-99.25, 38.018]], [[-98.499, 38.913], [-98.499, 38.913], [-98.38, 38.15], [-97.5, 38.629]]]}, {"type": "Polygon", "coordinates": [[[41.83, 71.01], [56.95, 33.75], [21.79, 36.56], [41.83, 71.01]]]}, {"type": "MultiPolygon", "coordinates": [[[[102.0, 2.0], [103.0, 2.0], [103.0, 3.0], [102.0, 3.0], [102.0, 2.0]]], [[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]]]]}]}
3550 SELECT ST_ASGEOJSON(ST_GEOMFROMGEOJSON(
3551 " { "
3552 " \"type\": \"Feature\", \"id\": \"stadium\", \"geometry\": "
3553 " { \"type\": \"Point\", \"coordinates\": "
3554 " [-104.99404, 39.75621] "
3555 " }, "
3556 " \"properties\": "
3557 " { "
3558 " \"name\": \"Coors Field\", "
3559 " \"amenity\": \"Baseball Stadium\", "
3560 " \"popupContent\": \"This is where the Rockies play!\" "
3561 " } "
3562 " }"));
3563 ST_ASGEOJSON(ST_GEOMFROMGEOJSON(
3564 " { "
3565 " \"type\": \"Feature\", \"id\": \"stadium\", \"geometry\": "
3566 " { \"type\": \"Point\", \"coordinates\": "
3567 " [-104.99404,
3568 {"type": "Point", "coordinates": [-104.99404, 39.75621]}
3569 SELECT ST_ASGEOJSON(ST_GEOMFROMGEOJSON(
3570 " { \"type\": \"FeatureCollection\", \"features\": "
3571 " [ "
3572 " { \"type\": \"Feature\", \"geometry\": "
3573 " { \"type\": \"Point\", \"coordinates\": "
3574 " [-80.83775386582222, 35.24980190252168] "
3575 " }, "
3576 " \"properties\": "
3577 " { "
3578 " \"name\": \"DOUBLE OAKS CENTER\", "
3579 " \"address\": \"1326 WOODWARD AV\" "
3580 " } "
3581 " }, "
3582 " { \"type\": \"Feature\", \"geometry\": "
3583 " { \"type\": \"Point\", \"coordinates\": "
3584 " [-80.83827000459532, 35.25674709224663] "
3585 " }, "
3586 " \"properties\": "
3587 " { "
3588 " \"name\": \"DOUBLE OAKS NEIGHBORHOOD PARK\", "
3589 " \"address\": \"2605 DOUBLE OAKS RD\" "
3590 " } "
3591 " } "
3592 " ] "
3593 " }"));
3594 ST_ASGEOJSON(ST_GEOMFROMGEOJSON(
3595 " { \"type\": \"FeatureCollection\", \"features\": "
3596 " [ "
3597 " { \"type\": \"Feature\", \"geometry\": "
3598 " { \"type\": \"Point\", \"coordinates\":
3599 {"type": "GeometryCollection", "geometries": [{"type": "Point", "coordinates": [-80.83775386582222, 35.24980190252168]}, {"type": "Point", "coordinates": [-80.83827000459532, 35.25674709224663]}]}
3600 SELECT ST_ASGEOJSON(ST_GEOMFROMGEOJSON(
3601 " { \"type\": \"FeatureCollection\", \"features\": "
3602 " [ "
3603 " { \"type\": \"Feature\", \"geometry\": "
3604 " { \"type\": \"Point\", \"coordinates\": "
3605 " [-80.83775386582222, 35.24980190252168] "
3606 " }, "
3607 " \"properties\": "
3608 " { "
3609 " \"name\": \"DOUBLE OAKS CENTER\", "
3610 " \"address\": \"1326 WOODWARD AV\" "
3611 " } "
3612 " }, "
3613 " { \"type\": \"Feature\", \"geometry\": "
3614 " { \"type\": \"Point\", \"coordinates\": "
3615 " [-80.83827000459532, 35.25674709224663] "
3616 " }, "
3617 " \"properties\": "
3618 " { "
3619 " \"name\": \"DOUBLE OAKS NEIGHBORHOOD PARK\", "
3620 " \"address\": \"2605 DOUBLE OAKS RD\" "
3621 " } "
3622 " }, "
3623 " { \"type\": \"Feature\", \"geometry\": "
3624 " null, "
3625 " \"properties\": "
3626 " { "
3627 " \"descr\": \"A NULL/EMPTY POINT\" "
3628 " } "
3629 " }, "
3630 " { \"type\": \"Feature\", \"geometry\": "
3631 " { \"type\": \"Point\", \"coordinates\": "
3632 " [-87.83827000459532, 42.0] "
3633 " }, "
3634 " \"properties\": "
3635 " { "
3636 " \"name\": \"DOUBLE OAKS NEIGHBORHOOD PARK\", "
3637 " \"address\": \"2605 DOUBLE OAKS RD\" "
3638 " } "
3639 " } "
3640 " ] "
3641 " }"));
3642 ST_ASGEOJSON(ST_GEOMFROMGEOJSON(
3643 " { \"type\": \"FeatureCollection\", \"features\": "
3644 " [ "
3645 " { \"type\": \"Feature\", \"geometry\": "
3646 " { \"type\": \"Point\", \"coordinates\":
3647 {"type": "GeometryCollection", "geometries": [{"type": "Point", "coordinates": [-80.83775386582222, 35.24980190252168]}, {"type": "Point", "coordinates": [-80.83827000459532, 35.25674709224663]}, {"type": "Point", "coordinates": [-87.83827000459532, 42.0]}]}
3648 SELECT ST_ASGEOJSON(ST_GEOMFROMGEOJSON(
3649 "{ \"type\": \"Point\", \"coordinates\": [1.23e3, 2.2e-1]}", 1, 0));
3650 ST_ASGEOJSON(ST_GEOMFROMGEOJSON(
3651 "{ \"type\": \"Point\", \"coordinates\": [1.23e3, 2.2e-1]}", 1, 0))
3652 {"type": "Point", "coordinates": [1230.0, 0.22]}
3653 SELECT ST_ASGEOJSON(ST_GEOMFROMGEOJSON(
3654 "{ \"type\": \"Point\", \"coordinates\": [1e-300, 1e300]}", 1, 0));
3655 ST_ASGEOJSON(ST_GEOMFROMGEOJSON(
3656 "{ \"type\": \"Point\", \"coordinates\": [1e-300, 1e300]}", 1, 0))
3657 {"type": "Point", "coordinates": [1e-300, 1e300]}
3658 SELECT ST_ASGEOJSON(ST_GEOMFROMGEOJSON(
3659 "{ \"type\": \"Point\", \"coordinates\": [1.7976931348623157E+308, -1.7976931348623157E+308]}", 1, 0));
3660 ST_ASGEOJSON(ST_GEOMFROMGEOJSON(
3661 "{ \"type\": \"Point\", \"coordinates\": [1.7976931348623157E+308, -1.7976931348623157E+308]}", 1, 0))
3662 {"type": "Point", "coordinates": [1.7976931348623157e308, -1.7976931348623157e308]}
3663 SELECT ST_ASGEOJSON(ST_GEOMFROMGEOJSON(
3664 "{ \"type\": \"Point\", \"coordinates\": [10, 20] }"));
3665 ST_ASGEOJSON(ST_GEOMFROMGEOJSON(
3666 "{ \"type\": \"Point\", \"coordinates\": [10, 20] }"))
3667 {"type": "Point", "coordinates": [10.0, 20.0]}
3668 SELECT ST_ASGEOJSON(ST_GEOMFROMGEOJSON(
3669 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
3670 " \"crs\": "
3671 " { \"type\": \"name\", \"properties\": "
3672 " { \"name\": \"urn:ogc:def:crs:EPSG::1234\" } "
3673 " } "
3674 " }"), 5, 0);
3675 ERROR SR001: There's no spatial reference system with SRID 1234.
3676 SELECT ST_ASGEOJSON(ST_GEOMFROMGEOJSON(
3677 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
3678 " \"crs\": "
3679 " { \"type\": \"name\", \"properties\": "
3680 " { \"name\": \"urn:ogc:def:crs:EPSG::1\" } "
3681 " } "
3682 " }"), 5, 1);
3683 ERROR SR001: There's no spatial reference system with SRID 1.
3684 SELECT ST_ASGEOJSON(ST_GEOMFROMGEOJSON(
3685 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
3686 " \"crs\": "
3687 " { \"type\": \"name\", \"properties\": "
3688 " { \"name\": \"urn:ogc:def:crs:EPSG::4294967295\" } "
3689 " } "
3690 " }"), 5, 2);
3691 ERROR SR001: There's no spatial reference system with SRID 4294967295.
3692 SELECT ST_ASGEOJSON(ST_GEOMFROMGEOJSON(
3693 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
3694 " \"crs\": "
3695 " { \"type\": \"name\", \"properties\": "
3696 " { \"name\": \"EPSG:234\" } "
3697 " } "
3698 " }"), 5, 3);
3699 ERROR SR001: There's no spatial reference system with SRID 234.
3700 SELECT ST_ASGEOJSON(ST_GEOMFROMGEOJSON(
3701 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
3702 " \"crs\": "
3703 " { \"type\": \"name\", \"properties\": "
3704 " { \"name\": \"EPSG:1\" } "
3705 " } "
3706 " }"), 5, 5);
3707 ERROR SR001: There's no spatial reference system with SRID 1.
3708 SELECT ST_ASGEOJSON(ST_GEOMFROMGEOJSON(
3709 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
3710 " \"crs\": "
3711 " { \"type\": \"name\", \"properties\": "
3712 " { \"name\": \"EPSG:4294967295\" } "
3713 " } "
3714 " }"), 5, 7);
3715 ERROR SR001: There's no spatial reference system with SRID 4294967295.
3716 SELECT ST_ASGEOJSON(ST_GEOMFROMGEOJSON(
3717 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
3718 " \"crs\": null "
3719 " }"));
3720 ST_ASGEOJSON(ST_GEOMFROMGEOJSON(
3721 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
3722 " \"crs\": null "
3723 " }"))
3724 {"type": "Point", "coordinates": [10.0, 20.0]}
3725 # Check that GeomFromGeoJSON can read data from a JSON field.
3726 CREATE TABLE json_tbl
3727 (
3728 id INT NOT NULL AUTO_INCREMENT,
3729 json_value JSON,
3730 PRIMARY KEY (id)
3731 );
3732 INSERT INTO json_tbl (json_value) VALUES
3733 ('{ "type": "Point", "coordinates": [100.0, 0.0] }'),
3734 ('{
3735 "type": "LineString",
3736 "coordinates":
3737 [ [100.0, 0.0], [101.0, 1.0] ]
3738 }'),
3739 ('{
3740 "type": "Polygon",
3741 "coordinates":
3742 [ [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ] ]
3743 }'),
3744 ('{
3745 "type": "Polygon",
3746 "coordinates": [
3747 [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ],
3748 [ [100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2] ]
3749 ]
3750 }'),
3751 ('{
3752 "type": "MultiPoint",
3753 "coordinates": [ [100.0, 0.0], [101.0, 1.0] ]
3754 }'),
3755 ('{ "type": "Point", "coordinates": [-12.144, 13.736489] }');
3756 SELECT ST_AsText(ST_GeomFromGeoJSON(json_value)) FROM json_tbl;
3757 ST_AsText(ST_GeomFromGeoJSON(json_value))
3758 POINT(0 100)
3759 LINESTRING(0 100,1 101)
3760 POLYGON((0 100,0 101,1 101,1 100,0 100))
3761 POLYGON((0 100,0 101,1 101,1 100,0 100),(0.2 100.2,0.2 100.8,0.8 100.8,0.8 100.2,0.2 100.2))
3762 MULTIPOINT((0 100),(1 101))
3763 POINT(13.736489 -12.144)
3764 DROP TABLE json_tbl;
3765 # Checking that member and type names with extra ending does not get
3766 # accepted/validated.
3767 SELECT ST_GEOMFROMGEOJSON(
3768 "{ "
3769 " \"type1234567890\": \"Point\", "
3770 " \"coordinates\": [102, 11] "
3771 "} "
3772 );
3773 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson: Missing required member 'type'
3774 SELECT ST_GEOMFROMGEOJSON(
3775 "{ "
3776 " \"type \": \"Point\", "
3777 " \"coordinates\": [102, 11] "
3778 "} "
3779 );
3780 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson: Missing required member 'type'
3781 SELECT ST_GEOMFROMGEOJSON(
3782 "{ "
3783 " \"type\": \"Point \", "
3784 " \"coordinates\": [102, 11] "
3785 "} "
3786 );
3787 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
3788 SELECT ST_GEOMFROMGEOJSON(
3789 "{ "
3790 " \"type\": \"Pointt\", "
3791 " \"coordinates\": [102, 11] "
3792 "} "
3793 );
3794 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
3795 SELECT ST_GEOMFROMGEOJSON(
3796 "{ "
3797 " \"type\": \"Point\", "
3798 " \"coordinates \": [102, 11] "
3799 "} "
3800 );
3801 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson: Missing required member 'coordinates'
3802 SELECT ST_GEOMFROMGEOJSON(
3803 "{ "
3804 " \"type\": \"Point\", "
3805 " \"coordinatess\": [102, 11] "
3806 "} "
3807 );
3808 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson: Missing required member 'coordinates'
3809 # Check that rapidjson parses decimal numbers with trailing zeroes
3810 # correctly.
3811 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
3812 "{ "
3813 " \"type\": \"Point\", "
3814 " \"coordinates\": [102.0000, 11] "
3815 "} "
3816 ));
3817 ST_ASTEXT(ST_GEOMFROMGEOJSON(
3818 "{ "
3819 " \"type\": \"Point\", "
3820 " \"coordinates\": [102.0000, 11] "
3821 "} "
3822 ))
3823 POINT(11 102)
3824 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
3825 "{ "
3826 " \"type\": \"Point\", "
3827 " \"coordinates\": [102.00000, 11] "
3828 "} "
3829 ));
3830 ST_ASTEXT(ST_GEOMFROMGEOJSON(
3831 "{ "
3832 " \"type\": \"Point\", "
3833 " \"coordinates\": [102.00000, 11] "
3834 "} "
3835 ))
3836 POINT(11 102)
3837 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
3838 "{ "
3839 " \"type\": \"Point\", "
3840 " \"coordinates\": [102.000000, 11] "
3841 "} "
3842 ));
3843 ST_ASTEXT(ST_GEOMFROMGEOJSON(
3844 "{ "
3845 " \"type\": \"Point\", "
3846 " \"coordinates\": [102.000000, 11] "
3847 "} "
3848 ))
3849 POINT(11 102)
3850 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
3851 "{ "
3852 " \"type\": \"Point\", "
3853 " \"coordinates\": [10.0000, 11] "
3854 "} "
3855 ));
3856 ST_ASTEXT(ST_GEOMFROMGEOJSON(
3857 "{ "
3858 " \"type\": \"Point\", "
3859 " \"coordinates\": [10.0000, 11] "
3860 "} "
3861 ))
3862 POINT(11 10)
3863 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
3864 "{ "
3865 " \"type\": \"Point\", "
3866 " \"coordinates\": [10.00000, 11] "
3867 "} "
3868 ));
3869 ST_ASTEXT(ST_GEOMFROMGEOJSON(
3870 "{ "
3871 " \"type\": \"Point\", "
3872 " \"coordinates\": [10.00000, 11] "
3873 "} "
3874 ))
3875 POINT(11 10)
3876 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
3877 "{ "
3878 " \"type\": \"Point\", "
3879 " \"coordinates\": [10.000000, 11] "
3880 "} "
3881 ));
3882 ST_ASTEXT(ST_GEOMFROMGEOJSON(
3883 "{ "
3884 " \"type\": \"Point\", "
3885 " \"coordinates\": [10.000000, 11] "
3886 "} "
3887 ))
3888 POINT(11 10)
3889 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
3890 "{ "
3891 " \"type\": \"Point\", "
3892 " \"coordinates\": [10.00000000000000000000000000000000000, 11] "
3893 "} "
3894 ));
3895 ST_ASTEXT(ST_GEOMFROMGEOJSON(
3896 "{ "
3897 " \"type\": \"Point\", "
3898 " \"coordinates\": [10.00000000000000000000000000000000000, 11] "
3899 "}
3900 POINT(11 10)
3901 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
3902 "{ "
3903 " \"type\": \"Point\", "
3904 " \"coordinates\": [102, 11.0000] "
3905 "} "
3906 ));
3907 ST_ASTEXT(ST_GEOMFROMGEOJSON(
3908 "{ "
3909 " \"type\": \"Point\", "
3910 " \"coordinates\": [102, 11.0000] "
3911 "} "
3912 ))
3913 POINT(11 102)
3914 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
3915 "{ "
3916 " \"type\": \"Point\", "
3917 " \"coordinates\": [102, 11.00000] "
3918 "} "
3919 ));
3920 ST_ASTEXT(ST_GEOMFROMGEOJSON(
3921 "{ "
3922 " \"type\": \"Point\", "
3923 " \"coordinates\": [102, 11.00000] "
3924 "} "
3925 ))
3926 POINT(11 102)
3927 SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON(
3928 "{ "
3929 " \"type\": \"Point\", "
3930 " \"coordinates\": [102, 11.000000] "
3931 "} "
3932 ));
3933 ST_ASTEXT(ST_GEOMFROMGEOJSON(
3934 "{ "
3935 " \"type\": \"Point\", "
3936 " \"coordinates\": [102, 11.000000] "
3937 "} "
3938 ))
3939 POINT(11 102)
3940 SELECT ST_ASGEOJSON(POINT(1, 1), -9223372036854775808);
3941 ERROR HY000: Incorrect max decimal digits value: '-9223372036854775808' for function st_asgeojson
3942 SELECT ST_ASGEOJSON(POINT(1, 1), 10, -9223372036854775808);
3943 ERROR HY000: Incorrect options value: '-9223372036854775808' for function st_asgeojson
3944 SELECT ST_ASGEOJSON(POINT(1, 1), 18446744073709551615);
3945 ERROR HY000: Incorrect max decimal digits value: '18446744073709551615' for function st_asgeojson
3946 SELECT ST_ASGEOJSON(POINT(1, 1), 10, 18446744073709551615);
3947 ERROR HY000: Incorrect options value: '18446744073709551615' for function st_asgeojson
3948 SELECT ST_GEOMFROMGEOJSON('{"type":"Point", "coordinates":[10, 20]}', 1, -9223372036854775808);
3949 ERROR 22003: SRID value is out of range in 'st_geomfromgeojson'
3950 SELECT ST_GEOMFROMGEOJSON('{"type":"Point", "coordinates":[10, 20]}', -9223372036854775808);
3951 ERROR HY000: Incorrect option value: '-9223372036854775808' for function st_geomfromgeojson
3952 SELECT ST_GEOMFROMGEOJSON('{"type":"Point", "coordinates":[10, 20]}', 1, 18446744073709551615);
3953 ERROR 22003: SRID value is out of range in 'st_geomfromgeojson'
3954 SELECT ST_GEOMFROMGEOJSON('{"type":"Point", "coordinates":[10, 20]}', 18446744073709551615);
3955 ERROR HY000: Incorrect option value: '18446744073709551615' for function st_geomfromgeojson
3956 SELECT ST_ASGEOJSON(POINT(1, 1), -9223372036854775809);
3957 ERROR HY000: Incorrect type for argument max decimal digits in function st_asgeojson.
3958 SELECT ST_ASGEOJSON(POINT(1, 1), 10, -9223372036854775809);
3959 ERROR HY000: Incorrect type for argument options in function st_asgeojson.
3960 SELECT ST_ASGEOJSON(POINT(1, 1), 18446744073709551616);
3961 ERROR HY000: Incorrect type for argument max decimal digits in function st_asgeojson.
3962 SELECT ST_ASGEOJSON(POINT(1, 1), 10, 18446744073709551616);
3963 ERROR HY000: Incorrect type for argument options in function st_asgeojson.
3964 SELECT ST_GEOMFROMGEOJSON('{"type":"Point", "coordinates":[10, 20]}', 1, -9223372036854775809);
3965 ERROR HY000: Incorrect type for argument SRID in function st_geomfromgeojson.
3966 SELECT ST_GEOMFROMGEOJSON('{"type":"Point", "coordinates":[10, 20]}', -9223372036854775809);
3967 ERROR HY000: Incorrect type for argument options in function st_geomfromgeojson.
3968 SELECT ST_GEOMFROMGEOJSON('{"type":"Point", "coordinates":[10, 20]}', 1, 18446744073709551616);
3969 ERROR HY000: Incorrect type for argument SRID in function st_geomfromgeojson.
3970 SELECT ST_GEOMFROMGEOJSON('{"type":"Point", "coordinates":[10, 20]}', 18446744073709551616);
3971 ERROR HY000: Incorrect type for argument options in function st_geomfromgeojson.
3972 CREATE TABLE geojson(
3973 gid INT NOT NULL AUTO_INCREMENT,
3974 geojson_value TEXT,
3975 PRIMARY KEY (`gid`)
3976 );
3977 INSERT INTO geojson (geojson_value) VALUES
3978 (ST_AsGeoJSON(ST_GeomFromText('POINT(10 11)', 4326), 100, 2)),
3979 (ST_AsGeoJSON(ST_GeomFromText('POINT(-1.324 66.231)', 0), 100, 2)),
3980 (ST_AsGeoJSON(ST_GeomFromText('POINT(98.344 -23.001)', 0), 100, 2)),
3981 (ST_AsGeoJSON(ST_GeomFromText('POINT(0.0 0.0)', 0), 100, 2));
3982 SELECT ST_AsText(ST_GeomFromGeoJSON(geojson_value)) FROM geojson;
3983 ST_AsText(ST_GeomFromGeoJSON(geojson_value))
3984 POINT(10 11)
3985 POINT(66.231 -1.324)
3986 POINT(-23.001 98.344)
3987 POINT(0 0)
3988 SELECT ST_SRID(ST_GeomFromGeoJSON(geojson_value)) FROM geojson;
3989 ST_SRID(ST_GeomFromGeoJSON(geojson_value))
3990 4326
3991 4326
3992 4326
3993 4326
3994 DROP TABLE geojson;
3995 #
3996 # Bug#21384048 ASSERTION FAILED: N >= 0 && N <= 308
3997 # IN RAPIDJSON::INTERNAL::FASTPATH
3998 #
3999 SELECT ST_GEOMFROMGEOJSON('1E-36181012216111515851075235238');
4000 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
4001 SELECT ST_GEOMFROMGEOJSON('-1E-36181012216111515851075235238');
4002 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson
4003 SELECT ST_GEOMFROMGEOJSON('1E+36181012216111515851075235238');
4004 ERROR 22032: Invalid JSON text in argument 1 to function st_geomfromgeojson: "Number too big to be stored in double." at position 0.
4005 SELECT ST_GEOMFROMGEOJSON('-1E+36181012216111515851075235238');
4006 ERROR 22032: Invalid JSON text in argument 1 to function st_geomfromgeojson: "Number too big to be stored in double." at position 0.
4007 #
4008 # Bug#21389101 ST_GEOMFROMGEOJSON: STACK OVERFLOW IN
4009 # RAPIDJSON::GENERICREADER
4010 #
4011 SELECT ST_GeomFromGeoJSON(REPEAT('[', 1000));
4012 ERROR 22032: The JSON document exceeds the maximum depth.
4013 SELECT ST_GeomFromGeoJSON(REPEAT('{"foo":', 1000));
4014 ERROR 22032: The JSON document exceeds the maximum depth.
4015 #
4016 # Bug#21616810 CONNECTION HANG OR ASSERTION 0 IN
4017 # THD::SEND_STATEMENT_STATUS, SQL_CLASS.CC
4018 #
4019 CREATE TABLE t (a INT) ENGINE=InnoDB;
4020 INSERT INTO t (a) VALUES (0), (1);
4021 SELECT 1 FROM t GROUP BY ST_AsGeoJSON(NULL, "1", NULL);
4022 1
4023 1
4024 SELECT 1 FROM t GROUP BY ST_AsGeoJSON(NULL, 5, 0);
4025 1
4026 1
4027 DROP TABLE t;
4028 #
4029 # Bug#22804853 ST_GEOMFROMGEOJSON: ASSERTION FAILED: 0, FILE FILESORT.CC
4030 #
4031 CREATE TABLE t (a INT) ENGINE=InnoDB;
4032 INSERT INTO t VALUES (1), (2);
4033 SELECT DISTINCT SQL_BIG_RESULT ST_GeomFromGeoJSON('1', 1, ST_SRID(a)) FROM t;
4034 ERROR 22023: Invalid GIS data provided to function st_srid.
4035 DROP TABLE t;
4036 #
4037 # Bug#22912800 ST_ASGEOJSON() DOESN'T WORK WITH SESSION VARIABLES
4038 #
4039 SET @geometry := ST_GeomFromText("POINT(4.9 52.366667)");
4040 SELECT ST_AsGeoJSON(@geometry);
4041 ST_AsGeoJSON(@geometry)
4042 {"type": "Point", "coordinates": [4.9, 52.366667]}
4043 #
4044 # Bug#22930020 INVALID DATA FOR ST_GEOMFROMGEOJSON() IS HARD TO DIAGNOSE
4045 #
4046 CREATE TABLE t1 (col1 JSON);
4047 INSERT INTO t1 (col1) VALUES
4048 ('{ "type": "Feature", "geometry": null, "properties": {} }');
4049 ALTER TABLE t1 ADD COLUMN `col2` geometry
4050 GENERATED ALWAYS AS (ST_GeomFromGeoJSON(col1->'$.geometry')) VIRTUAL;
4051 SELECT * FROM t1;
4052 col1 col2
4053 {"type": "Feature", "geometry": null, "properties": {}} NULL
4054 SELECT ST_GeomFromGeoJSON(CAST('null' AS JSON));
4055 ST_GeomFromGeoJSON(CAST('null' AS JSON))
4056 NULL
4057 SELECT ST_GeomFromGeoJSON('null');
4058 ST_GeomFromGeoJSON('null')
4059 NULL
4060 SELECT ST_GeomFromGeoJSON('Null');
4061 ERROR 22032: Invalid JSON text in argument 1 to function st_geomfromgeojson: "Invalid value." at position 0.
4062 DROP TABLE t1;
4063 #
4064 # WL#8579 Spatial Reference Systems
4065 #
4066 # SRID 0 (should pass)
4067 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT('POINT(0 0)', 0));
4068 ST_ASGEOJSON(ST_GEOMFROMTEXT('POINT(0 0)', 0))
4069 {"type": "Point", "coordinates": [0.0, 0.0]}
4070 SELECT ST_SRID(ST_GEOMFROMGEOJSON(
4071 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
4072 " \"crs\": "
4073 " { \"type\": \"name\", \"properties\": "
4074 " { \"name\": \"urn:ogc:def:crs:OGC:1.3:crs84\" } "
4075 " } "
4076 " }", 1, 0));
4077 ST_SRID(ST_GEOMFROMGEOJSON(
4078 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
4079 " \"crs\": "
4080 " { \"type\": \"name\", \"properties\": "
4081 " { \"name\"
4082 0
4083 # Projected SRS (should pass)
4084 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT('POINT(0 0)', 2000));
4085 ST_ASGEOJSON(ST_GEOMFROMTEXT('POINT(0 0)', 2000))
4086 {"type": "Point", "coordinates": [0.0, 0.0]}
4087 SELECT ST_SRID(ST_GEOMFROMGEOJSON(
4088 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
4089 " \"crs\": "
4090 " { \"type\": \"name\", \"properties\": "
4091 " { \"name\": \"urn:ogc:def:crs:OGC:1.3:crs84\" } "
4092 " } "
4093 " }", 1, 2000));
4094 ST_SRID(ST_GEOMFROMGEOJSON(
4095 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
4096 " \"crs\": "
4097 " { \"type\": \"name\", \"properties\": "
4098 " { \"name\"
4099 2000
4100 # Geographic SRS (should pass)
4101 SELECT ST_ASGEOJSON(ST_GEOMFROMTEXT('POINT(0 0)', 4326));
4102 ST_ASGEOJSON(ST_GEOMFROMTEXT('POINT(0 0)', 4326))
4103 {"type": "Point", "coordinates": [0.0, 0.0]}
4104 SELECT ST_SRID(ST_GEOMFROMGEOJSON(
4105 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
4106 " \"crs\": "
4107 " { \"type\": \"name\", \"properties\": "
4108 " { \"name\": \"urn:ogc:def:crs:OGC:1.3:crs84\" } "
4109 " } "
4110 " }", 1, 4326));
4111 ST_SRID(ST_GEOMFROMGEOJSON(
4112 " { \"type\": \"Point\", \"coordinates\": [10, 20], "
4113 " \"crs\": "
4114 " { \"type\": \"name\", \"properties\": "
4115 " { \"name\"
4116 4326
4117 #
4118 # Bug #26941370 ST_GEOMFROMGEOJSON ALLOWS OUT-OF-RANGE COORDINATES
4119 #
4120 SELECT ST_AsText(
4121 ST_GeomFromGeoJSON('{"type": "Point", "coordinates":[-180.0, 0.0]}')
4122 );
4123 ERROR 22S02: Longitude -180.000000 is out of range in function st_geomfromgeojson. It must be within (-180.000000, 180.000000].
4124 SELECT ST_AsText(
4125 ST_GeomFromGeoJSON('{"type": "Point", "coordinates":[-179.99999999999, 0.0]}')
4126 );
4127 ST_AsText(
4128 ST_GeomFromGeoJSON('{"type": "Point", "coordinates":[-179.99999999999, 0.0]}')
4129 )
4130 POINT(0 -179.99999999999)
4131 SELECT ST_AsText(
4132 ST_GeomFromGeoJSON('{"type": "Point", "coordinates":[180.0, 0.0]}')
4133 );
4134 ST_AsText(
4135 ST_GeomFromGeoJSON('{"type": "Point", "coordinates":[180.0, 0.0]}')
4136 )
4137 POINT(0 180)
4138 SELECT ST_AsText(
4139 ST_GeomFromGeoJSON('{"type": "Point", "coordinates":[180.000000000001, 0.0]}')
4140 );
4141 ERROR 22S02: Longitude 180.000000 is out of range in function st_geomfromgeojson. It must be within (-180.000000, 180.000000].
4142 SELECT ST_AsText(
4143 ST_GeomFromGeoJSON('{"type": "Point", "coordinates":[0.0, -90.000000000001]}')
4144 );
4145 ERROR 22S03: Latitude -90.000000 is out of range in function st_geomfromgeojson. It must be within [-90.000000, 90.000000].
4146 SELECT ST_AsText(
4147 ST_GeomFromGeoJSON('{"type": "Point", "coordinates":[0.0, -90.0]}')
4148 );
4149 ST_AsText(
4150 ST_GeomFromGeoJSON('{"type": "Point", "coordinates":[0.0, -90.0]}')
4151 )
4152 POINT(-90 0)
4153 SELECT ST_AsText(
4154 ST_GeomFromGeoJSON('{"type": "Point", "coordinates":[0.0, 90.0]}')
4155 );
4156 ST_AsText(
4157 ST_GeomFromGeoJSON('{"type": "Point", "coordinates":[0.0, 90.0]}')
4158 )
4159 POINT(90 0)
4160 SELECT ST_AsText(
4161 ST_GeomFromGeoJSON('{"type": "Point", "coordinates":[0.0, 90.0000000000001]}')
4162 );
4163 ERROR 22S03: Latitude 90.000000 is out of range in function st_geomfromgeojson. It must be within [-90.000000, 90.000000].
4164 SELECT ST_SRID(ST_GEOMFROMGEOJSON(
4165 " { \"type\": \"FeatureCollection\", "
4166 " \"features\": "
4167 " [ "
4168 " { \"type\": \"Feature\", \"geometry\": "
4169 " { \"type\": \"Point\", \"coordinates\": "
4170 " [-80.83775386582222, 35.24980190252168] "
4171 " }, "
4172 " \"properties\": "
4173 " { "
4174 " \"name\": \"DOUBLE OAKS CENTER\", "
4175 " \"address\": \"1326 WOODWARD AV\" "
4176 " } "
4177 " }, "
4178 " { \"type\": \"Feature\", \"geometry\": "
4179 " { \"type\": \"Point\", \"coordinates\": "
4180 " [-80.83827000459532, 35.25674709224663] "
4181 " }, "
4182 " \"properties\": "
4183 " { "
4184 " \"name\": \"DOUBLE OAKS NEIGHBORHOOD PARK\", "
4185 " \"address\": \"2605 DOUBLE OAKS RD\" "
4186 " } "
4187 " }, "
4188 " { \"type\": \"Feature\", \"geometry\": "
4189 " null, "
4190 " \"properties\": "
4191 " { "
4192 " \"descr\": \"A NULL/EMPTY POINT\" "
4193 " } "
4194 " }, "
4195 " { \"type\": \"Feature\", \"geometry\": "
4196 " { \"type\": \"Point\", "
4197 " \"crs\": "
4198 " { \"type\": \"name\", \"properties\": "
4199 " { \"name\": \"EPSG:4326\" } "
4200 " }, "
4201 " \"coordinates\": "
4202 " [-87.83827000459532, 42.0] "
4203 " }, "
4204 " \"properties\": "
4205 " { "
4206 " \"name\": \"DOUBLE OAKS NEIGHBORHOOD PARK\", "
4207 " \"address\": \"2605 DOUBLE OAKS RD\" "
4208 " } "
4209 " } "
4210 " ] "
4211 " }")) AS srid;
4212 srid
4213 4326
4214 SELECT ST_SRID(ST_GEOMFROMGEOJSON(
4215 " { \"type\": \"FeatureCollection\", "
4216 " \"features\": "
4217 " [ "
4218 " { \"type\": \"Feature\", \"geometry\": "
4219 " { \"type\": \"Point\", \"coordinates\": "
4220 " [-80.83775386582222, 35.24980190252168] "
4221 " }, "
4222 " \"properties\": "
4223 " { "
4224 " \"name\": \"DOUBLE OAKS CENTER\", "
4225 " \"address\": \"1326 WOODWARD AV\" "
4226 " } "
4227 " }, "
4228 " { \"type\": \"Feature\", \"geometry\": "
4229 " { \"type\": \"Point\", \"coordinates\": "
4230 " [-80.83827000459532, 35.25674709224663] "
4231 " }, "
4232 " \"properties\": "
4233 " { "
4234 " \"name\": \"DOUBLE OAKS NEIGHBORHOOD PARK\", "
4235 " \"address\": \"2605 DOUBLE OAKS RD\" "
4236 " } "
4237 " }, "
4238 " { \"type\": \"Feature\", \"geometry\": "
4239 " null, "
4240 " \"properties\": "
4241 " { "
4242 " \"descr\": \"A NULL/EMPTY POINT\" "
4243 " } "
4244 " }, "
4245 " { \"type\": \"Feature\", \"geometry\": "
4246 " { \"type\": \"Point\", "
4247 " \"crs\": "
4248 " { \"type\": \"name\", \"properties\": "
4249 " { \"name\": \"EPSG:2000\" } "
4250 " }, "
4251 " \"coordinates\": "
4252 " [-87.83827000459532, 42.0] "
4253 " }, "
4254 " \"properties\": "
4255 " { "
4256 " \"name\": \"DOUBLE OAKS NEIGHBORHOOD PARK\", "
4257 " \"address\": \"2605 DOUBLE OAKS RD\" "
4258 " } "
4259 " } "
4260 " ] "
4261 " }")) AS srid;
4262 ERROR HY000: Invalid GeoJSON data provided to function st_geomfromgeojson: Member 'crs' must be specified in the top level object.
4263 #
4264 # Bug#32047630: MISSING ERROR PROPAGATION IN JSON FUNCTIONS
4265 #
4266 SELECT JSON_ARRAY(ST_ASGEOJSON(ST_GEOMFROMTEXT('')), 1);
4267 ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
4268 SELECT JSON_ARRAY(ST_ASGEOJSON(0x00), 1);
4269 ERROR 22023: Invalid GIS data provided to function st_asgeojson.