diff options
Diffstat (limited to 'mysql-test/main/gis-precise.result')
-rw-r--r-- | mysql-test/main/gis-precise.result | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/mysql-test/main/gis-precise.result b/mysql-test/main/gis-precise.result index 4e4161c34ec..513d8b6e8c2 100644 --- a/mysql-test/main/gis-precise.result +++ b/mysql-test/main/gis-precise.result @@ -806,3 +806,114 @@ SRID(GEOMETRYFROMTEXT(' MULTIPOINT(8 4,5 0,7 8,6 9,3 4,7 3,5 5) ')))); ASTEXT(ST_BUFFER(POLYGONFROMTEXT(' POLYGON((9 9,5 2,4 5,9 9))'), SRID(GEOMETRYFROMTEXT(' MULTIPOINT(8 4,5 0,7 8,6 9,3 4,7 3,5 5) ')))) POLYGON((9 9,5 2,4 5,9 9)) +# +# MDEV-13467 Feature request: Support for ST_Distance_Sphere() +# +SELECT ST_DISTANCE_SPHERE(); +ERROR 42000: Incorrect parameter count in the call to native function 'ST_DISTANCE_SPHERE' +SELECT ST_DISTANCE_SPHERE(NULL); +ERROR 42000: Incorrect parameter count in the call to native function 'ST_DISTANCE_SPHERE' +SELECT ST_DISTANCE_SPHERE(NULL, NULL); +ST_DISTANCE_SPHERE(NULL, NULL) +NULL +SELECT ST_DISTANCE_SPHERE(NULL, NULL, 3); +ST_DISTANCE_SPHERE(NULL, NULL, 3) +NULL +SELECT ST_DISTANCE_SPHERE(NULL, 1, 3); +ST_DISTANCE_SPHERE(NULL, 1, 3) +NULL +SELECT ST_DISTANCE_SPHERE(1, NULL, 3); +ST_DISTANCE_SPHERE(1, NULL, 3) +NULL +SELECT ST_DISTANCE_SPHERE(1, 1); +ERROR 22023: Invalid GIS data provided to function ST_Distance_Sphere. +SELECT ST_DISTANCE_SPHERE(1, 1, 3); +ERROR 22023: Invalid GIS data provided to function ST_Distance_Sphere. +SELECT ST_DISTANCE_SPHERE(1, 1, NULL); +ST_DISTANCE_SPHERE(1, 1, NULL) +NULL +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 0)'), ST_GEOMFROMTEXT('LINESTRING(0 0, 1 1)')); +ERROR HY000: Internal error: st_distance_sphere +# Test Points and radius +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)')); +ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)')) +157249.0357231545 +SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(-1 -1)'), ST_GEOMFROMTEXT('POINT(-2 -2)')), 10); +TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(-1 -1)'), ST_GEOMFROMTEXT('POINT(-2 -2)')), 10) +157225.0865419108 +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'), 1); +ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'), 1) +0.024682056391766436 +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'), 0); +ERROR HY000: Internal error: Radius must be greater than zero. +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'), -1); +ERROR HY000: Internal error: Radius must be greater than zero. +# Test longitude/lattitude +SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 1)'), ST_GEOMFROMTEXT('POINT(1 2)')), 10); +TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 1)'), ST_GEOMFROMTEXT('POINT(1 2)')), 10) +157225.0865419108 +SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 1)'), ST_GEOMFROMTEXT('POINT(2 1)')), 10); +TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 1)'), ST_GEOMFROMTEXT('POINT(2 1)')), 10) +222355.4901806686 +SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 0)'), ST_GEOMFROMTEXT('POINT(1 2)')), 10); +TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 0)'), ST_GEOMFROMTEXT('POINT(1 2)')), 10) +222389.3645969269 +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 0)'), ST_GEOMFROMTEXT('POINT(2 1)')); +ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 0)'), ST_GEOMFROMTEXT('POINT(2 1)')) +157249.0357231545 +# Test Points - Multipoints +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(1 1)')); +ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(1 1)')) +157249.0357231545 +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 1)'), ST_GEOMFROMTEXT('POINT(0 0)')); +ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 1)'), ST_GEOMFROMTEXT('POINT(0 0)')) +157249.0357231545 +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(1 1,2 2)')); +ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(1 1,2 2)')) +157249.0357231545 +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(2 2,1 1)')); +ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(2 2,1 1)')) +157249.0357231545 +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(1 1,2 2)'), 1); +ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(1 1,2 2)'), 1) +0.024682056391766436 +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(2 2,1 1)'), 1); +ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(2 2,1 1)'), 1) +0.024682056391766436 +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(2 2, 1 1, 3 4)'), 1); +ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(2 2, 1 1, 3 4)'), 1) +0.024682056391766436 +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(2 2, 1 1,5 6)'), 1); +ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(2 2, 1 1,5 6)'), 1) +0.024682056391766436 +# Test Multipoints - Multipoints +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(3 4,8 9 )'), ST_GEOMFROMTEXT('MULTIPOINT(3 4,8 9 )')); +ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(3 4,8 9 )'), ST_GEOMFROMTEXT('MULTIPOINT(3 4,8 9 )')) +0 +SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(3 4,8 9 )')), 10); +TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(3 4,8 9 )')), 10) +314282.5644496733 +SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(8 9,3 4 )')), 10); +TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(8 9,3 4 )')), 10) +314282.5644496733 +SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(8 9,3 4 )'),1), 17); +TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(8 9,3 4 )'),1), 17) +0.04933028646581131 +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(8 9,3 4 )'),0); +ERROR HY000: Internal error: Radius must be greater than zero. +set @pt1 = ST_GeomFromText('POINT(190 -30)'); +set @pt2 = ST_GeomFromText('POINT(-30 50)'); +SELECT ST_Distance_Sphere(@pt1, @pt2); +ERROR HY000: Out of range error: Longitude should be [-180,180] in function ST_Distance_Sphere. +set @pt1 = ST_GeomFromText('POINT(135 -30)'); +set @pt2 = ST_GeomFromText('POINT(-30 91)'); +SELECT ST_Distance_Sphere(@pt1, @pt2); +ERROR HY000: Out of range error: Latitude should be [-90,90] in function ST_Distance_Sphere. +set @zenica = ST_GeomFromText('POINT(17.907743 44.203438)'); +set @sarajevo = ST_GeomFromText('POINT(18.413076 43.856258)'); +SELECT TRUNCATE(ST_Distance_Sphere(@zenica, @sarajevo), 10); +TRUNCATE(ST_Distance_Sphere(@zenica, @sarajevo), 10) +55878.5933759170 +SELECT TRUNCATE(ST_Distance_Sphere(@sarajevo, @zenica), 10); +TRUNCATE(ST_Distance_Sphere(@sarajevo, @zenica), 10) +55878.5933759170 |