# valid characters
SELECT ST_LONGFROMGEOHASH("0");
ST_LONGFROMGEOHASH("0")
-158
SELECT ST_LONGFROMGEOHASH("z");
ST_LONGFROMGEOHASH("z")
158
SELECT ST_LONGFROMGEOHASH("0z");
ST_LONGFROMGEOHASH("0z")
-141
SELECT ST_LONGFROMGEOHASH("upbp");
ST_LONGFROMGEOHASH("upbp")
0
SELECT ST_LONGFROMGEOHASH("h000");
ST_LONGFROMGEOHASH("h000")
0
SELECT ST_LONGFROMGEOHASH("s000");
ST_LONGFROMGEOHASH("s000")
0
SELECT ST_LONGFROMGEOHASH("0123456789");
ST_LONGFROMGEOHASH("0123456789")
-179.55743
SELECT ST_LONGFROMGEOHASH("9876543210");
ST_LONGFROMGEOHASH("9876543210")
-107.79609
SELECT ST_LONGFROMGEOHASH("bcdefghjkmnpqrstuvwxyz");
ST_LONGFROMGEOHASH("bcdefghjkmnpqrstuvwxyz")
-142.6078415216915
SELECT ST_LONGFROMGEOHASH("zyxwvutsrqpnmkjhgfedcb");
ST_LONGFROMGEOHASH("zyxwvutsrqpnmkjhgfedcb")
179.55743439816956
SELECT ST_LONGFROMGEOHASH("zzzzzzzzzzzzzzzzzzzz");
ST_LONGFROMGEOHASH("zzzzzzzzzzzzzzzzzzzz")
180
SELECT ST_LONGFROMGEOHASH("pbpbpbpbpbpbpbpbpbpb");
ST_LONGFROMGEOHASH("pbpbpbpbpbpbpbpbpbpb")
180
SELECT ST_LONGFROMGEOHASH("bpbpbpbpbpbpbpbpbpbp");
ST_LONGFROMGEOHASH("bpbpbpbpbpbpbpbpbpbp")
-180
SELECT ST_LONGFROMGEOHASH("00000000000000000000");
ST_LONGFROMGEOHASH("00000000000000000000")
-180
SELECT ST_LONGFROMGEOHASH("rzzzzzzzzzzzzzzzzzzz");
ST_LONGFROMGEOHASH("rzzzzzzzzzzzzzzzzzzz")
180
SELECT ST_LONGFROMGEOHASH("2pbpbpbpbpbpbpbpbpbp");
ST_LONGFROMGEOHASH("2pbpbpbpbpbpbpbpbpbp")
-180
SELECT ST_LONGFROMGEOHASH("7zzzzzzzzzzzzzzzzzzz");
ST_LONGFROMGEOHASH("7zzzzzzzzzzzzzzzzzzz")
0
SELECT ST_LONGFROMGEOHASH("gzzzzzzzzzzzzzzzzzzz");
ST_LONGFROMGEOHASH("gzzzzzzzzzzzzzzzzzzz")
0
SELECT ST_LONGFROMGEOHASH("5bpbpbpbpbpbpbpbpbpb");
ST_LONGFROMGEOHASH("5bpbpbpbpbpbpbpbpbpb")
0
SELECT ST_LONGFROMGEOHASH("0000000000zzzzzzzzzz");
ST_LONGFROMGEOHASH("0000000000zzzzzzzzzz")
-179.999989271164
SELECT ST_LONGFROMGEOHASH("zzzzzzzzzz0000000000");
ST_LONGFROMGEOHASH("zzzzzzzzzz0000000000")
179.999989271164
SELECT ST_LONGFROMGEOHASH("s000000001z7wsg7zzm6");
ST_LONGFROMGEOHASH("s000000001z7wsg7zzm6")
0.00001
SELECT ST_LONGFROMGEOHASH("kpbpbpbpbnpkqe5kpbtm");
ST_LONGFROMGEOHASH("kpbpbpbpbnpkqe5kpbtm")
0.00001
SELECT ST_LONGFROMGEOHASH("ebpbpbpbpcbe9kuebp6d");
ST_LONGFROMGEOHASH("ebpbpbpbpcbe9kuebp6d")
-0.00001
SELECT ST_LONGFROMGEOHASH("7zzzzzzzzy0s37hs00dt");
ST_LONGFROMGEOHASH("7zzzzzzzzy0s37hs00dt")
-0.00001
SELECT ST_LONGFROMGEOHASH("tzzzzzzzzzzzzzzzzzzz");
ST_LONGFROMGEOHASH("tzzzzzzzzzzzzzzzzzzz")
90
SELECT ST_LONGFROMGEOHASH("jzzzzzzzzzzzzzzzzzzz");
ST_LONGFROMGEOHASH("jzzzzzzzzzzzzzzzzzzz")
90
SELECT ST_LONGFROMGEOHASH("9zzzzzzzzzzzzzzzzzzz");
ST_LONGFROMGEOHASH("9zzzzzzzzzzzzzzzzzzz")
-90
SELECT ST_LONGFROMGEOHASH("1zzzzzzzzzzzzzzzzzzz");
ST_LONGFROMGEOHASH("1zzzzzzzzzzzzzzzzzzz")
-90
SELECT ST_LONGFROMGEOHASH("ypzpgxczbzurypzpgxcz");
ST_LONGFROMGEOHASH("ypzpgxczbzurypzpgxcz")
100
SELECT ST_LONGFROMGEOHASH("czbzurypzpgxczbzuryp");
ST_LONGFROMGEOHASH("czbzurypzpgxczbzuryp")
-100
SELECT ST_LONGFROMGEOHASH("0z0z0z0z0z0z0z0z0z0z0z0z0z0z0z0z");
ST_LONGFROMGEOHASH("0z0z0z0z0z0z0z0z0z0z0z0z0z0z0z0z")
-145.16129032258067
SELECT ST_LONGFROMGEOHASH("0123456789bcdefghjkmnpqrstuvwxyz");
ST_LONGFROMGEOHASH("0123456789bcdefghjkmnpqrstuvwxyz")
-179.55743439816956
SELECT ST_LONGFROMGEOHASH("0123456789BCDEFGHJKMNPQRSTUVWXYZ");
ST_LONGFROMGEOHASH("0123456789BCDEFGHJKMNPQRSTUVWXYZ")
-179.55743439816956
SELECT ST_LONGFROMGEOHASH("zyxwvutsrqpnmkjhgfedcb9876543210");
ST_LONGFROMGEOHASH("zyxwvutsrqpnmkjhgfedcb9876543210")
179.55743439816956
SELECT ST_LONGFROMGEOHASH("ZYXWVUTSRQPNMKJHGFEDCB9876543210");
ST_LONGFROMGEOHASH("ZYXWVUTSRQPNMKJHGFEDCB9876543210")
179.55743439816956
SELECT ST_LONGFROMGEOHASH("1e1");
ST_LONGFROMGEOHASH("1e1")
-110
SELECT ST_LONGFROMGEOHASH("100");
ST_LONGFROMGEOHASH("100")
-134
SELECT ST_LONGFROMGEOHASH(CAST(100 AS CHAR));
ST_LONGFROMGEOHASH(CAST(100 AS CHAR))
-134
SELECT ST_LONGFROMGEOHASH("10111000110001111001");
ST_LONGFROMGEOHASH("10111000110001111001")
-133.549761770805
SELECT ST_LONGFROMGEOHASH("11111111111111111111");
ST_LONGFROMGEOHASH("11111111111111111111")
-133.548387096774
SELECT ST_LONGFROMGEOHASH("99999999999999999999");
ST_LONGFROMGEOHASH("99999999999999999999")
-110.3225806451612
SELECT ST_LONGFROMGEOHASH(CAST("012" AS BINARY));
ST_LONGFROMGEOHASH(CAST("012" AS BINARY))
-179
SELECT ST_LONGFROMGEOHASH(NULL);
ST_LONGFROMGEOHASH(NULL)
NULL
SELECT ST_LONGFROMGEOHASH(null);
ST_LONGFROMGEOHASH(null)
NULL
# invalid characters and inputs
SELECT ST_LONGFROMGEOHASH("0123a45");
ERROR HY000: Incorrect geohash value: '0123a45' for function st_longfromgeohash
SELECT ST_LONGFROMGEOHASH("xyzi");
ERROR HY000: Incorrect geohash value: 'xyzi' for function st_longfromgeohash
SELECT ST_LONGFROMGEOHASH("zyxLwv");
ERROR HY000: Incorrect geohash value: 'zyxLwv' for function st_longfromgeohash
SELECT ST_LONGFROMGEOHASH("bcdjo");
ERROR HY000: Incorrect geohash value: 'bcdjo' for function st_longfromgeohash
SELECT ST_LONGFROMGEOHASH("zyx**wv");
ERROR HY000: Incorrect geohash value: 'zyx**wv' for function st_longfromgeohash
SELECT ST_LONGFROMGEOHASH("1 2 3 4");
ERROR HY000: Incorrect geohash value: '1 2 3 4' for function st_longfromgeohash
SELECT ST_LONGFROMGEOHASH("1''2345");
ERROR HY000: Incorrect geohash value: '1''2345' for function st_longfromgeohash
SELECT ST_LONGFROMGEOHASH("12.345");
ERROR HY000: Incorrect geohash value: '12.345' for function st_longfromgeohash
SELECT ST_LONGFROMGEOHASH("   ");
ERROR HY000: Incorrect geohash value: '   ' for function st_longfromgeohash
SELECT ST_LONGFROMGEOHASH("NULL");
ERROR HY000: Incorrect geohash value: 'NULL' for function st_longfromgeohash
SELECT ST_LONGFROMGEOHASH("0a 0d");
ERROR HY000: Incorrect geohash value: '0a 0d' for function st_longfromgeohash
SELECT ST_LONGFROMGEOHASH("-100");
ERROR HY000: Incorrect geohash value: '-100' for function st_longfromgeohash
SELECT ST_LONGFROMGEOHASH("");
ERROR HY000: Incorrect geohash value: '' for function st_longfromgeohash
SELECT ST_LONGFROMGEOHASH(9876543210);
ERROR 22023: Invalid GIS data provided to function ST_LongFromGeoHas.
SELECT ST_LONGFROMGEOHASH(0123456789);
ERROR 22023: Invalid GIS data provided to function ST_LongFromGeoHas.
SELECT ST_LONGFROMGEOHASH(1e1);
ERROR 22023: Invalid GIS data provided to function ST_LongFromGeoHas.
SELECT ST_LONGFROMGEOHASH();
ERROR 42000: Incorrect parameter count in the call to native function 'ST_LONGFROMGEOHASH'
SELECT ST_LONGFROMGEOHASH("123","456");
ERROR 42000: Incorrect parameter count in the call to native function 'ST_LONGFROMGEOHASH'
SELECT ST_LONGFROMGEOHASH("123",);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 1
SELECT ST_LONGFROMGEOHASH(,"456");
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '"456")' at line 1
SELECT ST_LONGFROMGEOHASH(,);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 1
SELECT ST_LONGFROMGEOHASH("0123456"789);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '789)' at line 1
SELECT ST_LONGFROMGEOHASH(abcdef);
ERROR 42S22: Unknown column 'abcdef' in 'SELECT'
# very long geohash
SELECT ST_LONGFROMGEOHASH("0123456789bcdefghjkmnpqrstuvwxyz0123456789bcdefghjkm"
                          "npqrstuvwxyz0123456789bcdefghjkmnpqrstuvwxyz01234567"
                          "89bcdefghjkmnpqrstuvwxyz") c;
c
-179.55743439816956
SELECT ST_LONGFROMGEOHASH("0123456789BCDEFGHJKMNPQRSTUVWXYZ0123456789BCDEFGHJKM"
                          "NPQRSTUVWXYZ0123456789BCDEFGHJKMNPQRSTUVWXYZ01234567"
                          "89BCDEFGHJKMNPQRSTUVWXYZ") c;
c
-179.55743439816956
SELECT ST_LONGFROMGEOHASH("zyxwvutsrqpnmkjhgfedcb9876543210zyxwvutsrqpnmkjhgfed"
                          "cb9876543210zyxwvutsrqpnmkjhgfedcb9876543210zyxwvuts"
                          "rqpnmkjhgfedcb9876543210") c;
c
179.55743439816956
SELECT ST_LONGFROMGEOHASH("ZYXWVUTSRQPNMKJHGFEDCB9876543210ZYXWVUTSRQPNMKJHGFED"
                          "CB9876543210ZYXWVUTSRQPNMKJHGFEDCB9876543210ZYXWVUTS"
                          "RQPNMKJHGFEDCB9876543210") c;
