summaryrefslogtreecommitdiff
path: root/mysql-test/t
diff options
context:
space:
mode:
authorAlexey Botchkov <holyfoot@askmonty.org>2017-01-24 02:29:04 +0400
committerAlexey Botchkov <holyfoot@askmonty.org>2017-01-24 02:29:04 +0400
commit0d107a85b3dd6969e66cc9cb4bd29e1cc92a7d18 (patch)
tree4ea2e72a0886dae95c31ecdc9556b381c4e097d5 /mysql-test/t
parent1f3ad6a4ba63074c51c84dff449c35a8314a7f36 (diff)
downloadmariadb-git-0d107a85b3dd6969e66cc9cb4bd29e1cc92a7d18.tar.gz
MDEV-11042 Implement GeoJSON functions.
ST_AsGeoJSON and ST_GeomFromGeoJSON functions implemented.
Diffstat (limited to 'mysql-test/t')
-rw-r--r--mysql-test/t/gis-json.test28
1 files changed, 28 insertions, 0 deletions
diff --git a/mysql-test/t/gis-json.test b/mysql-test/t/gis-json.test
new file mode 100644
index 00000000000..645c21bf011
--- /dev/null
+++ b/mysql-test/t/gis-json.test
@@ -0,0 +1,28 @@
+-- source include/have_geometry.inc
+
+select st_asgeojson(geomfromtext('POINT(1 1)'));
+select st_asgeojson(geomfromtext('LINESTRING(10 10,20 10,20 20,10 20,10 10)'));
+select st_asgeojson(geomfromtext('POLYGON((10 10,20 10,20 20,10 20,10 10))'));
+select st_asgeojson(geomfromtext('MULTIPOLYGON(((10 10,20 10,20 20,10 20,10 10)))'));
+select st_asgeojson(geomfromtext('multilinestring((10 10,20 10,20 20,10 20,10 10))'));
+select st_asgeojson(geomfromtext('multipoint(10 10,20 10,20 20,10 20,10 10)'));
+select st_asgeojson(st_geomfromtext('GEOMETRYCOLLECTION(POINT(100 0),LINESTRING(101 0,102 1))'));
+
+SELECT st_astext(st_geomfromgeojson('{"type":"point","coordinates":[1,2]}'));
+SELECT st_astext(st_geomfromgeojson('{"type":"LineString","coordinates":[[1,2],[4,5],[7,8]]}'));
+SELECT st_astext(st_geomfromgeojson('{"type": "polygon", "coordinates": [[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]}'));
+SELECT st_astext(st_geomfromgeojson('{"type":"multipoint","coordinates":[[1,2],[4,5],[7,8]]}'));
+SELECT st_astext(st_geomfromgeojson('{"type": "multilinestring", "coordinates": [[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]}'));
+SELECT st_astext(st_geomfromgeojson('{"type": "multipolygon", "coordinates": [[[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]]}'));
+SELECT st_astext(st_geomfromgeojson('{"type": "GeometryCollection", "geometries": [{"type": "Point","coordinates": [100.0, 0.0]}, {"type": "LineString","coordinates": [[101.0, 0.0],[102.0, 1.0]]}]}'));
+
+SELECT st_astext(st_geomfromgeojson('{"type":"point"}'));
+SELECT st_astext(st_geomfromgeojson('{"type":"point"'));
+SELECT st_astext(st_geomfromgeojson('{"type""point"}'));
+
+SELECT st_astext(st_geomfromgeojson('{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] } }'));
+SELECT st_astext(st_geomfromgeojson('{ "type": "FeatureCollection", "features": [{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] }, "properties": { "prop0": "value0" } }]}'));
+
+--echo #
+--echo # End of 10.2 tests
+--echo #