c
179.55743439816956
CREATE TABLE geohashes  (gid INT NOT NULL PRIMARY KEY, hash_value VARCHAR(255));
INSERT INTO geohashes VALUES
(1, "000000000000000000000"),
(2, "zzzzzzzzzzzzzzzzzzzzz"),
(3, NULL),
(4, "s00t"),
(5, "7zzzm"),
(6, "s00d"),
(7, "0"),
(8, "z"),
(9, "3ejh6z75ddt2d839zh2u"),
(10, "twtsuqg3q7vh3nrbt0nn"),
(11, "yw8s10dxddhe4s06nsph"),
(12, "h4g4h9yrjtgzvewxm0ru"),
(13, "9kqbredcnhq1b44ue48s"),
(14, "1pckwjkqw3km0v6ye5d2"),
(15, "wm313fnr92ggsysm64e6"),
(16, "vqghx20fx6d8r5vfkbgf"),
(17, "wvetm3u23kr9r6663k31"),
(18, "e5t2p7sk291vpyb08pwu");
# different random geohash values
SELECT ST_LONGFROMGEOHASH(hash_value) FROM geohashes;
ST_LONGFROMGEOHASH(hash_value)
-180
180
NULL
1
-0.1
1
-158
158
-105.343666081393
75.4258807526218
113.2506169687463
4.4253282778628
-113.9241805635394
-132.9724051824284
102.7417962437673
60.7886982739903
128.908488386749
-37.292723368146
# valid characters
SELECT ST_LATFROMGEOHASH("0");
ST_LATFROMGEOHASH("0")
-68
SELECT ST_LATFROMGEOHASH("z");
ST_LATFROMGEOHASH("z")
68
SELECT ST_LATFROMGEOHASH("0z");
ST_LATFROMGEOHASH("0z")
-48
SELECT ST_LATFROMGEOHASH("xbpb");
ST_LATFROMGEOHASH("xbpb")
0
SELECT ST_LATFROMGEOHASH("8000");
ST_LATFROMGEOHASH("8000")
0
SELECT ST_LATFROMGEOHASH("s000");
ST_LATFROMGEOHASH("s000")
0
SELECT ST_LATFROMGEOHASH("0123456789");
ST_LATFROMGEOHASH("0123456789")
-82.774507
SELECT ST_LATFROMGEOHASH("9876543210");
ST_LATFROMGEOHASH("9876543210")
1.770175
SELECT ST_LATFROMGEOHASH("bcdefghjkmnpqrstuvwxyz");
ST_LATFROMGEOHASH("bcdefghjkmnpqrstuvwxyz")
54.11408847964353
SELECT ST_LATFROMGEOHASH("zyxwvutsrqpnmkjhgfedcb");
ST_LATFROMGEOHASH("zyxwvutsrqpnmkjhgfedcb")
82.77450549262497
SELECT ST_LATFROMGEOHASH("zzzzzzzzzzzzzzzzzzzz");
ST_LATFROMGEOHASH("zzzzzzzzzzzzzzzzzzzz")
90
SELECT ST_LATFROMGEOHASH("bpbpbpbpbpbpbpbpbpbp");
ST_LATFROMGEOHASH("bpbpbpbpbpbpbpbpbpbp")
90
SELECT ST_LATFROMGEOHASH("pbpbpbpbpbpbpbpbpbpb");
ST_LATFROMGEOHASH("pbpbpbpbpbpbpbpbpbpb")
-90
SELECT ST_LATFROMGEOHASH("00000000000000000000");
ST_LATFROMGEOHASH("00000000000000000000")
-90
SELECT ST_LATFROMGEOHASH("gzzzzzzzzzzzzzzzzzzz");
ST_LATFROMGEOHASH("gzzzzzzzzzzzzzzzzzzz")
90
SELECT ST_LATFROMGEOHASH("5bpbpbpbpbpbpbpbpbpb");
ST_LATFROMGEOHASH("5bpbpbpbpbpbpbpbpbpb")
-90
SELECT ST_LATFROMGEOHASH("7zzzzzzzzzzzzzzzzzzz");
ST_LATFROMGEOHASH("7zzzzzzzzzzzzzzzzzzz")
0
SELECT ST_LATFROMGEOHASH("rzzzzzzzzzzzzzzzzzzz");
ST_LATFROMGEOHASH("rzzzzzzzzzzzzzzzzzzz")
0
SELECT ST_LATFROMGEOHASH("2pbpbpbpbpbpbpbpbpbp");
ST_LATFROMGEOHASH("2pbpbpbpbpbpbpbpbpbp")
0
SELECT ST_LATFROMGEOHASH("0000000000zzzzzzzzzz");
ST_LATFROMGEOHASH("0000000000zzzzzzzzzz")
-89.999994635582
SELECT ST_LATFROMGEOHASH("zzzzzzzzzz0000000000");
ST_LATFROMGEOHASH("zzzzzzzzzz0000000000")
89.999994635582
SELECT ST_LATFROMGEOHASH("s000000001z7wsg7zzm6");
ST_LATFROMGEOHASH("s000000001z7wsg7zzm6")
0.00001
SELECT ST_LATFROMGEOHASH("ebpbpbpbpcbe9kuebp6d");
ST_LATFROMGEOHASH("ebpbpbpbpcbe9kuebp6d")
0.00001
SELECT ST_LATFROMGEOHASH("kpbpbpbpbnpkqe5kpbtm");
ST_LATFROMGEOHASH("kpbpbpbpbnpkqe5kpbtm")
-0.00001
SELECT ST_LATFROMGEOHASH("7zzzzzzzzy0s37hs00dt");
ST_LATFROMGEOHASH("7zzzzzzzzy0s37hs00dt")
-0.00001
SELECT ST_LATFROMGEOHASH("tzzzzzzzzzzzzzzzzzzz");
ST_LATFROMGEOHASH("tzzzzzzzzzzzzzzzzzzz")
45
SELECT ST_LATFROMGEOHASH("9zzzzzzzzzzzzzzzzzzz");
ST_LATFROMGEOHASH("9zzzzzzzzzzzzzzzzzzz")
45
SELECT ST_LATFROMGEOHASH("jzzzzzzzzzzzzzzzzzzz");
ST_LATFROMGEOHASH("jzzzzzzzzzzzzzzzzzzz")
-45
SELECT ST_LATFROMGEOHASH("1zzzzzzzzzzzzzzzzzzz");
ST_LATFROMGEOHASH("1zzzzzzzzzzzzzzzzzzz")
-45
SELECT ST_LATFROMGEOHASH("zbzurypzpgxczbzurypz");
ST_LATFROMGEOHASH("zbzurypzpgxczbzurypz")
50
SELECT ST_LATFROMGEOHASH("5zpgxczbzurypzpgxczb");
ST_LATFROMGEOHASH("5zpgxczbzurypzpgxczb")
-50
SELECT ST_LATFROMGEOHASH("0z0z0z0z0z0z0z0z0z0z0z0z0z0z0z0z");
ST_LATFROMGEOHASH("0z0z0z0z0z0z0z0z0z0z0z0z0z0z0z0z")
-49.35483870967742
SELECT ST_LATFROMGEOHASH("0123456789bcdefghjkmnpqrstuvwxyz");
ST_LATFROMGEOHASH("0123456789bcdefghjkmnpqrstuvwxyz")
-82.77450549262497
SELECT ST_LATFROMGEOHASH("0123456789BCDEFGHJKMNPQRSTUVWXYZ");
ST_LATFROMGEOHASH("0123456789BCDEFGHJKMNPQRSTUVWXYZ")
-82.77450549262497
SELECT ST_LATFROMGEOHASH("zyxwvutsrqpnmkjhgfedcb9876543210");
ST_LATFROMGEOHASH("zyxwvutsrqpnmkjhgfedcb9876543210")
82.77450549262497
SELECT ST_LATFROMGEOHASH("ZYXWVUTSRQPNMKJHGFEDCB9876543210");
ST_LATFROMGEOHASH("ZYXWVUTSRQPNMKJHGFEDCB9876543210")
82.77450549262497
SELECT ST_LATFROMGEOHASH("1e1");
ST_LATFROMGEOHASH("1e1")
-72
SELECT ST_LATFROMGEOHASH("100");
ST_LATFROMGEOHASH("100")
-89
SELECT ST_LATFROMGEOHASH(CAST(100 AS CHAR));
ST_LATFROMGEOHASH(CAST(100 AS CHAR))
-89
SELECT ST_LATFROMGEOHASH("10111000110001111001");
ST_LATFROMGEOHASH("10111000110001111001")
-89.8242133801793
SELECT ST_LATFROMGEOHASH("11111111111111111111");
ST_LATFROMGEOHASH("11111111111111111111")
-84.1935483870967
SELECT ST_LATFROMGEOHASH("99999999999999999999");
ST_LATFROMGEOHASH("99999999999999999999")
8.7096774193548
SELECT ST_LATFROMGEOHASH(NULL);
ST_LATFROMGEOHASH(NULL)
NULL
SELECT ST_LATFROMGEOHASH(null);
ST_LATFROMGEOHASH(null)
NULL
SELECT ST_LATFROMGEOHASH(CAST("012" AS BINARY));
ST_LATFROMGEOHASH(CAST("012" AS BINARY))
-82
# invalid characters and inputs
SELECT ST_LATFROMGEOHASH("0123a45");
ERROR HY000: Incorrect geohash value: '0123a45' for function st_latfromgeohash
SELECT ST_LATFROMGEOHASH("xyzi");
ERROR HY000: Incorrect geohash value: 'xyzi' for function st_latfromgeohash
SELECT ST_LATFROMGEOHASH("zyxLwv");
ERROR HY000: Incorrect geohash value: 'zyxLwv' for function st_latfromgeohash
SELECT ST_LATFROMGEOHASH("bcdjo");
ERROR HY000: Incorrect geohash value: 'bcdjo' for function st_latfromgeohash
SELECT ST_LATFROMGEOHASH("zyx**wv");
ERROR HY000: Incorrect geohash value: 'zyx**wv' for function st_latfromgeohash
SELECT ST_LATFROMGEOHASH("1 2 3 4");
ERROR HY000: Incorrect geohash value: '1 2 3 4' for function st_latfromgeohash
SELECT ST_LATFROMGEOHASH("1''2345");
ERROR HY000: Incorrect geohash value: '1''2345' for function st_latfromgeohash
SELECT ST_LATFROMGEOHASH("12.345");
ERROR HY000: Incorrect geohash value: '12.345' for function st_latfromgeohash
SELECT ST_LATFROMGEOHASH("   ");
ERROR HY000: Incorrect geohash value: '   ' for function st_latfromgeohash
SELECT ST_LATFROMGEOHASH("NULL");
ERROR HY000: Incorrect geohash value: 'NULL' for function st_latfromgeohash
SELECT ST_LATFROMGEOHASH("-100");
ERROR HY000: Incorrect geohash value: '-100' for function st_latfromgeohash
SELECT ST_LATFROMGEOHASH("");
ERROR HY000: Incorrect geohash value: '' for function st_latfromgeohash
SELECT ST_LATFROMGEOHASH(9876543210);
ERROR 22023: Invalid GIS data provided to function ST_LatFromGeohash.
SELECT ST_LATFROMGEOHASH(0123456789);
ERROR 22023: Invalid GIS data provided to function ST_LatFromGeohash.
SELECT ST_LATFROMGEOHASH(1e1);
ERROR 22023: Invalid GIS data provided to function ST_LatFromGeohash.
SELECT ST_LATFROMGEOHASH();
ERROR 42000: Incorrect parameter count in the call to native function 'ST_LATFROMGEOHASH'
SELECT ST_LATFROMGEOHASH("123","456");
ERROR 42000: Incorrect parameter count in the call to native function 'ST_LATFROMGEOHASH'
SELECT ST_LATFROMGEOHASH("123",);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 1
SELECT ST_LATFROMGEOHASH(,"456");
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '"456")' at line 1
SELECT ST_LATFROMGEOHASH(,);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 1
SELECT ST_LATFROMGEOHASH("0123456"789);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '789)' at line 1
SELECT ST_LATFROMGEOHASH(abcdef);
ERROR 42S22: Unknown column 'abcdef' in 'SELECT'
# very long geohash
SELECT ST_LATFROMGEOHASH("0123456789bcdefghjkmnpqrstuvwxyz0123456789bcdefghjkmn"
                         "pqrstuvwxyz0123456789bcdefghjkmnpqrstuvwxyz0123456789"
                         "bcdefghjkmnpqrstuvwxyz") c;
c
-82.77450549262497
SELECT ST_LATFROMGEOHASH("0123456789BCDEFGHJKMNPQRSTUVWXYZ0123456789BCDEFGHJKMN"
                         "PQRSTUVWXYZ0123456789BCDEFGHJKMNPQRSTUVWXYZ0123456789"
                         "BCDEFGHJKMNPQRSTUVWXYZ") c;
c
-82.77450549262497
SELECT ST_LATFROMGEOHASH("zyxwvutsrqpnmkjhgfedcb9876543210zyxwvutsrqpnmkjhgfedc"
                         "b9876543210zyxwvutsrqpnmkjhgfedcb9876543210zyxwvutsrq"
                         "pnmkjhgfedcb9876543210") c;
c
82.77450549262497
SELECT ST_LATFROMGEOHASH("ZYXWVUTSRQPNMKJHGFEDCB9876543210ZYXWVUTSRQPNMKJHGFEDC"
                         "B9876543210ZYXWVUTSRQPNMKJHGFEDCB9876543210ZYXWVUTSRQ"
                         "PNMKJHGFEDCB9876543210") c;
c
82.77450549262497
# different random geohash values
SELECT ST_LATFROMGEOHASH(hash_value) FROM geohashes;
ST_LATFROMGEOHASH(hash_value)
-90
90
NULL
1
-0.1
0.4
-68
68
-27.3374899367448
37.4347752334972
82.269670295412
-74.168840669129
23.9696161514665
-45.5852718924236
29.763254995923
83.7602082514146
31.8700305354552
19.7074618731612
# valid characters
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("0", 0));
ST_ASTEXT(ST_POINTFROMGEOHASH("0", 0))
POINT(-158 -68)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("z", 0));
ST_ASTEXT(ST_POINTFROMGEOHASH("z", 0))
POINT(158 68)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("0z", 0));
ST_ASTEXT(ST_POINTFROMGEOHASH("0z", 0))
POINT(-141 -48)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("xbpb", 0));
ST_ASTEXT(ST_POINTFROMGEOHASH("xbpb", 0))
POINT(180 0)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("8000", 0));
ST_ASTEXT(ST_POINTFROMGEOHASH("8000", 0))
POINT(-180 0)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("s000", 0));
ST_ASTEXT(ST_POINTFROMGEOHASH("s000", 0))
POINT(0 0)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("0123456789", 0));
ST_ASTEXT(ST_POINTFROMGEOHASH("0123456789", 0))
POINT(-179.55743 -82.774507)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("9876543210", 0));
ST_ASTEXT(ST_POINTFROMGEOHASH("9876543210", 0))
POINT(-107.79609 1.770175)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("bcdefghjkmnpqrstuvwxyz", 0));
ST_ASTEXT(ST_POINTFROMGEOHASH("bcdefghjkmnpqrstuvwxyz", 0))
POINT(-142.6078415216915 54.11408847964353)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("zyxwvutsrqpnmkjhgfedcb", 0));
ST_ASTEXT(ST_POINTFROMGEOHASH("zyxwvutsrqpnmkjhgfedcb", 0))
POINT(179.55743439816956 82.77450549262497)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("zzzzzzzzzzzzzzzzzzzz", 0));
ST_ASTEXT(ST_POINTFROMGEOHASH("zzzzzzzzzzzzzzzzzzzz", 0))
POINT(180 90)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("bpbpbpbpbpbpbpbpbpbp", 0));
ST_ASTEXT(ST_POINTFROMGEOHASH("bpbpbpbpbpbpbpbpbpbp", 0))
POINT(-180 90)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("pbpbpbpbpbpbpbpbpbpb", 0));
ST_ASTEXT(ST_POINTFROMGEOHASH("pbpbpbpbpbpbpbpbpbpb", 0))
POINT(180 -90)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("00000000000000000000", 0));
ST_ASTEXT(ST_POINTFROMGEOHASH("00000000000000000000", 0))
POINT(-180 -90)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("gzzzzzzzzzzzzzzzzzzz", 0));
ST_ASTEXT(ST_POINTFROMGEOHASH("gzzzzzzzzzzzzzzzzzzz", 0))
POINT(0 90)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("5bpbpbpbpbpbpbpbpbpb", 0));
ST_ASTEXT(ST_POINTFROMGEOHASH("5bpbpbpbpbpbpbpbpbpb", 0))
POINT(0 -90)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("7zzzzzzzzzzzzzzzzzzz", 0));
ST_ASTEXT(ST_POINTFROMGEOHASH("7zzzzzzzzzzzzzzzzzzz", 0))
POINT(0 0)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("rzzzzzzzzzzzzzzzzzzz", 0));
ST_ASTEXT(ST_POINTFROMGEOHASH("rzzzzzzzzzzzzzzzzzzz", 0))
POINT(180 0)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("2pbpbpbpbpbpbpbpbpbp", 0));
ST_ASTEXT(ST_POINTFROMGEOHASH("2pbpbpbpbpbpbpbpbpbp", 0))
POINT(-180 0)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("0000000000zzzzzzzzzz", 0));
ST_ASTEXT(ST_POINTFROMGEOHASH("0000000000zzzzzzzzzz", 0))
POINT(-179.999989271164 -89.999994635582)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("zzzzzzzzzz0000000000", 0));
ST_ASTEXT(ST_POINTFROMGEOHASH("zzzzzzzzzz0000000000", 0))
POINT(179.999989271164 89.999994635582)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("s000000001z7wsg7zzm6", 0));
ST_ASTEXT(ST_POINTFROMGEOHASH("s000000001z7wsg7zzm6", 0))
POINT(0.00001 0.00001)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("ebpbpbpbpcbe9kuebp6d", 0));
ST_ASTEXT(ST_POINTFROMGEOHASH("ebpbpbpbpcbe9kuebp6d", 0))
POINT(-0.00001 0.00001)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("kpbpbpbpbnpkqe5kpbtm", 0));
ST_ASTEXT(ST_POINTFROMGEOHASH("kpbpbpbpbnpkqe5kpbtm", 0))
POINT(0.00001 -0.00001)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("7zzzzzzzzy0s37hs00dt", 0));
ST_ASTEXT(ST_POINTFROMGEOHASH("7zzzzzzzzy0s37hs00dt", 0))
POINT(-0.00001 -0.00001)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("tzzzzzzzzzzzzzzzzzzz", 0));
ST_ASTEXT(ST_POINTFROMGEOHASH("tzzzzzzzzzzzzzzzzzzz", 0))
POINT(90 45)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("9zzzzzzzzzzzzzzzzzzz", 0));
ST_ASTEXT(ST_POINTFROMGEOHASH("9zzzzzzzzzzzzzzzzzzz", 0))
POINT(-90 45)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("jzzzzzzzzzzzzzzzzzzz", 0));
ST_ASTEXT(ST_POINTFROMGEOHASH("jzzzzzzzzzzzzzzzzzzz", 0))
POINT(90 -45)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("1zzzzzzzzzzzzzzzzzzz", 0));
ST_ASTEXT(ST_POINTFROMGEOHASH("1zzzzzzzzzzzzzzzzzzz", 0))
POINT(-90 -45)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("zbzurypzpgxczbzurypz", 0));
ST_ASTEXT(ST_POINTFROMGEOHASH("zbzurypzpgxczbzurypz", 0))
POINT(180 50)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("5zpgxczbzurypzpgxczb", 0));
ST_ASTEXT(ST_POINTFROMGEOHASH("5zpgxczbzurypzpgxczb", 0))
POINT(0 -50)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("0z0z0z0z0z0z0z0z0z0z0z0z0z0z0z0z", 0)) c;
c
POINT(-145.16129032258067 -49.35483870967742)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("0123456789bcdefghjkmnpqrstuvwxyz", 0)) c;
c
POINT(-179.55743439816956 -82.77450549262497)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("0123456789BCDEFGHJKMNPQRSTUVWXYZ", 0)) c;
c
POINT(-179.55743439816956 -82.77450549262497)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("zyxwvutsrqpnmkjhgfedcb9876543210", 0)) c;
c
POINT(179.55743439816956 82.77450549262497)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("ZYXWVUTSRQPNMKJHGFEDCB9876543210", 0)) c;
c
POINT(179.55743439816956 82.77450549262497)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("1e1", " "));
ST_ASTEXT(ST_POINTFROMGEOHASH("1e1", " "))
POINT(-110 -72)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("100", "    0"));
ST_ASTEXT(ST_POINTFROMGEOHASH("100", "    0"))
POINT(-134 -89)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH(CAST(100 AS CHAR), 0));
ST_ASTEXT(ST_POINTFROMGEOHASH(CAST(100 AS CHAR), 0))
POINT(-134 -89)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("10111000110001111001", "0"));
ST_ASTEXT(ST_POINTFROMGEOHASH("10111000110001111001", "0"))
POINT(-133.549761770805 -89.8242133801793)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("11111111111111111111", 0));
ST_ASTEXT(ST_POINTFROMGEOHASH("11111111111111111111", 0))
POINT(-133.548387096774 -84.1935483870967)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("99999999999999999999", 0));
ST_ASTEXT(ST_POINTFROMGEOHASH("99999999999999999999", 0))
POINT(-110.3225806451612 8.7096774193548)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("00000000000000000000", " ***** ")) c;
c
POINT(-180 -90)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("00000000000000000000", " 0 "));
ST_ASTEXT(ST_POINTFROMGEOHASH("00000000000000000000", " 0 "))
POINT(-180 -90)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("zzzzzzzzzzzzzzzzzzzz", (CAST(0 AS CHAR)))) c;
c
POINT(180 90)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH(NULL, 0));
ST_ASTEXT(ST_POINTFROMGEOHASH(NULL, 0))
NULL
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH(null, 0));
ST_ASTEXT(ST_POINTFROMGEOHASH(null, 0))
NULL
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("tzzzzzzzzzzzzzzzzzzz", NULL));
ST_ASTEXT(ST_POINTFROMGEOHASH("tzzzzzzzzzzzzzzzzzzz", NULL))
NULL
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("9zzzzzzzzzzzzzzzzzzz", null));
ST_ASTEXT(ST_POINTFROMGEOHASH("9zzzzzzzzzzzzzzzzzzz", null))
NULL
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH(CAST("012" AS BINARY), 0));
ST_ASTEXT(ST_POINTFROMGEOHASH(CAST("012" AS BINARY), 0))
POINT(-179 -82)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("zzzzzzzzzzzzzzzzzzzz", (CAST(0 AS BINARY)))) c;
c
POINT(180 90)
# invalid characters and inputs
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("0123a45", 0));
ERROR HY000: Incorrect geohash value: '0123a45' for function st_pointfromgeohash
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("xyzi", 0));
ERROR HY000: Incorrect geohash value: 'xyzi' for function st_pointfromgeohash
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("zyxLwv", 0));
ERROR HY000: Incorrect geohash value: 'zyxLwv' for function st_pointfromgeohash
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("bcdjo", 0));
ERROR HY000: Incorrect geohash value: 'bcdjo' for function st_pointfromgeohash
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("zyx**wv", 0));
ERROR HY000: Incorrect geohash value: 'zyx**wv' for function st_pointfromgeohash
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("1 2 3 4", 0));
ERROR HY000: Incorrect geohash value: '1 2 3 4' for function st_pointfromgeohash
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("1''2345", 0));
ERROR HY000: Incorrect geohash value: '1''2345' for function st_pointfromgeohash
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("12.345", 0));
ERROR HY000: Incorrect geohash value: '12.345' for function st_pointfromgeohash
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("   ", 0));
ERROR HY000: Incorrect geohash value: '   ' for function st_pointfromgeohash
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("NULL", 0));
ERROR HY000: Incorrect geohash value: 'NULL' for function st_pointfromgeohash
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("0a 0d", 0));
ERROR HY000: Incorrect geohash value: '0a 0d' for function st_pointfromgeohash
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("-100", 0));
ERROR HY000: Incorrect geohash value: '-100' for function st_pointfromgeohash
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("", 2000));
ERROR HY000: Incorrect geohash value: '' for function st_pointfromgeohash
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH(9876543210, 0));
ERROR 22023: Invalid GIS data provided to function ST_PointFromGeoHash.
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH(0123456789, 0));
ERROR 22023: Invalid GIS data provided to function ST_PointFromGeoHash.
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH(1e1, 0));
ERROR 22023: Invalid GIS data provided to function ST_PointFromGeoHash.
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("123",));
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '))' at line 1
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH(,"456"));
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '"456"))' at line 1
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH(,));
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '))' at line 1
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("0123456"789));
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '789))' at line 1
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("7zzzzzzzzzzzzzzzzzzz", ****));
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '****))' at line 1
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("zzzzzzzzzzzzzzzzzzzz"));
ERROR 42000: Incorrect parameter count in the call to native function 'ST_POINTFROMGEOHASH'
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH());
ERROR 42000: Incorrect parameter count in the call to native function 'ST_POINTFROMGEOHASH'
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH(abcdef));
ERROR 42000: Incorrect parameter count in the call to native function 'ST_POINTFROMGEOHASH'
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH((1, 1), 1));
ERROR 21000: Operand should contain 1 column(s)
# very long geohash
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("0123456789bcdefghjkmnpqrstuvwxyz0123456789bc"
                                     "defghjkmnpqrstuvwxyz0123456789bcdefghjkmnpqr"
                                     "stuvwxyz0123456789bcdefghjkmnpqrstuvwxyz", 0)) c;
c
POINT(-179.55743439816956 -82.77450549262497)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("0123456789BCDEFGHJKMNPQRSTUVWXYZ0123456789BC"
                                     "DEFGHJKMNPQRSTUVWXYZ0123456789BCDEFGHJKMNPQR"
                                     "STUVWXYZ0123456789BCDEFGHJKMNPQRSTUVWXYZ", 0)) c;
c
POINT(-179.55743439816956 -82.77450549262497)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("zyxwvutsrqpnmkjhgfedcb9876543210zyxwvutsrqpn"
                                     "mkjhgfedcb9876543210zyxwvutsrqpnmkjhgfedcb98"
                                     "76543210zyxwvutsrqpnmkjhgfedcb9876543210", 0)) c;
c
POINT(179.55743439816956 82.77450549262497)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("ZYXWVUTSRQPNMKJHGFEDCB9876543210ZYXWVUTSRQPN"
                                     "MKJHGFEDCB9876543210ZYXWVUTSRQPNMKJHGFEDCB98"
                                     "76543210ZYXWVUTSRQPNMKJHGFEDCB9876543210", 0)) c;
c
POINT(179.55743439816956 82.77450549262497)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("0123456789bcdefghjkmnpqrstuvwxyz0123456789bc"
                                     "defghjkmnpqrstuvwxyz0123456789bcdefghjkmnpqr"
                                     "stuvwxyz0123456789bcdefghjkmnpqrstuvwxyz0123"
                                     "456789bcdefghjkmnpqrstuvwxyz0123456789bcdefg"
                                     "hjkmnpqrstuvwxyz0123456789bcdefghjkmnpqrstuv"
                                     "wxyz01234567890123456789bcdefghjkmnpqrstuvwx"
                                     "yz0123456789bcdefghjkmnpqrstuvwxyz0123456789"
                                     "bcdefghjkmnpqrstuvwxyz0123456789bcdefghjkmnp"
                                     "qrstuvwxyz0123456789bcdefghjkmnpqrstuvwxyz01"
                                     "23456789bcdefghjkmnpqrstuvwxyz0123456789bcde"
                                     "fghjkmnpqrstuvwxyz", 4326)) c;
c
POINT(-179.55743439816956 -82.77450549262497)
# different random geohash values
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH(hash_value,0)) FROM geohashes;
ST_ASTEXT(ST_POINTFROMGEOHASH(hash_value,0))
POINT(-180 -90)
POINT(180 90)
NULL
POINT(1 1)
POINT(-0.1 -0.1)
POINT(1 0.4)
POINT(-158 -68)
POINT(158 68)
POINT(-105.343666081393 -27.3374899367448)
POINT(75.4258807526218 37.4347752334972)
POINT(113.2506169687463 82.269670295412)
POINT(4.4253282778628 -74.168840669129)
POINT(-113.9241805635394 23.9696161514665)
POINT(-132.9724051824284 -45.5852718924236)
POINT(102.7417962437673 29.763254995923)
POINT(60.7886982739903 83.7602082514146)
POINT(128.908488386749 31.8700305354552)
POINT(-37.292723368146 19.7074618731612)
# Test create table from SELECT statement
CREATE TABLE t1 AS SELECT ST_POINTFROMGEOHASH("0123", 4326);
EXPLAIN t1;
Field	Type	Null	Key	Default	Extra
ST_POINTFROMGEOHASH("0123", 4326)	geometry	YES		NULL	
DROP TABLE t1;
# valid inputs
SELECT ST_GEOHASH(0,0,1);
ST_GEOHASH(0,0,1)
s
SELECT ST_GEOHASH(180,0,20);
ST_GEOHASH(180,0,20)
xbpbpbpbpbpbpbpbpbpb
SELECT ST_GEOHASH(-180,0,20);
ST_GEOHASH(-180,0,20)
80000000000000000000
SELECT ST_GEOHASH(0,90,20);
ST_GEOHASH(0,90,20)
upbpbpbpbpbpbpbpbpbp
SELECT ST_GEOHASH(0,-90,20);
ST_GEOHASH(0,-90,20)
h0000000000000000000
SELECT ST_GEOHASH(180,90,20);
ST_GEOHASH(180,90,20)
zzzzzzzzzzzzzzzzzzzz
SELECT ST_GEOHASH(180,-90,20);
ST_GEOHASH(180,-90,20)
pbpbpbpbpbpbpbpbpbpb
SELECT ST_GEOHASH(-180,90,20);
ST_GEOHASH(-180,90,20)
bpbpbpbpbpbpbpbpbpbp
SELECT ST_GEOHASH(-180,-90,20);
ST_GEOHASH(-180,-90,20)
00000000000000000000
SELECT ST_GEOHASH(100,45,5);
ST_GEOHASH(100,45,5)
y0p05
SELECT ST_GEOHASH(100,-45,10);
ST_GEOHASH(100,-45,10)
q0p0581b0b
SELECT ST_GEOHASH(-100,45,+50);
ST_GEOHASH(-100,45,+50)
cb0bh2n0p0581b0bh2n0p8
SELECT ST_GEOHASH(0.0001,0.0001,10);
ST_GEOHASH(0.0001,0.0001,10)
s0000000d6
SELECT ST_GEOHASH(0.0001,-0.0001,30);
ST_GEOHASH(0.0001,-0.0001,30)
kpbpbpbp6m6e6p6bpntebbpkpnqbuf
SELECT ST_GEOHASH(-0.0001,0.0001,90);
ST_GEOHASH(-0.0001,0.0001,90)
ebpbpbpbtdtktbtpbc6kppbebc9p5q000000000000000000000000000000000000000000000000000000000000
SELECT ST_GEOHASH(-0.0001,-0.0001,100);
ST_GEOHASH(-0.0001,-0.0001,100)
7zzzzzzzmtm7mzm00yd7z00s0y30g60000000000000000000000000000000000000000000000000000000000000000000000
SELECT ST_GEOHASH("",90,10);
ST_GEOHASH("",90,10)
upbpbpbpbp
SELECT ST_GEOHASH(0,"90",10);
ST_GEOHASH(0,"90",10)
upbpbpbpbp
SELECT ST_GEOHASH("0","0",10);
ST_GEOHASH("0","0",10)
s000000000
SELECT ST_GEOHASH(180,90,"20");
ST_GEOHASH(180,90,"20")
zzzzzzzzzzzzzzzzzzzz
SELECT ST_GEOHASH("180","90","20");
ST_GEOHASH("180","90","20")
zzzzzzzzzzzzzzzzzzzz
SELECT ST_GEOHASH("***",90,"20");
ST_GEOHASH("***",90,"20")
upbpbpbpbpbpbpbpbpbp
SELECT ST_GEOHASH(180,"***",20);
ST_GEOHASH(180,"***",20)
xbpbpbpbpbpbpbpbpbpb
SELECT ST_GEOHASH("abcd",90,20);
ST_GEOHASH("abcd",90,20)
upbpbpbpbpbpbpbpbpbp
SELECT ST_GEOHASH(180,"abcd",25-5);
ST_GEOHASH(180,"abcd",25-5)
xbpbpbpbpbpbpbpbpbpb
SELECT ST_GEOHASH(NULL,90,10);
ST_GEOHASH(NULL,90,10)
NULL
SELECT ST_GEOHASH(180,NULL,10);
ST_GEOHASH(180,NULL,10)
NULL
SELECT ST_GEOHASH(180,90,NULL);
ST_GEOHASH(180,90,NULL)
NULL
SELECT ST_GEOHASH(ST_GEOMFROMTEXT('POINT(0 0)'),10);
ST_GEOHASH(ST_GEOMFROMTEXT('POINT(0 0)'),10)
s000000000
SELECT ST_GEOHASH(ST_GEOMFROMTEXT('POINT(180 0)'),20);
ST_GEOHASH(ST_GEOMFROMTEXT('POINT(180 0)'),20)
xbpbpbpbpbpbpbpbpbpb
SELECT ST_GEOHASH(ST_GEOMFROMTEXT('POINT(-180 0)'),25);
ST_GEOHASH(ST_GEOMFROMTEXT('POINT(-180 0)'),25)
8000000000000000000002pbp
SELECT ST_GEOHASH(ST_GEOMFROMTEXT('POINT(0 90)'),30);
ST_GEOHASH(ST_GEOMFROMTEXT('POINT(0 90)'),30)
upbpbpbpbpbpbpbpbpbpbpbpbpbpbp
SELECT ST_GEOHASH(ST_GEOMFROMTEXT('POINT(0 -90)'),35);
ST_GEOHASH(ST_GEOMFROMTEXT('POINT(0 -90)'),35)
h000000000000000000001bpbpbpbpbpbpb
SELECT ST_GEOHASH(ST_GEOMFROMTEXT('POINT(180 90)'),40);
ST_GEOHASH(ST_GEOMFROMTEXT('POINT(180 90)'),40)
zzzzzzzzzzzzzzzzzzzzzz
SELECT ST_GEOHASH(ST_GEOMFROMTEXT('POINT(180 -90)'),45);
ST_GEOHASH(ST_GEOMFROMTEXT('POINT(180 -90)'),45)
pbpbpbpbpbpbpbpbpbpbpc
SELECT ST_GEOHASH(ST_GEOMFROMTEXT('POINT(-180 90)'),50);
ST_GEOHASH(ST_GEOMFROMTEXT('POINT(-180 90)'),50)
bpbpbpbpbpbpbpbpbpbpbr
SELECT ST_GEOHASH(ST_GEOMFROMTEXT('POINT(-180 -90)'),55);
ST_GEOHASH(ST_GEOMFROMTEXT('POINT(-180 -90)'),55)
0000000000000000000003
SELECT ST_GEOHASH(ST_GEOMFROMTEXT('POINT(100 45)'),60);
ST_GEOHASH(ST_GEOMFROMTEXT('POINT(100 45)'),60)
y0p0581b0bh2n0p0581b0b
SELECT ST_GEOHASH(ST_GEOMFROMTEXT('POINT(100 -45)'),65);
ST_GEOHASH(ST_GEOMFROMTEXT('POINT(100 -45)'),65)
q0p0581b0bh2n0p0581b0b
SELECT ST_GEOHASH(ST_GEOMFROMTEXT('POINT(-100 45)'),70);
ST_GEOHASH(ST_GEOMFROMTEXT('POINT(-100 45)'),70)
cb0bh2n0p0581b0bh2n0p8
SELECT ST_GEOHASH(ST_GEOMFROMTEXT('POINT(-100 -45)'),75);
ST_GEOHASH(ST_GEOMFROMTEXT('POINT(-100 -45)'),75)
3b0bh2n0p0581b0bh2n0p8
SELECT ST_GEOHASH(ST_GEOMFROMWKB(ST_ASWKB(ST_GEOMFROMTEXT('POINT(0.0001 0.0001)'))),80) c;
c
s0000000d6dsd0dzz1ms0zz7z1wzhy00000000000000000000000000000000000000000000000000
SELECT ST_GEOHASH(ST_GEOMFROMWKB(ST_ASWKB(ST_GEOMFROMTEXT('POINT(0.0001 -0.0001)'))),85) c;
c
kpbpbpbp6m6e6p6bpntebbpkpnqbuf0000000000000000000000000000000000000000000000000000000
SELECT ST_GEOHASH(ST_GEOMFROMWKB(ST_ASWKB(ST_GEOMFROMTEXT('POINT(-0.0001 0.0001)'))),90) c;
c
ebpbpbpbtdtktbtpbc6kppbebc9p5q000000000000000000000000000000000000000000000000000000000000
SELECT ST_GEOHASH(ST_GEOMFROMWKB(ST_ASWKB(ST_GEOMFROMTEXT('POINT(-0.0001 -0.0001)'))),100) c;
c
7zzzzzzzmtm7mzm00yd7z00s0y30g60000000000000000000000000000000000000000000000000000000000000000000000
SELECT ST_GEOHASH(ST_GEOMFROMWKB(0x010100000000000000008066400000000000805640),20) c;
c
zzzzzzzzzzzzzzzzzzzz
SELECT ST_GEOHASH(ST_GEOMFROMWKB(0x010100000000000000008066C00000000000805640),20) c;
c
bpbpbpbpbpbpbpbpbpbp
SELECT ST_GEOHASH(ST_GEOMFROMWKB(0x00000000014066800000000000C056800000000000),20) c;
c
pbpbpbpbpbpbpbpbpbpb
SELECT ST_GEOHASH(ST_GEOMFROMWKB(0x0000000001C066800000000000C056800000000000),20) c;
c
00000000000000000000
SELECT ST_GEOHASH(ST_GEOMFROMTEXT('POINT(0 0)'),"1");
ST_GEOHASH(ST_GEOMFROMTEXT('POINT(0 0)'),"1")
s
SELECT ST_GEOHASH(ST_GEOMFROMTEXT('POINT(0 0)')," 10 ");
ST_GEOHASH(ST_GEOMFROMTEXT('POINT(0 0)')," 10 ")
s000000000
SELECT ST_GEOHASH(ST_GEOMFROMTEXT('POINT(0 0)'),"+100");
ST_GEOHASH(ST_GEOMFROMTEXT('POINT(0 0)'),"+100")
s000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
SELECT ST_GEOHASH(NULL,100);
ST_GEOHASH(NULL,100)
NULL
SELECT ST_GEOHASH(ST_GEOMFROMTEXT('POINT(-0.0001 -0.0001)'),NULL);
ST_GEOHASH(ST_GEOMFROMTEXT('POINT(-0.0001 -0.0001)'),NULL)
NULL
SELECT ST_GEOHASH(ST_DIFFERENCE(ST_GEOMFROMTEXT('POINT(180 90)'),ST_GEOMFROMTEXT('POINT(0 0)')),20) c;
c
zzzzzzzzzzzzzzzzzzzz
SELECT ST_GEOHASH(ST_DIFFERENCE(ST_GEOMFROMTEXT('POINT(-180 90)'),ST_GEOMFROMTEXT('MULTIPOINT(0 0,100 100)')),20) c;
c
bpbpbpbpbpbpbpbpbpbp
SELECT ST_GEOHASH(ST_INTERSECTION(ST_GEOMFROMTEXT('POINT(180 -90)'),ST_GEOMFROMTEXT('POINT(180 -90)')),20) c;
c
pbpbpbpbpbpbpbpbpbpb
SELECT ST_GEOHASH(ST_INTERSECTION(ST_GEOMFROMTEXT('POINT(-180 -90)'),ST_GEOMFROMTEXT('POINT(-180 -90)')),20) c;
c
00000000000000000000
SELECT ST_GEOHASH(ST_GEOMFROMTEXT('POINT(180 90)'),(CAST(10 AS BINARY))) c;
c
zzzzzzzzzz
SELECT ST_GEOHASH((CAST(10 AS BINARY)),20,1);
ST_GEOHASH((CAST(10 AS BINARY)),20,1)
s
SELECT ST_GEOHASH(10,(CAST(20 AS BINARY)),1);
ST_GEOHASH(10,(CAST(20 AS BINARY)),1)
s
SELECT ST_GEOHASH((CAST(10 AS BINARY)),(CAST(20 AS BINARY)),1);
ST_GEOHASH((CAST(10 AS BINARY)),(CAST(20 AS BINARY)),1)
s
SELECT ST_GEOHASH(ST_GEOMFROMTEXT('POINT()'),20);
ST_GEOHASH(ST_GEOMFROMTEXT('POINT()'),20)
NULL
SELECT ST_GEOHASH(ST_GEOMFROMTEXT('POINT(1)'),20);
ST_GEOHASH(ST_GEOMFROMTEXT('POINT(1)'),20)
NULL
SELECT ST_GEOHASH(ST_GEOMFROMTEXT('POINT(1 a)'),20);
ST_GEOHASH(ST_GEOMFROMTEXT('POINT(1 a)'),20)
NULL
SELECT ST_GEOHASH(ST_GEOMFROMTEXT('POINT(180,90)'),20);
ST_GEOHASH(ST_GEOMFROMTEXT('POINT(180,90)'),20)
NULL
# invalid inputs
SELECT ST_GEOHASH(181,0,10);
ERROR HY000: Out of range error: Longitude should be [-180,180] in function ST_GeoHash.
SELECT ST_GEOHASH(1000,90,10);
ERROR HY000: Out of range error: Longitude should be [-180,180] in function ST_GeoHash.
SELECT ST_GEOHASH(180.0000000000001,-90,10);
ERROR HY000: Out of range error: Longitude should be [-180,180] in function ST_GeoHash.
SELECT ST_GEOHASH(-181,0,10);
ERROR HY000: Out of range error: Longitude should be [-180,180] in function ST_GeoHash.
SELECT ST_GEOHASH(-1000,90,10);
ERROR HY000: Out of range error: Longitude should be [-180,180] in function ST_GeoHash.
SELECT ST_GEOHASH(-180.0000000000001,-90,10);
ERROR HY000: Out of range error: Longitude should be [-180,180] in function ST_GeoHash.
SELECT ST_GEOHASH(0,91,10);
ERROR HY000: Out of range error: Latitude should be [-90,90] in function ST_GeoHash.
SELECT ST_GEOHASH(180,500,10);
ERROR HY000: Out of range error: Latitude should be [-90,90] in function ST_GeoHash.
SELECT ST_GEOHASH(-180,90.0000000000001,10);
ERROR HY000: Out of range error: Latitude should be [-90,90] in function ST_GeoHash.
SELECT ST_GEOHASH(0,-91,10);
ERROR HY000: Out of range error: Latitude should be [-90,90] in function ST_GeoHash.
SELECT ST_GEOHASH(180,-500,10);
ERROR HY000: Out of range error: Latitude should be [-90,90] in function ST_GeoHash.
SELECT ST_GEOHASH(-180,-90.0000000000001,10);
ERROR HY000: Out of range error: Latitude should be [-90,90] in function ST_GeoHash.
SELECT ST_GEOHASH(180,90,0);
ERROR HY000: Out of range error: max_length parameter should be an integer in the range [1, 100] in function ST_GeoHash.
SELECT ST_GEOHASH(-180,90,-1);
ERROR HY000: Out of range error: max_length parameter should be an integer in the range [1, 100] in function ST_GeoHash.
SELECT ST_GEOHASH(180,-90,-100);
ERROR HY000: Out of range error: max_length parameter should be an integer in the range [1, 100] in function ST_GeoHash.
SELECT ST_GEOHASH(-180,-90,101);
ERROR HY000: Out of range error: max_length parameter should be an integer in the range [1, 100] in function ST_GeoHash.
SELECT ST_GEOHASH(0,90,1000);
ERROR HY000: Out of range error: max_length parameter should be an integer in the range [1, 100] in function ST_GeoHash.
SELECT ST_GEOHASH("181",90,20);
ERROR HY000: Out of range error: Longitude should be [-180,180] in function ST_GeoHash.
SELECT ST_GEOHASH("-181",90,20);
ERROR HY000: Out of range error: Longitude should be [-180,180] in function ST_GeoHash.
SELECT ST_GEOHASH(180,"91",20);
ERROR HY000: Out of range error: Latitude should be [-90,90] in function ST_GeoHash.
SELECT ST_GEOHASH(180,"-91",20);
ERROR HY000: Out of range error: Latitude should be [-90,90] in function ST_GeoHash.
SELECT ST_GEOHASH(180,90,"0");
ERROR HY000: Out of range error: max_length parameter should be an integer in the range [1, 100] in function ST_GeoHash.
SELECT ST_GEOHASH(180,90,"-1");
ERROR HY000: Out of range error: max_length parameter should be an integer in the range [1, 100] in function ST_GeoHash.
SELECT ST_GEOHASH(180,90,"-100");
ERROR HY000: Out of range error: max_length parameter should be an integer in the range [1, 100] in function ST_GeoHash.
SELECT ST_GEOHASH(180,90,"101");
ERROR HY000: Out of range error: max_length parameter should be an integer in the range [1, 100] in function ST_GeoHash.
SELECT ST_GEOHASH(180,90,"1000");
ERROR HY000: Out of range error: max_length parameter should be an integer in the range [1, 100] in function ST_GeoHash.
SELECT ST_GEOHASH(180,90,"");
ERROR HY000: Out of range error: max_length parameter should be an integer in the range [1, 100] in function ST_GeoHash.
SELECT ST_GEOHASH(180,90,"****");
ERROR HY000: Out of range error: max_length parameter should be an integer in the range [1, 100] in function ST_GeoHash.
SELECT ST_GEOHASH();
ERROR 42000: Incorrect parameter count in the call to native function 'ST_GEOHASH'
SELECT ST_GEOHASH(1);
ERROR 42000: Incorrect parameter count in the call to native function 'ST_GEOHASH'
SELECT ST_GEOHASH(1,2);
ERROR 22023: Invalid GIS data provided to function ST_GeoHash.
SELECT ST_GEOHASH(, ,);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ' ,)' at line 1
SELECT ST_GEOHASH(1,2,);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 1
SELECT ST_GEOHASH(*,0,10);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '*,0,10)' at line 1
SELECT ST_GEOHASH(0,*,10);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '*,10)' at line 1
SELECT ST_GEOHASH(0,0,*);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '*)' at line 1
SELECT ST_GEOHASH(a,90,10);
ERROR 42S22: Unknown column 'a' in 'SELECT'
SELECT ST_GEOHASH(180,p,10);
ERROR 42S22: Unknown column 'p' in 'SELECT'
SELECT ST_GEOHASH(180,90,z);
ERROR 42S22: Unknown column 'z' in 'SELECT'
SELECT ST_GEOHASH((CAST(180 AS DATE)),90,10);
ERROR 22023: Invalid GIS data provided to function ST_GeoHash.
SELECT ST_GEOHASH(180,(CAST(90 AS DATE)),10);
ERROR 22023: Invalid GIS data provided to function ST_GeoHash.
SELECT ST_GEOHASH(ST_GEOMFROMTEXT('POINT(181 0)'),10);
ERROR HY000: Out of range error: Longitude should be [-180,180] in function ST_GeoHash.
SELECT ST_GEOHASH(ST_GEOMFROMTEXT('POINT(1000 90)'),10);
ERROR HY000: Out of range error: Longitude should be [-180,180] in function ST_GeoHash.
SELECT ST_GEOHASH(ST_GEOMFROMTEXT('POINT(180.0000000000001 -90)'),10);
ERROR HY000: Out of range error: Longitude should be [-180,180] in function ST_GeoHash.
SELECT ST_GEOHASH(ST_GEOMFROMTEXT('POINT(-181 0)'),10);
ERROR HY000: Out of range error: Longitude should be [-180,180] in function ST_GeoHash.
SELECT ST_GEOHASH(ST_GEOMFROMTEXT('POINT(-1000 90)'),10);
ERROR HY000: Out of range error: Longitude should be [-180,180] in function ST_GeoHash.
SELECT ST_GEOHASH(ST_GEOMFROMTEXT('POINT(-180.0000000000001 -90)'),10);
ERROR HY000: Out of range error: Longitude should be [-180,180] in function ST_GeoHash.
SELECT ST_GEOHASH(ST_GEOMFROMTEXT('POINT(0 91)'),10);
ERROR HY000: Out of range error: Latitude should be [-90,90] in function ST_GeoHash.
SELECT ST_GEOHASH(ST_GEOMFROMTEXT('POINT(180 500)'),10);
ERROR HY000: Out of range error: Latitude should be [-90,90] in function ST_GeoHash.
SELECT ST_GEOHASH(ST_GEOMFROMTEXT('POINT(-180 90.0000000000001)'),10);
ERROR HY000: Out of range error: Latitude should be [-90,90] in function ST_GeoHash.
SELECT ST_GEOHASH(ST_GEOMFROMTEXT('POINT(0 -91)'),10);
ERROR HY000: Out of range error: Latitude should be [-90,90] in function ST_GeoHash.
SELECT ST_GEOHASH(ST_GEOMFROMTEXT('POINT(180 -500)'),10);
ERROR HY000: Out of range error: Latitude should be [-90,90] in function ST_GeoHash.
SELECT ST_GEOHASH(ST_GEOMFROMTEXT('POINT(-180 -90.0000000000001)'),10);
ERROR HY000: Out of range error: Latitude should be [-90,90] in function ST_GeoHash.
SELECT ST_GEOHASH(ST_GEOMFROMTEXT('POINT(180 90)'),0);
ERROR HY000: Out of range error: max_length parameter should be an integer in the range [1, 100] in function ST_GeoHash.
SELECT ST_GEOHASH(ST_GEOMFROMTEXT('POINT(180 -90)'),-1);
ERROR HY000: Out of range error: max_length parameter should be an integer in the range [1, 100] in function ST_GeoHash.
SELECT ST_GEOHASH(ST_GEOMFROMTEXT('POINT(-180 90)'),-100);
ERROR HY000: Out of range error: max_length parameter should be an integer in the range [1, 100] in function ST_GeoHash.
SELECT ST_GEOHASH(ST_GEOMFROMTEXT('POINT(-180 -90)'),101);
ERROR HY000: Out of range error: max_length parameter should be an integer in the range [1, 100] in function ST_GeoHash.
SELECT ST_GEOHASH(ST_GEOMFROMTEXT('POINT(0 0)'),10000);
ERROR HY000: Out of range error: max_length parameter should be an integer in the range [1, 100] in function ST_GeoHash.
SELECT ST_GEOHASH(ST_GEOMFROMWKB(ST_ASWKB(ST_GEOMFROMTEXT('POINT(180 90)'))),"0");
ERROR HY000: Out of range error: max_length parameter should be an integer in the range [1, 100] in function ST_GeoHash.
SELECT ST_GEOHASH(ST_GEOMFROMWKB(ST_ASWKB(ST_GEOMFROMTEXT('POINT(180 -90)'))),"-1");
ERROR HY000: Out of range error: max_length parameter should be an integer in the range [1, 100] in function ST_GeoHash.
SELECT ST_GEOHASH(ST_GEOMFROMWKB(ST_ASWKB(ST_GEOMFROMTEXT('POINT(-180 90)'))),"-100");
ERROR HY000: Out of range error: max_length parameter should be an integer in the range [1, 100] in function ST_GeoHash.
SELECT ST_GEOHASH(ST_GEOMFROMWKB(ST_ASWKB(ST_GEOMFROMTEXT('POINT(-180 -90)'))),"101");
ERROR HY000: Out of range error: max_length parameter should be an integer in the range [1, 100] in function ST_GeoHash.
SELECT ST_GEOHASH(ST_GEOMFROMWKB(ST_ASWKB(ST_GEOMFROMTEXT('POINT(0 0)'))),"10000");
ERROR HY000: Out of range error: max_length parameter should be an integer in the range [1, 100] in function ST_GeoHash.
SELECT ST_GEOHASH(ST_GEOMFROMTEXT('POINT(0 0)')," ");
ERROR HY000: Out of range error: max_length parameter should be an integer in the range [1, 100] in function ST_GeoHash.
SELECT ST_GEOHASH(ST_GEOMFROMTEXT('POINT(0 0)'),"***");
ERROR HY000: Out of range error: max_length parameter should be an integer in the range [1, 100] in function ST_GeoHash.
SELECT ST_GEOHASH(ST_GEOMFROMTEXT('POINT(0 0)'));
ERROR 42000: Incorrect parameter count in the call to native function 'ST_GEOHASH'
SELECT ST_GEOHASH(ST_GEOMFROMTEXT(),20);
ERROR 42000: Incorrect parameter count in the call to native function 'ST_GEOMFROMTEXT'
SELECT ST_GEOHASH((ST_GEOMFROMTEXT('POINT(0 0)'),);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 1
SELECT ST_GEOHASH(,10);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '10)' at line 1
SELECT ST_GEOHASH(ST_GEOMFROMTEXT('POINT(0 0)'),a);
ERROR 42S22: Unknown column 'a' in 'SELECT'
SELECT ST_GEOHASH(ST_GEOMFROMTEXT('LINESTRING(0 0,10 10)'),10);
ERROR 22023: Invalid GIS data provided to function ST_GeoHash.
SELECT ST_GEOHASH(ST_GEOMFROMTEXT('POLYGON((0 0,10 0,10 10,0 10,0 0))'),10);
ERROR 22023: Invalid GIS data provided to function ST_GeoHash.
SELECT ST_GEOHASH(ST_GEOMFROMTEXT('MULTIPOINT(0 0,10 10)'),10);
ERROR 22023: Invalid GIS data provided to function ST_GeoHash.
SELECT ST_GEOHASH(ST_GEOMFROMTEXT('MULTILINESTRING((0 0,10 10),(20 20,30 30))'),10);
ERROR 22023: Invalid GIS data provided to function ST_GeoHash.
SELECT ST_GEOHASH(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4)))'),10);
ERROR 22023: Invalid GIS data provided to function ST_GeoHash.
SELECT ST_GEOHASH(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(0 0))'),10);
ERROR 22023: Invalid GIS data provided to function ST_GeoHash.
SELECT ST_GEOHASH(ST_GEOMFROMTEXT('POINT(180 90)'),20.0001);
ERROR HY000: Out of range error: max_length parameter should be an integer in the range [1, 100] in function ST_GeoHash.
SELECT ST_GEOHASH(ST_GEOMFROMTEXT('POINT(180 90)'),(CAST(10 AS DATE)));
ERROR HY000: Out of range error: max_length parameter should be an integer in the range [1, 100] in function ST_GeoHash.
SELECT ST_GEOHASH(ST_INTERSECTION(ST_GEOMFROMTEXT('POINT(180 90)'),ST_GEOMFROMTEXT('POINT(1 1)')),20);
ERROR 22023: Invalid GIS data provided to function ST_GeoHash.
SELECT ST_GEOHASH(ST_UNION(ST_GEOMFROMTEXT('POINT(180 90)'),ST_GEOMFROMTEXT('POINT(-180 -90)')),20);
ERROR 22023: Invalid GIS data provided to function ST_GeoHash.
SELECT ST_GEOHASH(ST_DIFFERENCE(ST_GEOMFROMTEXT('POINT(180 90)'),ST_GEOMFROMTEXT('MULTIPOINT(0 0,180 90)')),20);
ERROR 22023: Invalid GIS data provided to function ST_GeoHash.
SELECT ST_GEOHASH(ST_SYMDIFFERENCE(ST_GEOMFROMTEXT('POINT(180 90)'),ST_GEOMFROMTEXT('POINT(0 0)')),20);
ERROR 22023: Invalid GIS data provided to function ST_GeoHash.
#=============================================================
# ST_LONGFROMGEOHASH()
#=============================================================
SELECT ST_LONGFROMGEOHASH(ST_GEOHASH(180,90,20));
ST_LONGFROMGEOHASH(ST_GEOHASH(180,90,20))
180
SELECT ST_LONGFROMGEOHASH(ST_GEOHASH(180,-90,20));
ST_LONGFROMGEOHASH(ST_GEOHASH(180,-90,20))
180
SELECT ST_LONGFROMGEOHASH(ST_GEOHASH(-180,90,20));
ST_LONGFROMGEOHASH(ST_GEOHASH(-180,90,20))
-180
SELECT ST_LONGFROMGEOHASH(ST_GEOHASH(-180,-90,20));
ST_LONGFROMGEOHASH(ST_GEOHASH(-180,-90,20))
-180
SELECT ST_LONGFROMGEOHASH(ST_GEOHASH(180,0,20));
ST_LONGFROMGEOHASH(ST_GEOHASH(180,0,20))
180
SELECT ST_LONGFROMGEOHASH(ST_GEOHASH(-180,0,20));
ST_LONGFROMGEOHASH(ST_GEOHASH(-180,0,20))
-180
SELECT ST_LONGFROMGEOHASH(ST_GEOHASH(-0,0,20));
ST_LONGFROMGEOHASH(ST_GEOHASH(-0,0,20))
0
SELECT ST_LONGFROMGEOHASH(ST_GEOHASH(0.10,90,20));
ST_LONGFROMGEOHASH(ST_GEOHASH(0.10,90,20))
0.1
SELECT ST_LONGFROMGEOHASH(ST_GEOHASH(100,45,20));
ST_LONGFROMGEOHASH(ST_GEOHASH(100,45,20))
100
SELECT ST_LONGFROMGEOHASH(ST_GEOHASH(179.999999,90,20));
ST_LONGFROMGEOHASH(ST_GEOHASH(179.999999,90,20))
179.999999
SELECT ST_LONGFROMGEOHASH(ST_GEOHASH(-179.999999,0,20));
ST_LONGFROMGEOHASH(ST_GEOHASH(-179.999999,0,20))
-179.999999
SELECT ST_LONGFROMGEOHASH(ST_GEOHASH(18*10,900/10,20));
ST_LONGFROMGEOHASH(ST_GEOHASH(18*10,900/10,20))
180
SELECT ST_LONGFROMGEOHASH(ST_GEOHASH(ST_GEOMFROMTEXT('POINT(100 10)'),10)) c;
c
100
SELECT ST_LONGFROMGEOHASH(ST_GEOHASH(ST_GEOMFROMTEXT('POINT(10 10)'),10)) c;
c
10
SELECT ST_LONGFROMGEOHASH(ST_GEOHASH(ST_GEOMFROMTEXT('POINT(-10 10)'),10)) c;
c
-10
SELECT ST_LONGFROMGEOHASH(ST_GEOHASH(ST_GEOMFROMTEXT('POINT(1.000 10)'),10)) c;
c
1
SELECT ST_LONGFROMGEOHASH(ST_GEOHASH(ST_GEOMFROMTEXT('POINT(-1.000 10)'),10)) c;
c
-1
SELECT ST_LONGFROMGEOHASH(ST_GEOHASH(ST_GEOMFROMTEXT('POINT(1.00101 90)'),20)) c;
c
1.00101
SELECT ST_LONGFROMGEOHASH(ST_GEOHASH(ST_GEOMFROMTEXT('POINT(-1.00101 90)'),20)) c;
c
-1.00101
SELECT ST_LONGFROMGEOHASH(ST_GEOHASH(ST_GEOMFROMTEXT('POINT(20 20)'),10)) c;
c
20
#=============================================================
# ST_LATFROMGEOHASH()
#=============================================================
SELECT ST_LATFROMGEOHASH(ST_GEOHASH(180,90,20));
ST_LATFROMGEOHASH(ST_GEOHASH(180,90,20))
90
SELECT ST_LATFROMGEOHASH(ST_GEOHASH(180,-90,20));
ST_LATFROMGEOHASH(ST_GEOHASH(180,-90,20))
-90
SELECT ST_LATFROMGEOHASH(ST_GEOHASH(-180,90,20));
ST_LATFROMGEOHASH(ST_GEOHASH(-180,90,20))
90
SELECT ST_LATFROMGEOHASH(ST_GEOHASH(-180,-90,20));
ST_LATFROMGEOHASH(ST_GEOHASH(-180,-90,20))
-90
SELECT ST_LATFROMGEOHASH(ST_GEOHASH(0,90,20));
ST_LATFROMGEOHASH(ST_GEOHASH(0,90,20))
90
SELECT ST_LATFROMGEOHASH(ST_GEOHASH(0,-90,20));
ST_LATFROMGEOHASH(ST_GEOHASH(0,-90,20))
-90
SELECT ST_LATFROMGEOHASH(ST_GEOHASH(0,-0,20));
ST_LATFROMGEOHASH(ST_GEOHASH(0,-0,20))
0
SELECT ST_LATFROMGEOHASH(ST_GEOHASH(180,0.101,20));
ST_LATFROMGEOHASH(ST_GEOHASH(180,0.101,20))
0.101
SELECT ST_LATFROMGEOHASH(ST_GEOHASH(100,45,20));
ST_LATFROMGEOHASH(ST_GEOHASH(100,45,20))
45
SELECT ST_LATFROMGEOHASH(ST_GEOHASH(180,89.99999990,20));
ST_LATFROMGEOHASH(ST_GEOHASH(180,89.99999990,20))
89.9999999
SELECT ST_LATFROMGEOHASH(ST_GEOHASH(0,89.999999,20));
ST_LATFROMGEOHASH(ST_GEOHASH(0,89.999999,20))
89.999999
SELECT ST_LATFROMGEOHASH(ST_GEOHASH(18*10,900/10,20));
ST_LATFROMGEOHASH(ST_GEOHASH(18*10,900/10,20))
90
SELECT ST_LATFROMGEOHASH(ST_GEOHASH(ST_GEOMFROMTEXT('POINT(10 50)'),10)) c;
c
50
SELECT ST_LATFROMGEOHASH(ST_GEOHASH(ST_GEOMFROMTEXT('POINT(10 10)'),10)) c;
c
10
SELECT ST_LATFROMGEOHASH(ST_GEOHASH(ST_GEOMFROMTEXT('POINT(10 -10)'),10)) c;
c
-10
SELECT ST_LATFROMGEOHASH(ST_GEOHASH(ST_GEOMFROMTEXT('POINT(10 1.000)'),10)) c;
c
1
SELECT ST_LATFROMGEOHASH(ST_GEOHASH(ST_GEOMFROMTEXT('POINT(10 -1.0000)'),10)) c;
c
-1
SELECT ST_LATFROMGEOHASH(ST_GEOHASH(ST_GEOMFROMTEXT('POINT(180 1.00101)'),20)) c;
c
1.00101
SELECT ST_LATFROMGEOHASH(ST_GEOHASH(ST_GEOMFROMTEXT('POINT(-100 -1.00101)'),20)) c;
c
-1.00101
SELECT ST_LATFROMGEOHASH(ST_GEOHASH(ST_GEOMFROMTEXT('POINT(20 -20)'),10)) c;
c
-20
#=============================================================
# ST_POINTFROMGEOHASH()
#=============================================================
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH(ST_GEOHASH(180,90,20),0));
ST_ASTEXT(ST_POINTFROMGEOHASH(ST_GEOHASH(180,90,20),0))
POINT(180 90)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH(ST_GEOHASH(180,-90,20),0));
ST_ASTEXT(ST_POINTFROMGEOHASH(ST_GEOHASH(180,-90,20),0))
POINT(180 -90)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH(ST_GEOHASH(-180,90,20),0));
ST_ASTEXT(ST_POINTFROMGEOHASH(ST_GEOHASH(-180,90,20),0))
POINT(-180 90)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH(ST_GEOHASH(-180,-90,20),0));
ST_ASTEXT(ST_POINTFROMGEOHASH(ST_GEOHASH(-180,-90,20),0))
POINT(-180 -90)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH(ST_GEOHASH(180,0,20),0));
ST_ASTEXT(ST_POINTFROMGEOHASH(ST_GEOHASH(180,0,20),0))
POINT(180 0)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH(ST_GEOHASH(-180,0,20),0));
ST_ASTEXT(ST_POINTFROMGEOHASH(ST_GEOHASH(-180,0,20),0))
POINT(-180 0)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH(ST_GEOHASH(0,90,20),0));
ST_ASTEXT(ST_POINTFROMGEOHASH(ST_GEOHASH(0,90,20),0))
POINT(0 90)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH(ST_GEOHASH(0,-90,20),0));
ST_ASTEXT(ST_POINTFROMGEOHASH(ST_GEOHASH(0,-90,20),0))
POINT(0 -90)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH(ST_GEOHASH(0,0,20),0));
ST_ASTEXT(ST_POINTFROMGEOHASH(ST_GEOHASH(0,0,20),0))
POINT(0 0)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH(ST_GEOHASH(-0,0,20),0));
ST_ASTEXT(ST_POINTFROMGEOHASH(ST_GEOHASH(-0,0,20),0))
POINT(0 0)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH(ST_GEOHASH(0,-0,20),0));
ST_ASTEXT(ST_POINTFROMGEOHASH(ST_GEOHASH(0,-0,20),0))
POINT(0 0)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH(ST_GEOHASH(0.10,90,20),0));
ST_ASTEXT(ST_POINTFROMGEOHASH(ST_GEOHASH(0.10,90,20),0))
POINT(0.1 90)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH(ST_GEOHASH(100,45,20),0));
ST_ASTEXT(ST_POINTFROMGEOHASH(ST_GEOHASH(100,45,20),0))
POINT(100 45)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH(ST_GEOHASH(179.999999,90,20),0));
ST_ASTEXT(ST_POINTFROMGEOHASH(ST_GEOHASH(179.999999,90,20),0))
POINT(179.999999 90)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH(ST_GEOHASH(-179.999999,0,20),0));
ST_ASTEXT(ST_POINTFROMGEOHASH(ST_GEOHASH(-179.999999,0,20),0))
POINT(-179.999999 0)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH(ST_GEOHASH(180,89.999999,20),0));
ST_ASTEXT(ST_POINTFROMGEOHASH(ST_GEOHASH(180,89.999999,20),0))
POINT(180 89.999999)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH(ST_GEOHASH(0,-89.999999,20),0));
ST_ASTEXT(ST_POINTFROMGEOHASH(ST_GEOHASH(0,-89.999999,20),0))
POINT(0 -89.999999)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH(ST_GEOHASH(18*10,900/10,20),0));
ST_ASTEXT(ST_POINTFROMGEOHASH(ST_GEOHASH(18*10,900/10,20),0))
POINT(180 90)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH(ST_GEOHASH(ST_GEOMFROMTEXT('POINT(100 50)'),10),0)) c;
c
POINT(100 50)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH(ST_GEOHASH(ST_GEOMFROMTEXT('POINT(10 10)'),10),0)) c;
c
POINT(10 10)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH(ST_GEOHASH(ST_GEOMFROMTEXT('POINT(-10 10)'),10),0)) c;
c
POINT(-10 10)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH(ST_GEOHASH(ST_GEOMFROMTEXT('POINT(1.000 1.00010)'),10),0)) c;
c
POINT(1 1.0001)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH(ST_GEOHASH(ST_GEOMFROMTEXT('POINT(-1.000 -1.1010)'),10),0)) c;
c
POINT(-1 -1.101)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH(ST_GEOHASH(ST_GEOMFROMTEXT('POINT(1.00101 1.000)'),10),0)) c;
c
POINT(1.00101 1)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH(ST_GEOHASH(ST_GEOMFROMTEXT('POINT(-1.00101 -1.0000)'),20),0)) c;
c
POINT(-1.00101 -1)
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH(ST_GEOHASH(ST_GEOMFROMTEXT('POINT(20 20)'),10),0)) c;
c
POINT(20 20)
#=============================================================
# ST_GEOHASH()
#=============================================================
SELECT ST_GEOHASH(ST_POINTFROMGEOHASH("upbp",0),4);
ST_GEOHASH(ST_POINTFROMGEOHASH("upbp",0),4)
upbp
SELECT ST_GEOHASH(ST_POINTFROMGEOHASH("h000",0),8);
ST_GEOHASH(ST_POINTFROMGEOHASH("h000",0),8)
h0000000
SELECT ST_GEOHASH(ST_POINTFROMGEOHASH("s000",0),10);
ST_GEOHASH(ST_POINTFROMGEOHASH("s000",0),10)
s000000000
SELECT ST_GEOHASH(ST_POINTFROMGEOHASH("zzzzm",0),10);
ST_GEOHASH(ST_POINTFROMGEOHASH("zzzzm",0),10)
zzzzmtz1my
SELECT ST_GEOHASH(ST_POINTFROMGEOHASH("pbpbt",0),10);
ST_GEOHASH(ST_POINTFROMGEOHASH("pbpbt",0),10)
pbpbtdpntc
SELECT ST_GEOHASH(ST_POINTFROMGEOHASH("bpbp6",0),10);
ST_GEOHASH(ST_POINTFROMGEOHASH("bpbp6",0),10)
bpbp6mbc6n
SELECT ST_GEOHASH(ST_POINTFROMGEOHASH("0000d",0),10);
ST_GEOHASH(ST_POINTFROMGEOHASH("0000d",0),10)
0000d60yd1
SELECT ST_GEOHASH(ST_POINTFROMGEOHASH("xbpbpbpbp",0),9);
ST_GEOHASH(ST_POINTFROMGEOHASH("xbpbpbpbp",0),9)
xbpbpbpbp
SELECT ST_GEOHASH(ST_POINTFROMGEOHASH("800000000",0),12);
ST_GEOHASH(ST_POINTFROMGEOHASH("800000000",0),12)
800000000000
SELECT ST_GEOHASH(ST_POINTFROMGEOHASH("zzzzzzzzzzzzzzzzzzzz",0),20);
ST_GEOHASH(ST_POINTFROMGEOHASH("zzzzzzzzzzzzzzzzzzzz",0),20)
zzzzzzzzzzzzzzzzzzzz
SELECT ST_GEOHASH(ST_POINTFROMGEOHASH("00000000000000000000",0),20);
ST_GEOHASH(ST_POINTFROMGEOHASH("00000000000000000000",0),20)
00000000000000000000
SELECT ST_GEOHASH(ST_POINTFROMGEOHASH("pbpbpbpbpbpbpbpbpbpb",0),20);
ST_GEOHASH(ST_POINTFROMGEOHASH("pbpbpbpbpbpbpbpbpbpb",0),20)
pbpbpbpbpbpbpbpbpbpb
SELECT ST_GEOHASH(ST_POINTFROMGEOHASH("bpbpbpbpbpbpbpbpbpbp",0),20);
ST_GEOHASH(ST_POINTFROMGEOHASH("bpbpbpbpbpbpbpbpbpbp",0),20)
bpbpbpbpbpbpbpbpbpbp
SELECT ST_GEOHASH(ST_LONGFROMGEOHASH("zzzzzzzzzzzzzzzzzzzz"),ST_LATFROMGEOHASH("zzzzzzzzzzzzzzzzzzzz"),20) c;
c
zzzzzzzzzzzzzzzzzzzz
SELECT ST_GEOHASH(ST_LONGFROMGEOHASH("00000000000000000000"),ST_LATFROMGEOHASH("00000000000000000000"),20) c;
c
00000000000000000000
SELECT ST_GEOHASH(ST_LONGFROMGEOHASH("zzzzzzzzzzzzzzzzzzzz"),ST_LATFROMGEOHASH("00000000000000000000"),20) c;
c
pbpbpbpbpbpbpbpbpbpb
SELECT ST_GEOHASH(ST_LONGFROMGEOHASH("00000000000000000000"),ST_LATFROMGEOHASH("zzzzzzzzzzzzzzzzzzzz"),20) c;
c
bpbpbpbpbpbpbpbpbpbp
SELECT ST_GEOHASH(ST_LONGFROMGEOHASH("pbpbpbpbpbpbpbpbpbpb"),ST_LATFROMGEOHASH("zzzzzzzzzzzzzzzzzzzz"),20) c;
c
zzzzzzzzzzzzzzzzzzzz
SELECT ST_GEOHASH(ST_LONGFROMGEOHASH("zzzzzzzzzzzzzzzzzzzz"),ST_LATFROMGEOHASH("pbpbpbpbpbpbpbpbpbpb"),20) c;
c
pbpbpbpbpbpbpbpbpbpb
SELECT ST_GEOHASH(ST_LONGFROMGEOHASH("zzzzzzzzzzzzzzzzzzzz"),ST_LATFROMGEOHASH("bpbpbpbpbpbpbpbpbpbp"),20) c;
c
zzzzzzzzzzzzzzzzzzzz
SELECT ST_GEOHASH(ST_LONGFROMGEOHASH("bpbpbpbpbpbpbpbpbpbp"),ST_LATFROMGEOHASH("zzzzzzzzzzzzzzzzzzzz"),20) c;
c
bpbpbpbpbpbpbpbpbpbp
SELECT ST_GEOHASH(ST_LONGFROMGEOHASH("bpbpbpbpbpbpbpbpbpbp"),ST_LATFROMGEOHASH("pbpbpbpbpbpbpbpbpbpb"),20) c;
c
00000000000000000000
SELECT
ST_LONGFROMGEOHASH(
CAST("0123456789bcdefghjkmnpqrstuvwxyz0123456789BCDEFGHJKMNPQRSTUVWXYZ"
         AS CHAR CHARACTER SET utf8) COLLATE utf8_persian_ci) c;
c
-179.55743439816956
SELECT
ST_LONGFROMGEOHASH(
CAST("0123456789bcdefghjkmnpqrstuvwxyz0123456789BCDEFGHJKMNPQRSTUVWXYZ"
         AS CHAR CHARACTER SET utf8) COLLATE utf8_czech_ci) c;
c
-179.55743439816956
SELECT
ST_LONGFROMGEOHASH(
CAST("0123456789bcdefghjkmnpqrstuvwxyz0123456789BCDEFGHJKMNPQRSTUVWXYZ"
         AS CHAR CHARACTER SET utf8) COLLATE utf8_unicode_ci) c;
c
-179.55743439816956
SELECT
ST_LONGFROMGEOHASH(
CAST("0123456789bcdefghjkmnpqrstuvwxyz0123456789BCDEFGHJKMNPQRSTUVWXYZ"
         AS CHAR CHARACTER SET utf8) COLLATE utf8_hungarian_ci) c;
c
-179.55743439816956
SELECT
ST_LATFROMGEOHASH(
CAST("0123456789bcdefghjkmnpqrstuvwxyz0123456789BCDEFGHJKMNPQRSTUVWXYZ"
         AS CHAR CHARACTER SET utf8) COLLATE utf8_persian_ci) c;
c
-82.77450549262497
SELECT
ST_LATFROMGEOHASH(
CAST("0123456789bcdefghjkmnpqrstuvwxyz0123456789BCDEFGHJKMNPQRSTUVWXYZ"
         AS CHAR CHARACTER SET utf8) COLLATE utf8_czech_ci) c;
c
-82.77450549262497
SELECT
ST_LATFROMGEOHASH(
CAST("0123456789bcdefghjkmnpqrstuvwxyz0123456789BCDEFGHJKMNPQRSTUVWXYZ"
         AS CHAR CHARACTER SET utf8) COLLATE utf8_unicode_ci) c;
c
-82.77450549262497
SELECT
ST_LATFROMGEOHASH(
CAST("0123456789bcdefghjkmnpqrstuvwxyz0123456789BCDEFGHJKMNPQRSTUVWXYZ"
         AS CHAR CHARACTER SET utf8) COLLATE utf8_hungarian_ci) c;
c
-82.77450549262497
SELECT
ST_ASTEXT(
ST_POINTFROMGEOHASH(
CAST("0123456789bcdefghjkmnpqrstuvwxyz0123456789BCDEFGHJKMNPQRSTUVWXYZ"
           AS CHAR CHARACTER SET utf8) COLLATE utf8_persian_ci,
4326
)
) c;
c
POINT(-179.55743439816956 -82.77450549262497)
SELECT
ST_ASTEXT(
ST_POINTFROMGEOHASH(
CAST("0123456789bcdefghjkmnpqrstuvwxyz0123456789BCDEFGHJKMNPQRSTUVWXYZ"
           AS CHAR CHARACTER SET utf8) COLLATE utf8_czech_ci,
4326
)
) c;
c
POINT(-179.55743439816956 -82.77450549262497)
SELECT
ST_ASTEXT(
ST_POINTFROMGEOHASH(
CAST("0123456789bcdefghjkmnpqrstuvwxyz0123456789BCDEFGHJKMNPQRSTUVWXYZ"
           AS CHAR CHARACTER SET utf8) COLLATE utf8_unicode_ci,
4326
)
) c;
c
POINT(-179.55743439816956 -82.77450549262497)
SELECT
ST_ASTEXT(
ST_POINTFROMGEOHASH(
CAST("0123456789bcdefghjkmnpqrstuvwxyz0123456789BCDEFGHJKMNPQRSTUVWXYZ"
           AS CHAR CHARACTER SET utf8) COLLATE utf8_hungarian_ci,
4326
)
) c;
c
POINT(-179.55743439816956 -82.77450549262497)
CREATE TABLE t1 (val DOUBLE);
INSERT INTO t1 (val) VALUES (12.2);
SELECT val INTO @double FROM t1;
DROP TABLE t1;
SET @null = NULL;
SET @geohash = "01bbgcee";
PREPARE stmt FROM "SELECT ST_LONGFROMGEOHASH(?)";
EXECUTE stmt USING @geohash;
ST_LONGFROMGEOHASH(?)
-178.7755
DEALLOCATE PREPARE stmt;
SELECT ST_LONGFROMGEOHASH(@geohash);
ST_LONGFROMGEOHASH(@geohash)
-178.7755
SELECT ST_LONGFROMGEOHASH(@null);
ST_LONGFROMGEOHASH(@null)
NULL
PREPARE stmt FROM "SELECT ST_LATFROMGEOHASH(?)";
EXECUTE stmt USING @geohash;
ST_LATFROMGEOHASH(?)
-80.0156
DEALLOCATE PREPARE stmt;
SELECT ST_LATFROMGEOHASH(@geohash);
ST_LATFROMGEOHASH(@geohash)
-80.0156
SELECT ST_LATFROMGEOHASH(@null);
ST_LATFROMGEOHASH(@null)
NULL
PREPARE stmt FROM "SELECT ST_ASTEXT(ST_POINTFROMGEOHASH(?, 0))";
EXECUTE stmt USING @geohash;
ST_ASTEXT(ST_POINTFROMGEOHASH(?, 0))
POINT(-178.7755 -80.0156)
DEALLOCATE PREPARE stmt;
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH(@geohash, 0));
ST_ASTEXT(ST_POINTFROMGEOHASH(@geohash, 0))
POINT(-178.7755 -80.0156)
SET @srid = 4326;
PREPARE stmt FROM "SELECT ST_ASTEXT(ST_POINTFROMGEOHASH(\"00\", ?))";
EXECUTE stmt USING @srid;
ST_ASTEXT(ST_POINTFROMGEOHASH("00", ?))
POINT(-174 -87)
DEALLOCATE PREPARE stmt;
SELECT ST_ASTEXT(ST_POINTFROMGEOHASH("00", @srid));
ST_ASTEXT(ST_POINTFROMGEOHASH("00", @srid))
POINT(-174 -87)
SET @maxlen = 3;
PREPARE stmt FROM "SELECT ST_GeoHash(POINT(10, 10), ?)";
EXECUTE stmt USING @maxlen;
ST_GeoHash(POINT(10, 10), ?)
s1z
DEALLOCATE PREPARE stmt;
SELECT ST_GeoHash(POINT(10, 10), @maxlen);
ST_GeoHash(POINT(10, 10), @maxlen)
s1z
SELECT ST_GeoHash(POINT(10, 10), @null);
ST_GeoHash(POINT(10, 10), @null)
NULL
SET @point = POINT(10, 10);
PREPARE stmt FROM "SELECT ST_GeoHash(?, 10)";
EXECUTE stmt USING @point;
ST_GeoHash(?, 10)
s1z0gs3y0z
DEALLOCATE PREPARE stmt;
SELECT ST_GeoHash(@point, 10);
ST_GeoHash(@point, 10)
s1z0gs3y0z
SELECT ST_GeoHash(@null, 10);
ST_GeoHash(@null, 10)
NULL
SET @long = 22.0311;
PREPARE stmt FROM "SELECT ST_GeoHash(?, 10, 10)";
EXECUTE stmt USING @long;
ST_GeoHash(?, 10, 10)
s3z8vk6w1z
DEALLOCATE PREPARE stmt;
SELECT ST_GeoHash(@long, 10, 10);
ST_GeoHash(@long, 10, 10)
s3z8vk6w1z
SELECT ST_GeoHash(@null, 10, 10);
ST_GeoHash(@null, 10, 10)
NULL
SET @lat = -54.123;
PREPARE stmt FROM "SELECT ST_GeoHash(10, ?, 10)";
EXECUTE stmt USING @lat;
ST_GeoHash(10, ?, 10)
hnrh5e1y8v
DEALLOCATE PREPARE stmt;
SELECT ST_GeoHash(10, @lat, 10);
ST_GeoHash(10, @lat, 10)
hnrh5e1y8v
SELECT ST_GeoHash(10, @null, 10);
ST_GeoHash(10, @null, 10)
NULL
PREPARE stmt FROM "SELECT ST_GeoHash(10, 10, ?)";
EXECUTE stmt USING @maxlen;
ST_GeoHash(10, 10, ?)
s1z
DEALLOCATE PREPARE stmt;
SELECT ST_GeoHash(10, 10, @maxlen);
ST_GeoHash(10, 10, @maxlen)
s1z
SELECT ST_GeoHash(@double, @double, 10);
ST_GeoHash(@double, @double, 10)
s60tmsgy0s
SELECT ST_GeoHash(POINT(10, 10), @double);
ERROR HY000: Out of range error: max_length parameter should be an integer in the range [1, 100] in function ST_GeoHash.
SELECT ST_POINTFROMGEOHASH("00", @double);
ERROR 22023: Invalid GIS data provided to function ST_PointFromGeoHash.
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a VARCHAR(255));
INSERT INTO t1 (a) VALUES ('  ');
SELECT ST_LONGFROMGEOHASH(a) FROM t1;
ERROR HY000: Incorrect geohash value: '  ' for function st_longfromgeohash
SELECT ST_LATFROMGEOHASH(a) FROM t1;
ERROR HY000: Incorrect geohash value: '  ' for function st_latfromgeohash
SELECT ST_POINTFROMGEOHASH(a, 0) FROM t1;
ERROR HY000: Incorrect geohash value: '  ' for function st_pointfromgeohash
DELETE FROM t1;
INSERT INTO t1 VALUES ('swpwwwwww'), ('guqtjvooguqtjvoo');
SELECT ST_LONGFROMGEOHASH(a) FROM t1;
ERROR HY000: Incorrect geohash value: 'guqtjvooguqtjvoo' for function st_longfromgeohash
SELECT ST_LATFROMGEOHASH(a) FROM t1;
ERROR HY000: Incorrect geohash value: 'guqtjvooguqtjvoo' for function st_latfromgeohash
SELECT ST_POINTFROMGEOHASH(a, 0) FROM t1;
ERROR HY000: Incorrect geohash value: 'guqtjvooguqtjvoo' for function st_pointfromgeohash
# Clean up
DROP TABLE geohashes;
DROP TABLE t1;
#
# Bug#22165582 ST_*FROMGEOHASH ROUNDS INCORRECTLY
#
SELECT ST_GeoHash(ST_PointFromGeoHash('xkcd', 0), 4);
ST_GeoHash(ST_PointFromGeoHash('xkcd', 0), 4)
xkcd
SELECT ST_LongFromGeoHash('xkcd');
ST_LongFromGeoHash('xkcd')
148.5
SELECT ST_LatFromGeoHash('xkcd');
ST_LatFromGeoHash('xkcd')
27.2
SELECT ST_GeoHash(ST_PointFromGeoHash('ebrb', 0), 4);
ST_GeoHash(ST_PointFromGeoHash('ebrb', 0), 4)
s020
SELECT ST_LatFromGeoHash('m7s9pyctu9bbwqkgbw5x6vutzkztd9szjh86gmz9w9nsz6792d') c;
c
-25.098643334722453
#
# Bug#22838668 CRASH IN ITEM_FUNC_LATLONGFROMGEOHASH::VAL_REAL
# WITH BAD PARAMETERS
#
DO ST_Disjoint(
POLYGON(
LINESTRING(POINT(1, 1))
),
ST_LatFromGeoHash(ExtractValue(1, NULL))
);
ERROR HY000: Illegal parameter data type double for operation 'st_disjoint'
DO ST_Disjoint(
POLYGON(
LINESTRING(POINT(1, 1))
),
ST_LongFromGeoHash(ExtractValue(1, NULL))
);
ERROR HY000: Illegal parameter data type double for operation 'st_disjoint'
DO ST_Disjoint(
POLYGON(
LINESTRING(POINT(1, 1))
),
ST_LatFromGeoHash(UpdateXML(1, NULL, NULL))
);
ERROR HY000: Illegal parameter data type double for operation 'st_disjoint'
DO ST_Disjoint(
POLYGON(
LINESTRING(POINT(1, 1))
),
ST_LongFromGeoHash(UpdateXML(1, NULL, NULL))
);
ERROR HY000: Illegal parameter data type double for operation 'st_disjoint'
#
# Bug#25912557 ST_LATFROMGEOHASH/ST_LONGFROMGEOHASH ODD INPUT TYPE
#              REQUIREMENT
#
CREATE TABLE t1 (col1 CHAR(4));
INSERT INTO t1 VALUES ('bbbb');
SELECT ST_LatFromGeohash(col1) FROM t1;
ST_LatFromGeohash(col1)
49.3
SELECT ST_LongFromGeohash(col1) FROM t1;
ST_LongFromGeohash(col1)
-145
SELECT ST_AsText(ST_PointFromGeohash(col1, 4326)) FROM t1;
ST_AsText(ST_PointFromGeohash(col1, 4326))
POINT(-145 49.3)
DROP TABLE t1;
#
# MDEV-36168 ASAN global-buffer-overflow in Item_func_latlongfromgeohash::decode_geohash
#
SELECT ST_LatFromGeoHash("ї");
ERROR HY000: Incorrect geohash value: '\0457' for function st_latfromgeohash
SELECT ST_LongFromGeoHash("ї");
ERROR HY000: Incorrect geohash value: '\0457' for function st_longfromgeohash
#
# MDEV-34158 st_geohash error reporting and null handling
#
SELECT  ST_GeoHash(( POINTFROMTEXT(' POINT( 4 1 ) ') ), 1e0);
ERROR HY000: Out of range error: max_length parameter should be an integer in the range [1, 100] in function ST_GeoHash.
SELECT  ST_GeoHash(( POINTFROMTEXT(' POINT( 4 1 ) ') ), 0);
ERROR HY000: Out of range error: max_length parameter should be an integer in the range [1, 100] in function ST_GeoHash.
SELECT ST_GeoHash(45,-20,null);
ST_GeoHash(45,-20,null)
NULL
SELECT ST_GeoHash(0,-20,null);
ST_GeoHash(0,-20,null)
NULL
SELECT  ST_GeoHash(( POINTFROMTEXT(' POINT( 4 1 ) ') ), NULL);
ST_GeoHash(( POINTFROMTEXT(' POINT( 4 1 ) ') ), NULL)
NULL
