mark some file to been opensource for ce-farm
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,28 @@
|
||||
# ----------------------------------------------------------------------
|
||||
# Create spatial index test of GEOMETRY spatial index.
|
||||
# ----------------------------------------------------------------------
|
||||
DROP TABLE IF EXISTS tab;
|
||||
CREATE TABLE tab(c1 int NOT NULL PRIMARY KEY,c2 GEOMETRY NOT NULL SRID 0,
|
||||
c3 GEOMETRY NOT NULL SRID 0,c4 GEOMETRY NOT NULL SRID 0,c5 GEOMETRY NOT NULL SRID 0);
|
||||
CREATE SPATIAL INDEX idx1 on tab(c2);
|
||||
CREATE SPATIAL INDEX idx2 on tab(c3 ASC) COMMENT 'wl6968';
|
||||
ERROR HY000: Incorrect usage of spatial/fulltext/hash index and explicit index order.
|
||||
CREATE SPATIAL INDEX idx2 on tab(c3 DESC) COMMENT 'wl6968';
|
||||
ERROR HY000: Incorrect usage of spatial/fulltext/hash index and explicit index order.
|
||||
CREATE SPATIAL INDEX idx3 on tab(c4);
|
||||
CREATE SPATIAL INDEX idx4 on tab(c5 DESC) COMMENT 'Spatial index on Geometry type column';
|
||||
ERROR HY000: Incorrect usage of spatial/fulltext/hash index and explicit index order.
|
||||
SHOW INDEXES FROM tab;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Visible Expression
|
||||
tab 0 PRIMARY 1 c1 A NULL NULL NULL BTREE available YES NULL
|
||||
tab 1 idx1 1 c2 A NULL NULL NULL SPATIAL available YES NULL
|
||||
tab 1 idx3 1 c4 A NULL NULL NULL SPATIAL available YES NULL
|
||||
INSERT INTO tab(c1,c2,c3,c4,c5)
|
||||
VALUES(1,ST_GeomFromText('POINT(10 10)'),ST_GeomFromText('LINESTRING(5 5,20 20,30 30)'),
|
||||
ST_GeomFromText('POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))'),
|
||||
ST_GeomFromText('POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))'));
|
||||
INSERT INTO tab(c1,c2,c3,c4,c5)
|
||||
VALUES(3,ST_GeomFromText('POINT(4 4)'),ST_GeomFromText('LINESTRING(130 130,140 140,150 150)'),
|
||||
ST_GeomFromText('POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'),
|
||||
ST_GeomFromText('POLYGON((4 -2,5 -4,6 -5,7 -4,7 2,4 -2))'));
|
||||
DROP TABLE tab;
|
||||
@ -0,0 +1,585 @@
|
||||
# ----------------------------------------------------------------------
|
||||
# Base test of geometry ddl.
|
||||
# ----------------------------------------------------------------------
|
||||
set @g = point(1, 1);
|
||||
select length(@g);
|
||||
length(@g)
|
||||
25
|
||||
drop table if exists geo_table, tt1, T_GEO, tab, FF01, gis_point_plancache;
|
||||
CREATE TABLE geo_table(
|
||||
k int primary key,
|
||||
geom geometry NOT NULL,
|
||||
SPATIAL INDEX (geom)
|
||||
);
|
||||
INSERT INTO geo_table VALUES
|
||||
(1, ST_GeomFromText('POINT(1.0 1.0)')),
|
||||
(2, ST_GeomFromText('LINESTRING(1.0 1.0, 2.0 2.0)')),
|
||||
(3, ST_GeomFromText('POINT(3.0 3.0)')),
|
||||
(4, ST_GeomFromText('LINESTRING(4.0 4.0, 5.0 5.0)')),
|
||||
(5, ST_GeomFromText('LINESTRING(40.0 40.0, 41.0 41.0)')),
|
||||
(6, ST_GeomFromText('POLYGON((1.0 1.0, 5.0 1.0, 5.0 5.0, 1.0 5.0, 1.0 1.0))'));
|
||||
SELECT k FROM geo_table WHERE ST_Intersects(ST_GeomFromText('POINT(3.0 3.0)'), geom) ORDER BY k;
|
||||
k
|
||||
3
|
||||
6
|
||||
drop table geo_table;
|
||||
CREATE TABLE geo_table(
|
||||
k int primary key,
|
||||
geom geometry NOT NULL srid 4326,
|
||||
SPATIAL INDEX (geom) local
|
||||
);
|
||||
INSERT INTO geo_table VALUES (1, ST_GeomFromText('POINT(1.0 1.0)', 4326));
|
||||
SELECT k FROM geo_table WHERE ST_Intersects(ST_GeomFromText('POINT(1.0 1.0)', 0), geom) ORDER BY k;
|
||||
ERROR HY000: The SRID of the geometry does not match the SRID of the column. The SRID of the geometry is 0, but the SRID of the column is 4326. Consider changing the SRID of the geometry or the SRID property of the column.
|
||||
drop table geo_table;
|
||||
create table tt1(g GEOMETRY check(g=ST_GeomFromText('point(10 20)')));
|
||||
insert into tt1 values(ST_GeomFromText('point(10 20)',26918));
|
||||
ERROR HY000: check constraint violated
|
||||
insert into tt1 values(st_geomfromwkb(x'01040000000300000001010000000000000000c067400000000000805b4001010000000000000000c06240000000000080514001010000000000000000c06c400000000000805140'));
|
||||
ERROR HY000: check constraint violated
|
||||
insert into tt1 values(ST_GeomFromText('point(10 20)'));
|
||||
drop table tt1;
|
||||
create table T_GEO (GID int auto_increment primary key, geo_c geometrycollection,geo geometry);
|
||||
select * from T_GEO group by geo;
|
||||
GID geo_c geo
|
||||
select * from T_GEO order by geo_c;
|
||||
GID geo_c geo
|
||||
drop table T_GEO;
|
||||
CREATE TABLE tab(c1 int NOT NULL PRIMARY KEY,c2 POINT NOT NULL SRID 0,
|
||||
c3 LINESTRING NOT NULL SRID 0,c4 POLYGON NOT NULL SRID 0,c5 GEOMETRY NOT NULL SRID 0)
|
||||
ENGINE=InnoDB;
|
||||
Warnings:
|
||||
Warning 1286 Unknown storage engine 'InnoDB'
|
||||
INSERT INTO tab(c1,c2,c3,c4,c5)
|
||||
VALUES(1,ST_GeomFromText('POINT(10 10)'),ST_GeomFromText('LINESTRING(5 5,20 20,30 30)'),
|
||||
ST_GeomFromText('POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))'),
|
||||
ST_GeomFromText('POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))'));
|
||||
INSERT INTO tab(c1,c2,c3,c4,c5)
|
||||
VALUES(2,ST_GeomFromText('POINT(20 20)'),ST_GeomFromText('LINESTRING(20 20,30 30,40 40)'),
|
||||
ST_GeomFromText('POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50))'),
|
||||
ST_GeomFromText('POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50))'));
|
||||
INSERT INTO tab(c1,c2,c3,c4,c5)
|
||||
VALUES(3,ST_GeomFromText('POINT(4 4)'),ST_GeomFromText('LINESTRING(130 130,140 140,150 150)'),
|
||||
ST_GeomFromText('POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'),
|
||||
ST_GeomFromText('POLYGON((4 -2,5 -4,6 -5,7 -4,7 2,4 -2))'));
|
||||
INSERT INTO tab(c1,c2,c3,c4,c5)
|
||||
VALUES(4,ST_GeomFromText('POINT(50 50)'),ST_GeomFromText('LINESTRING(200 200,300 300,400 400)'),
|
||||
ST_GeomFromText('POLYGON((300 300,400 400,500 500,300 500,300 400,300 300))'),
|
||||
ST_GeomFromText('POLYGON((300 300,400 400,500 500,300 500,300 400,300 300))'));
|
||||
INSERT INTO tab(c1,c2,c3,c4,c5)
|
||||
VALUES(5,ST_GeomFromText('POINT(3 3)'),ST_GeomFromText('LINESTRING(400 400,500 500,600 700)'),
|
||||
ST_GeomFromText('POLYGON((1010 1010,1020 1020,1030 1030,1040 1030,1020 1010,1010 1010))'),
|
||||
ST_GeomFromText('POLYGON((1010 1010,1020 1020,1030 1030,1040 1030,1020 1010,1010 1010))'));
|
||||
INSERT INTO tab(c1,c2,c3,c4,c5)
|
||||
VALUES(6,ST_GeomFromText('POINT(3 3)'),ST_GeomFromText('LINESTRING(40 40,50 50,60 70)'),
|
||||
ST_GeomFromText('POLYGON((2010 2010,2020 2020,2030 2030,2040 2030,2020 2010,2010 2010))'),
|
||||
ST_GeomFromText('POLYGON((2010 2010,2020 2020,2030 2030,2040 2030,2020 2010,2010 2010))'));
|
||||
INSERT INTO tab(c1,c2,c3,c4,c5)
|
||||
VALUES(7,ST_GeomFromText('POINT(60 70)'),ST_GeomFromText('LINESTRING(40 40,50 50,60 70)'),
|
||||
ST_GeomFromText('POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))'),
|
||||
ST_GeomFromText('POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))'));
|
||||
INSERT INTO tab(c1,c2,c3,c4,c5)
|
||||
VALUES(8,ST_GeomFromText('POINT(0 0)'),ST_GeomFromText('LINESTRING(40 40,50 50,60 70)'),
|
||||
ST_GeomFromText('POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))'),
|
||||
ST_GeomFromText('POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))'));
|
||||
INSERT INTO tab(c1,c2,c3,c4,c5)
|
||||
VALUES(9,ST_GeomFromText('POINT(120 120)'),ST_GeomFromText('LINESTRING(100 100,110 110,120 120)'),
|
||||
ST_GeomFromText('POLYGON((4010 4010,4020 4020,4030 4030,4040 4030,4020 4010,4010 4010))'),
|
||||
ST_GeomFromText('POLYGON((4010 4010,4020 4020,4030 4030,4040 4030,4020 4010,4010 4010))'));
|
||||
INSERT INTO tab(c1,c2,c3,c4,c5)
|
||||
VALUES(10,ST_GeomFromText('POINT(160 160)'),ST_GeomFromText('LINESTRING(140 140,150 150,160 160)'),
|
||||
ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'),
|
||||
ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'));
|
||||
SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab ORDER BY c1;
|
||||
c1 ST_Astext(c2) ST_Astext(c4)
|
||||
1 POINT(10 10) POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))
|
||||
2 POINT(20 20) POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50))
|
||||
3 POINT(4 4) POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))
|
||||
4 POINT(50 50) POLYGON((300 300,400 400,500 500,300 500,300 400,300 300))
|
||||
5 POINT(3 3) POLYGON((1010 1010,1020 1020,1030 1030,1040 1030,1020 1010,1010 1010))
|
||||
6 POINT(3 3) POLYGON((2010 2010,2020 2020,2030 2030,2040 2030,2020 2010,2010 2010))
|
||||
7 POINT(60 70) POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))
|
||||
8 POINT(0 0) POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))
|
||||
9 POINT(120 120) POLYGON((4010 4010,4020 4020,4030 4030,4040 4030,4020 4010,4010 4010))
|
||||
10 POINT(160 160) POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))
|
||||
SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab ORDER BY c2;
|
||||
c1 ST_Astext(c2) ST_Astext(c4)
|
||||
8 POINT(0 0) POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))
|
||||
5 POINT(3 3) POLYGON((1010 1010,1020 1020,1030 1030,1040 1030,1020 1010,1010 1010))
|
||||
6 POINT(3 3) POLYGON((2010 2010,2020 2020,2030 2030,2040 2030,2020 2010,2010 2010))
|
||||
3 POINT(4 4) POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))
|
||||
1 POINT(10 10) POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))
|
||||
2 POINT(20 20) POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50))
|
||||
4 POINT(50 50) POLYGON((300 300,400 400,500 500,300 500,300 400,300 300))
|
||||
7 POINT(60 70) POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))
|
||||
9 POINT(120 120) POLYGON((4010 4010,4020 4020,4030 4030,4040 4030,4020 4010,4010 4010))
|
||||
10 POINT(160 160) POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))
|
||||
SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab ORDER BY c3;
|
||||
c1 ST_Astext(c2) ST_Astext(c4)
|
||||
1 POINT(10 10) POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))
|
||||
2 POINT(20 20) POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50))
|
||||
6 POINT(3 3) POLYGON((2010 2010,2020 2020,2030 2030,2040 2030,2020 2010,2010 2010))
|
||||
7 POINT(60 70) POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))
|
||||
8 POINT(0 0) POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))
|
||||
9 POINT(120 120) POLYGON((4010 4010,4020 4020,4030 4030,4040 4030,4020 4010,4010 4010))
|
||||
4 POINT(50 50) POLYGON((300 300,400 400,500 500,300 500,300 400,300 300))
|
||||
5 POINT(3 3) POLYGON((1010 1010,1020 1020,1030 1030,1040 1030,1020 1010,1010 1010))
|
||||
3 POINT(4 4) POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))
|
||||
10 POINT(160 160) POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))
|
||||
SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab ORDER BY c4;
|
||||
c1 ST_Astext(c2) ST_Astext(c4)
|
||||
3 POINT(4 4) POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))
|
||||
1 POINT(10 10) POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))
|
||||
9 POINT(120 120) POLYGON((4010 4010,4020 4020,4030 4030,4040 4030,4020 4010,4010 4010))
|
||||
6 POINT(3 3) POLYGON((2010 2010,2020 2020,2030 2030,2040 2030,2020 2010,2010 2010))
|
||||
7 POINT(60 70) POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))
|
||||
8 POINT(0 0) POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))
|
||||
5 POINT(3 3) POLYGON((1010 1010,1020 1020,1030 1030,1040 1030,1020 1010,1010 1010))
|
||||
10 POINT(160 160) POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))
|
||||
4 POINT(50 50) POLYGON((300 300,400 400,500 500,300 500,300 400,300 300))
|
||||
2 POINT(20 20) POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50))
|
||||
SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab ORDER BY c5;
|
||||
c1 ST_Astext(c2) ST_Astext(c4)
|
||||
3 POINT(4 4) POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))
|
||||
1 POINT(10 10) POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))
|
||||
9 POINT(120 120) POLYGON((4010 4010,4020 4020,4030 4030,4040 4030,4020 4010,4010 4010))
|
||||
6 POINT(3 3) POLYGON((2010 2010,2020 2020,2030 2030,2040 2030,2020 2010,2010 2010))
|
||||
7 POINT(60 70) POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))
|
||||
8 POINT(0 0) POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))
|
||||
5 POINT(3 3) POLYGON((1010 1010,1020 1020,1030 1030,1040 1030,1020 1010,1010 1010))
|
||||
10 POINT(160 160) POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))
|
||||
4 POINT(50 50) POLYGON((300 300,400 400,500 500,300 500,300 400,300 300))
|
||||
2 POINT(20 20) POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50))
|
||||
SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab GROUP BY c1;
|
||||
c1 ST_Astext(c2) ST_Astext(c4)
|
||||
1 POINT(10 10) POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))
|
||||
2 POINT(20 20) POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50))
|
||||
3 POINT(4 4) POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))
|
||||
4 POINT(50 50) POLYGON((300 300,400 400,500 500,300 500,300 400,300 300))
|
||||
5 POINT(3 3) POLYGON((1010 1010,1020 1020,1030 1030,1040 1030,1020 1010,1010 1010))
|
||||
6 POINT(3 3) POLYGON((2010 2010,2020 2020,2030 2030,2040 2030,2020 2010,2010 2010))
|
||||
7 POINT(60 70) POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))
|
||||
8 POINT(0 0) POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))
|
||||
9 POINT(120 120) POLYGON((4010 4010,4020 4020,4030 4030,4040 4030,4020 4010,4010 4010))
|
||||
10 POINT(160 160) POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))
|
||||
SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab GROUP BY c2;
|
||||
c1 ST_Astext(c2) ST_Astext(c4)
|
||||
1 POINT(10 10) POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))
|
||||
2 POINT(20 20) POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50))
|
||||
3 POINT(4 4) POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))
|
||||
4 POINT(50 50) POLYGON((300 300,400 400,500 500,300 500,300 400,300 300))
|
||||
5 POINT(3 3) POLYGON((1010 1010,1020 1020,1030 1030,1040 1030,1020 1010,1010 1010))
|
||||
7 POINT(60 70) POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))
|
||||
8 POINT(0 0) POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))
|
||||
9 POINT(120 120) POLYGON((4010 4010,4020 4020,4030 4030,4040 4030,4020 4010,4010 4010))
|
||||
10 POINT(160 160) POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))
|
||||
SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab GROUP BY c3;
|
||||
c1 ST_Astext(c2) ST_Astext(c4)
|
||||
1 POINT(10 10) POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))
|
||||
2 POINT(20 20) POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50))
|
||||
3 POINT(4 4) POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))
|
||||
4 POINT(50 50) POLYGON((300 300,400 400,500 500,300 500,300 400,300 300))
|
||||
5 POINT(3 3) POLYGON((1010 1010,1020 1020,1030 1030,1040 1030,1020 1010,1010 1010))
|
||||
6 POINT(3 3) POLYGON((2010 2010,2020 2020,2030 2030,2040 2030,2020 2010,2010 2010))
|
||||
9 POINT(120 120) POLYGON((4010 4010,4020 4020,4030 4030,4040 4030,4020 4010,4010 4010))
|
||||
10 POINT(160 160) POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))
|
||||
SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab GROUP BY c4;
|
||||
c1 ST_Astext(c2) ST_Astext(c4)
|
||||
1 POINT(10 10) POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))
|
||||
2 POINT(20 20) POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50))
|
||||
3 POINT(4 4) POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))
|
||||
4 POINT(50 50) POLYGON((300 300,400 400,500 500,300 500,300 400,300 300))
|
||||
5 POINT(3 3) POLYGON((1010 1010,1020 1020,1030 1030,1040 1030,1020 1010,1010 1010))
|
||||
6 POINT(3 3) POLYGON((2010 2010,2020 2020,2030 2030,2040 2030,2020 2010,2010 2010))
|
||||
7 POINT(60 70) POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))
|
||||
9 POINT(120 120) POLYGON((4010 4010,4020 4020,4030 4030,4040 4030,4020 4010,4010 4010))
|
||||
10 POINT(160 160) POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))
|
||||
SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab GROUP BY c5;
|
||||
c1 ST_Astext(c2) ST_Astext(c4)
|
||||
1 POINT(10 10) POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))
|
||||
2 POINT(20 20) POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50))
|
||||
3 POINT(4 4) POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))
|
||||
4 POINT(50 50) POLYGON((300 300,400 400,500 500,300 500,300 400,300 300))
|
||||
5 POINT(3 3) POLYGON((1010 1010,1020 1020,1030 1030,1040 1030,1020 1010,1010 1010))
|
||||
6 POINT(3 3) POLYGON((2010 2010,2020 2020,2030 2030,2040 2030,2020 2010,2010 2010))
|
||||
7 POINT(60 70) POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))
|
||||
9 POINT(120 120) POLYGON((4010 4010,4020 4020,4030 4030,4040 4030,4020 4010,4010 4010))
|
||||
10 POINT(160 160) POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))
|
||||
SET sql_mode = 'ONLY_FULL_GROUP_BY';
|
||||
SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab GROUP BY c2;
|
||||
ERROR 42000: 'test.tab.c1' is not in GROUP BY
|
||||
SET sql_mode = ' ';
|
||||
drop table tab;
|
||||
CREATE TABLE FF01 (A INT,B GEOMETRY);
|
||||
INSERT INTO FF01 VALUES (1,NULL);
|
||||
INSERT INTO FF01 VALUES (2,POINT(1,2));
|
||||
INSERT INTO FF01 VALUES (3,POINT(-1,-2));
|
||||
SELECT ST_ASTEXT(B) FROM FF01 WHERE B = SOME (SELECT B FROM FF01 WHERE A=1);
|
||||
ST_ASTEXT(B)
|
||||
SELECT ST_ASTEXT(B) FROM FF01 WHERE B = SOME (SELECT A FROM FF01 WHERE B=POINT(1,2));
|
||||
ST_ASTEXT(B)
|
||||
SELECT ST_ASTEXT(B) FROM FF01 WHERE B IN (SELECT B FROM FF01 WHERE B=POINT(1,2));
|
||||
ST_ASTEXT(B)
|
||||
POINT(1 2)
|
||||
SELECT ST_ASTEXT(B) FROM FF01 WHERE B LIKE (SELECT B FROM FF01 WHERE B=POINT(1,2));
|
||||
ERROR HY000: Invalid argument
|
||||
SELECT ST_ASTEXT(B) FROM FF01 WHERE B NOT IN (SELECT B FROM FF01 WHERE B=POINT(1,2));
|
||||
ST_ASTEXT(B)
|
||||
POINT(-1 -2)
|
||||
SELECT ST_ASTEXT(B) FROM FF01 WHERE B = ANY (SELECT A FROM FF01 WHERE B=POINT(1,2));
|
||||
ST_ASTEXT(B)
|
||||
SELECT ST_ASTEXT(B) FROM FF01 WHERE B = ALL (SELECT A FROM FF01 WHERE B=POINT(1,2));
|
||||
ST_ASTEXT(B)
|
||||
drop table FF01;
|
||||
create table FF01 (gid int auto_increment primary key, geo geometry SRID 4326,geo_c GEOMETRYCOLLECTION SRID 26918,poi point SRID 4326,lin linestring SRID 26918,pol polygon SRID 4326,M_POI MULTIPOINT SRID 26918,M_LIN MULTILINESTRING SRID 4326 ,M_POL MULTIPOLYGON SRID 26918);
|
||||
SELECT ST_ASTEXT(POL) FROM FF01 WHERE (GEO,GEO_C) = (SELECT GEO,GEO_C FROM FF01 WHERE GID=1);
|
||||
ST_ASTEXT(POL)
|
||||
drop table FF01;
|
||||
create table FF01 (gid int auto_increment primary key, M_POI MULTIPOINT SRID 26918);
|
||||
create table FF02 (gid int auto_increment primary key, geo geometry SRID 4326);
|
||||
SELECT ST_ASTEXT(M_POI) FROM FF01 WHERE M_POI <=> (SELECT M_POI FROM FF02 WHERE GID=1);
|
||||
ST_ASTEXT(M_POI)
|
||||
drop table FF01;
|
||||
drop table FF02;
|
||||
alter system flush plan cache;
|
||||
create table gis_point_plancache (x double, y double, poi geometry);
|
||||
insert into gis_point_plancache (x,y,poi) values (88.9200873939389,-70.01650134265074,st_srid(point(88.9200873939389,-70.01650134265074),4326)),(-131.96607164968344,70.74339201768984,st_srid(point(-131.96607164968344,70.74339201768984),4326));
|
||||
insert into gis_point_plancache (x,y,poi) values (66.70676602312597,68.49638658511424,st_srid(point(66.70676602312597,68.49638658511424),4326)),(38.2111204280196,-84.97214528175294,st_srid(point(38.2111204280196,-84.97214528175294),4326));
|
||||
insert into gis_point_plancache (x,y,poi) values (-135.24378902766549,-45.111689570279204,st_srid(point(-135.24378902766549,-45.111689570279204),4326)),(54.43574907318134,11.87557381602113,st_srid(point(54.43574907318134,11.87557381602113),4326));
|
||||
insert into gis_point_plancache (x,y,poi) values (-51.28971091880538,-16.112290993511024,st_srid(point(-51.28971091880538,-16.112290993511024),4326)),(26.793719900045886,38.22676013634444,st_srid(point(26.793719900045886,38.22676013634444),4326));
|
||||
insert into gis_point_plancache (x,y,poi) values (1.1, 1.2, st_srid(linestring(point(1.1, 1.2), point(1.2, 1.3)), 4326));
|
||||
insert into gis_point_plancache (x,y,poi) values (1.111, 1.211, st_srid(linestring(point(1.111, 1.211), point(1.211, 1.311)), 4326));
|
||||
insert into gis_point_plancache (x,y,poi) values (1.111111, 1.211111, st_srid(linestring(point(1.111111, 1.211111), point(1.211111, 1.311111)), 4326));
|
||||
select x,y,st_astext(poi) from gis_point_plancache;
|
||||
x y st_astext(poi)
|
||||
88.9200873939389 -70.01650134265074 POINT(-70.01650134265074 88.9200873939389)
|
||||
-131.96607164968344 70.74339201768984 POINT(70.74339201768984 -131.96607164968344)
|
||||
66.70676602312597 68.49638658511424 POINT(68.49638658511424 66.70676602312597)
|
||||
38.2111204280196 -84.97214528175294 POINT(-84.97214528175294 38.2111204280196)
|
||||
-135.24378902766549 -45.111689570279204 POINT(-45.111689570279204 -135.24378902766549)
|
||||
54.43574907318134 11.87557381602113 POINT(11.87557381602113 54.43574907318134)
|
||||
-51.28971091880538 -16.112290993511024 POINT(-16.112290993511024 -51.28971091880538)
|
||||
26.793719900045886 38.22676013634444 POINT(38.22676013634444 26.793719900045886)
|
||||
1.1 1.2 LINESTRING(1.2 1.1,1.3 1.2)
|
||||
1.111 1.211 LINESTRING(1.211 1.111,1.311 1.211)
|
||||
1.111111 1.211111 LINESTRING(1.211111 1.111111,1.311111 1.211111)
|
||||
select executions, hit_count, substring(query_sql, 1, 100) as sql_text from oceanbase.GV$OB_PLAN_CACHE_PLAN_STAT where query_sql like '%x,y,poi%' order by plan_size desc limit 10;
|
||||
executions hit_count sql_text
|
||||
0 0 select executions, hit_count, substring(query_sql, 1, 100) as sql_text from oceanbase.GV$OB_PLAN_CAC
|
||||
1 0 insert into gis_point_plancache (x,y,poi) values (88.9200873939389,-70.01650134265074,st_srid(point(
|
||||
1 0 insert into gis_point_plancache (x,y,poi) values (-51.28971091880538,-16.112290993511024,st_srid(poi
|
||||
1 0 insert into gis_point_plancache (x,y,poi) values (66.70676602312597,68.49638658511424,st_srid(point(
|
||||
1 0 insert into gis_point_plancache (x,y,poi) values (-135.24378902766549,-45.111689570279204,st_srid(po
|
||||
1 0 insert into gis_point_plancache (x,y,poi) values (1.1, 1.2, st_srid(linestring(point(1.1, 1.2), poin
|
||||
1 0 insert into gis_point_plancache (x,y,poi) values (1.111, 1.211, st_srid(linestring(point(1.111, 1.21
|
||||
1 0 insert into gis_point_plancache (x,y,poi) values (1.111111, 1.211111, st_srid(linestring(point(1.111
|
||||
drop table gis_point_plancache;
|
||||
select json_array(1.1, 1.1, 1.1);
|
||||
json_array(1.1, 1.1, 1.1)
|
||||
[1.1, 1.1, 1.1]
|
||||
select json_array(1.1111, 1.1, 1.1);
|
||||
json_array(1.1111, 1.1, 1.1)
|
||||
[1.1111, 1.1, 1.1]
|
||||
select json_array(1.111111111, 1.1, 1.1);
|
||||
json_array(1.111111111, 1.1, 1.1)
|
||||
[1.111111111, 1.1, 1.1]
|
||||
select st_astext(point(cast(1.11 as double), 1.1)) as plancache_not_share;
|
||||
plancache_not_share
|
||||
POINT(1.11 1.1)
|
||||
select st_astext(point(cast(1.1111 as double), 1.1111)) as plancache_not_share;
|
||||
plancache_not_share
|
||||
POINT(1.1111 1.1111)
|
||||
select cast(1.11 as double), st_astext(point(1.1, 1.1)) as plancache_not_share;
|
||||
cast(1.11 as double) plancache_not_share
|
||||
1.11 POINT(1.1 1.1)
|
||||
select cast(1.11111 as double), st_astext(point(1.1, 1.1111)) as plancache_not_share;
|
||||
cast(1.11111 as double) plancache_not_share
|
||||
1.11111 POINT(1.1 1.1111)
|
||||
select executions, hit_count, substring(query_sql, 1, 100) as sql_text from oceanbase.GV$OB_PLAN_CACHE_PLAN_STAT where query_sql like '%plancache_not_share%' and query_sql not like '%OB_PLAN_CACHE_PLAN_STAT%' order by plan_size desc limit 10;
|
||||
executions hit_count sql_text
|
||||
1 0 select st_astext(point(cast(1.11 as double), 1.1)) as plancache_not_share
|
||||
1 0 select st_astext(point(cast(1.1111 as double), 1.1111)) as plancache_not_share
|
||||
1 0 select cast(1.11 as double), st_astext(point(1.1, 1.1)) as plancache_not_share
|
||||
1 0 select cast(1.11111 as double), st_astext(point(1.1, 1.1111)) as plancache_not_share
|
||||
drop table if exists tt2;
|
||||
create table tt2(g GEOMETRY);
|
||||
insert into tt2 values(ST_GeomFromText('LINESTRING(0 0, 10 10, 20 25, 50 60)'));
|
||||
ALTER TABLE tt2 ADD CONSTRAINT qq CHECK(g=ST_GeomFromText('point(10 20)'));
|
||||
ERROR HY000: check constraint violated
|
||||
ALTER TABLE tt2 ADD CONSTRAINT qq CHECK(g=ST_GeomFromText('LINESTRING(0 0, 10 10, 20 25, 50 60)'));
|
||||
drop table tt2;
|
||||
SELECT ST_CONTAINS(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(LINESTRING(2 0,2 0))'),ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(2 0))')) A;
|
||||
A
|
||||
1
|
||||
SELECT ST_CONTAINS(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(LINESTRING(2 0,2 0))', 4326),ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(2 0))', 4326)) A;
|
||||
A
|
||||
1
|
||||
SELECT ST_CONTAINS(ST_GEOMETRYFROMTEXT('POLYGON((2 0,0 0,0 0,2 0))'),ST_GEOMETRYFROMTEXT('GEOMETRYCOLLECTION(MULTIPOLYGON(((0 0,1 1,1 0,0 1,0 0))))'));
|
||||
ERROR 22023: Invalid GIS data provided to function.
|
||||
SELECT ST_CONTAINS(
|
||||
ST_GEOMFROMTEXT('MULTIPOLYGON(((0 1e+19,0 0,0 0,0 1e+19)))'),
|
||||
ST_GEOMFROMTEXT('POLYGON((0 0,0 0,0 0,0 0))'));
|
||||
ERROR 22003: coordinate value is out of range in 'st_contains'
|
||||
SELECT ST_CONTAINS(
|
||||
ST_GEOMFROMTEXT('MULTIPOLYGON(((0 9.22e+18,0 0,0 0,0 9.22e+18)))'),
|
||||
ST_GEOMFROMTEXT('POLYGON((0 0,0 0,0 0,0 0))'));
|
||||
ST_CONTAINS(
|
||||
ST_GEOMFROMTEXT('MULTIPOLYGON(((0 9.22e+18,0 0,0 0,0 9.22e+18)))'),
|
||||
ST_GEOMFROMTEXT('POLYGON((0 0,0 0,0 0,0 0))'))
|
||||
0
|
||||
SELECT ST_CONTAINS(
|
||||
ST_GEOMFROMTEXT('MULTIPOLYGON(((0 -9.22e+18,0 0,0 0,0 -9.22e+18)))'),
|
||||
ST_GEOMFROMTEXT('POLYGON((0 0,0 0,0 0,0 0))'));
|
||||
ST_CONTAINS(
|
||||
ST_GEOMFROMTEXT('MULTIPOLYGON(((0 -9.22e+18,0 0,0 0,0 -9.22e+18)))'),
|
||||
ST_GEOMFROMTEXT('POLYGON((0 0,0 0,0 0,0 0))'))
|
||||
0
|
||||
create table tt1(id int,p point);
|
||||
alter table tt1 change p p polygon;
|
||||
ERROR 0A000: Change geometry type not supported
|
||||
desc tt1;
|
||||
Field Type Null Key Default Extra
|
||||
id int(11) YES NULL
|
||||
p point YES NULL
|
||||
drop table tt1;
|
||||
create table tt2(a blob);
|
||||
insert into tt2 values('E6100000010100000000000000000034400000000000002440');
|
||||
select cast(a as point) from tt2;
|
||||
ERROR SR001: There's no spatial reference system with SRID 808531525.
|
||||
drop table tt2;
|
||||
select hex(st_aswkb(x'E61000000108000000000000000e0066C00000000000A06640'));
|
||||
ERROR 22023: Invalid GIS data provided to function st_aswkb.
|
||||
select hex(st_asbinary(x'E61000000108000000000000000e0066C00000000000A06640'));
|
||||
ERROR 22023: Invalid GIS data provided to function st_asbinary.
|
||||
drop table if exists tt1,t1;
|
||||
CREATE TABLE tt1 (
|
||||
id INT NOT NULL ,
|
||||
g GEOMETRY not null srid 4236,
|
||||
p point not null srid 0,
|
||||
l LINESTRING not null srid 26918,
|
||||
po POLYGON not null srid 4236,
|
||||
mu MULTIPOINT not null,
|
||||
ml MULTILINESTRING not null srid 0,
|
||||
mp MULTIPOLYGON not null srid 26918,
|
||||
ge GEOMETRYCOLLECTION not null srid 4236
|
||||
);
|
||||
CREATE INDEX idx02 ON tt1(mu);
|
||||
CREATE INDEX idx03 ON tt1(ml);
|
||||
CREATE INDEX idx05 ON tt1(ge);
|
||||
insert into tt1 values(1,ST_GeomFromText('POINT(15 20)',4236),ST_GeomFromText('POINT(15 20)',0),ST_GeomFromText('LINESTRING(0 0, 10 10, 20 25, 50 60)',26918),ST_GeomFromText('POLYGON((0 1,10 0,9 10,0 10,0 1),(5 5,7 5,8 7,5 7, 5 5))',4236),ST_GeomFromText('MULTIPOINT(0 1, -20 25, 60 -60)'),
|
||||
ST_GeomFromText('MULTILINESTRING((11 10, 20 -20), (-15 20, 30 15))',0),ST_GeomFromText('MULTIPOLYGON(((0 0,10 0,10 11,0 10,0 0)),((-5 -6,7 5,7 7,5 7, -5 -6)))',26918),
|
||||
ST_GeomFromText('GEOMETRYCOLLECTION(POINT(11 10), POINT(30 -30), LINESTRING(-15 15, -20 20))',4236));
|
||||
insert into tt1 values(1,ST_GeomFromText('POINT(15 20)',4236),ST_GeomFromText('POINT(15 20)',0),ST_GeomFromText('LINESTRING(0 0, 10 10, 20 25, 50 60)',26918),ST_GeomFromText('POLYGON((0 1,10 0,9 10,0 10,0 1),(5 5,7 5,8 7,5 7, 5 5))',4236),ST_GeomFromText('MULTIPOINT(0 1, -20 25, 60 -60)'),
|
||||
ST_GeomFromText('MULTILINESTRING((11 10, 20 -20), (-15 20, 30 15))',0),ST_GeomFromText('MULTIPOLYGON(((0 0,10 0,10 11,0 10,0 0)),((-5 -6,7 5,7 7,5 7, -5 -6)))',26918),
|
||||
ST_GeomFromText('GEOMETRYCOLLECTION(POINT(11 10), POINT(30 -30), LINESTRING(-15 15, -20 20))',4236));
|
||||
insert into tt1 values(2,ST_GeomFromText('POINT(15 20)',4236),ST_GeomFromText('POINT(15 20)',0),ST_GeomFromText('LINESTRING(0 0, 10 10, 20 25, 50 60)',26918),ST_GeomFromText('POLYGON((0 1,10 0,9 10,0 10,0 1),(5 5,7 5,8 7,5 7, 5 5))',4236),ST_GeomFromText('MULTIPOINT(0 1, -20 25, 60 -60)'),
|
||||
ST_GeomFromText('MULTILINESTRING((11 10, 20 -20), (-15 20, 30 15))',0),ST_GeomFromText('MULTIPOLYGON(((0 0,10 0,10 11,0 10,0 0)),((-5 -6,7 5,7 7,5 7, -5 -6)))',26918),
|
||||
ST_GeomFromText('GEOMETRYCOLLECTION(POINT(11 10), POINT(30 -30), LINESTRING(-15 15, -20 20))',4236));
|
||||
insert into tt1 values(2,ST_GeomFromText('POINT(15 20)',4236),ST_GeomFromText('POINT(15 20)',0),ST_GeomFromText('LINESTRING(0 0, 10 10, 20 25, 50 60)',26918),ST_GeomFromText('POLYGON((0 1,10 0,9 10,0 10,0 1),(5 5,7 5,8 7,5 7, 5 5))',4236),ST_GeomFromText('MULTIPOINT(0 1, -20 25, 60 -60)'),
|
||||
ST_GeomFromText('MULTILINESTRING((11 10, 20 -20), (-15 20, 30 15))',0),ST_GeomFromText('MULTIPOLYGON(((1 1,10 0,10 11,0 10,1 1)),((-5 -6,7 5,7 7,5 7, -5 -6)))',26918),
|
||||
ST_GeomFromText('GEOMETRYCOLLECTION(POINT(11 10), POINT(30 -30), LINESTRING(-15 15, -20 20))',4236));
|
||||
insert into tt1 values(1,ST_GeomFromText('POINT(15 20)',4236),ST_GeomFromText('POINT(15 20)',0),ST_GeomFromText('LINESTRING(0 0, 10 10, 20 25, 50 60)',26918),ST_GeomFromText('POLYGON((0 1,10 0,9 10,0 10,0 1),(5 5,7 5,8 7,5 7, 5 5))',4236),ST_GeomFromText('MULTIPOINT(0 1, -20 25, 60 -60)'),
|
||||
ST_GeomFromText('MULTILINESTRING((11 10, 20 -20), (-15 20, 30 15))',0),ST_GeomFromText('MULTIPOLYGON(((0 0,10 0,10 11,0 10,0 0)),((5 6,7 5,7 7,5 7, 5 6)))',26918),
|
||||
ST_GeomFromText('GEOMETRYCOLLECTION(POINT(11 10), POINT(30 -30), LINESTRING(-15 15, -20 20))',4236));
|
||||
insert into tt1 values(1,ST_GeomFromText('POINT(15 20)',4236),ST_GeomFromText('POINT(15 20)',0),ST_GeomFromText('LINESTRING(0 0, 10 10, 20 25, 50 60)',26918),ST_GeomFromText('POLYGON((0 1,10 0,9 10,0 10,0 1),(5 5,7 5,8 7,5 7, 5 5))',4236),ST_GeomFromText('MULTIPOINT(0 1, -20 25, 60 -60)'),
|
||||
ST_GeomFromText('MULTILINESTRING((11 10, 20 -20), (-15 20, 30 15))',0),ST_GeomFromText('MULTIPOLYGON(((0 0,10 0,10 11,0 10,0 0)),((-5 -6,7 5,7 7,5 7, -5 -6)))',26918),
|
||||
ST_GeomFromText('GEOMETRYCOLLECTION(POINT(11 10), POINT(30 -30), LINESTRING(-15 15, -20 20))',4236));
|
||||
explain select id from tt1 where ST_Intersects(ge,ST_GeomFromText('POINT(15 20)',4236));
|
||||
Query Plan
|
||||
=====================================================
|
||||
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
|
||||
-----------------------------------------------------
|
||||
|0 |TABLE FULL SCAN|tt1(idx05)|1 |299 |
|
||||
=====================================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([tt1.id]), filter([ST_Intersects(tt1.ge, ST_GeomFromText('POINT(15 20)', 4236))])
|
||||
access([tt1.__pk_increment], [tt1.ge], [tt1.id]), partitions(p0)
|
||||
is_index_back=true, is_global_index=false, filter_before_indexback[false],
|
||||
range_key([tt1.__cellid_24], [tt1.__mbr_24], [tt1.__pk_increment]), range(1240640185631322861,MIN,MIN ; 1240640185631322861,MAX,MAX), (1240640185631322860,
|
||||
MIN,MIN ; 1240640185631322860,MAX,MAX), (1240640185631322864,MIN,MIN ; 1240640185631322864,MAX,MAX), (1240640185631322816,MIN,MIN ; 1240640185631322816,
|
||||
MAX,MAX), (1240640185631322880,MIN,MIN ; 1240640185631322880,MAX,MAX), (1240640185631323136,MIN,MIN ; 1240640185631323136,MAX,MAX), (1240640185631322112,
|
||||
MIN,MIN ; 1240640185631322112,MAX,MAX), (1240640185631326208,MIN,MIN ; 1240640185631326208,MAX,MAX), (1240640185631309824,MIN,MIN ; 1240640185631309824,
|
||||
MAX,MAX), (1240640185631506432,MIN,MIN ; 1240640185631506432,MAX,MAX), (1240640185632292864,MIN,MIN ; 1240640185632292864,MAX,MAX), (1240640185633341440,
|
||||
MIN,MIN ; 1240640185633341440,MAX,MAX), (1240640185637535744,MIN,MIN ; 1240640185637535744,MAX,MAX), (1240640185587204096,MIN,MIN ; 1240640185587204096,
|
||||
MAX,MAX), (1240640185520095232,MIN,MIN ; 1240640185520095232,MAX,MAX), (1240640184714788864,MIN,MIN ; 1240640184714788864,MAX,MAX), (1240640185788530688,
|
||||
MIN,MIN ; 1240640185788530688,MAX,MAX), (1240640181493563392,MIN,MIN ; 1240640181493563392,MAX,MAX), (1240640198673432576,MIN,MIN ; 1240640198673432576,
|
||||
MAX,MAX), (1240640267392909312,MIN,MIN ; 1240640267392909312,MAX,MAX), (1240639442759188480,MIN,MIN ; 1240639442759188480,MAX,MAX), (1240640542270816256,
|
||||
MIN,MIN ; 1240640542270816256,MAX,MAX), (1240653736410349568,MIN,MIN ; 1240653736410349568,MAX,MAX), (1240671328596393984,MIN,MIN ; 1240671328596393984,
|
||||
MAX,MAX), (1240460222363860992,MIN,MIN ; 1240460222363860992,MAX,MAX), (1239615797433729024,MIN,MIN ; 1239615797433729024,MAX,MAX), (1238489897526886400,
|
||||
MIN,MIN ; 1238489897526886400,MAX,MAX), (1242993497154256896,MIN,MIN ; 1242993497154256896,MAX,MAX), (1224979098644774912,MIN,MIN ; 1224979098644774912,
|
||||
MAX,MAX), (1441151880758558720,MIN,MIN ; 1441151880758558720,MAX,MAX), (1152921504606846976,MIN,MIN ; 1152921504606846976,MAX,MAX)
|
||||
drop table tt1;
|
||||
create table t1 (a geometry not null, spatial index(a)) row_format=dynamic;
|
||||
INSERT IGNORE INTO t1 VALUES (NULL);
|
||||
ERROR 23000: Column 'a' cannot be null
|
||||
drop table t1;
|
||||
drop table if exists t;
|
||||
create table t1(g geometry NOT NULL SRID 3294);
|
||||
create index idx on t1 (g);
|
||||
INSERT INTO t1 (g) VALUES
|
||||
(ST_GeomFromText('POINT(0 0)', 3294)),
|
||||
(ST_GeomFromText('POINT(1 1)', 3294)),
|
||||
(ST_GeomFromText('POINT(2 2)', 3294)),
|
||||
(ST_GeomFromText('POINT(3 3)', 3294)),
|
||||
(ST_GeomFromText('POINT(4 4)', 3294)),
|
||||
(ST_GeomFromText('POINT(5 5.5)', 3294)),
|
||||
(ST_GeomFromText('POINT(6 6)', 3294)),
|
||||
(ST_GeomFromText('POINT(7 7)', 3294)),
|
||||
(ST_GeomFromText('LINESTRING(0 0, 3 3)',3294));
|
||||
explain select st_astext(a.g), st_astext(b.g) from t1 a join t1 b where _st_covers(a.g, b.g);
|
||||
Query Plan
|
||||
===============================================================
|
||||
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
|
||||
---------------------------------------------------------------
|
||||
|0 |NESTED-LOOP JOIN | |27 |345 |
|
||||
|1 |├─TABLE FULL SCAN |a |9 |3 |
|
||||
|2 |└─DISTRIBUTED TABLE FULL SCAN|b(idx)|3 |38 |
|
||||
===============================================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([st_astext(a.g)], [st_astext(b.g)]), filter(nil)
|
||||
conds(nil), nl_params_([a.g(:0)]), use_batch=false
|
||||
1 - output([a.g]), filter(nil)
|
||||
access([a.g]), partitions(p0)
|
||||
is_index_back=false, is_global_index=false,
|
||||
range_key([a.__pk_increment]), range(MIN ; MAX)always true
|
||||
2 - output([b.g]), filter([_st_covers(:0, b.g)])
|
||||
access([b.__pk_increment], [b.g]), partitions(p0)
|
||||
is_index_back=true, is_global_index=false, filter_before_indexback[false],
|
||||
range_key([b.__cellid_16], [b.__mbr_16], [b.__pk_increment]), range(MIN ; MAX)
|
||||
explain select st_astext(a.g), st_astext(b.g) from t1 a join t1 b where st_contains(a.g, b.g);
|
||||
Query Plan
|
||||
===============================================================
|
||||
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
|
||||
---------------------------------------------------------------
|
||||
|0 |NESTED-LOOP JOIN | |27 |345 |
|
||||
|1 |├─TABLE FULL SCAN |a |9 |3 |
|
||||
|2 |└─DISTRIBUTED TABLE FULL SCAN|b(idx)|3 |38 |
|
||||
===============================================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([st_astext(a.g)], [st_astext(b.g)]), filter(nil)
|
||||
conds(nil), nl_params_([a.g(:0)]), use_batch=false
|
||||
1 - output([a.g]), filter(nil)
|
||||
access([a.g]), partitions(p0)
|
||||
is_index_back=false, is_global_index=false,
|
||||
range_key([a.__pk_increment]), range(MIN ; MAX)always true
|
||||
2 - output([b.g]), filter([st_contains(:0, b.g)])
|
||||
access([b.__pk_increment], [b.g]), partitions(p0)
|
||||
is_index_back=true, is_global_index=false, filter_before_indexback[false],
|
||||
range_key([b.__cellid_16], [b.__mbr_16], [b.__pk_increment]), range(MIN ; MAX)
|
||||
explain select st_astext(a.g), st_astext(b.g) from t1 a join t1 b where st_within(a.g, b.g);
|
||||
Query Plan
|
||||
===============================================================
|
||||
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
|
||||
---------------------------------------------------------------
|
||||
|0 |NESTED-LOOP JOIN | |27 |345 |
|
||||
|1 |├─TABLE FULL SCAN |a |9 |3 |
|
||||
|2 |└─DISTRIBUTED TABLE FULL SCAN|b(idx)|3 |38 |
|
||||
===============================================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([st_astext(a.g)], [st_astext(b.g)]), filter(nil)
|
||||
conds(nil), nl_params_([a.g(:0)]), use_batch=false
|
||||
1 - output([a.g]), filter(nil)
|
||||
access([a.g]), partitions(p0)
|
||||
is_index_back=false, is_global_index=false,
|
||||
range_key([a.__pk_increment]), range(MIN ; MAX)always true
|
||||
2 - output([b.g]), filter([st_within(:0, b.g)])
|
||||
access([b.__pk_increment], [b.g]), partitions(p0)
|
||||
is_index_back=true, is_global_index=false, filter_before_indexback[false],
|
||||
range_key([b.__cellid_16], [b.__mbr_16], [b.__pk_increment]), range(MIN ; MAX)
|
||||
explain select st_astext(a.g), st_astext(b.g) from t1 a join t1 b where _st_dwithin(a.g, b.g, 0.1);
|
||||
Query Plan
|
||||
===============================================================
|
||||
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
|
||||
---------------------------------------------------------------
|
||||
|0 |NESTED-LOOP JOIN | |27 |345 |
|
||||
|1 |├─TABLE FULL SCAN |a |9 |3 |
|
||||
|2 |└─DISTRIBUTED TABLE FULL SCAN|b(idx)|3 |38 |
|
||||
===============================================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([st_astext(a.g)], [st_astext(b.g)]), filter(nil)
|
||||
conds(nil), nl_params_([a.g(:0)]), use_batch=false
|
||||
1 - output([a.g]), filter(nil)
|
||||
access([a.g]), partitions(p0)
|
||||
is_index_back=false, is_global_index=false,
|
||||
range_key([a.__pk_increment]), range(MIN ; MAX)always true
|
||||
2 - output([b.g]), filter([_st_dwithin(:0, b.g, cast(0.1, DOUBLE(-1, -1)))])
|
||||
access([b.__pk_increment], [b.g]), partitions(p0)
|
||||
is_index_back=true, is_global_index=false, filter_before_indexback[false],
|
||||
range_key([b.__cellid_16], [b.__mbr_16], [b.__pk_increment]), range(MIN ; MAX)
|
||||
select st_astext(a.g), st_astext(b.g) from t1 a join t1 b where _st_covers(a.g, b.g);
|
||||
st_astext(a.g) st_astext(b.g)
|
||||
POINT(0 0) POINT(0 0)
|
||||
POINT(1 1) POINT(1 1)
|
||||
POINT(2 2) POINT(2 2)
|
||||
POINT(3 3) POINT(3 3)
|
||||
POINT(4 4) POINT(4 4)
|
||||
POINT(5 5.5) POINT(5 5.5)
|
||||
POINT(6 6) POINT(6 6)
|
||||
POINT(7 7) POINT(7 7)
|
||||
LINESTRING(0 0,3 3) POINT(0 0)
|
||||
LINESTRING(0 0,3 3) POINT(1 1)
|
||||
LINESTRING(0 0,3 3) POINT(2 2)
|
||||
LINESTRING(0 0,3 3) POINT(3 3)
|
||||
LINESTRING(0 0,3 3) LINESTRING(0 0,3 3)
|
||||
select st_astext(a.g), st_astext(b.g) from t1 a join t1 b where st_contains(a.g, b.g);
|
||||
st_astext(a.g) st_astext(b.g)
|
||||
POINT(0 0) POINT(0 0)
|
||||
POINT(1 1) POINT(1 1)
|
||||
POINT(2 2) POINT(2 2)
|
||||
POINT(3 3) POINT(3 3)
|
||||
POINT(4 4) POINT(4 4)
|
||||
POINT(5 5.5) POINT(5 5.5)
|
||||
POINT(6 6) POINT(6 6)
|
||||
POINT(7 7) POINT(7 7)
|
||||
LINESTRING(0 0,3 3) POINT(1 1)
|
||||
LINESTRING(0 0,3 3) POINT(2 2)
|
||||
LINESTRING(0 0,3 3) LINESTRING(0 0,3 3)
|
||||
select st_astext(a.g), st_astext(b.g) from t1 a join t1 b where st_within(a.g, b.g);
|
||||
st_astext(a.g) st_astext(b.g)
|
||||
POINT(0 0) POINT(0 0)
|
||||
POINT(1 1) POINT(1 1)
|
||||
POINT(1 1) LINESTRING(0 0,3 3)
|
||||
POINT(2 2) POINT(2 2)
|
||||
POINT(2 2) LINESTRING(0 0,3 3)
|
||||
POINT(3 3) POINT(3 3)
|
||||
POINT(4 4) POINT(4 4)
|
||||
POINT(5 5.5) POINT(5 5.5)
|
||||
POINT(6 6) POINT(6 6)
|
||||
POINT(7 7) POINT(7 7)
|
||||
LINESTRING(0 0,3 3) LINESTRING(0 0,3 3)
|
||||
select st_astext(a.g), st_astext(b.g) from t1 a join t1 b where _st_dwithin(a.g, b.g, 0.1);
|
||||
st_astext(a.g) st_astext(b.g)
|
||||
POINT(0 0) POINT(0 0)
|
||||
POINT(0 0) LINESTRING(0 0,3 3)
|
||||
POINT(1 1) POINT(1 1)
|
||||
POINT(1 1) LINESTRING(0 0,3 3)
|
||||
POINT(2 2) POINT(2 2)
|
||||
POINT(2 2) LINESTRING(0 0,3 3)
|
||||
POINT(3 3) POINT(3 3)
|
||||
POINT(3 3) LINESTRING(0 0,3 3)
|
||||
POINT(4 4) POINT(4 4)
|
||||
POINT(5 5.5) POINT(5 5.5)
|
||||
POINT(6 6) POINT(6 6)
|
||||
POINT(7 7) POINT(7 7)
|
||||
LINESTRING(0 0,3 3) POINT(0 0)
|
||||
LINESTRING(0 0,3 3) POINT(1 1)
|
||||
LINESTRING(0 0,3 3) POINT(2 2)
|
||||
LINESTRING(0 0,3 3) POINT(3 3)
|
||||
LINESTRING(0 0,3 3) LINESTRING(0 0,3 3)
|
||||
select st_astext(g) from t1 where st_within(ST_GeomFromText('POINT(2.5 2.5)', 3294),st_buffer(g, 0));
|
||||
st_astext(g)
|
||||
LINESTRING(0 0,3 3)
|
||||
drop table if exists FF01;
|
||||
CREATE TABLE FF01 (A INT,B GEOMETRY);
|
||||
INSERT INTO FF01 VALUES (1,NULL);
|
||||
INSERT INTO FF01 VALUES (2,POINT(1,2));
|
||||
INSERT INTO FF01 VALUES (3,POINT(-1,-2));
|
||||
SELECT ST_ASTEXT(B) FROM FF01 WHERE B NOT IN (SELECT /*+no_unnest*/B FROM FF01 WHERE B=POINT(1,2));
|
||||
ST_ASTEXT(B)
|
||||
POINT(-1 -2)
|
||||
drop table FF01;
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,284 @@
|
||||
# ----------------------------------------------------------------------
|
||||
# Test of GEOMETRY filter.
|
||||
# ----------------------------------------------------------------------
|
||||
drop table if exists matrix;
|
||||
create table matrix (TinyIntType tinyint(1),SmallIntType smallint(2),MediumIntType mediumint(3),Int32Type int(4),IntType bigint(5),UTinyIntType tinyint(1) unsigned,USmallIntType smallint(2) unsigned,UMediumIntType mediumint(3) unsigned,UInt32Type int(4) unsigned,UInt64Type bigint(5) unsigned,FloatType float,DoubleType double,UFloatType float unsigned,UDoubleType double unsigned,NumberType decimal(8,2),UNumberType decimal(8,2) unsigned,DateTimeType datetime,TimestampType timestamp,DateType date,TimeType time,YearType year,VarcharType varchar(9),CharType char(10),VarbinaryType varbinary(11),BinaryType binary(12),ExtendType int(13),TinyTextType TINYTEXT, TextType TEXT,MediumTextType MEDIUMTEXT, LongTextType LONGTEXT CHARSET utf8, BitType BIT(63),EnumType ENUM('a', 'b', 'c') default 'a',SetType SET('a', 'b', 'c') default 'b',JsonType json, GeometryType geometry);
|
||||
insert into matrix values (-1, -2, -3, -4, -5, 1, 2, 3, 4, 5, -1.1, -1.2, 1.1, 1.2, -1.3, 1.3, '2014-01-01 12:12:12', '2014-01-01 12:12:12', '2014-01-01', '12:12:12', 2014, 'varchar', 'char', 'varbinary', 'binary', 0,'tinytext','text','mediumtext','longtext',b'01010101010101','a','c','"jsonstring"', ST_GeomFromText('POINT(1 1)'));
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = TinyIntType;
|
||||
TinyIntType SmallIntType MediumIntType Int32Type IntType UTinyIntType USmallIntType UMediumIntType UInt32Type UInt64Type FloatType DoubleType UFloatType UDoubleType NumberType UNumberType DateTimeType TimestampType DateType TimeType YearType VarcharType CharType VarbinaryType BinaryType ExtendType TinyTextType TextType MediumTextType LongTextType BitType EnumType SetType JsonType GeometryType
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = SmallIntType;
|
||||
TinyIntType SmallIntType MediumIntType Int32Type IntType UTinyIntType USmallIntType UMediumIntType UInt32Type UInt64Type FloatType DoubleType UFloatType UDoubleType NumberType UNumberType DateTimeType TimestampType DateType TimeType YearType VarcharType CharType VarbinaryType BinaryType ExtendType TinyTextType TextType MediumTextType LongTextType BitType EnumType SetType JsonType GeometryType
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = MediumIntType;
|
||||
TinyIntType SmallIntType MediumIntType Int32Type IntType UTinyIntType USmallIntType UMediumIntType UInt32Type UInt64Type FloatType DoubleType UFloatType UDoubleType NumberType UNumberType DateTimeType TimestampType DateType TimeType YearType VarcharType CharType VarbinaryType BinaryType ExtendType TinyTextType TextType MediumTextType LongTextType BitType EnumType SetType JsonType GeometryType
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = Int32Type;
|
||||
TinyIntType SmallIntType MediumIntType Int32Type IntType UTinyIntType USmallIntType UMediumIntType UInt32Type UInt64Type FloatType DoubleType UFloatType UDoubleType NumberType UNumberType DateTimeType TimestampType DateType TimeType YearType VarcharType CharType VarbinaryType BinaryType ExtendType TinyTextType TextType MediumTextType LongTextType BitType EnumType SetType JsonType GeometryType
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = IntType;
|
||||
TinyIntType SmallIntType MediumIntType Int32Type IntType UTinyIntType USmallIntType UMediumIntType UInt32Type UInt64Type FloatType DoubleType UFloatType UDoubleType NumberType UNumberType DateTimeType TimestampType DateType TimeType YearType VarcharType CharType VarbinaryType BinaryType ExtendType TinyTextType TextType MediumTextType LongTextType BitType EnumType SetType JsonType GeometryType
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = UTinyIntType;
|
||||
TinyIntType SmallIntType MediumIntType Int32Type IntType UTinyIntType USmallIntType UMediumIntType UInt32Type UInt64Type FloatType DoubleType UFloatType UDoubleType NumberType UNumberType DateTimeType TimestampType DateType TimeType YearType VarcharType CharType VarbinaryType BinaryType ExtendType TinyTextType TextType MediumTextType LongTextType BitType EnumType SetType JsonType GeometryType
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = USmallIntType;
|
||||
TinyIntType SmallIntType MediumIntType Int32Type IntType UTinyIntType USmallIntType UMediumIntType UInt32Type UInt64Type FloatType DoubleType UFloatType UDoubleType NumberType UNumberType DateTimeType TimestampType DateType TimeType YearType VarcharType CharType VarbinaryType BinaryType ExtendType TinyTextType TextType MediumTextType LongTextType BitType EnumType SetType JsonType GeometryType
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = UMediumIntType;
|
||||
TinyIntType SmallIntType MediumIntType Int32Type IntType UTinyIntType USmallIntType UMediumIntType UInt32Type UInt64Type FloatType DoubleType UFloatType UDoubleType NumberType UNumberType DateTimeType TimestampType DateType TimeType YearType VarcharType CharType VarbinaryType BinaryType ExtendType TinyTextType TextType MediumTextType LongTextType BitType EnumType SetType JsonType GeometryType
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = UInt32Type;
|
||||
TinyIntType SmallIntType MediumIntType Int32Type IntType UTinyIntType USmallIntType UMediumIntType UInt32Type UInt64Type FloatType DoubleType UFloatType UDoubleType NumberType UNumberType DateTimeType TimestampType DateType TimeType YearType VarcharType CharType VarbinaryType BinaryType ExtendType TinyTextType TextType MediumTextType LongTextType BitType EnumType SetType JsonType GeometryType
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = UInt64Type;
|
||||
TinyIntType SmallIntType MediumIntType Int32Type IntType UTinyIntType USmallIntType UMediumIntType UInt32Type UInt64Type FloatType DoubleType UFloatType UDoubleType NumberType UNumberType DateTimeType TimestampType DateType TimeType YearType VarcharType CharType VarbinaryType BinaryType ExtendType TinyTextType TextType MediumTextType LongTextType BitType EnumType SetType JsonType GeometryType
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = FloatType;
|
||||
TinyIntType SmallIntType MediumIntType Int32Type IntType UTinyIntType USmallIntType UMediumIntType UInt32Type UInt64Type FloatType DoubleType UFloatType UDoubleType NumberType UNumberType DateTimeType TimestampType DateType TimeType YearType VarcharType CharType VarbinaryType BinaryType ExtendType TinyTextType TextType MediumTextType LongTextType BitType EnumType SetType JsonType GeometryType
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = DoubleType;
|
||||
TinyIntType SmallIntType MediumIntType Int32Type IntType UTinyIntType USmallIntType UMediumIntType UInt32Type UInt64Type FloatType DoubleType UFloatType UDoubleType NumberType UNumberType DateTimeType TimestampType DateType TimeType YearType VarcharType CharType VarbinaryType BinaryType ExtendType TinyTextType TextType MediumTextType LongTextType BitType EnumType SetType JsonType GeometryType
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = UFloatType;
|
||||
TinyIntType SmallIntType MediumIntType Int32Type IntType UTinyIntType USmallIntType UMediumIntType UInt32Type UInt64Type FloatType DoubleType UFloatType UDoubleType NumberType UNumberType DateTimeType TimestampType DateType TimeType YearType VarcharType CharType VarbinaryType BinaryType ExtendType TinyTextType TextType MediumTextType LongTextType BitType EnumType SetType JsonType GeometryType
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = UDoubleType;
|
||||
TinyIntType SmallIntType MediumIntType Int32Type IntType UTinyIntType USmallIntType UMediumIntType UInt32Type UInt64Type FloatType DoubleType UFloatType UDoubleType NumberType UNumberType DateTimeType TimestampType DateType TimeType YearType VarcharType CharType VarbinaryType BinaryType ExtendType TinyTextType TextType MediumTextType LongTextType BitType EnumType SetType JsonType GeometryType
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = NumberType;
|
||||
TinyIntType SmallIntType MediumIntType Int32Type IntType UTinyIntType USmallIntType UMediumIntType UInt32Type UInt64Type FloatType DoubleType UFloatType UDoubleType NumberType UNumberType DateTimeType TimestampType DateType TimeType YearType VarcharType CharType VarbinaryType BinaryType ExtendType TinyTextType TextType MediumTextType LongTextType BitType EnumType SetType JsonType GeometryType
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = UNumberType;
|
||||
TinyIntType SmallIntType MediumIntType Int32Type IntType UTinyIntType USmallIntType UMediumIntType UInt32Type UInt64Type FloatType DoubleType UFloatType UDoubleType NumberType UNumberType DateTimeType TimestampType DateType TimeType YearType VarcharType CharType VarbinaryType BinaryType ExtendType TinyTextType TextType MediumTextType LongTextType BitType EnumType SetType JsonType GeometryType
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = DateTimeType;
|
||||
ERROR HY000: Invalid argument
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = TimestampType;
|
||||
ERROR HY000: Invalid argument
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = DateType;
|
||||
ERROR HY000: Invalid argument
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = TimeType;
|
||||
TinyIntType SmallIntType MediumIntType Int32Type IntType UTinyIntType USmallIntType UMediumIntType UInt32Type UInt64Type FloatType DoubleType UFloatType UDoubleType NumberType UNumberType DateTimeType TimestampType DateType TimeType YearType VarcharType CharType VarbinaryType BinaryType ExtendType TinyTextType TextType MediumTextType LongTextType BitType EnumType SetType JsonType GeometryType
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = YearType;
|
||||
TinyIntType SmallIntType MediumIntType Int32Type IntType UTinyIntType USmallIntType UMediumIntType UInt32Type UInt64Type FloatType DoubleType UFloatType UDoubleType NumberType UNumberType DateTimeType TimestampType DateType TimeType YearType VarcharType CharType VarbinaryType BinaryType ExtendType TinyTextType TextType MediumTextType LongTextType BitType EnumType SetType JsonType GeometryType
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = VarcharType;
|
||||
TinyIntType SmallIntType MediumIntType Int32Type IntType UTinyIntType USmallIntType UMediumIntType UInt32Type UInt64Type FloatType DoubleType UFloatType UDoubleType NumberType UNumberType DateTimeType TimestampType DateType TimeType YearType VarcharType CharType VarbinaryType BinaryType ExtendType TinyTextType TextType MediumTextType LongTextType BitType EnumType SetType JsonType GeometryType
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = CharType;
|
||||
TinyIntType SmallIntType MediumIntType Int32Type IntType UTinyIntType USmallIntType UMediumIntType UInt32Type UInt64Type FloatType DoubleType UFloatType UDoubleType NumberType UNumberType DateTimeType TimestampType DateType TimeType YearType VarcharType CharType VarbinaryType BinaryType ExtendType TinyTextType TextType MediumTextType LongTextType BitType EnumType SetType JsonType GeometryType
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = VarbinaryType;
|
||||
TinyIntType SmallIntType MediumIntType Int32Type IntType UTinyIntType USmallIntType UMediumIntType UInt32Type UInt64Type FloatType DoubleType UFloatType UDoubleType NumberType UNumberType DateTimeType TimestampType DateType TimeType YearType VarcharType CharType VarbinaryType BinaryType ExtendType TinyTextType TextType MediumTextType LongTextType BitType EnumType SetType JsonType GeometryType
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = BinaryType;
|
||||
TinyIntType SmallIntType MediumIntType Int32Type IntType UTinyIntType USmallIntType UMediumIntType UInt32Type UInt64Type FloatType DoubleType UFloatType UDoubleType NumberType UNumberType DateTimeType TimestampType DateType TimeType YearType VarcharType CharType VarbinaryType BinaryType ExtendType TinyTextType TextType MediumTextType LongTextType BitType EnumType SetType JsonType GeometryType
|
||||
select st_astext(GeometryType) from matrix where ST_GeomFromText('POINT(1 1)') = ExtendType;
|
||||
st_astext(GeometryType)
|
||||
POINT(1 1)
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = TinyTextType;
|
||||
ERROR HY000: Invalid argument
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = TextType;
|
||||
ERROR HY000: Invalid argument
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = MediumTextType;
|
||||
ERROR HY000: Invalid argument
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = LongTextType;
|
||||
ERROR HY000: Invalid argument
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = BitType;
|
||||
TinyIntType SmallIntType MediumIntType Int32Type IntType UTinyIntType USmallIntType UMediumIntType UInt32Type UInt64Type FloatType DoubleType UFloatType UDoubleType NumberType UNumberType DateTimeType TimestampType DateType TimeType YearType VarcharType CharType VarbinaryType BinaryType ExtendType TinyTextType TextType MediumTextType LongTextType BitType EnumType SetType JsonType GeometryType
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = EnumType;
|
||||
ERROR HY000: Invalid argument
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = SetType;
|
||||
ERROR HY000: Invalid argument
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = JsonType;
|
||||
ERROR 0A000: geomerty, json not supported
|
||||
select st_astext(GeometryType) from matrix where ST_GeomFromText('POINT(1 1)') = GeometryType;
|
||||
st_astext(GeometryType)
|
||||
POINT(1 1)
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') > TinyIntType;
|
||||
ERROR HY000: Invalid argument
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') < SmallIntType;
|
||||
ERROR HY000: Invalid argument
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') > MediumIntType;
|
||||
ERROR HY000: Invalid argument
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') < Int32Type;
|
||||
ERROR HY000: Invalid argument
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') > IntType;
|
||||
ERROR HY000: Invalid argument
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') < UTinyIntType;
|
||||
ERROR HY000: Invalid argument
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') > USmallIntType;
|
||||
ERROR HY000: Invalid argument
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') <= UMediumIntType;
|
||||
ERROR HY000: Invalid argument
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') >= UInt32Type;
|
||||
ERROR HY000: Invalid argument
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') <= UInt64Type;
|
||||
ERROR HY000: Invalid argument
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') >= FloatType;
|
||||
ERROR HY000: Invalid argument
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') <= DoubleType;
|
||||
ERROR HY000: Invalid argument
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') >= UFloatType;
|
||||
ERROR HY000: Invalid argument
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') <= UDoubleType;
|
||||
ERROR HY000: Invalid argument
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') >= NumberType;
|
||||
ERROR HY000: Invalid argument
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') <= UNumberType;
|
||||
ERROR HY000: Invalid argument
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') > DateTimeType;
|
||||
ERROR HY000: Invalid argument
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') < TimestampType;
|
||||
ERROR HY000: Invalid argument
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') > DateType;
|
||||
ERROR HY000: Invalid argument
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') < TimeType;
|
||||
ERROR HY000: Invalid argument
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') >= YearType;
|
||||
ERROR HY000: Invalid argument
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') < VarcharType;
|
||||
ERROR HY000: Invalid argument
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') >= CharType;
|
||||
ERROR HY000: Invalid argument
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') < VarbinaryType;
|
||||
ERROR HY000: Invalid argument
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') >= BinaryType;
|
||||
ERROR HY000: Invalid argument
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') <= ExtendType;
|
||||
ERROR HY000: Invalid argument
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') > TinyTextType;
|
||||
ERROR HY000: Invalid argument
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') <= TextType;
|
||||
ERROR HY000: Invalid argument
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') > MediumTextType;
|
||||
ERROR HY000: Invalid argument
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') <= LongTextType;
|
||||
ERROR HY000: Invalid argument
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') > BitType;
|
||||
ERROR HY000: Invalid argument
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') <= EnumType;
|
||||
ERROR HY000: Invalid argument
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') > SetType;
|
||||
ERROR HY000: Invalid argument
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') < JsonType;
|
||||
ERROR HY000: Invalid argument
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') > GeometryType;
|
||||
ERROR HY000: Invalid argument
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') | IntType;
|
||||
ERROR HY000: Invalid argument
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') | GeometryType;
|
||||
ERROR HY000: Invalid argument
|
||||
select * from matrix where ~GeometryType;
|
||||
ERROR HY000: Invalid argument
|
||||
select * from matrix where GeometryType^IntType;
|
||||
ERROR HY000: Invalid argument
|
||||
select * from matrix where GeometryType&IntType;
|
||||
ERROR HY000: Invalid argument
|
||||
select * from matrix where GeometryType>>1;
|
||||
ERROR HY000: Invalid argument
|
||||
select * from matrix where GeometryType<<1;
|
||||
ERROR HY000: Invalid argument
|
||||
select * from matrix where GeometryType like 'a';
|
||||
ERROR HY000: Invalid argument
|
||||
select * from matrix where GeometryType between ST_GeomFromText('POINT(1 1)') and ST_GeomFromText('POINT(2 2)');
|
||||
ERROR HY000: Invalid argument
|
||||
select MIN(GeometryType) from matrix;
|
||||
ERROR HY000: Invalid argument
|
||||
select MAX(GeometryType) from matrix;
|
||||
ERROR HY000: Invalid argument
|
||||
select LEAST(st_geomfromtext('POINT(0 0)'), st_geomfromtext('POINT(1 1)'));
|
||||
ERROR HY000: Invalid argument
|
||||
select GREATEST(st_geomfromtext('POINT(0 0)'), st_geomfromtext('POINT(1 1)'));
|
||||
ERROR HY000: Invalid argument
|
||||
select st_geomfromtext('POINT(0 0)') + st_geomfromtext('POINT(1 1)');
|
||||
ERROR 22000: Invalid data type for the operation
|
||||
select st_geomfromtext('POINT(0 0)') - st_geomfromtext('POINT(1 1)');
|
||||
ERROR 22000: Invalid data type for the operation
|
||||
select st_geomfromtext('POINT(0 0)') * st_geomfromtext('POINT(1 1)');
|
||||
ERROR 22000: Invalid data type for the operation
|
||||
select st_geomfromtext('POINT(0 0)') / st_geomfromtext('POINT(1 1)');
|
||||
ERROR 22000: Invalid data type for the operation
|
||||
select st_geomfromtext('POINT(0 0)') DIV st_geomfromtext('POINT(1 1)');
|
||||
ERROR 22000: Invalid data type for the operation
|
||||
select st_geomfromtext('POINT(0 0)') % st_geomfromtext('POINT(1 1)');
|
||||
ERROR 22000: Invalid data type for the operation
|
||||
SELECT EXP(st_geomfromtext('POINT(1 1)'));
|
||||
ERROR HY000: Invalid argument
|
||||
SELECT lOG2(st_geomfromtext('POINT(1 1)'));
|
||||
ERROR HY000: Invalid argument
|
||||
SELECT lOG10(st_geomfromtext('POINT(1 1)'));
|
||||
ERROR HY000: Invalid argument
|
||||
SELECT LN(st_geomfromtext('POINT(1 1)'));
|
||||
ERROR HY000: Invalid argument
|
||||
SELECT lOG(3, st_geomfromtext('POINT(1 1)'));
|
||||
ERROR HY000: Invalid argument
|
||||
SELECT POW(3, st_geomfromtext('POINT(1 1)'));
|
||||
ERROR HY000: Invalid argument
|
||||
SELECT POW(3, GeometryType) from matrix;
|
||||
ERROR HY000: Invalid argument
|
||||
SELECT sqrt(st_geomfromtext('POINT(1 1)'));
|
||||
ERROR HY000: Invalid argument
|
||||
SELECT acos(st_geomfromtext('POINT(1 1)'));
|
||||
ERROR HY000: Invalid argument
|
||||
SELECT asin(st_geomfromtext('POINT(1 1)'));
|
||||
ERROR HY000: Invalid argument
|
||||
SELECT atan(st_geomfromtext('POINT(1 1)'));
|
||||
ERROR HY000: Invalid argument
|
||||
SELECT cos(st_geomfromtext('POINT(1 1)'));
|
||||
ERROR HY000: Invalid argument
|
||||
SELECT sin(st_geomfromtext('POINT(1 1)'));
|
||||
ERROR HY000: Invalid argument
|
||||
SELECT tan(st_geomfromtext('POINT(1 1)'));
|
||||
ERROR HY000: Invalid argument
|
||||
SELECT cot(st_geomfromtext('POINT(1 1)'));
|
||||
ERROR HY000: Invalid argument
|
||||
SELECT round(st_geomfromtext('POINT(1 1)'));
|
||||
ERROR HY000: Invalid argument
|
||||
SELECT round(st_geomfromtext('POINT(1 1)'), 1);
|
||||
ERROR HY000: Invalid argument
|
||||
SELECT round(st_geomfromtext('POINT(1 1)'), -1);
|
||||
ERROR HY000: Invalid argument
|
||||
SELECT truncate(st_geomfromtext('POINT(1 1)'),1);
|
||||
ERROR HY000: Invalid argument
|
||||
SELECT truncate(GeometryType ,1) from matrix;
|
||||
ERROR HY000: Invalid argument
|
||||
SELECT ceiling(st_geomfromtext('POINT(1 1)'));
|
||||
ERROR HY000: Invalid argument
|
||||
SELECT ceiling(GeometryType) from matrix;
|
||||
ERROR HY000: Invalid argument
|
||||
SELECT abs(GeometryType) from matrix;
|
||||
ERROR HY000: Invalid argument
|
||||
SELECT abs(st_geomfromtext('POINT(1 1)')) from matrix;
|
||||
ERROR HY000: Invalid argument
|
||||
SELECT -GeometryType from matrix;
|
||||
ERROR HY000: Invalid argument
|
||||
SELECT -st_geomfromtext('POINT(1 1)') from matrix;
|
||||
ERROR HY000: Invalid argument
|
||||
SELECT rand(GeometryType) from matrix;
|
||||
ERROR HY000: Invalid argument
|
||||
SELECT rand(st_geomfromtext('POINT(1 1)')) from matrix;
|
||||
ERROR HY000: Invalid argument
|
||||
SELECT sign(GeometryType) from matrix;
|
||||
ERROR HY000: Invalid argument
|
||||
SELECT sign(st_geomfromtext('POINT(1 1)')) from matrix;
|
||||
ERROR HY000: Invalid argument
|
||||
SELECT degrees(GeometryType) from matrix;
|
||||
ERROR HY000: Invalid argument
|
||||
SELECT degrees(st_geomfromtext('POINT(1 1)')) from matrix;
|
||||
ERROR HY000: Invalid argument
|
||||
SELECT radians(GeometryType) from matrix;
|
||||
ERROR HY000: Invalid argument
|
||||
SELECT radians(st_geomfromtext('POINT(1 1)')) from matrix;
|
||||
ERROR HY000: Invalid argument
|
||||
SELECT format(GeometryType, 2) from matrix;
|
||||
ERROR HY000: Invalid argument
|
||||
SELECT format(st_geomfromtext('POINT(1 1)'), 2) from matrix;
|
||||
ERROR HY000: Invalid argument
|
||||
SELECT conv(st_geomfromtext('POINT(1 1)'), 1, 2) from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
SELECT conv(-1, st_geomfromtext('POINT(1 1)'), 2) from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
SELECT conv(-1, 1, st_geomfromtext('POINT(1 1)')) from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
SELECT conv(GeometryType, 1, 1) from matrix;
|
||||
ERROR HY000: Invalid argument
|
||||
drop table if exists FF01;
|
||||
CREATE TABLE FF01(A INT, B GEOMETRY);
|
||||
INSERT INTO FF01 VALUES (1, NULL);
|
||||
INSERT INTO FF01 VALUES (1, ST_GeomFromText('POINT(0 0)'));
|
||||
SELECT A FROM FF01 WHERE B <=> NULL;
|
||||
A
|
||||
1
|
||||
SELECT A FROM FF01 GROUP BY B HAVING AVG(B) IS NULL;
|
||||
ERROR HY000: Invalid argument
|
||||
SELECT A FROM FF01 GROUP BY B HAVING SUM(B) IS NULL;
|
||||
ERROR HY000: Invalid argument
|
||||
SELECT A FROM FF01 GROUP BY B HAVING STD(B) IS NULL;
|
||||
ERROR HY000: Invalid argument
|
||||
SELECT A FROM FF01 GROUP BY B HAVING STDDEV_POP(B) IS NULL;
|
||||
ERROR HY000: Invalid argument
|
||||
SELECT A FROM FF01 GROUP BY B HAVING VARIANCE(B) IS NULL;
|
||||
ERROR HY000: Invalid argument
|
||||
DROP TABLE FF01;
|
||||
File diff suppressed because one or more lines are too long
@ -0,0 +1,494 @@
|
||||
# ----------------------------------------------------------------------
|
||||
# Base test of geometry ddl.
|
||||
# ----------------------------------------------------------------------
|
||||
# Create a table with three columns:
|
||||
# 1) Normal POINT column without SRID specification
|
||||
# 2) Normal POINT column with SRID 0
|
||||
# 3) Normal POINT column with SRID 4326
|
||||
drop table if exists t1,tt1;
|
||||
CREATE TABLE t1 (no_srid POINT DEFAULT NULL,
|
||||
srid_0 POINT SRID 0 DEFAULT NULL,
|
||||
srid_4326 POINT SRID 4326 DEFAULT NULL);
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`no_srid` point DEFAULT NULL,
|
||||
`srid_0` point /*!80003 SRID 0 */ DEFAULT NULL,
|
||||
`srid_4326` point /*!80003 SRID 4326 */ DEFAULT NULL
|
||||
) DEFAULT CHARSET = utf8mb4 COMPRESSION = 'lz4_1.0' REPLICA_NUM = NUM BLOCK_SIZE = SIZE USE_BLOOM_FILTER = FALSE TABLET_SIZE = SIZE PCTFREE = 10
|
||||
# Insert some data with correct SRID into these columns
|
||||
INSERT INTO t1 (no_srid, srid_0, srid_4326)
|
||||
VALUES (ST_GeomFromText('POINT(0 0)', 0),
|
||||
ST_GeomFromText('POINT(0 0)', 0),
|
||||
ST_GeomFromText('POINT(0 0)', 4326));
|
||||
INSERT INTO t1 (no_srid, srid_0, srid_4326)
|
||||
VALUES (ST_GeomFromText('POINT(1 1)', 4326),
|
||||
ST_GeomFromText('POINT(1 1)', 0),
|
||||
ST_GeomFromText('POINT(1 1)', 4326));
|
||||
# Insert data with wrong SRID, which should fail.
|
||||
INSERT INTO t1 (srid_0) VALUES (ST_GeomFromText('POINT(1 1)', 4326));
|
||||
ERROR HY000: The SRID of the geometry does not match the SRID of the column. The SRID of the geometry is 4326, but the SRID of the column is 0. Consider changing the SRID of the geometry or the SRID property of the column.
|
||||
INSERT INTO t1 (srid_4326) VALUES (ST_GeomFromText('POINT(1 1)', 0));
|
||||
ERROR HY000: The SRID of the geometry does not match the SRID of the column. The SRID of the geometry is 0, but the SRID of the column is 4326. Consider changing the SRID of the geometry or the SRID property of the column.
|
||||
INSERT INTO t1 (srid_4326) VALUES (POINT(0, 0));
|
||||
ERROR HY000: The SRID of the geometry does not match the SRID of the column. The SRID of the geometry is 0, but the SRID of the column is 4326. Consider changing the SRID of the geometry or the SRID property of the column.
|
||||
# Try to alter the SRID of the columns, which should fail for all columns
|
||||
# now since they already contain data.
|
||||
ALTER TABLE t1 CHANGE COLUMN no_srid no_srid POINT SRID 0 DEFAULT NULL;
|
||||
ERROR 0A000: not support alter srid not supported
|
||||
ALTER TABLE t1 CHANGE COLUMN srid_0 srid_0 POINT SRID 4326 DEFAULT NULL;
|
||||
ERROR 0A000: not support alter srid not supported
|
||||
ALTER TABLE t1 CHANGE COLUMN srid_4326 srid_4326 POINT SRID 0 DEFAULT NULL;
|
||||
ERROR 0A000: not support alter srid not supported
|
||||
# Removing the SRID specification from a column should work just fine.
|
||||
# Setting the SRID to a non-existing SRID should not work.
|
||||
ALTER TABLE t1 CHANGE COLUMN srid_4326 srid_1 POINT SRID 1 DEFAULT NULL;
|
||||
ERROR SR001: There's no spatial reference system with SRID 1.
|
||||
DROP TABLE t1;
|
||||
# Creating a geometry column with a non-existing SRID should not work
|
||||
CREATE TABLE t1 (col1 POINT SRID 1);
|
||||
ERROR SR001: There's no spatial reference system with SRID 1.
|
||||
# Try to create a table without the SRID property, insert data with
|
||||
# different SRIDs and then add the SRID property (which should not work).
|
||||
CREATE TABLE t1 (col1 POINT);
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`col1` point DEFAULT NULL
|
||||
) DEFAULT CHARSET = utf8mb4 COMPRESSION = 'lz4_1.0' REPLICA_NUM = NUM BLOCK_SIZE = SIZE USE_BLOOM_FILTER = FALSE TABLET_SIZE = SIZE PCTFREE = 10
|
||||
INSERT INTO t1 VALUES (ST_GeomFromText('POINT(1 1)', 4326)),
|
||||
(ST_GeomFromText('POINT(2 2)', 0)),
|
||||
(ST_GeomFromText('POINT(3 3)', 4326)),
|
||||
(ST_GeomFromText('POINT(4 4)', 0)),
|
||||
(ST_GeomFromText('POINT(5 5)', 4326)),
|
||||
(ST_GeomFromText('POINT(6 6)', 0));
|
||||
ALTER TABLE t1 CHANGE COLUMN col1 col1 POINT SRID 4326;
|
||||
ERROR 0A000: not support alter srid not supported
|
||||
ALTER TABLE t1 CHANGE COLUMN col1 col1 POINT SRID 4326;
|
||||
ERROR 0A000: not support alter srid not supported
|
||||
DROP TABLE t1;
|
||||
# Creating a column with SRID property on a MyISAM table should only
|
||||
# be supported if the SRID represents a cartesian coordinate system.
|
||||
drop table if exists t1, t2;
|
||||
CREATE TABLE t1 (col1 POINT SRID 0) ENGINE = MyISAM;
|
||||
Warnings:
|
||||
Warning 1286 Unknown storage engine 'MyISAM'
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`col1` point /*!80003 SRID 0 */ DEFAULT NULL
|
||||
) DEFAULT CHARSET = utf8mb4 COMPRESSION = 'lz4_1.0' REPLICA_NUM = NUM BLOCK_SIZE = SIZE USE_BLOOM_FILTER = FALSE TABLET_SIZE = SIZE PCTFREE = 10
|
||||
CREATE TABLE t2 (col1 POINT SRID 2000) ENGINE = MyISAM;
|
||||
Warnings:
|
||||
Warning 1286 Unknown storage engine 'MyISAM'
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`col1` point /*!80003 SRID 0 */ DEFAULT NULL
|
||||
) DEFAULT CHARSET = utf8mb4 COMPRESSION = 'lz4_1.0' REPLICA_NUM = NUM BLOCK_SIZE = SIZE USE_BLOOM_FILTER = FALSE TABLET_SIZE = SIZE PCTFREE = 10
|
||||
DROP TABLE t1, t2;
|
||||
# It should not be possible to use the SRID property with any other types
|
||||
# than geometric types.
|
||||
CREATE TABLE t1 (col1 DOUBLE SRID 0);
|
||||
ERROR HY000: Incorrect usage of srid.
|
||||
CREATE TABLE t1 (col1 BLOB SRID 0);
|
||||
ERROR HY000: Incorrect usage of srid.
|
||||
CREATE TABLE t1 (col1 VARCHAR(255) SRID 0);
|
||||
ERROR HY000: Incorrect usage of srid.
|
||||
# Check that any indexes on SRID-less columns are ignored by the
|
||||
# optimizer
|
||||
CREATE TABLE t1 (col1 POINT NOT NULL, SPATIAL INDEX (col1));
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`col1` point NOT NULL,
|
||||
SPATIAL KEY `col1` (`col1`) BLOCK_SIZE 16384 LOCAL
|
||||
) DEFAULT CHARSET = utf8mb4 COMPRESSION = 'lz4_1.0' REPLICA_NUM = NUM BLOCK_SIZE = SIZE USE_BLOOM_FILTER = FALSE TABLET_SIZE = SIZE PCTFREE = 10
|
||||
INSERT INTO t1 VALUES (POINT(0, 0)), (POINT(0.5, 0.5)), (POINT(1, 1));
|
||||
# The following query plan should NOT use the index on "col1", since
|
||||
# the column does not have the SRID property defined.
|
||||
SELECT ST_ASTEXT(col1) FROM t1;
|
||||
ST_ASTEXT(col1)
|
||||
POINT(0 0)
|
||||
POINT(0.5 0.5)
|
||||
POINT(1 1)
|
||||
DROP TABLE t1;
|
||||
# Check that we print error message for misuse of SRID with non-geometric
|
||||
# data type instead of "SRID not found"
|
||||
CREATE TABLE t1 (a INTEGER SRID 1);
|
||||
ERROR HY000: Incorrect usage of srid.
|
||||
CREATE TABLE t1 (a INTEGER);
|
||||
ALTER TABLE t1 MODIFY COLUMN a INTEGER SRID 1;
|
||||
ERROR HY000: Incorrect usage of srid.
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#26594499 WL#8592:ALTER TABLE ADD SPATIAL INDEX RETURNS CANNOT GET
|
||||
# GEOMETRY OBJECT ERROR
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
g1 geometry NOT NULL,
|
||||
g3 geometry SRID 2000 NOT NULL,
|
||||
g4 geometry SRID 4326 NOT NULL
|
||||
);
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`g1` geometry NOT NULL,
|
||||
`g3` geometry NOT NULL /*!80003 SRID 2000 */,
|
||||
`g4` geometry NOT NULL /*!80003 SRID 4326 */
|
||||
) DEFAULT CHARSET = utf8mb4 COMPRESSION = 'lz4_1.0' REPLICA_NUM = NUM BLOCK_SIZE = SIZE USE_BLOOM_FILTER = FALSE TABLET_SIZE = SIZE PCTFREE = 10
|
||||
INSERT INTO t1 VALUES (ST_GeomFromText('POINT(0 0)'),
|
||||
ST_GeomFromText('POINT(0 0)', 2000), ST_GeomFromText('POINT(0 0)', 4326));
|
||||
ALTER TABLE t1 add spatial index idx1(g4);
|
||||
ALTER TABLE t1 add spatial index idx3(g3);
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (col1 POINT SRID 4294967296);
|
||||
ERROR 22003: srid value is out of range in 'UINT32_MAX'
|
||||
#
|
||||
# Check that adding, modifying and removing spatial indexes works well
|
||||
# with SRID columns
|
||||
#
|
||||
drop table if exists t1;
|
||||
CREATE TABLE t1 (col_no_srid POINT NOT NULL,
|
||||
col_srid_0 POINT SRID 0 NOT NULL,
|
||||
col_srid_4326 POINT SRID 4326 NOT NULL);
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`col_no_srid` point NOT NULL,
|
||||
`col_srid_0` point NOT NULL /*!80003 SRID 0 */,
|
||||
`col_srid_4326` point NOT NULL /*!80003 SRID 4326 */
|
||||
) DEFAULT CHARSET = utf8mb4 COMPRESSION = 'lz4_1.0' REPLICA_NUM = NUM BLOCK_SIZE = SIZE USE_BLOOM_FILTER = FALSE TABLET_SIZE = SIZE PCTFREE = 10
|
||||
INSERT INTO t1 VALUES (
|
||||
ST_GeomFromText("POINT(0 0)", 0),
|
||||
ST_GeomFromText("POINT(0 0)", 0),
|
||||
ST_GeomFromText("POINT(0 0)", 4326));
|
||||
INSERT INTO t1 VALUES (
|
||||
ST_GeomFromText("POINT(1 1)", 4326),
|
||||
ST_GeomFromText("POINT(1 1)", 0),
|
||||
ST_GeomFromText("POINT(1 1)", 4326));
|
||||
ALTER TABLE t1 ADD SPATIAL INDEX idx1 (col_no_srid);
|
||||
ALTER TABLE t1 ADD SPATIAL INDEX idx2 (col_srid_0);
|
||||
ALTER TABLE t1 ADD SPATIAL INDEX idx3 (col_srid_4326);
|
||||
ALTER TABLE t1 DROP INDEX idx2;
|
||||
ALTER TABLE t1 DROP INDEX idx3;
|
||||
ALTER TABLE t1 DROP INDEX idx1;
|
||||
CREATE SPATIAL INDEX idx1 ON t1 (col_srid_4326);
|
||||
CREATE SPATIAL INDEX idx2 ON t1 (col_no_srid);
|
||||
CREATE SPATIAL INDEX idx3 ON t1 (col_srid_0);
|
||||
DROP INDEX idx1 ON t1;
|
||||
DROP INDEX idx2 ON t1;
|
||||
DROP INDEX idx3 ON t1;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (col_no_srid POINT NOT NULL,
|
||||
col_srid_0 POINT SRID 0 NOT NULL,
|
||||
col_srid_4326 POINT SRID 4326 NOT NULL,
|
||||
SPATIAL INDEX idx1 (col_no_srid),
|
||||
SPATIAL INDEX idx2 (col_srid_0),
|
||||
SPATIAL INDEX idx3 (col_srid_4326));
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`col_no_srid` point NOT NULL,
|
||||
`col_srid_0` point NOT NULL /*!80003 SRID 0 */,
|
||||
`col_srid_4326` point NOT NULL /*!80003 SRID 4326 */,
|
||||
SPATIAL KEY `idx1` (`col_no_srid`) BLOCK_SIZE 16384 LOCAL,
|
||||
SPATIAL KEY `idx2` (`col_srid_0`) BLOCK_SIZE 16384 LOCAL,
|
||||
SPATIAL KEY `idx3` (`col_srid_4326`) BLOCK_SIZE 16384 LOCAL
|
||||
) DEFAULT CHARSET = utf8mb4 COMPRESSION = 'lz4_1.0' REPLICA_NUM = NUM BLOCK_SIZE = SIZE USE_BLOOM_FILTER = FALSE TABLET_SIZE = SIZE PCTFREE = 10
|
||||
INSERT INTO t1 VALUES (
|
||||
ST_GeomFromText("POINT(0 0)", 0),
|
||||
ST_GeomFromText("POINT(0 0)", 0),
|
||||
ST_GeomFromText("POINT(0 0)", 4326));
|
||||
INSERT INTO t1 VALUES (
|
||||
ST_GeomFromText("POINT(1 1)", 4326),
|
||||
ST_GeomFromText("POINT(1 1)", 0),
|
||||
ST_GeomFromText("POINT(1 1)", 4326));
|
||||
DROP INDEX idx3 ON t1;
|
||||
DROP INDEX idx2 ON t1;
|
||||
DROP INDEX idx1 ON t1;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Altering the SRID specification should not be allowed if there is a
|
||||
# spatial index on the column.
|
||||
#
|
||||
CREATE TABLE t1 (col1 POINT NOT NULL SRID 4326,
|
||||
SPATIAL INDEX idx1 (col1));
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`col1` point NOT NULL /*!80003 SRID 4326 */,
|
||||
SPATIAL KEY `idx1` (`col1`) BLOCK_SIZE 16384 LOCAL
|
||||
) DEFAULT CHARSET = utf8mb4 COMPRESSION = 'lz4_1.0' REPLICA_NUM = NUM BLOCK_SIZE = SIZE USE_BLOOM_FILTER = FALSE TABLET_SIZE = SIZE PCTFREE = 10
|
||||
ALTER TABLE t1 CHANGE COLUMN col1 col1 POINT NOT NULL SRID 0;
|
||||
ERROR 0A000: not support alter srid not supported
|
||||
ALTER TABLE t1 CHANGE COLUMN col1 col1 POINT NOT NULL;
|
||||
ERROR 0A000: not support alter srid not supported
|
||||
ALTER TABLE t1 CHANGE COLUMN col1 col1 POINT NOT NULL SRID 0;
|
||||
ERROR 0A000: not support alter srid not supported
|
||||
ALTER TABLE t1 CHANGE COLUMN col1 col1 POINT NOT NULL;
|
||||
ERROR 0A000: not support alter srid not supported
|
||||
ALTER TABLE t1 CHANGE COLUMN col1 col1 POINT NOT NULL SRID 0;
|
||||
ERROR 0A000: not support alter srid not supported
|
||||
ALTER TABLE t1 CHANGE COLUMN col1 col1 POINT NOT NULL;
|
||||
ERROR 0A000: not support alter srid not supported
|
||||
ALTER TABLE t1 CHANGE COLUMN col1 col1 POINT NOT NULL SRID 0;
|
||||
ERROR 0A000: not support alter srid not supported
|
||||
ALTER TABLE t1 CHANGE COLUMN col1 col1 POINT NOT NULL;
|
||||
ERROR 0A000: not support alter srid not supported
|
||||
ALTER TABLE t1 CHANGE COLUMN col1 col2 POINT NOT NULL SRID 0;
|
||||
ERROR 0A000: not support alter srid not supported
|
||||
ALTER TABLE t1 CHANGE COLUMN col1 col2 POINT NOT NULL;
|
||||
ERROR 0A000: not support alter srid not supported
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#26594499 WL#8592: CANNOT GET GEOMETRY OBJECT ERROR
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
g1 geometry NOT NULL,
|
||||
g3 geometry SRID 2000 NOT NULL,
|
||||
g4 geometry SRID 4326 NOT NULL
|
||||
);
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`g1` geometry NOT NULL,
|
||||
`g3` geometry NOT NULL /*!80003 SRID 2000 */,
|
||||
`g4` geometry NOT NULL /*!80003 SRID 4326 */
|
||||
) DEFAULT CHARSET = utf8mb4 COMPRESSION = 'lz4_1.0' REPLICA_NUM = NUM BLOCK_SIZE = SIZE USE_BLOOM_FILTER = FALSE TABLET_SIZE = SIZE PCTFREE = 10
|
||||
INSERT INTO t1 VALUES (ST_GeomFromText('POINT(0 0)'),
|
||||
ST_GeomFromText('POINT(0 0)', 2000), ST_GeomFromText('POINT(0 0)', 4326));
|
||||
ALTER TABLE t1 add spatial index idx1(g4);
|
||||
ALTER TABLE t1 add spatial index idx3(g3);
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#27015964 USELESS SPATIAL INDEX CAN BE CREATED WITHOUT WARNING
|
||||
#
|
||||
# Creating a table with a spatial index on a SRID-less column should
|
||||
# raise a warning.
|
||||
CREATE TABLE t1 (
|
||||
g1 POINT NOT NULL
|
||||
, g2 POINT NOT NULL
|
||||
, g3 POINT NOT NULL SRID 0
|
||||
, SPATIAL INDEX idx1 (g1)
|
||||
, SPATIAL INDEX idx2 (g2)
|
||||
, SPATIAL INDEX idx3 (g3));
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`g1` point NOT NULL,
|
||||
`g2` point NOT NULL,
|
||||
`g3` point NOT NULL /*!80003 SRID 0 */,
|
||||
SPATIAL KEY `idx1` (`g1`) BLOCK_SIZE 16384 LOCAL,
|
||||
SPATIAL KEY `idx2` (`g2`) BLOCK_SIZE 16384 LOCAL,
|
||||
SPATIAL KEY `idx3` (`g3`) BLOCK_SIZE 16384 LOCAL
|
||||
) DEFAULT CHARSET = utf8mb4 COMPRESSION = 'lz4_1.0' REPLICA_NUM = NUM BLOCK_SIZE = SIZE USE_BLOOM_FILTER = FALSE TABLET_SIZE = SIZE PCTFREE = 10
|
||||
DROP INDEX idx1 ON t1;
|
||||
DROP INDEX idx2 ON t1;
|
||||
DROP INDEX idx3 ON t1;
|
||||
# Verify that we get the same warning when using CREATE INDEX syntax.
|
||||
CREATE SPATIAL INDEX idx1 ON t1 (g1);
|
||||
CREATE SPATIAL INDEX idx2 ON t1 (g2);
|
||||
CREATE SPATIAL INDEX idx3 ON t1 (g3);
|
||||
DROP INDEX idx1 ON t1;
|
||||
DROP INDEX idx2 ON t1;
|
||||
DROP INDEX idx3 ON t1;
|
||||
# Verify that we get the same warning when using ALTER TABLE syntax.
|
||||
ALTER TABLE t1 ADD SPATIAL INDEX idx1 (g1);
|
||||
ALTER TABLE t1 ADD SPATIAL INDEX idx2 (g2);
|
||||
ALTER TABLE t1 ADD SPATIAL INDEX idx3 (g3);
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#27220467 SERVER HANGS WHILE CREATING A NEW SRS WHICH IS USED IN
|
||||
# ANOTHER CLIENT
|
||||
#
|
||||
# Try to create a point column using a SRID that doesn't exist
|
||||
CREATE TABLE t1 (col1 POINT SRID 4326, col2 POINT SRID 1000000000);
|
||||
ERROR SR001: There's no spatial reference system with SRID 1000000000.
|
||||
# Force the error to happen after all the columns are contextualized.
|
||||
# Verify the same behavior for ALTER TABLE as well.
|
||||
CREATE TABLE t1 (col1 INT);
|
||||
ALTER TABLE t1 ADD COLUMN col2 POINT SRID 1000000000;
|
||||
ERROR SR001: There's no spatial reference system with SRID 1000000000.
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (col_no_srid POINT NOT NULL,
|
||||
col_srid_0 POINT SRID 0 NOT NULL,
|
||||
col_srid_4326 POINT SRID 4326 NOT NULL,
|
||||
SPATIAL INDEX idx1 (col_no_srid),
|
||||
SPATIAL INDEX idx2 (col_srid_0),
|
||||
SPATIAL INDEX idx3 (col_srid_4326));
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`col_no_srid` point NOT NULL,
|
||||
`col_srid_0` point NOT NULL /*!80003 SRID 0 */,
|
||||
`col_srid_4326` point NOT NULL /*!80003 SRID 4326 */,
|
||||
SPATIAL KEY `idx1` (`col_no_srid`) BLOCK_SIZE 16384 LOCAL,
|
||||
SPATIAL KEY `idx2` (`col_srid_0`) BLOCK_SIZE 16384 LOCAL,
|
||||
SPATIAL KEY `idx3` (`col_srid_4326`) BLOCK_SIZE 16384 LOCAL
|
||||
) DEFAULT CHARSET = utf8mb4 COMPRESSION = 'lz4_1.0' REPLICA_NUM = NUM BLOCK_SIZE = SIZE USE_BLOOM_FILTER = FALSE TABLET_SIZE = SIZE PCTFREE = 10
|
||||
DROP TABLE t1;
|
||||
create table tt1(p POINT SRID -1);
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '-1)' at line 1
|
||||
create table tt1(p POINT SRID 'test');
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near ''test')' at line 1
|
||||
create table tt1(p POINT SRID 0.7);
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '0.7)' at line 1
|
||||
create table tt1(p POINT SRID null);
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'null)' at line 1
|
||||
create table tt1(p POINT SRID '');
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near ''')' at line 1
|
||||
create table tt1(p POINT SRID 4294967295);
|
||||
DROP TABLE tt1;
|
||||
create table tt1(g GEOMETRY primary key);
|
||||
ERROR HY000: Spatial indexes can't be primary or unique indexes.
|
||||
create table tt1(g geometry, primary key (g));
|
||||
ERROR HY000: Spatial indexes can't be primary or unique indexes.
|
||||
create table tt2(p point unique key);
|
||||
ERROR HY000: Spatial indexes can't be primary or unique indexes.
|
||||
create table tt2(p point, unique key (p));
|
||||
ERROR HY000: Spatial indexes can't be primary or unique indexes.
|
||||
create table child(i int primary key, g geometry not null srid 4326);
|
||||
create table parent(i int primary key, g geometry not null srid 4326, constraint g1_fk foreign key(g) references child(g));
|
||||
ERROR HY000: Cannot add foreign key constraint
|
||||
drop table child;
|
||||
drop table if exists T_GEO;
|
||||
drop view if exists V_T_GEO;
|
||||
create table T_GEO (gid int auto_increment primary key, geometry geometry not null srid 4326);
|
||||
create view V_T_GEO AS SELECT * FROM T_GEO;
|
||||
desc V_T_GEO;
|
||||
Field Type Null Key Default Extra
|
||||
gid int(11) NO NULL
|
||||
geometry geometry NO NULL
|
||||
drop view V_T_GEO;
|
||||
drop table T_GEO;
|
||||
create table T_GEO (gid int auto_increment primary key, geo geometry ,geo_c GEOMETRYCOLLECTION,poi point,lin linestring ,pol polygon,M_POI MULTIPOINT,M_LIN MULTILINESTRING ,M_POL MULTIPOLYGON );
|
||||
create view V_T_GEO AS SELECT * FROM T_GEO;
|
||||
insert into V_T_GEO(POI) VALUES (ST_GEOMFROMTEXT('POLYGON((0 0,1 1,1 0,0 1,0 0)) '));
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
SELECT ST_ASTEXT(poi) FROM V_T_GEO;
|
||||
ST_ASTEXT(poi)
|
||||
SELECT ST_ASTEXT(poi) FROM T_GEO;
|
||||
ST_ASTEXT(poi)
|
||||
drop view V_T_GEO;
|
||||
DROP TABLE T_GEO;
|
||||
create table tt4(id int, g GEOMETRY);
|
||||
alter table tt4 add g1 GEOMETRY not null;
|
||||
ERROR 22004: Invalid use of NULL value
|
||||
show create table tt4;
|
||||
Table Create Table
|
||||
tt4 CREATE TABLE `tt4` (
|
||||
`id` int(11) DEFAULT NULL,
|
||||
`g` geometry DEFAULT NULL
|
||||
) DEFAULT CHARSET = utf8mb4 COMPRESSION = 'lz4_1.0' REPLICA_NUM = NUM BLOCK_SIZE = SIZE USE_BLOOM_FILTER = FALSE TABLET_SIZE = SIZE PCTFREE = 10
|
||||
alter table tt4 add g2 GEOMETRY null;
|
||||
show create table tt4;
|
||||
Table Create Table
|
||||
tt4 CREATE TABLE `tt4` (
|
||||
`id` int(11) DEFAULT NULL,
|
||||
`g` geometry DEFAULT NULL,
|
||||
`g2` geometry DEFAULT NULL
|
||||
) DEFAULT CHARSET = utf8mb4 COMPRESSION = 'lz4_1.0' REPLICA_NUM = NUM BLOCK_SIZE = SIZE USE_BLOOM_FILTER = FALSE TABLET_SIZE = SIZE PCTFREE = 10
|
||||
insert into tt4(id, g2) values (1, point(1,1));
|
||||
select id,st_astext(g2) from tt4 order by id;
|
||||
id st_astext(g2)
|
||||
1 POINT(1 1)
|
||||
drop table tt4;
|
||||
drop table if exists test;
|
||||
create table test(p point srid 4326);
|
||||
alter table test modify p MULTIPOINT;
|
||||
ERROR 0A000: Modify geometry type not supported
|
||||
alter table test change p p1 MULTIPOINT;
|
||||
ERROR 0A000: Change geometry type not supported
|
||||
alter table test modify p POINT SRID 0;
|
||||
ERROR 0A000: Modify geometry srid not supported
|
||||
alter table test change p p1 point srid 0;
|
||||
ERROR 0A000: not support alter srid not supported
|
||||
alter table test change p p1 point;
|
||||
ERROR 0A000: not support alter srid not supported
|
||||
alter table test change p p1 point srid 4326;
|
||||
desc test;
|
||||
Field Type Null Key Default Extra
|
||||
p1 point YES NULL
|
||||
drop table test;
|
||||
create table tt1(id int);
|
||||
insert into tt1 values(1);
|
||||
alter table tt1 add g GEOMETRY not null;
|
||||
ERROR 22004: Invalid use of NULL value
|
||||
drop table tt1;
|
||||
create table tt1(id int);
|
||||
alter table tt1 add g GEOMETRY not null;
|
||||
ERROR 22004: Invalid use of NULL value
|
||||
drop table tt1;
|
||||
create table tt1(id int);
|
||||
alter table tt1 add g GEOMETRY;
|
||||
drop table tt1;
|
||||
create table tt1(id int);
|
||||
insert into tt1 values(1);
|
||||
alter table tt1 add g GEOMETRY;
|
||||
drop table tt1;
|
||||
create table tt1(id int);
|
||||
alter table tt1 add g GEOMETRY;
|
||||
insert into tt1 values (1, point(0,0));
|
||||
alter table tt1 modify column g geometry not null;
|
||||
drop table tt1;
|
||||
create table tt1(g geometry);
|
||||
alter table tt1 modify column g geometry not null;
|
||||
drop table tt1;
|
||||
create table tt1(g geometry);
|
||||
insert into tt1(g) value (null);
|
||||
alter table tt1 modify column g geometry not null;
|
||||
ERROR 22004: Invalid use of NULL value
|
||||
drop table tt1;
|
||||
drop table if exists T_GEO;
|
||||
drop table if exists t;
|
||||
drop view if exists V_T_GEO;
|
||||
create table T_GEO (poi point);
|
||||
insert into T_GEO values (ST_GEOMFROMTEXT('POINT(0 0)', 4267));
|
||||
create view V_T_GEO AS SELECT * FROM T_GEO;
|
||||
REPLACE INTO V_T_GEO(poi) VALUES (ST_GEOMFROMTEXT('POLYGON((0 0,1 1,1 0,0 1,0 0))'));
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
insert into T_GEO values (ST_GEOMFROMTEXT('point(0 0)'));
|
||||
create table t as select st_buffer(T_GEO.poi, 1) from T_GEO;
|
||||
drop table t;
|
||||
drop table if exists T_GEO;
|
||||
drop table if exists t;
|
||||
create table T_GEO (poly polygon);
|
||||
insert into T_GEO values (ST_GEOMFROMTEXT('polygon((0 0, 0 1, 1 1,0 0))', 4267));
|
||||
create table t as select st_area(T_GEO.poly) from T_GEO;
|
||||
select * from t;
|
||||
st_area(T_GEO.poly)
|
||||
6154457959.759597
|
||||
drop table T_GEO;
|
||||
drop table t;
|
||||
drop view if exists V_T_GEO;
|
||||
create or replace view vv as select st_aswkb(x'00000000010100000000000000000034C00000000000004940') a;
|
||||
desc vv;
|
||||
Field Type Null Key Default Extra
|
||||
a longblob YES NULL
|
||||
create or replace view vv as select st_geomfromwkb(x'0106000000010000000103000000010000000500000000000000008056400000000000C0564000000000000024400000000000A066C0000000000000244000000000000024400000000000000000000000000000244000000000008056400000000000C05640');
|
||||
desc vv;
|
||||
Field Type Null Key Default Extra
|
||||
Name_exp_1 geometry YES NULL
|
||||
create or replace view vv as select Point(0,0);
|
||||
desc vv;
|
||||
Field Type Null Key Default Extra
|
||||
Point(0,0) point YES NULL
|
||||
drop table if exists geometries;
|
||||
drop table if exists t1;
|
||||
CREATE TABLE geometries ( g GEOMETRY, pt POINT, ls LINESTRING, py POLYGON, mpt MULTIPOINT, mls MULTILINESTRING, mpy MULTIPOLYGON, gc GEOMETRYCOLLECTION);
|
||||
SET @c1 = ST_GEOMFROMTEXT('POINT(10 10)');
|
||||
SET @c2 = ST_GEOMFROMTEXT('LINESTRING(10 10,20 20,30 30)');
|
||||
SET @c3 = ST_GEOMFROMTEXT('POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4))');
|
||||
SET @c4 = ST_GEOMFROMTEXT('MULTIPOINT(0 0,5 5,10 10,20 20)');
|
||||
SET @c5 = ST_GEOMFROMTEXT('MULTILINESTRING((1 1,2 2,3 3),(10 10,20 20,30 30))');
|
||||
SET @c6 = ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0)),((5 5,5 10,10 10,10 5,5 5)))');
|
||||
SET @c7 = ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))');
|
||||
INSERT INTO geometries VALUES (@c1, @c1, @c2, @c3, @c4, @c5, @c6, @c7);
|
||||
CREATE TABLE t1 SELECT a FROM (SELECT pt AS a FROM geometries UNION SELECT mls FROM geometries) t;
|
||||
select st_astext(a) from t1;
|
||||
st_astext(a)
|
||||
POINT(10 10)
|
||||
MULTILINESTRING((1 1,2 2,3 3),(10 10,20 20,30 30))
|
||||
drop table geometries;
|
||||
drop table t1;
|
||||
@ -0,0 +1,425 @@
|
||||
# ----------------------------------------------------------------------
|
||||
# Base test of GEOMETRY dml.
|
||||
# ----------------------------------------------------------------------
|
||||
alter system set _enable_defensive_check = 1;
|
||||
DROP TABLE IF EXISTS spatial_index_dml_constraint, tt1;
|
||||
CREATE TABLE spatial_index_dml_constraint (i INT, g GEOMETRY NOT NULL SRID 4326, PRIMARY KEY (i));
|
||||
SET @v1=ST_GEOMFROMTEXT('POINT(0 0)', 4326);
|
||||
SET @v2=ST_GEOMFROMTEXT('LINESTRING(0 0,10 10)', 4326);
|
||||
SET @v3=ST_GEOMFROMTEXT('POLYGON((0 0, 0 8, 8 8, 8 10, -10 10, -10 0, 0 0))', 4326);
|
||||
SET @v4=ST_GEOMFROMTEXT('MULTIPOINT(1 1, 11 11, 11 21, 21 21)', 4326);
|
||||
SET @v5=ST_GEOMFROMTEXT('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))', 4326);
|
||||
SET @v6=ST_GEOMFROMTEXT('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))', 4326);
|
||||
SET @v7=ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(9 9),LINESTRING(1 5,0 0),POLYGON((2 2,2 8,8 8,8 2,2 2)))', 4326);
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (1, @v1);
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (2, @v2);
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (3, @v3);
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (4, @v4);
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (5, @v5);
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (6, @v6);
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (7, @v7);
|
||||
DROP TABLE spatial_index_dml_constraint;
|
||||
CREATE TABLE spatial_index_dml_constraint (i INT, g POINT NOT NULL SRID 4326, PRIMARY KEY (i));
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (1, @v1);
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (2, @v2);
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (3, @v3);
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (4, @v4);
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (5, @v5);
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (6, @v6);
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (7, @v7);
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
DROP TABLE spatial_index_dml_constraint;
|
||||
CREATE TABLE spatial_index_dml_constraint (i INT, g LINESTRING NOT NULL SRID 4326, PRIMARY KEY (i));
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (1, @v1);
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (2, @v2);
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (3, @v3);
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (4, @v4);
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (5, @v5);
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (6, @v6);
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (7, @v7);
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
DROP TABLE spatial_index_dml_constraint;
|
||||
CREATE TABLE spatial_index_dml_constraint (i INT, g POLYGON NOT NULL SRID 4326, PRIMARY KEY (i));
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (1, @v1);
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (2, @v2);
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (3, @v3);
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (4, @v4);
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (5, @v5);
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (6, @v6);
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (7, @v7);
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
DROP TABLE spatial_index_dml_constraint;
|
||||
CREATE TABLE spatial_index_dml_constraint (i INT, g MULTIPOINT NOT NULL SRID 4326, PRIMARY KEY (i));
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (1, @v1);
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (2, @v2);
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (3, @v3);
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (4, @v4);
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (5, @v5);
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (6, @v6);
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (7, @v7);
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
DROP TABLE spatial_index_dml_constraint;
|
||||
CREATE TABLE spatial_index_dml_constraint (i INT, g MULTILINESTRING NOT NULL SRID 4326, PRIMARY KEY (i));
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (1, @v1);
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (2, @v2);
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (3, @v3);
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (4, @v4);
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (5, @v5);
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (6, @v6);
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (7, @v7);
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
DROP TABLE spatial_index_dml_constraint;
|
||||
CREATE TABLE spatial_index_dml_constraint (i INT, g MULTIPOLYGON NOT NULL SRID 4326, PRIMARY KEY (i));
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (1, @v1);
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (2, @v2);
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (3, @v3);
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (4, @v4);
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (5, @v5);
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (6, @v6);
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (7, @v7);
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
DROP TABLE spatial_index_dml_constraint;
|
||||
CREATE TABLE spatial_index_dml_constraint (i INT, g GEOMETRYCOLLECTION NOT NULL SRID 4326, PRIMARY KEY (i));
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (1, @v1);
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (2, @v2);
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (3, @v3);
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (4, @v4);
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (5, @v5);
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (6, @v6);
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (7, @v7);
|
||||
DROP TABLE spatial_index_dml_constraint;
|
||||
DROP TABLE IF EXISTS spatial_index_dml_constraint;
|
||||
CREATE TABLE spatial_index_dml_constraint (i int, g GEOMETRY NOT NULL SRID 4326, PRIMARY KEY (i));
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (1, @v1);
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (2, @v2);
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (3, @v3);
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (4, @v4);
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (5, @v5);
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (6, @v6);
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (7, @v7);
|
||||
UPDATE spatial_index_dml_constraint SET g=@v1 WHERE i = 1;
|
||||
UPDATE spatial_index_dml_constraint SET g=@v2 WHERE i = 1;
|
||||
UPDATE spatial_index_dml_constraint SET g=@v3 WHERE i = 1;
|
||||
UPDATE spatial_index_dml_constraint SET g=@v4 WHERE i = 1;
|
||||
UPDATE spatial_index_dml_constraint SET g=@v5 WHERE i = 1;
|
||||
UPDATE spatial_index_dml_constraint SET g=@v6 WHERE i = 1;
|
||||
UPDATE spatial_index_dml_constraint SET g=@v7 WHERE i = 1;
|
||||
DROP TABLE spatial_index_dml_constraint;
|
||||
CREATE TABLE spatial_index_dml_constraint (i int, g POINT NOT NULL SRID 4326, PRIMARY KEY (i));
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (1, @v1);
|
||||
UPDATE spatial_index_dml_constraint SET g=@v1 WHERE i = 1;
|
||||
UPDATE spatial_index_dml_constraint SET g=@v2 WHERE i = 1;
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
UPDATE spatial_index_dml_constraint SET g=@v3 WHERE i = 1;
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
UPDATE spatial_index_dml_constraint SET g=@v4 WHERE i = 1;
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
UPDATE spatial_index_dml_constraint SET g=@v5 WHERE i = 1;
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
UPDATE spatial_index_dml_constraint SET g=@v6 WHERE i = 1;
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
UPDATE spatial_index_dml_constraint SET g=@v7 WHERE i = 1;
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
DROP TABLE spatial_index_dml_constraint;
|
||||
CREATE TABLE spatial_index_dml_constraint (i int, g LINESTRING NOT NULL SRID 4326, PRIMARY KEY (i));
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (1, @v2);
|
||||
UPDATE spatial_index_dml_constraint SET g=@v1 WHERE i = 1;
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
UPDATE spatial_index_dml_constraint SET g=@v2 WHERE i = 1;
|
||||
UPDATE spatial_index_dml_constraint SET g=@v3 WHERE i = 1;
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
UPDATE spatial_index_dml_constraint SET g=@v4 WHERE i = 1;
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
UPDATE spatial_index_dml_constraint SET g=@v5 WHERE i = 1;
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
UPDATE spatial_index_dml_constraint SET g=@v6 WHERE i = 1;
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
UPDATE spatial_index_dml_constraint SET g=@v7 WHERE i = 1;
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
DROP TABLE spatial_index_dml_constraint;
|
||||
CREATE TABLE spatial_index_dml_constraint (i int, g POLYGON NOT NULL SRID 4326, PRIMARY KEY (i));
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (1, @v3);
|
||||
UPDATE spatial_index_dml_constraint SET g=@v1 WHERE i = 1;
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
UPDATE spatial_index_dml_constraint SET g=@v2 WHERE i = 1;
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
UPDATE spatial_index_dml_constraint SET g=@v3 WHERE i = 1;
|
||||
UPDATE spatial_index_dml_constraint SET g=@v4 WHERE i = 1;
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
UPDATE spatial_index_dml_constraint SET g=@v5 WHERE i = 1;
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
UPDATE spatial_index_dml_constraint SET g=@v6 WHERE i = 1;
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
UPDATE spatial_index_dml_constraint SET g=@v7 WHERE i = 1;
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
DROP TABLE spatial_index_dml_constraint;
|
||||
CREATE TABLE spatial_index_dml_constraint (i int, g MULTIPOINT NOT NULL SRID 4326, PRIMARY KEY (i));
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (1, @v4);
|
||||
UPDATE spatial_index_dml_constraint SET g=@v1 WHERE i = 1;
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
UPDATE spatial_index_dml_constraint SET g=@v2 WHERE i = 1;
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
UPDATE spatial_index_dml_constraint SET g=@v3 WHERE i = 1;
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
UPDATE spatial_index_dml_constraint SET g=@v4 WHERE i = 1;
|
||||
UPDATE spatial_index_dml_constraint SET g=@v5 WHERE i = 1;
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
UPDATE spatial_index_dml_constraint SET g=@v6 WHERE i = 1;
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
UPDATE spatial_index_dml_constraint SET g=@v7 WHERE i = 1;
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
DROP TABLE spatial_index_dml_constraint;
|
||||
CREATE TABLE spatial_index_dml_constraint (i int, g MULTILINESTRING NOT NULL SRID 4326, PRIMARY KEY (i));
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (1, @v5);
|
||||
UPDATE spatial_index_dml_constraint SET g=@v1 WHERE i = 1;
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
UPDATE spatial_index_dml_constraint SET g=@v2 WHERE i = 1;
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
UPDATE spatial_index_dml_constraint SET g=@v3 WHERE i = 1;
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
UPDATE spatial_index_dml_constraint SET g=@v4 WHERE i = 1;
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
UPDATE spatial_index_dml_constraint SET g=@v5 WHERE i = 1;
|
||||
UPDATE spatial_index_dml_constraint SET g=@v6 WHERE i = 1;
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
UPDATE spatial_index_dml_constraint SET g=@v7 WHERE i = 1;
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
DROP TABLE spatial_index_dml_constraint;
|
||||
CREATE TABLE spatial_index_dml_constraint (i int, g MULTIPOLYGON NOT NULL SRID 4326, PRIMARY KEY (i));
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (1, @v6);
|
||||
UPDATE spatial_index_dml_constraint SET g=@v1 WHERE i = 1;
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
UPDATE spatial_index_dml_constraint SET g=@v2 WHERE i = 1;
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
UPDATE spatial_index_dml_constraint SET g=@v3 WHERE i = 1;
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
UPDATE spatial_index_dml_constraint SET g=@v4 WHERE i = 1;
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
UPDATE spatial_index_dml_constraint SET g=@v5 WHERE i = 1;
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
UPDATE spatial_index_dml_constraint SET g=@v6 WHERE i = 1;
|
||||
UPDATE spatial_index_dml_constraint SET g=@v7 WHERE i = 1;
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
DROP TABLE spatial_index_dml_constraint;
|
||||
CREATE TABLE spatial_index_dml_constraint (i int, g GEOMETRYCOLLECTION NOT NULL SRID 4326, PRIMARY KEY (i));
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (1, @v7);
|
||||
UPDATE spatial_index_dml_constraint SET g=@v1 WHERE i = 1;
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
UPDATE spatial_index_dml_constraint SET g=@v2 WHERE i = 1;
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
UPDATE spatial_index_dml_constraint SET g=@v3 WHERE i = 1;
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
UPDATE spatial_index_dml_constraint SET g=@v4 WHERE i = 1;
|
||||
UPDATE spatial_index_dml_constraint SET g=@v5 WHERE i = 1;
|
||||
UPDATE spatial_index_dml_constraint SET g=@v6 WHERE i = 1;
|
||||
UPDATE spatial_index_dml_constraint SET g=@v7 WHERE i = 1;
|
||||
DROP TABLE spatial_index_dml_constraint;
|
||||
CREATE TABLE t(p POINT);
|
||||
INSERT INTO t VALUES(1);
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
DROP TABLE t;
|
||||
create table T_GEO (gid int auto_increment primary key,geo geometry );
|
||||
replace into T_GEO VALUES (1,st_geomfromtext('point(90 90)'));
|
||||
select st_astext(geo) from T_GEO;
|
||||
st_astext(geo)
|
||||
POINT(90 90)
|
||||
replace into T_GEO VALUES (1,st_geomfromtext('point(80 80)'));
|
||||
select st_astext(geo) from T_GEO;
|
||||
st_astext(geo)
|
||||
POINT(80 80)
|
||||
replace into T_GEO VALUES (1,st_geomfromtext('point(80 80)'));
|
||||
select st_astext(geo) from T_GEO;
|
||||
st_astext(geo)
|
||||
POINT(80 80)
|
||||
drop table T_GEO;
|
||||
create table T_GEO (gid int auto_increment primary key,g point srid 4326);
|
||||
replace into T_GEO VALUES (1,st_geomfromtext('point(90 90)', 0));
|
||||
ERROR HY000: The SRID of the geometry does not match the SRID of the column. The SRID of the geometry is 0, but the SRID of the column is 4326. Consider changing the SRID of the geometry or the SRID property of the column.
|
||||
replace into T_GEO VALUES (1,st_geomfromtext('LINESTRING(90 90, 1 1)', 0));
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
replace into T_GEO VALUES (1,st_geomfromtext('point(90 90)', 4326));
|
||||
select st_astext(g) from T_GEO;
|
||||
st_astext(g)
|
||||
POINT(90 90)
|
||||
drop table T_GEO;
|
||||
create table T_GEO (gid int auto_increment primary key,g point);
|
||||
replace into T_GEO VALUES (1,st_geomfromtext('point(90 90)', 0));
|
||||
replace into T_GEO VALUES (2,st_geomfromtext('point(90 90)', 4326));
|
||||
replace into T_GEO VALUES (3,st_geomfromtext('LINESTRING(90 90, 1 1)', 0));
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
select st_astext(g) from T_GEO;
|
||||
st_astext(g)
|
||||
POINT(90 90)
|
||||
POINT(90 90)
|
||||
drop table T_GEO;
|
||||
create table T_GEO (gid int auto_increment primary key, geo geometry ,geo_c GEOMETRYCOLLECTION,poi point,lin linestring ,pol polygon,M_POI MULTIPOINT,M_LIN MULTILINESTRING ,M_POL MULTIPOLYGON);
|
||||
REPLACE INTO T_GEO(geo) VALUES ( st_geomfromtext('point(90 90)'));
|
||||
select st_astext(geo) from T_GEO;
|
||||
st_astext(geo)
|
||||
POINT(90 90)
|
||||
drop table T_GEO;
|
||||
create table T_GEO (gid int auto_increment primary key, geo geometry ,geo_c GEOMETRYCOLLECTION,poi point,lin linestring ,pol polygon,M_POI MULTIPOINT,M_LIN MULTILINESTRING ,M_POL MULTIPOLYGON );
|
||||
INSERT INTO T_GEO VALUES (1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
||||
UPDATE T_GEO SET GEO=0;
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
drop table T_GEO;
|
||||
create table tt1(id int , g geometry not null srid 4236 , spatial index(g));
|
||||
insert into tt1(g) values(st_geomfromtext('POINT(0 0)', 4236));
|
||||
select id ,st_astext(g) from tt1 where ST_Intersects(ST_GeomFromText('point(10 20)',426),g);
|
||||
ERROR SR001: There's no spatial reference system with SRID 426.
|
||||
drop table tt1;
|
||||
DROP TABLE IF EXISTS gis_line;
|
||||
CREATE TABLE `gis_line` (`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`num` bigint(18) DEFAULT NULL,
|
||||
`lin` linestring NOT NULL /*!80003 SRID 4326 */,
|
||||
PRIMARY KEY (`id`), SPATIAL KEY `lin_index` (`lin`) BLOCK_SIZE 16384 LOCAL );
|
||||
insert into gis_line values(1,0, st_geomfromtext('LINESTRING(1 1, 2 2)', 4326));
|
||||
select /*+index (gis_line lin_index)*/ * from gis_line where _st_covers(lin, ST_GeomFromText('point(15.830728278409012 10.534231407596138,,,,)', 4326));
|
||||
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
|
||||
select /*+index (gis_line lin_index)*/ st_astext(lin) from gis_line where _st_covers(lin, ST_GeomFromText('point(1 1)', 4326));
|
||||
st_astext(lin)
|
||||
LINESTRING(1 1,2 2)
|
||||
drop table gis_line;
|
||||
DROP TABLE IF EXISTS gis_point;
|
||||
CREATE TABLE `gis_point` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `x` decimal(19,16) DEFAULT NULL, `y` decimal(19,16) DEFAULT NULL, `poi` point NOT NULL /*!80003 SRID 4326 */, PRIMARY KEY (`id`), KEY `xy_index` (`x`, `y`) BLOCK_SIZE 16384 LOCAL, SPATIAL KEY `poi_index` (`poi`) BLOCK_SIZE 16384 LOCAL ) AUTO_INCREMENT = 1196000001 DEFAULT CHARSET = utf8mb4 ROW_FORMAT = DYNAMIC COMPRESSION = 'zstd_1.3.8' REPLICA_NUM = 3 BLOCK_SIZE = 16384 USE_BLOOM_FILTER = FALSE TABLET_SIZE = 134217728 PCTFREE = 0;
|
||||
select concat((select st_astext(poi) from gis_point order by id desc limit 1),(select st_astext(poi) from gis_point order by id desc limit 1)) ;
|
||||
concat((select st_astext(poi) from gis_point order by id desc limit 1),(select st_astext(poi) from gis_point order by id desc limit 1))
|
||||
NULL
|
||||
drop table gis_point;
|
||||
DROP TABLE IF EXISTS spatial_index;
|
||||
CREATE TABLE spatial_index (i INT, g GEOMETRY NOT NULL SRID 4326, PRIMARY KEY (i), SPATIAL KEY (g));
|
||||
INSERT INTO spatial_index VALUES (1, ST_GEOMFROMTEXT('POLYGON((1 1, 1 8, 8 8, 8 10, -10 10, -10 1, 1 1))', 4326));
|
||||
INSERT INTO spatial_index VALUES (2, ST_GEOMFROMTEXT('LINESTRING(0 0,1 1)', 4326));
|
||||
select i, st_astext(g) from spatial_index where ST_Intersects(g, ST_GEOMFROMTEXT('POINT(1 1)', 4326));
|
||||
i st_astext(g)
|
||||
1 POLYGON((1 1,1 8,8 8,8 10,-10 10,-10 1,1 1))
|
||||
2 LINESTRING(0 0,1 1)
|
||||
update spatial_index set g=ST_GEOMFROMTEXT('POINT(2 2)', 4326) where i=1;
|
||||
select i, st_astext(g) from spatial_index where ST_Intersects(g, ST_GEOMFROMTEXT('POINT(2 2)', 4326));
|
||||
i st_astext(g)
|
||||
1 POINT(2 2)
|
||||
DROP TABLE IF EXISTS t3;
|
||||
create table t3(id int, g1 geometry not null srid 2284);
|
||||
create spatial index spidx3 on t3(g1);
|
||||
insert into t3 values(13, ST_GeomFromText('GEOMETRYCOLLECTION EMPTY', 2284));
|
||||
select /*+index(t3 spidx3)*/ st_astext(g1) from t3 where _st_covers(ST_GeomFromText('GEOMETRYCOLLECTION EMPTY', 2284), g1);
|
||||
st_astext(g1)
|
||||
select /*+index(t3 spidx3)*/ st_astext(g1) from t3 where st_intersects(ST_GeomFromText('GEOMETRYCOLLECTION EMPTY', 2284), g1);
|
||||
st_astext(g1)
|
||||
select /*+index(t3 spidx3)*/ st_astext(g1) from t3 where st_within(ST_GeomFromText('GEOMETRYCOLLECTION EMPTY', 2284), g1);
|
||||
st_astext(g1)
|
||||
select /*+index(t3 spidx3)*/ st_astext(g1) from t3 where st_contains(ST_GeomFromText('GEOMETRYCOLLECTION EMPTY', 2284), g1);
|
||||
st_astext(g1)
|
||||
select /*+index(t3 spidx3)*/ st_astext(g1) from t3 where st_intersects(ST_GeomFromText('POINT(1 1)', 2284), g1);
|
||||
st_astext(g1)
|
||||
select /*+index(t3 spidx3)*/ st_astext(g1) from t3 where _st_covers(ST_GeomFromText('POINT(1 1)', 2284), g1);
|
||||
st_astext(g1)
|
||||
select /*+index(t3 spidx3)*/ st_astext(g1) from t3 where st_within(ST_GeomFromText('POINT(1 1)', 2284), g1);
|
||||
st_astext(g1)
|
||||
select /*+index(t3 spidx3)*/ st_astext(g1) from t3 where st_contains(ST_GeomFromText('POINT(1 1)', 2284), g1);
|
||||
st_astext(g1)
|
||||
select /*+index(t3 spidx3)*/ st_astext(g1) from t3 where st_intersects(g1, ST_GeomFromText('POINT(1 1)', 2284));
|
||||
st_astext(g1)
|
||||
select /*+index(t3 spidx3)*/ st_astext(g1) from t3 where _st_covers(g1, ST_GeomFromText('POINT(1 1)', 2284));
|
||||
st_astext(g1)
|
||||
select /*+index(t3 spidx3)*/ st_astext(g1) from t3 where st_within(g1, ST_GeomFromText('POINT(1 1)', 2284));
|
||||
st_astext(g1)
|
||||
select /*+index(t3 spidx3)*/ st_astext(g1) from t3 where st_contains(g1, ST_GeomFromText('POINT(1 1)', 2284));
|
||||
st_astext(g1)
|
||||
select /*+index(t3 spidx3)*/ st_astext(g1) from t3 where _st_dwithin(ST_GeomFromText('GEOMETRYCOLLECTION EMPTY', 2284), g1, 0.1);
|
||||
st_astext(g1)
|
||||
drop table t3;
|
||||
DROP TABLE IF EXISTS t_geo, cities;
|
||||
CREATE TABLE `cities` (
|
||||
`CityId` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Name` longtext DEFAULT NULL,
|
||||
`Location` geometry DEFAULT NULL,
|
||||
PRIMARY KEY (`CityId`)
|
||||
);
|
||||
insert into cities(Name,Location) values("Berlin", 0xE61000000101000000CEC4742156CF2A407558E1968F424A40),
|
||||
("Seattle", 0xE61000000101000000387DE2A540955EC02383DC4598CD4740),
|
||||
("Warsaw", 0xE6100000010100000013109370210335408A56EE05661D4A40),
|
||||
("Shenzhen", 0xE61000000102000000020000000000000000002E400000000000002E4000000000000034400000000000003440),
|
||||
("Guangzhou", 0xE610000001030000000100000007000000000000000000F03F000000000000F03F0000000000002040000000000000F03F0000000000002040000000000000204000000000000024400000000000002040000000000000244000000000000024C0000000000000F03F00000000000024C0000000000000F03F000000000000F03F),
|
||||
("Emptycollection", 0xE6100000010700000000000000);
|
||||
select st_astext(cast(0xE61000000101000000CEC4742156CF2A407558E1968F424A40 as point));
|
||||
st_astext(cast(0xE61000000101000000CEC4742156CF2A407558E1968F424A40 as point))
|
||||
POINT(52.520007 13.404954)
|
||||
select Location from cities;
|
||||
Location
|
||||
� ��t!V�*@uXᖏBJ@
|
||||
� 8}��@�^�#��E��G@
|
||||
� �p!5@�V�fJ@
|
||||
� .@ .@ 4@ 4@
|
||||
� �? �? @ �? @ @ $@ @ $@ $� �? $� �? �?
|
||||
�
|
||||
select hex(Location) from cities;
|
||||
hex(Location)
|
||||
E61000000101000000CEC4742156CF2A407558E1968F424A40
|
||||
E61000000101000000387DE2A540955EC02383DC4598CD4740
|
||||
E6100000010100000013109370210335408A56EE05661D4A40
|
||||
E61000000102000000020000000000000000002E400000000000002E4000000000000034400000000000003440
|
||||
E610000001030000000100000007000000000000000000F03F000000000000F03F0000000000002040000000000000F03F0000000000002040000000000000204000000000000024400000000000002040000000000000244000000000000024C0000000000000F03F00000000000024C0000000000000F03F000000000000F03F
|
||||
E6100000010700000000000000
|
||||
select st_astext(Location) from cities;
|
||||
st_astext(Location)
|
||||
POINT(52.520007 13.404954)
|
||||
POINT(47.6062095 -122.3320708)
|
||||
POINT(52.229676 21.012229)
|
||||
LINESTRING(15 15,20 20)
|
||||
POLYGON((1 1,1 8,8 8,8 10,-10 10,-10 1,1 1))
|
||||
GEOMETRYCOLLECTION EMPTY
|
||||
drop table cities;
|
||||
CREATE TABLE `t_geo` (
|
||||
`geo` geometry NOT NULL,
|
||||
SPATIAL KEY `SP_GEO` (`geo`) BLOCK_SIZE 16384 LOCAL
|
||||
) DEFAULT CHARSET = utf8mb4 ROW_FORMAT = DYNAMIC COMPRESSION = 'zstd_1.3.8' REPLICA_NUM = 1 BLOCK_SIZE = 16384 USE_BLOOM_FILTER = FALSE TABLET_SIZE = 134217728 PCTFREE = 0;
|
||||
insert into t_geo values(st_geomfromtext('POINT(1.2345678987654322e24 -1.2345678998765433e25)'));
|
||||
insert into t_geo values(st_geomfromtext('GEOMETRYCOLLECTION(MULTIPOINT((2 -1),(11831.743318109031 -63273.949623278015),(0 -1)))'));
|
||||
insert into t_geo values(st_geomfromtext('GEOMETRYCOLLECTION EMPTY'));
|
||||
select st_astext(geo) from t_geo;
|
||||
st_astext(geo)
|
||||
POINT(1.2345678987654322e24 -1.2345678998765433e25)
|
||||
GEOMETRYCOLLECTION(MULTIPOINT((2 -1),(11831.743318109031 -63273.949623278015),(0 -1)))
|
||||
GEOMETRYCOLLECTION EMPTY
|
||||
UPDATE T_GEO SET GEO=ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(10 10), POINT(30 30), LINESTRING(15 15, 20 20))');
|
||||
select st_astext(geo) from t_geo;
|
||||
st_astext(geo)
|
||||
GEOMETRYCOLLECTION(POINT(10 10),POINT(30 30),LINESTRING(15 15,20 20))
|
||||
GEOMETRYCOLLECTION(POINT(10 10),POINT(30 30),LINESTRING(15 15,20 20))
|
||||
GEOMETRYCOLLECTION(POINT(10 10),POINT(30 30),LINESTRING(15 15,20 20))
|
||||
alter system set _enable_defensive_check = 0;
|
||||
drop table t_geo;
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,215 @@
|
||||
# ----------------------------------------------------------------------
|
||||
# Base test of GEOMETRY function.
|
||||
# ----------------------------------------------------------------------
|
||||
SELECT ST_ASTEXT(POINT(1));
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '))' at line 1
|
||||
SELECT ST_ASTEXT(POINT(1,1,1));
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near ',1))' at line 1
|
||||
SELECT ST_ASTEXT(POINT(1, 1));
|
||||
ST_ASTEXT(POINT(1, 1))
|
||||
POINT(1 1)
|
||||
SELECT ST_ASTEXT(POINT('1', '1'));
|
||||
ST_ASTEXT(POINT('1', '1'))
|
||||
POINT(1 1)
|
||||
SELECT ST_ASTEXT(POINT('a', 'a'));
|
||||
ST_ASTEXT(POINT('a', 'a'))
|
||||
POINT(0 0)
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'a'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'a'
|
||||
SELECT ST_ASTEXT(POINT(' ', ' '));
|
||||
ST_ASTEXT(POINT(' ', ' '))
|
||||
POINT(0 0)
|
||||
SELECT ST_ASTEXT(POINT(12345, ''));
|
||||
ST_ASTEXT(POINT(12345, ''))
|
||||
POINT(12345 0)
|
||||
SELECT ST_ASTEXT(POINT(NULL, NULL));
|
||||
ST_ASTEXT(POINT(NULL, NULL))
|
||||
NULL
|
||||
SELECT ST_ASTEXT(POINT(1, NULL));
|
||||
ST_ASTEXT(POINT(1, NULL))
|
||||
NULL
|
||||
SELECT ST_ASTEXT(POINT(NULL, 1));
|
||||
ST_ASTEXT(POINT(NULL, 1))
|
||||
NULL
|
||||
SELECT ST_ASTEXT(POINT('NULL', 1));
|
||||
ST_ASTEXT(POINT('NULL', 1))
|
||||
POINT(0 1)
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'NULL'
|
||||
SELECT ST_ASTEXT(LINESTRING(1));
|
||||
ERROR 22007: Illegal non geometric 'BIGINT' value found during parsing
|
||||
SELECT ST_ASTEXT(LINESTRING(1,1,1));
|
||||
ERROR 22007: Illegal non geometric 'BIGINT' value found during parsing
|
||||
SELECT ST_ASTEXT(LINESTRING('1', '1'));
|
||||
ERROR 22007: Illegal non geometric 'VARCHAR' value found during parsing
|
||||
SELECT ST_ASTEXT(LINESTRING(NULL, NULL));
|
||||
ERROR 22007: Illegal non geometric 'NULL' value found during parsing
|
||||
SELECT ST_ASTEXT(LINESTRING('NULL', 'NULL'));
|
||||
ERROR 22007: Illegal non geometric 'VARCHAR' value found during parsing
|
||||
SELECT ST_ASTEXT(LINESTRING(POINT(0,0)));
|
||||
ERROR 22023: Invalid GIS data provided to function linestring.
|
||||
SELECT ST_ASTEXT(LINESTRING(LINESTRING(POINT(0,0),POINT(1,0))));
|
||||
ERROR HY000: Incorrect arguments to linestring
|
||||
SELECT ST_ASTEXT(LINESTRING(POINT(0,0),POINT(1,0)));
|
||||
ST_ASTEXT(LINESTRING(POINT(0,0),POINT(1,0)))
|
||||
LINESTRING(0 0,1 0)
|
||||
SELECT ST_ASTEXT(LINESTRING(POINT(0,0),POINT(1,0),POINT(0,0)));
|
||||
ST_ASTEXT(LINESTRING(POINT(0,0),POINT(1,0),POINT(0,0)))
|
||||
LINESTRING(0 0,1 0,0 0)
|
||||
SELECT ST_ASTEXT(LINESTRING(POINT(0,0),POINT(1,0),POINT(1,1), POINT(0,0)));
|
||||
ST_ASTEXT(LINESTRING(POINT(0,0),POINT(1,0),POINT(1,1), POINT(0,0)))
|
||||
LINESTRING(0 0,1 0,1 1,0 0)
|
||||
SELECT ST_ASTEXT(MULTIPOINT(1));
|
||||
ERROR 22007: Illegal non geometric 'BIGINT' value found during parsing
|
||||
SELECT ST_ASTEXT(MULTIPOINT(1,1,1));
|
||||
ERROR 22007: Illegal non geometric 'BIGINT' value found during parsing
|
||||
SELECT ST_ASTEXT(MULTIPOINT('1', '1'));
|
||||
ERROR 22007: Illegal non geometric 'VARCHAR' value found during parsing
|
||||
SELECT ST_ASTEXT(MULTIPOINT(NULL, NULL));
|
||||
ERROR 22007: Illegal non geometric 'NULL' value found during parsing
|
||||
SELECT ST_ASTEXT(MULTIPOINT('NULL', 'NULL'));
|
||||
ERROR 22007: Illegal non geometric 'VARCHAR' value found during parsing
|
||||
SELECT ST_ASTEXT(MULTIPOINT(LINESTRING(POINT(0,0),POINT(1,0))));
|
||||
ERROR HY000: Incorrect arguments to multipoint
|
||||
SELECT ST_ASTEXT(MULTIPOINT(POINT(0,0)));
|
||||
ST_ASTEXT(MULTIPOINT(POINT(0,0)))
|
||||
MULTIPOINT((0 0))
|
||||
SELECT ST_ASTEXT(MULTIPOINT(POINT(0,0),POINT(1,1)));
|
||||
ST_ASTEXT(MULTIPOINT(POINT(0,0),POINT(1,1)))
|
||||
MULTIPOINT((0 0),(1 1))
|
||||
SELECT ST_ASTEXT(MULTILINESTRING(1));
|
||||
ERROR 22007: Illegal non geometric 'BIGINT' value found during parsing
|
||||
SELECT ST_ASTEXT(MULTILINESTRING(1,1,1));
|
||||
ERROR 22007: Illegal non geometric 'BIGINT' value found during parsing
|
||||
SELECT ST_ASTEXT(MULTILINESTRING('1', '1'));
|
||||
ERROR 22007: Illegal non geometric 'VARCHAR' value found during parsing
|
||||
SELECT ST_ASTEXT(MULTILINESTRING(NULL, NULL));
|
||||
ERROR 22007: Illegal non geometric 'NULL' value found during parsing
|
||||
SELECT ST_ASTEXT(MULTILINESTRING('NULL', 'NULL'));
|
||||
ERROR 22007: Illegal non geometric 'VARCHAR' value found during parsing
|
||||
SELECT ST_ASTEXT(MULTILINESTRING(POINT(0,0)));
|
||||
ERROR HY000: Incorrect arguments to multilinestring
|
||||
SELECT ST_ASTEXT(MULTILINESTRING(LINESTRING(POINT(0,0),POINT(1,0)),LINESTRING(POINT(0,0),POINT(1,0)),POINT(1,1)));
|
||||
ERROR HY000: Incorrect arguments to multilinestring
|
||||
SELECT ST_ASTEXT(MULTILINESTRING(LINESTRING(POINT(0,0),POINT(1,0))));
|
||||
ST_ASTEXT(MULTILINESTRING(LINESTRING(POINT(0,0),POINT(1,0))))
|
||||
MULTILINESTRING((0 0,1 0))
|
||||
SELECT ST_ASTEXT(MULTILINESTRING(LINESTRING(POINT(0,0),POINT(1,0)),LINESTRING(POINT(0,0),POINT(1,0))));
|
||||
ST_ASTEXT(MULTILINESTRING(LINESTRING(POINT(0,0),POINT(1,0)),LINESTRING(POINT(0,0),POINT(1,0))))
|
||||
MULTILINESTRING((0 0,1 0),(0 0,1 0))
|
||||
SELECT ST_ASTEXT(POLYGON(1));
|
||||
ERROR 22007: Illegal non geometric 'BIGINT' value found during parsing
|
||||
SELECT ST_ASTEXT(POLYGON(1,1,1));
|
||||
ERROR 22007: Illegal non geometric 'BIGINT' value found during parsing
|
||||
SELECT ST_ASTEXT(POLYGON('1', '1'));
|
||||
ERROR 22007: Illegal non geometric 'VARCHAR' value found during parsing
|
||||
SELECT ST_ASTEXT(POLYGON(NULL, NULL));
|
||||
ERROR 22007: Illegal non geometric 'NULL' value found during parsing
|
||||
SELECT ST_ASTEXT(POLYGON('NULL', 'NULL'));
|
||||
ERROR 22007: Illegal non geometric 'VARCHAR' value found during parsing
|
||||
SELECT ST_ASTEXT(POLYGON(POINT(0,0)));
|
||||
ERROR HY000: Incorrect arguments to polygon
|
||||
SELECT ST_ASTEXT(POLYGON(LINESTRING(POINT(0,0),POINT(1,0)),LINESTRING(POINT(0,0),POINT(1,0)),POINT(1,1)));
|
||||
ERROR 22023: Invalid GIS data provided to function polygon.
|
||||
SELECT ST_ASTEXT(POLYGON(LINESTRING(POINT(0,0),POINT(1,0))));
|
||||
ERROR 22023: Invalid GIS data provided to function polygon.
|
||||
SELECT ST_ASTEXT(POLYGON(LINESTRING(POINT(0,0),POINT(1,0)),LINESTRING(POINT(0,0),POINT(1,0))));
|
||||
ERROR 22023: Invalid GIS data provided to function polygon.
|
||||
SELECT ST_ASTEXT(POLYGON(LINESTRING(POINT(0,0),POINT(1,0),POINT(1,1),POINT(0,1),POINT(0,0)), POINT(1,1)));
|
||||
ERROR HY000: Incorrect arguments to polygon
|
||||
SELECT ST_ASTEXT(POLYGON(LINESTRING(POINT(0,0),POINT(1,0),POINT(1,1),POINT(0,1),POINT(0,0))));
|
||||
ST_ASTEXT(POLYGON(LINESTRING(POINT(0,0),POINT(1,0),POINT(1,1),POINT(0,1),POINT(0,0))))
|
||||
POLYGON((0 0,1 0,1 1,0 1,0 0))
|
||||
SELECT ST_ASTEXT(MULTIPOLYGON(1));
|
||||
ERROR 22007: Illegal non geometric 'BIGINT' value found during parsing
|
||||
SELECT ST_ASTEXT(MULTIPOLYGON(1,1,1));
|
||||
ERROR 22007: Illegal non geometric 'BIGINT' value found during parsing
|
||||
SELECT ST_ASTEXT(MULTIPOLYGON('1', '1'));
|
||||
ERROR 22007: Illegal non geometric 'VARCHAR' value found during parsing
|
||||
SELECT ST_ASTEXT(MULTIPOLYGON(NULL, NULL));
|
||||
ERROR 22007: Illegal non geometric 'NULL' value found during parsing
|
||||
SELECT ST_ASTEXT(MULTIPOLYGON('NULL', 'NULL'));
|
||||
ERROR 22007: Illegal non geometric 'VARCHAR' value found during parsing
|
||||
SELECT ST_ASTEXT(MULTIPOLYGON(POINT(0,0)));
|
||||
ERROR HY000: Incorrect arguments to multipolygon
|
||||
SELECT ST_ASTEXT(MULTIPOLYGON(LINESTRING(POINT(0,0),POINT(1,0)),LINESTRING(POINT(0,0),POINT(1,0))));
|
||||
ERROR HY000: Incorrect arguments to multipolygon
|
||||
SELECT ST_ASTEXT(MULTIPOLYGON(LINESTRING(POINT(0,0),POINT(1,0)),LINESTRING(POINT(0,0),POINT(1,0))));
|
||||
ERROR HY000: Incorrect arguments to multipolygon
|
||||
SELECT ST_ASTEXT(MULTIPOLYGON(POLYGON(LINESTRING(POINT(0,0),POINT(1,0),POINT(1,1),POINT(0,1),POINT(0,0))), POINT(1,1)));
|
||||
ERROR HY000: Incorrect arguments to multipolygon
|
||||
SELECT ST_ASTEXT(MULTIPOLYGON(POLYGON(LINESTRING(POINT(0,0),POINT(1,0),POINT(1,1),POINT(0,1),POINT(0,0)))));
|
||||
ST_ASTEXT(MULTIPOLYGON(POLYGON(LINESTRING(POINT(0,0),POINT(1,0),POINT(1,1),POINT(0,1),POINT(0,0)))))
|
||||
MULTIPOLYGON(((0 0,1 0,1 1,0 1,0 0)))
|
||||
SELECT ST_ASTEXT(MULTIPOLYGON(POLYGON(LINESTRING(POINT(0,0),POINT(1,0),POINT(1,1),POINT(0,1),POINT(0,0))),
|
||||
POLYGON(LINESTRING(POINT(0,0),POINT(1,0),POINT(1,1),POINT(0,1),POINT(0,0)))));
|
||||
ST_ASTEXT(MULTIPOLYGON(POLYGON(LINESTRING(POINT(0,0),POINT(1,0),POINT(1,1),POINT(0,1),POINT(0,0))),
|
||||
POLYGON(LINESTRING(POINT(0,0),POINT(1,0),POINT(1,1),POINT(0,1),POINT(0,0)))))
|
||||
MULTIPOLYGON(((0 0,1 0,1 1,0 1,0 0)),((0 0,1 0,1 1,0 1,0 0)))
|
||||
SELECT ST_ASTEXT(GEOMETRYCOLLECTION(1));
|
||||
ERROR 22007: Illegal non geometric 'BIGINT' value found during parsing
|
||||
SELECT ST_ASTEXT(GEOMETRYCOLLECTION(1,1,1));
|
||||
ERROR 22007: Illegal non geometric 'BIGINT' value found during parsing
|
||||
SELECT ST_ASTEXT(GEOMETRYCOLLECTION('1', '1'));
|
||||
ERROR 22007: Illegal non geometric 'VARCHAR' value found during parsing
|
||||
SELECT ST_ASTEXT(GEOMETRYCOLLECTION(NULL, NULL));
|
||||
ERROR 22007: Illegal non geometric 'NULL' value found during parsing
|
||||
SELECT ST_ASTEXT(GEOMETRYCOLLECTION('NULL', 'NULL'));
|
||||
ERROR 22007: Illegal non geometric 'VARCHAR' value found during parsing
|
||||
SELECT ST_ASTEXT(GEOMETRYCOLLECTION());
|
||||
ST_ASTEXT(GEOMETRYCOLLECTION())
|
||||
GEOMETRYCOLLECTION EMPTY
|
||||
SELECT ST_ASTEXT(GEOMETRYCOLLECTION(POINT(0,0)));
|
||||
ST_ASTEXT(GEOMETRYCOLLECTION(POINT(0,0)))
|
||||
GEOMETRYCOLLECTION(POINT(0 0))
|
||||
SELECT ST_ASTEXT(GEOMETRYCOLLECTION(LINESTRING(POINT(0,0),POINT(1,0)),LINESTRING(POINT(0,0),POINT(1,0))));
|
||||
ST_ASTEXT(GEOMETRYCOLLECTION(LINESTRING(POINT(0,0),POINT(1,0)),LINESTRING(POINT(0,0),POINT(1,0))))
|
||||
GEOMETRYCOLLECTION(LINESTRING(0 0,1 0),LINESTRING(0 0,1 0))
|
||||
SELECT ST_ASTEXT(GEOMETRYCOLLECTION(POLYGON(LINESTRING(POINT(0,0),POINT(1,0),POINT(1,1),POINT(0,1),POINT(0,0)))));
|
||||
ST_ASTEXT(GEOMETRYCOLLECTION(POLYGON(LINESTRING(POINT(0,0),POINT(1,0),POINT(1,1),POINT(0,1),POINT(0,0)))))
|
||||
GEOMETRYCOLLECTION(POLYGON((0 0,1 0,1 1,0 1,0 0)))
|
||||
SELECT ST_ASTEXT(GEOMETRYCOLLECTION(MULTIPOINT(POINT(0,0),POINT(1,1))));
|
||||
ST_ASTEXT(GEOMETRYCOLLECTION(MULTIPOINT(POINT(0,0),POINT(1,1))))
|
||||
GEOMETRYCOLLECTION(MULTIPOINT((0 0),(1 1)))
|
||||
SELECT ST_ASTEXT(GEOMETRYCOLLECTION(MULTILINESTRING(LINESTRING(POINT(0,0),POINT(1,0)),LINESTRING(POINT(0,0),POINT(1,0)))));
|
||||
ST_ASTEXT(GEOMETRYCOLLECTION(MULTILINESTRING(LINESTRING(POINT(0,0),POINT(1,0)),LINESTRING(POINT(0,0),POINT(1,0)))))
|
||||
GEOMETRYCOLLECTION(MULTILINESTRING((0 0,1 0),(0 0,1 0)))
|
||||
SELECT ST_ASTEXT(GEOMETRYCOLLECTION(MULTIPOLYGON(POLYGON(LINESTRING(POINT(0,0),POINT(1,0),POINT(1,1),POINT(0,1),POINT(0,0))),
|
||||
POLYGON(LINESTRING(POINT(0,0),POINT(1,0),POINT(1,1),POINT(0,1),POINT(0,0))))));
|
||||
ST_ASTEXT(GEOMETRYCOLLECTION(MULTIPOLYGON(POLYGON(LINESTRING(POINT(0,0),POINT(1,0),POINT(1,1),POINT(0,1),POINT(0,0))),
|
||||
POLYGON(LINESTRING(POINT(0,0),POINT(1,0),POINT(1,1),POINT(0,1),POINT(0,0))))))
|
||||
GEOMETRYCOLLECTION(MULTIPOLYGON(((0 0,1 0,1 1,0 1,0 0)),((0 0,1 0,1 1,0 1,0 0))))
|
||||
SELECT ST_ASTEXT(GEOMCOLLECTION(1));
|
||||
ERROR 22007: Illegal non geometric 'BIGINT' value found during parsing
|
||||
SELECT ST_ASTEXT(GEOMCOLLECTION(1,1,1));
|
||||
ERROR 22007: Illegal non geometric 'BIGINT' value found during parsing
|
||||
SELECT ST_ASTEXT(GEOMCOLLECTION('1', '1'));
|
||||
ERROR 22007: Illegal non geometric 'VARCHAR' value found during parsing
|
||||
SELECT ST_ASTEXT(GEOMCOLLECTION(NULL, NULL));
|
||||
ERROR 22007: Illegal non geometric 'NULL' value found during parsing
|
||||
SELECT ST_ASTEXT(GEOMCOLLECTION('NULL', 'NULL'));
|
||||
ERROR 22007: Illegal non geometric 'VARCHAR' value found during parsing
|
||||
SELECT ST_ASTEXT(GEOMCOLLECTION());
|
||||
ST_ASTEXT(GEOMCOLLECTION())
|
||||
GEOMETRYCOLLECTION EMPTY
|
||||
SELECT ST_ASTEXT(GEOMCOLLECTION(POINT(0,0)));
|
||||
ST_ASTEXT(GEOMCOLLECTION(POINT(0,0)))
|
||||
GEOMETRYCOLLECTION(POINT(0 0))
|
||||
SELECT ST_ASTEXT(GEOMCOLLECTION(LINESTRING(POINT(0,0),POINT(1,0)),LINESTRING(POINT(0,0),POINT(1,0))));
|
||||
ST_ASTEXT(GEOMCOLLECTION(LINESTRING(POINT(0,0),POINT(1,0)),LINESTRING(POINT(0,0),POINT(1,0))))
|
||||
GEOMETRYCOLLECTION(LINESTRING(0 0,1 0),LINESTRING(0 0,1 0))
|
||||
SELECT ST_ASTEXT(GEOMCOLLECTION(POLYGON(LINESTRING(POINT(0,0),POINT(1,0),POINT(1,1),POINT(0,1),POINT(0,0)))));
|
||||
ST_ASTEXT(GEOMCOLLECTION(POLYGON(LINESTRING(POINT(0,0),POINT(1,0),POINT(1,1),POINT(0,1),POINT(0,0)))))
|
||||
GEOMETRYCOLLECTION(POLYGON((0 0,1 0,1 1,0 1,0 0)))
|
||||
SELECT ST_ASTEXT(GEOMCOLLECTION(MULTIPOINT(POINT(0,0),POINT(1,1))));
|
||||
ST_ASTEXT(GEOMCOLLECTION(MULTIPOINT(POINT(0,0),POINT(1,1))))
|
||||
GEOMETRYCOLLECTION(MULTIPOINT((0 0),(1 1)))
|
||||
SELECT ST_ASTEXT(GEOMCOLLECTION(MULTILINESTRING(LINESTRING(POINT(0,0),POINT(1,0)),LINESTRING(POINT(0,0),POINT(1,0)))));
|
||||
ST_ASTEXT(GEOMCOLLECTION(MULTILINESTRING(LINESTRING(POINT(0,0),POINT(1,0)),LINESTRING(POINT(0,0),POINT(1,0)))))
|
||||
GEOMETRYCOLLECTION(MULTILINESTRING((0 0,1 0),(0 0,1 0)))
|
||||
SELECT ST_ASTEXT(GEOMCOLLECTION(MULTIPOLYGON(POLYGON(LINESTRING(POINT(0,0),POINT(1,0),POINT(1,1),POINT(0,1),POINT(0,0))),
|
||||
POLYGON(LINESTRING(POINT(0,0),POINT(1,0),POINT(1,1),POINT(0,1),POINT(0,0))))));
|
||||
ST_ASTEXT(GEOMCOLLECTION(MULTIPOLYGON(POLYGON(LINESTRING(POINT(0,0),POINT(1,0),POINT(1,1),POINT(0,1),POINT(0,0))),
|
||||
POLYGON(LINESTRING(POINT(0,0),POINT(1,0),POINT(1,1),POINT(0,1),POINT(0,0))))))
|
||||
GEOMETRYCOLLECTION(MULTIPOLYGON(((0 0,1 0,1 1,0 1,0 0)),((0 0,1 0,1 1,0 1,0 0))))
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,150 @@
|
||||
# ----------------------------------------------------------------------
|
||||
# Base test of GEOMETRY spatial index.
|
||||
# ----------------------------------------------------------------------
|
||||
drop table if exists t1;
|
||||
CREATE TABLE t1 (x INTEGER,
|
||||
y INTEGER,
|
||||
g POINT GENERATED ALWAYS AS (POINT(x, y)) NOT NULL SRID 0);
|
||||
SHOW COLUMNS FROM t1;
|
||||
Field Type Null Key Default Extra
|
||||
x int(11) YES NULL
|
||||
y int(11) YES NULL
|
||||
g point NO point(`x`,`y`) VIRTUAL GENERATED
|
||||
INSERT INTO t1(x,y) VALUES (0, 0);
|
||||
INSERT INTO t1(x,y) VALUES (0.1, 0.1);
|
||||
SELECT x,y,st_astext(g) FROM t1 ORDER BY x;
|
||||
x y st_astext(g)
|
||||
0 0 POINT(0 0)
|
||||
0 0 POINT(0 0)
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (x INTEGER,
|
||||
y INTEGER,
|
||||
g POINT GENERATED ALWAYS AS (POINT(x, y)) NOT NULL SRID 4326);
|
||||
SHOW COLUMNS FROM t1;
|
||||
Field Type Null Key Default Extra
|
||||
x int(11) YES NULL
|
||||
y int(11) YES NULL
|
||||
g point NO point(`x`,`y`) VIRTUAL GENERATED
|
||||
INSERT INTO t1(x,y) VALUES (0, 0);
|
||||
ERROR HY000: The SRID of the geometry does not match the SRID of the column. The SRID of the geometry is 0, but the SRID of the column is 4326. Consider changing the SRID of the geometry or the SRID property of the column.
|
||||
INSERT INTO t1(x,y) VALUES (0.1, 0.1);
|
||||
ERROR HY000: The SRID of the geometry does not match the SRID of the column. The SRID of the geometry is 0, but the SRID of the column is 4326. Consider changing the SRID of the geometry or the SRID property of the column.
|
||||
SELECT x,y,st_astext(g) FROM t1 ORDER BY x;
|
||||
x y st_astext(g)
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (x INTEGER,
|
||||
y INTEGER,
|
||||
g POINT GENERATED ALWAYS AS (ST_GEOMFROMTEXT('POINT(1 1)', 4326)) STORED NOT NULL SRID 4326);
|
||||
SHOW COLUMNS FROM t1;
|
||||
Field Type Null Key Default Extra
|
||||
x int(11) YES NULL
|
||||
y int(11) YES NULL
|
||||
g point NO ST_GEOMFROMTEXT('POINT(1 1)',4326) STORED GENERATED
|
||||
INSERT INTO t1(x,y) VALUES (0, 0);
|
||||
INSERT INTO t1(x,y) VALUES (0.1, 0.1);
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (x INTEGER,
|
||||
y INTEGER,
|
||||
g POINT GENERATED ALWAYS AS (ST_GEOMFROMTEXT('POINT(1 1)', 0)) STORED NOT NULL SRID 4326);
|
||||
SHOW COLUMNS FROM t1;
|
||||
Field Type Null Key Default Extra
|
||||
x int(11) YES NULL
|
||||
y int(11) YES NULL
|
||||
g point NO ST_GEOMFROMTEXT('POINT(1 1)',0) STORED GENERATED
|
||||
INSERT INTO t1(x,y) VALUES (0, 0);
|
||||
ERROR HY000: The SRID of the geometry does not match the SRID of the column. The SRID of the geometry is 0, but the SRID of the column is 4326. Consider changing the SRID of the geometry or the SRID property of the column.
|
||||
INSERT INTO t1(x,y) VALUES (0.1, 0.1);
|
||||
ERROR HY000: The SRID of the geometry does not match the SRID of the column. The SRID of the geometry is 0, but the SRID of the column is 4326. Consider changing the SRID of the geometry or the SRID property of the column.
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (g GEOMETRY NOT NULL SRID 4326,
|
||||
i INT GENERATED ALWAYS AS (ST_INTERSECTS(ST_GEOMFROMTEXT('POINT(0 0)', 4326), g)));
|
||||
SHOW COLUMNS FROM t1;
|
||||
Field Type Null Key Default Extra
|
||||
g geometry NO NULL
|
||||
i int(11) YES ST_INTERSECTS(ST_GEOMFROMTEXT('POINT(0 0)',4326),`g`) VIRTUAL GENERATED
|
||||
INSERT INTO t1(g) VALUES (ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0)))', 4326));
|
||||
SELECT i,st_astext(g) FROM t1 ORDER BY i;
|
||||
i st_astext(g)
|
||||
1 MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0)))
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (g GEOMETRY NOT NULL SRID 4326,
|
||||
i INT GENERATED ALWAYS AS (ST_INTERSECTS(ST_GEOMFROMTEXT('POINT(0 0)', 4326), g)));
|
||||
SHOW COLUMNS FROM t1;
|
||||
Field Type Null Key Default Extra
|
||||
g geometry NO NULL
|
||||
i int(11) YES ST_INTERSECTS(ST_GEOMFROMTEXT('POINT(0 0)',4326),`g`) VIRTUAL GENERATED
|
||||
INSERT INTO t1(g) VALUES (ST_GEOMFROMTEXT('MULTIPOLYGON(((1 1,10 0,10 10,0 10,1 1)))', 4326));
|
||||
SELECT i,st_astext(g) FROM t1 ORDER BY i;
|
||||
i st_astext(g)
|
||||
0 MULTIPOLYGON(((1 1,10 0,10 10,0 10,1 1)))
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (g GEOMETRY NOT NULL SRID 4326,
|
||||
i INT GENERATED ALWAYS AS (ST_INTERSECTS(g, ST_GEOMFROMTEXT('POINT(0 0)', 4326))));
|
||||
SHOW COLUMNS FROM t1;
|
||||
Field Type Null Key Default Extra
|
||||
g geometry NO NULL
|
||||
i int(11) YES ST_INTERSECTS(`g`,ST_GEOMFROMTEXT('POINT(0 0)',4326)) VIRTUAL GENERATED
|
||||
INSERT INTO t1(g) VALUES (ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0)))', 4326));
|
||||
SELECT i,st_astext(g) FROM t1 ORDER BY i;
|
||||
i st_astext(g)
|
||||
1 MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0)))
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (g GEOMETRY NOT NULL SRID 4326,
|
||||
i INT GENERATED ALWAYS AS (ST_INTERSECTS(g, ST_GEOMFROMTEXT('POINT(0 0)', 4326))));
|
||||
SHOW COLUMNS FROM t1;
|
||||
Field Type Null Key Default Extra
|
||||
g geometry NO NULL
|
||||
i int(11) YES ST_INTERSECTS(`g`,ST_GEOMFROMTEXT('POINT(0 0)',4326)) VIRTUAL GENERATED
|
||||
INSERT INTO t1(g) VALUES (ST_GEOMFROMTEXT('MULTIPOLYGON(((1 1,10 0,10 10,0 10,1 1)))', 4326));
|
||||
SELECT i,st_astext(g) FROM t1 ORDER BY i;
|
||||
i st_astext(g)
|
||||
0 MULTIPOLYGON(((1 1,10 0,10 10,0 10,1 1)))
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (g GEOMETRY NOT NULL SRID 4326,
|
||||
i INT GENERATED ALWAYS AS (ST_INTERSECTS(ST_GEOMFROMTEXT('POINT(0 0)', 4326), g)) STORED);
|
||||
SHOW COLUMNS FROM t1;
|
||||
Field Type Null Key Default Extra
|
||||
g geometry NO NULL
|
||||
i int(11) YES ST_INTERSECTS(ST_GEOMFROMTEXT('POINT(0 0)',4326),`g`) STORED GENERATED
|
||||
INSERT INTO t1(g) VALUES (ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0)))', 4326));
|
||||
SELECT i,st_astext(g) FROM t1 ORDER BY i;
|
||||
i st_astext(g)
|
||||
1 MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0)))
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (g GEOMETRY NOT NULL SRID 4326,
|
||||
i INT GENERATED ALWAYS AS (ST_INTERSECTS(ST_GEOMFROMTEXT('POINT(0 0)', 4326), g)) STORED);
|
||||
SHOW COLUMNS FROM t1;
|
||||
Field Type Null Key Default Extra
|
||||
g geometry NO NULL
|
||||
i int(11) YES ST_INTERSECTS(ST_GEOMFROMTEXT('POINT(0 0)',4326),`g`) STORED GENERATED
|
||||
INSERT INTO t1(g) VALUES (ST_GEOMFROMTEXT('MULTIPOLYGON(((1 1,10 0,10 10,0 10,1 1)))', 4326));
|
||||
SELECT i,st_astext(g) FROM t1 ORDER BY i;
|
||||
i st_astext(g)
|
||||
0 MULTIPOLYGON(((1 1,10 0,10 10,0 10,1 1)))
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (g GEOMETRY NOT NULL SRID 4326,
|
||||
i INT GENERATED ALWAYS AS (ST_INTERSECTS(g, ST_GEOMFROMTEXT('POINT(0 0)', 4326))) STORED);
|
||||
SHOW COLUMNS FROM t1;
|
||||
Field Type Null Key Default Extra
|
||||
g geometry NO NULL
|
||||
i int(11) YES ST_INTERSECTS(`g`,ST_GEOMFROMTEXT('POINT(0 0)',4326)) STORED GENERATED
|
||||
INSERT INTO t1(g) VALUES (ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0)))', 4326));
|
||||
SELECT i,st_astext(g) FROM t1 ORDER BY i;
|
||||
i st_astext(g)
|
||||
1 MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0)))
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (g GEOMETRY NOT NULL SRID 4326,
|
||||
i INT GENERATED ALWAYS AS (ST_INTERSECTS(g, ST_GEOMFROMTEXT('POINT(0 0)', 4326))) STORED);
|
||||
SHOW COLUMNS FROM t1;
|
||||
Field Type Null Key Default Extra
|
||||
g geometry NO NULL
|
||||
i int(11) YES ST_INTERSECTS(`g`,ST_GEOMFROMTEXT('POINT(0 0)',4326)) STORED GENERATED
|
||||
INSERT INTO t1(g) VALUES (ST_GEOMFROMTEXT('MULTIPOLYGON(((1 1,10 0,10 10,0 10,1 1)))', 4326));
|
||||
SELECT i,st_astext(g) FROM t1 ORDER BY i;
|
||||
i st_astext(g)
|
||||
0 MULTIPOLYGON(((1 1,10 0,10 10,0 10,1 1)))
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(id INT, p POLYGON GENERATED ALWAYS AS (ST_GeomFromText('POINT(15 20)',0)) STORED);
|
||||
INSERT INTO t1(id) VALUES (1);
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field.
|
||||
DROP TABLE t1;
|
||||
@ -0,0 +1,355 @@
|
||||
# ----------------------------------------------------------------------
|
||||
# Base test of GEOMETRY spatial index.
|
||||
# ----------------------------------------------------------------------
|
||||
#Creating the spatial Geometry object
|
||||
USE test;
|
||||
DROP TABLE IF EXISTS gis_line_with_spatial_index, gis_polygon_with_spatial_index, gis_multipoint_with_spatial_index, gis_multiline_with_spatial_index,
|
||||
gis_point_with_spatial_index, gis_geometrycollection_with_spatial_index, gis_linestring_and_int_with_spatial_index;
|
||||
CREATE TABLE gis_point_with_spatial_index (fid INTEGER NOT NULL PRIMARY KEY, g POINT
|
||||
NOT NULL SRID 0,spatial index (g) );
|
||||
INSERT INTO gis_point_with_spatial_index VALUES (5,ST_GEOMFROMTEXT('POINT(100 10)'));
|
||||
INSERT INTO gis_point_with_spatial_index VALUES (4,ST_GEOMFROMTEXT('POINT(100 10)'));
|
||||
INSERT INTO gis_point_with_spatial_index VALUES (3,ST_GEOMFROMTEXT('POINT(100 10)'));
|
||||
INSERT INTO gis_point_with_spatial_index VALUES (2,ST_GEOMFROMTEXT('POINT(100 10)'));
|
||||
INSERT INTO gis_point_with_spatial_index VALUES (1,ST_GEOMFROMTEXT('POINT(100 10)'));
|
||||
select count(g) from gis_point_with_spatial_index where ST_AsText(g) like "%100 10%";
|
||||
count(g)
|
||||
5
|
||||
select ST_AsText(g) from gis_point_with_spatial_index where ST_AsText(g) like "%100 10%";
|
||||
ST_AsText(g)
|
||||
POINT(100 10)
|
||||
POINT(100 10)
|
||||
POINT(100 10)
|
||||
POINT(100 10)
|
||||
POINT(100 10)
|
||||
DROP TABLE gis_point_with_spatial_index;
|
||||
CREATE TABLE gis_line_with_spatial_index (fid INTEGER NOT NULL PRIMARY KEY, g LINESTRING
|
||||
NOT NULL SRID 0, spatial index (g) );
|
||||
INSERT INTO gis_line_with_spatial_index VALUES (5,ST_GeomFromText('LINESTRING(100 10,10 100)'));
|
||||
INSERT INTO gis_line_with_spatial_index VALUES (4,ST_GeomFromText('LINESTRING(100 10,10 100)'));
|
||||
INSERT INTO gis_line_with_spatial_index VALUES (3,ST_GeomFromText('LINESTRING(100 10,10 100)'));
|
||||
INSERT INTO gis_line_with_spatial_index VALUES (2,ST_GeomFromText('LINESTRING(100 10,10 100)'));
|
||||
INSERT INTO gis_line_with_spatial_index VALUES (1,ST_GeomFromText('LINESTRING(100 10,10 100)'));
|
||||
select count(g) from gis_line_with_spatial_index where ST_AsText(g) like "%100 10%";
|
||||
count(g)
|
||||
5
|
||||
select ST_AsText(g) from gis_line_with_spatial_index where ST_AsText(g) like "%100 10%";
|
||||
ST_AsText(g)
|
||||
LINESTRING(100 10,10 100)
|
||||
LINESTRING(100 10,10 100)
|
||||
LINESTRING(100 10,10 100)
|
||||
LINESTRING(100 10,10 100)
|
||||
LINESTRING(100 10,10 100)
|
||||
DROP TABLE gis_line_with_spatial_index;
|
||||
CREATE TABLE gis_polygon_with_spatial_index (fid INTEGER NOT NULL PRIMARY KEY, g POLYGON
|
||||
NOT NULL SRID 0, spatial index (g) );
|
||||
INSERT INTO gis_polygon_with_spatial_index VALUES (5,ST_GEOMFROMTEXT('POLYGON((10 10,20 10,20 20,10 20,10 10))'));
|
||||
INSERT INTO gis_polygon_with_spatial_index VALUES (4,ST_GEOMFROMTEXT('POLYGON((10 10,20 10,20 20,10 20,10 10))'));
|
||||
INSERT INTO gis_polygon_with_spatial_index VALUES (3,ST_GEOMFROMTEXT('POLYGON((10 10,20 10,20 20,10 20,10 10))'));
|
||||
INSERT INTO gis_polygon_with_spatial_index VALUES (2,ST_GEOMFROMTEXT('POLYGON((10 10,20 10,20 20,10 20,10 10))'));
|
||||
INSERT INTO gis_polygon_with_spatial_index VALUES (1,ST_GEOMFROMTEXT('POLYGON((10 10,20 10,20 20,10 20,10 10))'));
|
||||
select count(g) from gis_polygon_with_spatial_index where ST_AsText(g) like "%10 10%";
|
||||
count(g)
|
||||
5
|
||||
select ST_AsText(g) from gis_polygon_with_spatial_index where ST_AsText(g) like "%10 10%";
|
||||
ST_AsText(g)
|
||||
POLYGON((10 10,20 10,20 20,10 20,10 10))
|
||||
POLYGON((10 10,20 10,20 20,10 20,10 10))
|
||||
POLYGON((10 10,20 10,20 20,10 20,10 10))
|
||||
POLYGON((10 10,20 10,20 20,10 20,10 10))
|
||||
POLYGON((10 10,20 10,20 20,10 20,10 10))
|
||||
DROP TABLE gis_polygon_with_spatial_index;
|
||||
CREATE TABLE gis_multipoint_with_spatial_index (fid INTEGER NOT NULL PRIMARY KEY, g MULTIPOINT
|
||||
NOT NULL SRID 0, spatial index (g) );
|
||||
INSERT INTO gis_multipoint_with_spatial_index VALUES (5,ST_GEOMFROMTEXT('MULTIPOINT(0 0,10 10,10 20,20 20)'));
|
||||
INSERT INTO gis_multipoint_with_spatial_index VALUES (4,ST_GEOMFROMTEXT('MULTIPOINT(0 0,10 10,10 20,20 20)'));
|
||||
INSERT INTO gis_multipoint_with_spatial_index VALUES (3,ST_GEOMFROMTEXT('MULTIPOINT(0 0,10 10,10 20,20 20)'));
|
||||
INSERT INTO gis_multipoint_with_spatial_index VALUES (2,ST_GEOMFROMTEXT('MULTIPOINT(0 0,10 10,10 20,20 20)'));
|
||||
INSERT INTO gis_multipoint_with_spatial_index VALUES (1,ST_GEOMFROMTEXT('MULTIPOINT(0 0,10 10,10 20,20 20)'));
|
||||
select count(g) from gis_multipoint_with_spatial_index where ST_AsText(g) like "%10 10%";
|
||||
count(g)
|
||||
5
|
||||
select ST_AsText(g) from gis_multipoint_with_spatial_index where ST_AsText(g) like "%10 10%";
|
||||
ST_AsText(g)
|
||||
MULTIPOINT((0 0),(10 10),(10 20),(20 20))
|
||||
MULTIPOINT((0 0),(10 10),(10 20),(20 20))
|
||||
MULTIPOINT((0 0),(10 10),(10 20),(20 20))
|
||||
MULTIPOINT((0 0),(10 10),(10 20),(20 20))
|
||||
MULTIPOINT((0 0),(10 10),(10 20),(20 20))
|
||||
DROP TABLE gis_multipoint_with_spatial_index;
|
||||
CREATE TABLE gis_multiline_with_spatial_index (fid INTEGER NOT NULL PRIMARY KEY, g MULTILINESTRING
|
||||
NOT NULL SRID 0, spatial index (g) );
|
||||
INSERT INTO gis_multiline_with_spatial_index VALUES (5,ST_GEOMFROMTEXT('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))'));
|
||||
INSERT INTO gis_multiline_with_spatial_index VALUES (4,ST_GEOMFROMTEXT('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))'));
|
||||
INSERT INTO gis_multiline_with_spatial_index VALUES (3,ST_GEOMFROMTEXT('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))'));
|
||||
INSERT INTO gis_multiline_with_spatial_index VALUES (2,ST_GEOMFROMTEXT('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))'));
|
||||
INSERT INTO gis_multiline_with_spatial_index VALUES (1,ST_GEOMFROMTEXT('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))'));
|
||||
select count(g) from gis_multiline_with_spatial_index where ST_AsText(g) like "%10 0%";
|
||||
count(g)
|
||||
5
|
||||
select ST_AsText(g) from gis_multiline_with_spatial_index where ST_AsText(g) like "%10 0%";
|
||||
ST_AsText(g)
|
||||
MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))
|
||||
MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))
|
||||
MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))
|
||||
MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))
|
||||
MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))
|
||||
DROP TABLE gis_multiline_with_spatial_index;
|
||||
CREATE TABLE gis_multipolygon_with_spatial_index (fid INTEGER NOT NULL PRIMARY KEY, g MULTIPOLYGON
|
||||
NOT NULL SRID 0, spatial index (g) );
|
||||
INSERT INTO gis_multipolygon_with_spatial_index VALUES (5,ST_GEOMFROMTEXT('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))'));
|
||||
INSERT INTO gis_multipolygon_with_spatial_index VALUES (4,ST_GEOMFROMTEXT('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))'));
|
||||
INSERT INTO gis_multipolygon_with_spatial_index VALUES (3,ST_GEOMFROMTEXT('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))'));
|
||||
INSERT INTO gis_multipolygon_with_spatial_index VALUES (2,ST_GEOMFROMTEXT('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))'));
|
||||
INSERT INTO gis_multipolygon_with_spatial_index VALUES (1,ST_GEOMFROMTEXT('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))'));
|
||||
select count(g) from gis_multipolygon_with_spatial_index where ST_AsText(g) like "%10 10%";
|
||||
count(g)
|
||||
0
|
||||
select ST_AsText(g) from gis_multipolygon_with_spatial_index where ST_AsText(g) like "%10 10%";
|
||||
ST_AsText(g)
|
||||
select count(g) from gis_multipolygon_with_spatial_index where ST_AsText(g) like "%84 0%";
|
||||
count(g)
|
||||
5
|
||||
select ST_AsText(g) from gis_multipolygon_with_spatial_index where ST_AsText(g) like "%84 0%";
|
||||
ST_AsText(g)
|
||||
MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
|
||||
MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
|
||||
MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
|
||||
MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
|
||||
MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
|
||||
DROP TABLE gis_multipolygon_with_spatial_index;
|
||||
CREATE TABLE gis_geometrycollection_with_spatial_index (fid INTEGER NOT NULL PRIMARY KEY, g GEOMETRYCOLLECTION
|
||||
NOT NULL SRID 0, spatial index (g) );
|
||||
INSERT INTO gis_geometrycollection_with_spatial_index VALUES (5,ST_GeomFromText('GEOMETRYCOLLECTION(POINT(10 10), LINESTRING(10 10,20 20))'));
|
||||
INSERT INTO gis_geometrycollection_with_spatial_index VALUES (4,ST_GeomFromText('GEOMETRYCOLLECTION(POINT(10 10), LINESTRING(10 10,20 20))'));
|
||||
INSERT INTO gis_geometrycollection_with_spatial_index VALUES (3,ST_GeomFromText('GEOMETRYCOLLECTION(POINT(10 10), LINESTRING(10 10,20 20))'));
|
||||
INSERT INTO gis_geometrycollection_with_spatial_index VALUES (2,ST_GeomFromText('GEOMETRYCOLLECTION(POINT(10 10), LINESTRING(10 10,20 20))'));
|
||||
INSERT INTO gis_geometrycollection_with_spatial_index VALUES (1,ST_GeomFromText('GEOMETRYCOLLECTION(POINT(10 10), LINESTRING(10 10,20 20))'));
|
||||
select count(g) from gis_geometrycollection_with_spatial_index where ST_AsText(g) like "%10 10%";
|
||||
count(g)
|
||||
5
|
||||
select ST_AsText(g) from gis_geometrycollection_with_spatial_index where ST_AsText(g) like "%10 10%";
|
||||
ST_AsText(g)
|
||||
GEOMETRYCOLLECTION(POINT(10 10),LINESTRING(10 10,20 20))
|
||||
GEOMETRYCOLLECTION(POINT(10 10),LINESTRING(10 10,20 20))
|
||||
GEOMETRYCOLLECTION(POINT(10 10),LINESTRING(10 10,20 20))
|
||||
GEOMETRYCOLLECTION(POINT(10 10),LINESTRING(10 10,20 20))
|
||||
GEOMETRYCOLLECTION(POINT(10 10),LINESTRING(10 10,20 20))
|
||||
DROP TABLE gis_geometrycollection_with_spatial_index;
|
||||
CREATE TABLE gis_geometry_with_spatial_index (fid INTEGER NOT NULL PRIMARY KEY, g GEOMETRY
|
||||
NOT NULL SRID 0, spatial index (g) );
|
||||
INSERT INTO gis_geometry_with_spatial_index VALUES (5,ST_GeomFromText('GEOMETRYCOLLECTION(POINT(10 10), LINESTRING(10 10,20 20))'));
|
||||
INSERT INTO gis_geometry_with_spatial_index VALUES (4,ST_GeomFromText('GEOMETRYCOLLECTION(POINT(10 10), LINESTRING(10 10,20 20))'));
|
||||
INSERT INTO gis_geometry_with_spatial_index VALUES (3,ST_GeomFromText('GEOMETRYCOLLECTION(POINT(10 10), LINESTRING(10 10,20 20))'));
|
||||
INSERT INTO gis_geometry_with_spatial_index VALUES (2,ST_GeomFromText('GEOMETRYCOLLECTION(POINT(10 10), LINESTRING(10 10,20 20))'));
|
||||
INSERT INTO gis_geometry_with_spatial_index VALUES (1,ST_GeomFromText('GEOMETRYCOLLECTION(POINT(10 10), LINESTRING(10 10,20 20))'));
|
||||
select count(g) from gis_geometry_with_spatial_index where ST_AsText(g) like "%10 10%";
|
||||
count(g)
|
||||
5
|
||||
select ST_AsText(g) from gis_geometry_with_spatial_index where ST_AsText(g) like "%10 10%";
|
||||
ST_AsText(g)
|
||||
GEOMETRYCOLLECTION(POINT(10 10),LINESTRING(10 10,20 20))
|
||||
GEOMETRYCOLLECTION(POINT(10 10),LINESTRING(10 10,20 20))
|
||||
GEOMETRYCOLLECTION(POINT(10 10),LINESTRING(10 10,20 20))
|
||||
GEOMETRYCOLLECTION(POINT(10 10),LINESTRING(10 10,20 20))
|
||||
GEOMETRYCOLLECTION(POINT(10 10),LINESTRING(10 10,20 20))
|
||||
DROP TABLE gis_geometry_with_spatial_index;
|
||||
DROP TABLE IF EXISTS gis_point_and_int_with_spatial_index;
|
||||
CREATE TABLE gis_point_and_int_with_spatial_index (fid INTEGER NOT NULL PRIMARY KEY, g POINT
|
||||
NOT NULL SRID 0,spatial index (g) );
|
||||
INSERT INTO gis_point_and_int_with_spatial_index VALUES (5,ST_GEOMFROMTEXT('POINT(100 10)'));
|
||||
INSERT INTO gis_point_and_int_with_spatial_index VALUES (4,ST_GEOMFROMTEXT('POINT(100 10)'));
|
||||
INSERT INTO gis_point_and_int_with_spatial_index VALUES (3,ST_GEOMFROMTEXT('POINT(100 10)'));
|
||||
INSERT INTO gis_point_and_int_with_spatial_index VALUES (2,ST_GEOMFROMTEXT('POINT(100 10)'));
|
||||
INSERT INTO gis_point_and_int_with_spatial_index VALUES (1,ST_GEOMFROMTEXT('POINT(100 10)'));
|
||||
select count(g) from gis_point_and_int_with_spatial_index where ST_AsText(g) like "%100 10%";
|
||||
count(g)
|
||||
5
|
||||
select ST_AsText(g) from gis_point_and_int_with_spatial_index where ST_AsText(g) like "%100 10%";
|
||||
ST_AsText(g)
|
||||
POINT(100 10)
|
||||
POINT(100 10)
|
||||
POINT(100 10)
|
||||
POINT(100 10)
|
||||
POINT(100 10)
|
||||
DROP TABLE gis_point_and_int_with_spatial_index;
|
||||
CREATE TABLE gis_point_and_int_with_spatial_index (fid INTEGER NOT NULL PRIMARY KEY, g POINT
|
||||
NOT NULL SRID 0, a int, spatial index (g) );
|
||||
#INSERT valid entries to Point class
|
||||
INSERT INTO gis_point_and_int_with_spatial_index VALUES
|
||||
(101, ST_GEOMFROMTEXT('POINT(10 10)'),1),
|
||||
(102, ST_GEOMFROMTEXT('POINT(10 20)'),21),
|
||||
(103, ST_GEOMFROMTEXT('POINT(100 20)'),3),
|
||||
(104, ST_GEOMFROMTEXT('POINT(100 20)'),3);
|
||||
SELECT COUNT(g) FROM gis_point_and_int_with_spatial_index WHERE ST_AsText(g) LIKE "%point%";
|
||||
COUNT(g)
|
||||
4
|
||||
ALTER TABLE gis_point_and_int_with_spatial_index DROP INDEX g;
|
||||
CREATE SPATIAL INDEX g ON gis_point_and_int_with_spatial_index (g);
|
||||
SELECT COUNT(g) FROM gis_point_and_int_with_spatial_index WHERE ST_AsText(g) LIKE "%point%";
|
||||
COUNT(g)
|
||||
4
|
||||
ALTER TABLE gis_point_and_int_with_spatial_index DROP INDEX g;
|
||||
CREATE INDEX a ON gis_point_and_int_with_spatial_index (a) ;
|
||||
select count(g) from gis_point_and_int_with_spatial_index where a like "%3%";
|
||||
count(g)
|
||||
2
|
||||
select ST_AsText(g) from gis_point_and_int_with_spatial_index where a like "%3%";
|
||||
ST_AsText(g)
|
||||
POINT(100 20)
|
||||
POINT(100 20)
|
||||
DROP TABLE gis_point_and_int_with_spatial_index;
|
||||
CREATE TABLE gis_point_and_int_with_spatial_index (fid INTEGER NOT NULL PRIMARY KEY, g POINT
|
||||
NOT NULL SRID 0, a int, index (a) );
|
||||
#INSERT valid entries to Point class
|
||||
INSERT INTO gis_point_and_int_with_spatial_index VALUES
|
||||
(101, ST_GEOMFROMTEXT('POINT(10 10)'),1),
|
||||
(102, ST_GEOMFROMTEXT('POINT(10 20)'),21),
|
||||
(103, ST_GEOMFROMTEXT('POINT(100 20)'),3),
|
||||
(104, ST_GEOMFROMTEXT('POINT(101 20)'),3);
|
||||
select count(g) from gis_point_and_int_with_spatial_index where a like "%3%";
|
||||
count(g)
|
||||
2
|
||||
SELECT COUNT(a) FROM gis_point_and_int_with_spatial_index WHERE a LIKE "%3%";
|
||||
COUNT(a)
|
||||
2
|
||||
ALTER TABLE gis_point_and_int_with_spatial_index DROP INDEX a;
|
||||
CREATE SPATIAL INDEX g ON gis_point_and_int_with_spatial_index (g);
|
||||
SELECT COUNT(g) FROM gis_point_and_int_with_spatial_index WHERE ST_AsText(g) LIKE "%point%";
|
||||
COUNT(g)
|
||||
4
|
||||
SELECT COUNT(a) FROM gis_point_and_int_with_spatial_index WHERE ST_AsText(g) LIKE "%point%";
|
||||
COUNT(a)
|
||||
4
|
||||
DROP TABLE gis_point_and_int_with_spatial_index ;
|
||||
CREATE TABLE gis_linestring_and_int_with_spatial_index (fid INTEGER NOT NULL PRIMARY KEY, g LINESTRING
|
||||
NOT NULL SRID 0, a int, spatial index (g) );
|
||||
#INSERT valid entries to Point class
|
||||
INSERT INTO gis_linestring_and_int_with_spatial_index VALUES
|
||||
(201,ST_GEOMFROMTEXT('LINESTRING(0 0,0 10,10 0)'),1),
|
||||
(202,ST_GEOMFROMTEXT('LINESTRING(1 1,1 10,10 20)'),2),
|
||||
(203,ST_GEOMFROMTEXT('LINESTRING(1 1,1 10,10 20)'),2);
|
||||
select count(g) from gis_linestring_and_int_with_spatial_index where ST_AsText(g) like "%0%";
|
||||
count(g)
|
||||
3
|
||||
select count(a) from gis_linestring_and_int_with_spatial_index where ST_AsText(g) like "%0%";
|
||||
count(a)
|
||||
3
|
||||
select count(a) from gis_linestring_and_int_with_spatial_index where ST_AsText(g) like "%10 10%";
|
||||
count(a)
|
||||
0
|
||||
ALTER TABLE gis_linestring_and_int_with_spatial_index DROP INDEX g;
|
||||
CREATE INDEX a ON gis_linestring_and_int_with_spatial_index (a) ;
|
||||
SELECT COUNT(g) FROM gis_linestring_and_int_with_spatial_index WHERE a LIKE "%2%";
|
||||
COUNT(g)
|
||||
2
|
||||
ALTER TABLE gis_linestring_and_int_with_spatial_index DROP INDEX a;
|
||||
CREATE SPATIAL INDEX g ON gis_linestring_and_int_with_spatial_index (g) ;
|
||||
SELECT COUNT(g) FROM gis_linestring_and_int_with_spatial_index WHERE ST_AsText(g) LIKE "%2%";
|
||||
COUNT(g)
|
||||
2
|
||||
DROP TABLE gis_linestring_and_int_with_spatial_index ;
|
||||
CREATE TABLE gis_multilinestring_and_int_with_spatial_index (fid INTEGER PRIMARY KEY, g MULTILINESTRING
|
||||
NOT NULL SRID 0, a int, spatial index (g) );
|
||||
#INSERT valid entries to Point class
|
||||
INSERT INTO gis_multilinestring_and_int_with_spatial_index VALUES
|
||||
(300,ST_GEOMFROMTEXT('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))'),1),
|
||||
(301,ST_GEOMFROMTEXT('MULTILINESTRING((130 48,180 21,10 90),(916 0,516 2373223,816 48))'),1),
|
||||
(302,ST_GEOMFROMTEXT('MULTILINESTRING((180 48,10 25891,160 0),(5416 0,19096 29093,19096 498))'),1);
|
||||
select count(g) from gis_multilinestring_and_int_with_spatial_index where ST_AsText(g) like "%48%";
|
||||
count(g)
|
||||
3
|
||||
select count(a) from gis_multilinestring_and_int_with_spatial_index where ST_AsText(g) like "%48%";
|
||||
count(a)
|
||||
3
|
||||
ALTER TABLE gis_multilinestring_and_int_with_spatial_index DROP INDEX g;
|
||||
CREATE INDEX a ON gis_multilinestring_and_int_with_spatial_index (a) ;
|
||||
SELECT COUNT(g) FROM gis_multilinestring_and_int_with_spatial_index WHERE a LIKE "%2%";
|
||||
COUNT(g)
|
||||
0
|
||||
ALTER TABLE gis_multilinestring_and_int_with_spatial_index DROP INDEX a;
|
||||
CREATE SPATIAL INDEX g ON gis_multilinestring_and_int_with_spatial_index (g) ;
|
||||
SELECT COUNT(g) FROM gis_multilinestring_and_int_with_spatial_index WHERE ST_AsText(g) LIKE "%48%";
|
||||
COUNT(g)
|
||||
3
|
||||
DROP TABLE gis_multilinestring_and_int_with_spatial_index ;
|
||||
CREATE TABLE gis_polygon_and_int_with_spatial_index (fid INTEGER PRIMARY KEY, g POLYGON
|
||||
NOT NULL SRID 0, a int, spatial index (g) );
|
||||
#INSERT valid entries to Point class
|
||||
INSERT INTO gis_polygon_and_int_with_spatial_index VALUES
|
||||
(300,ST_GEOMFROMTEXT('POLYGON((183670 10,2470 10,20 249380,10 254760,183670 10))'),12),
|
||||
(301,ST_GEOMFROMTEXT('POLYGON((10 10,20 10,20 20,10 20,10 10))'),2),
|
||||
(302,ST_GEOMFROMTEXT('POLYGON((110 10,320 310,2550 8520,1059 2590,110 10))'),2),
|
||||
(303,ST_GEOMFROMTEXT('POLYGON((180 160,55620 5610,240 206560,10 285960,180 160))'),2);
|
||||
select count(g) from gis_polygon_and_int_with_spatial_index where ST_AsText(g) like "%10 10%";
|
||||
count(g)
|
||||
2
|
||||
select count(a) from gis_polygon_and_int_with_spatial_index where ST_AsText(g) like "%10 10%";
|
||||
count(a)
|
||||
2
|
||||
ALTER TABLE gis_polygon_and_int_with_spatial_index DROP INDEX g;
|
||||
CREATE INDEX a ON gis_polygon_and_int_with_spatial_index (a) ;
|
||||
SELECT COUNT(g) FROM gis_polygon_and_int_with_spatial_index WHERE a LIKE "%2%";
|
||||
COUNT(g)
|
||||
4
|
||||
ALTER TABLE gis_polygon_and_int_with_spatial_index DROP INDEX a;
|
||||
CREATE SPATIAL INDEX g ON gis_polygon_and_int_with_spatial_index (g) ;
|
||||
SELECT COUNT(g) FROM gis_polygon_and_int_with_spatial_index WHERE ST_AsText(g) LIKE "%48%";
|
||||
COUNT(g)
|
||||
0
|
||||
DROP TABLE gis_polygon_and_int_with_spatial_index ;
|
||||
DROP TABLE IF EXISTS gis_multipolygon_and_int_with_spatial_index;
|
||||
CREATE TABLE gis_multipolygon_and_int_with_spatial_index (fid INTEGER PRIMARY KEY, g multiPOLYGON
|
||||
NOT NULL SRID 0, a int, spatial index (g) );
|
||||
#INSERT valid entries to Point class
|
||||
INSERT INTO gis_multipolygon_and_int_with_spatial_index VALUES
|
||||
(1,ST_GEOMFROMTEXT('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))'),1),
|
||||
(2,ST_GEOMFROMTEXT('MULTIPOLYGON(((28 26,28 0,864 0,8984 42,28 26),(2 18,66 348345723,73 9,48 6,2 18)),((519 18,67 18,348345767 13,59 13,519 18)))'),1),
|
||||
(5,ST_GEOMFROMTEXT('MULTIPOLYGON(((254397348 26,28 0,84 0,84 42,254397348 26),(52 18,634834576 23,73 9,48 34834576,52 18)),((59 18,67 18,67 13,59 13,59 18)))'),1),
|
||||
(9,ST_GEOMFROMTEXT('MULTIPOLYGON(((28 26,28 0,84 0,834834574 42,28 26),(52 18,348345766 23,73 9,434834578 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))'),1);
|
||||
select count(g) from gis_multipolygon_and_int_with_spatial_index where ST_AsText(g) like "%59 18%";
|
||||
count(g)
|
||||
3
|
||||
select count(a) from gis_multipolygon_and_int_with_spatial_index where ST_AsText(g) like "%59 18%";
|
||||
count(a)
|
||||
3
|
||||
ALTER TABLE gis_multipolygon_and_int_with_spatial_index DROP INDEX g;
|
||||
CREATE INDEX a ON gis_multipolygon_and_int_with_spatial_index (a) ;
|
||||
SELECT COUNT(g) FROM gis_multipolygon_and_int_with_spatial_index WHERE a LIKE "%1%";
|
||||
COUNT(g)
|
||||
4
|
||||
ALTER TABLE gis_multipolygon_and_int_with_spatial_index DROP INDEX a;
|
||||
CREATE SPATIAL INDEX g ON gis_multipolygon_and_int_with_spatial_index (g) ;
|
||||
SELECT COUNT(g) FROM gis_multipolygon_and_int_with_spatial_index WHERE ST_AsText(g) LIKE "%18%";
|
||||
COUNT(g)
|
||||
4
|
||||
DROP TABLE gis_multipolygon_and_int_with_spatial_index ;
|
||||
CREATE TABLE gis_multipolygon_and_int_with_spatial_index (fid INTEGER PRIMARY KEY, g MULTIPOLYGON
|
||||
NOT NULL SRID 0, a int, spatial index (g) );
|
||||
#INSERT valid entries to Point class
|
||||
INSERT INTO gis_multipolygon_and_int_with_spatial_index VALUES
|
||||
(1,ST_GEOMFROMTEXT('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))'),1),
|
||||
(2,ST_GEOMFROMTEXT('MULTIPOLYGON(((28 26,28 0,864 0,8984 42,28 26),(2 18,66 348345723,73 9,48 6,2 18)),((519 18,67 18,348345767 13,59 13,519 18)))'),1),
|
||||
(5,ST_GEOMFROMTEXT('MULTIPOLYGON(((254397348 26,28 0,84 0,84 42,254397348 26),(52 18,634834576 23,73 9,48 34834576,52 18)),((59 18,67 18,67 13,59 13,59 18)))'),1),
|
||||
(9,ST_GEOMFROMTEXT('MULTIPOLYGON(((28 26,28 0,84 0,834834574 42,28 26),(52 18,348345766 23,73 9,434834578 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))'),1);
|
||||
select count(g) from gis_multipolygon_and_int_with_spatial_index where ST_AsText(g) like "%59 18%";
|
||||
count(g)
|
||||
3
|
||||
select count(a) from gis_multipolygon_and_int_with_spatial_index where ST_AsText(g) like "%59 18%";
|
||||
count(a)
|
||||
3
|
||||
ALTER TABLE gis_multipolygon_and_int_with_spatial_index DROP INDEX g;
|
||||
CREATE INDEX a ON gis_multipolygon_and_int_with_spatial_index (a) ;
|
||||
SELECT COUNT(g) FROM gis_multipolygon_and_int_with_spatial_index WHERE a LIKE "%1%";
|
||||
COUNT(g)
|
||||
4
|
||||
ALTER TABLE gis_multipolygon_and_int_with_spatial_index DROP INDEX a;
|
||||
CREATE INDEX g ON gis_multipolygon_and_int_with_spatial_index (g) ;
|
||||
DROP INDEX g ON gis_multipolygon_and_int_with_spatial_index;
|
||||
CREATE SPATIAL INDEX a ON gis_multipolygon_and_int_with_spatial_index (a) ;
|
||||
ERROR 42000: A SPATIAL index may only contain a geometrical type column.
|
||||
CREATE SPATIAL INDEX g ON gis_multipolygon_and_int_with_spatial_index (g) ;
|
||||
SELECT COUNT(g) FROM gis_multipolygon_and_int_with_spatial_index WHERE ST_AsText(g) LIKE "%18%";
|
||||
COUNT(g)
|
||||
4
|
||||
DROP TABLE gis_multipolygon_and_int_with_spatial_index ;
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,222 @@
|
||||
# ----------------------------------------------------------------------
|
||||
# Base test of GEOMETRY spatial index.
|
||||
# ----------------------------------------------------------------------
|
||||
DROP TABLE IF EXISTS spatial_index_syntax;
|
||||
CREATE TABLE spatial_index_syntax (g GEOMETRY NOT NULL SRID 4326, INDEX(g) LOCAL);
|
||||
SHOW FIELDS FROM spatial_index_syntax;
|
||||
Field Type Null Key Default Extra
|
||||
g geometry NO MUL NULL
|
||||
DROP TABLE IF EXISTS spatial_index_syntax;
|
||||
CREATE TABLE spatial_index_syntax (g GEOMETRY NOT NULL SRID 4326, INDEX(g) GLOBAL);
|
||||
SHOW FIELDS FROM spatial_index_syntax;
|
||||
Field Type Null Key Default Extra
|
||||
g geometry NO MUL NULL
|
||||
DROP TABLE IF EXISTS spatial_index_syntax;
|
||||
CREATE TABLE spatial_index_syntax (g GEOMETRY NOT NULL SRID 4326, INDEX(g));
|
||||
SHOW FIELDS FROM spatial_index_syntax;
|
||||
Field Type Null Key Default Extra
|
||||
g geometry NO MUL NULL
|
||||
DROP TABLE IF EXISTS spatial_index_syntax;
|
||||
CREATE TABLE spatial_index_syntax (g GEOMETRY NOT NULL SRID 4326, SPATIAL INDEX(g) LOCAL);
|
||||
SHOW FIELDS FROM spatial_index_syntax;
|
||||
Field Type Null Key Default Extra
|
||||
g geometry NO MUL NULL
|
||||
DROP TABLE IF EXISTS spatial_index_syntax;
|
||||
CREATE TABLE spatial_index_syntax (g GEOMETRY NOT NULL SRID 4326, SPATIAL INDEX(g) GLOBAL);
|
||||
SHOW FIELDS FROM spatial_index_syntax;
|
||||
Field Type Null Key Default Extra
|
||||
g geometry NO MUL NULL
|
||||
DROP TABLE IF EXISTS spatial_index_syntax;
|
||||
CREATE TABLE spatial_index_syntax (g GEOMETRY NOT NULL SRID 4326, SPATIAL INDEX(g));
|
||||
SHOW FIELDS FROM spatial_index_syntax;
|
||||
Field Type Null Key Default Extra
|
||||
g geometry NO MUL NULL
|
||||
DROP TABLE IF EXISTS spatial_index_syntax;
|
||||
DROP TABLE IF EXISTS spatial_index_syntax;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 'test.spatial_index_syntax'
|
||||
CREATE TABLE spatial_index_syntax (g GEOMETRY NOT NULL SRID 4326);
|
||||
ALTER TABLE spatial_index_syntax ADD INDEX idx(g) LOCAL;
|
||||
SHOW FIELDS FROM spatial_index_syntax;
|
||||
Field Type Null Key Default Extra
|
||||
g geometry NO MUL NULL
|
||||
DROP INDEX idx ON spatial_index_syntax;
|
||||
ALTER TABLE spatial_index_syntax ADD INDEX idx(g) GLOBAL;
|
||||
SHOW FIELDS FROM spatial_index_syntax;
|
||||
Field Type Null Key Default Extra
|
||||
g geometry NO MUL NULL
|
||||
DROP INDEX idx ON spatial_index_syntax;
|
||||
ALTER TABLE spatial_index_syntax ADD INDEX idx(g);
|
||||
SHOW FIELDS FROM spatial_index_syntax;
|
||||
Field Type Null Key Default Extra
|
||||
g geometry NO MUL NULL
|
||||
DROP INDEX idx ON spatial_index_syntax;
|
||||
DROP TABLE IF EXISTS spatial_index_syntax;
|
||||
CREATE TABLE spatial_index_syntax (g GEOMETRY NOT NULL SRID 4326);
|
||||
ALTER TABLE spatial_index_syntax ADD SPATIAL INDEX idx(g) LOCAL;
|
||||
SHOW FIELDS FROM spatial_index_syntax;
|
||||
Field Type Null Key Default Extra
|
||||
g geometry NO MUL NULL
|
||||
DROP INDEX idx ON spatial_index_syntax;
|
||||
ALTER TABLE spatial_index_syntax ADD SPATIAL INDEX idx(g) GLOBAL;
|
||||
SHOW FIELDS FROM spatial_index_syntax;
|
||||
Field Type Null Key Default Extra
|
||||
g geometry NO MUL NULL
|
||||
DROP INDEX idx ON spatial_index_syntax;
|
||||
ALTER TABLE spatial_index_syntax ADD SPATIAL INDEX idx(g);
|
||||
SHOW FIELDS FROM spatial_index_syntax;
|
||||
Field Type Null Key Default Extra
|
||||
g geometry NO MUL NULL
|
||||
DROP INDEX idx ON spatial_index_syntax;
|
||||
DROP TABLE IF EXISTS spatial_index_syntax;
|
||||
CREATE TABLE spatial_index_syntax (g GEOMETRY NOT NULL SRID 4326);
|
||||
CREATE INDEX idx ON spatial_index_syntax (g) LOCAL;
|
||||
SHOW FIELDS FROM spatial_index_syntax;
|
||||
Field Type Null Key Default Extra
|
||||
g geometry NO MUL NULL
|
||||
DROP INDEX idx ON spatial_index_syntax;
|
||||
CREATE INDEX idx ON spatial_index_syntax (g) GLOBAL;
|
||||
SHOW FIELDS FROM spatial_index_syntax;
|
||||
Field Type Null Key Default Extra
|
||||
g geometry NO MUL NULL
|
||||
DROP INDEX idx ON spatial_index_syntax;
|
||||
CREATE INDEX idx ON spatial_index_syntax (g);
|
||||
SHOW FIELDS FROM spatial_index_syntax;
|
||||
Field Type Null Key Default Extra
|
||||
g geometry NO MUL NULL
|
||||
DROP INDEX idx ON spatial_index_syntax;
|
||||
DROP TABLE IF EXISTS spatial_index_syntax;
|
||||
CREATE TABLE spatial_index_syntax (g GEOMETRY NOT NULL SRID 4326);
|
||||
CREATE SPATIAL INDEX idx ON spatial_index_syntax (g) LOCAL;
|
||||
SHOW FIELDS FROM spatial_index_syntax;
|
||||
Field Type Null Key Default Extra
|
||||
g geometry NO MUL NULL
|
||||
DROP INDEX idx ON spatial_index_syntax;
|
||||
CREATE SPATIAL INDEX idx ON spatial_index_syntax (g) GLOBAL;
|
||||
SHOW FIELDS FROM spatial_index_syntax;
|
||||
Field Type Null Key Default Extra
|
||||
g geometry NO MUL NULL
|
||||
DROP INDEX idx ON spatial_index_syntax;
|
||||
CREATE SPATIAL INDEX idx ON spatial_index_syntax (g);
|
||||
SHOW FIELDS FROM spatial_index_syntax;
|
||||
Field Type Null Key Default Extra
|
||||
g geometry NO MUL NULL
|
||||
DROP INDEX idx ON spatial_index_syntax;
|
||||
DROP TABLE IF EXISTS spatial_index_constraint;
|
||||
CREATE TABLE spatial_index_constraint (g1 GEOMETRY NOT NULL SRID 4326, g2 GEOMETRY NOT NULL SRID 4326);
|
||||
CREATE INDEX idx ON spatial_index_constraint (g1, g2);
|
||||
ERROR 42000: Too many key parts specified; max 64 parts allowed
|
||||
DROP TABLE IF EXISTS spatial_index_constraint;
|
||||
CREATE TABLE spatial_index_constraint (i int, g GEOMETRY NOT NULL SRID 4326);
|
||||
CREATE INDEX idx ON spatial_index_constraint (i, g);
|
||||
ERROR 42000: Too many key parts specified; max 64 parts allowed
|
||||
DROP TABLE IF EXISTS spatial_index_constraint;
|
||||
CREATE TABLE spatial_index_constraint (i int, g GEOMETRY NOT NULL SRID 4326);
|
||||
CREATE SPATIAL INDEX idx ON spatial_index_constraint (i);
|
||||
ERROR 42000: A SPATIAL index may only contain a geometrical type column.
|
||||
DROP TABLE IF EXISTS spatial_index_constraint;
|
||||
CREATE TABLE spatial_index_constraint (i int, g GEOMETRY NOT NULL SRID 4326);
|
||||
CREATE UNIQUE INDEX idx ON spatial_index_constraint (g);
|
||||
ERROR HY000: Spatial indexes can't be primary or unique indexes.
|
||||
DROP TABLE IF EXISTS spatial_index_constraint;
|
||||
CREATE TABLE spatial_index_constraint (i int, g GEOMETRY);
|
||||
CREATE INDEX idx ON spatial_index_constraint (g);
|
||||
ERROR 42000: All parts of a SPATIAL index must be NOT NULL.
|
||||
DROP TABLE IF EXISTS spatial_index_constraint;
|
||||
CREATE TABLE spatial_index_constraint (g GEOMETRY NOT NULL SRID 4326);
|
||||
CREATE INDEX idx ON spatial_index_constraint (g);
|
||||
INSERT INTO spatial_index_constraint values (ST_GEOMFROMTEXT('POINT(1 1)', 0));
|
||||
ERROR HY000: The SRID of the geometry does not match the SRID of the column. The SRID of the geometry is 0, but the SRID of the column is 4326. Consider changing the SRID of the geometry or the SRID property of the column.
|
||||
DROP TABLE IF EXISTS spatial_index_constraint;
|
||||
DROP TABLE IF EXISTS spatial_index_dml;
|
||||
SET @v=ST_GEOMFROMTEXT('POINT(0 0)', 4326);
|
||||
SET @v0=ST_GEOMFROMTEXT('POINT(0 0)', 4326);
|
||||
SET @v1=ST_GEOMFROMTEXT('POINT(1 1)', 4326);
|
||||
CREATE TABLE spatial_index_dml (i int, g GEOMETRY NOT NULL SRID 4326, PRIMARY KEY (i));
|
||||
CREATE INDEX idx ON spatial_index_dml (g);
|
||||
INSERT INTO spatial_index_dml VALUES (1, ST_GEOMFROMTEXT('POINT(0 0)', 4326));
|
||||
SELECT /*+INDEX(spatial_index_dml idx)*/ st_astext(g) FROM spatial_index_dml WHERE ST_INTERSECTS(g, ST_GEOMFROMTEXT('POINT(0 0)', 4326));
|
||||
st_astext(g)
|
||||
POINT(0 0)
|
||||
DROP TABLE spatial_index_dml;
|
||||
CREATE TABLE spatial_index_dml (i int, g GEOMETRY NOT NULL SRID 4326, PRIMARY KEY (i));
|
||||
CREATE INDEX idx ON spatial_index_dml (g);
|
||||
INSERT INTO spatial_index_dml VALUES (1, ST_GEOMFROMTEXT('POINT(0 0)', 4326));
|
||||
SELECT /*+INDEX(spatial_index_dml idx)*/ st_astext(g) FROM spatial_index_dml WHERE ST_INTERSECTS(g, ST_GEOMFROMTEXT('POINT(0 0)', 4326));
|
||||
st_astext(g)
|
||||
POINT(0 0)
|
||||
DROP TABLE spatial_index_dml;
|
||||
CREATE TABLE spatial_index_dml (i1 int, i2 int, g GEOMETRY NOT NULL SRID 4326, PRIMARY KEY (i1, i2));
|
||||
CREATE INDEX idx ON spatial_index_dml (g);
|
||||
INSERT INTO spatial_index_dml VALUES (1, 2, ST_GEOMFROMTEXT('POINT(0 0)', 4326));
|
||||
SELECT /*+INDEX(spatial_index_dml idx)*/ st_astext(g) FROM spatial_index_dml WHERE ST_INTERSECTS(g, ST_GEOMFROMTEXT('POINT(0 0)', 4326));
|
||||
st_astext(g)
|
||||
POINT(0 0)
|
||||
DROP TABLE spatial_index_dml;
|
||||
DROP TABLE IF EXISTS spatial_index_dml;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 'test.spatial_index_dml'
|
||||
CREATE TABLE spatial_index_dml (i int, g GEOMETRY NOT NULL SRID 4326, PRIMARY KEY (i));
|
||||
CREATE INDEX idx ON spatial_index_dml (g);
|
||||
INSERT INTO spatial_index_dml VALUES (1, ST_GEOMFROMTEXT('POINT(0 0)', 4326));
|
||||
UPDATE spatial_index_dml SET g=ST_GEOMFROMTEXT('POINT(1 2)', 4326) WHERE ST_INTERSECTS(g, ST_GEOMFROMTEXT('POINT(0 0)', 4326));
|
||||
SELECT /*+INDEX(spatial_index_dml idx)*/ g FROM spatial_index_dml WHERE ST_INTERSECTS(g, ST_GEOMFROMTEXT('POINT(1 1)', 4326));
|
||||
g
|
||||
DROP TABLE IF EXISTS spatial_index_dml;
|
||||
CREATE TABLE spatial_index_dml (i1 int, i2 int, g GEOMETRY NOT NULL SRID 4326, PRIMARY KEY (i1, i2));
|
||||
CREATE INDEX idx ON spatial_index_dml (g);
|
||||
SET @v0=ST_GEOMFROMTEXT('POINT(0 0)', 4326);
|
||||
SET @v1=ST_GEOMFROMTEXT('POINT(1 1)', 4326);
|
||||
INSERT INTO spatial_index_dml VALUES (1, 2, ST_GEOMFROMTEXT('POINT(0 0)', 4326));
|
||||
UPDATE spatial_index_dml SET g=ST_GEOMFROMTEXT('POINT(1 2)', 4326) WHERE ST_INTERSECTS(g, ST_GEOMFROMTEXT('POINT(0 0)', 4326));
|
||||
SELECT /*+INDEX(spatial_index_dml idx)*/ g FROM spatial_index_dml WHERE ST_INTERSECTS(g, ST_GEOMFROMTEXT('POINT(1 1)', 4326));
|
||||
g
|
||||
DROP TABLE IF EXISTS spatial_index_dml;
|
||||
CREATE TABLE spatial_index_dml (i int, g GEOMETRY NOT NULL SRID 4326, PRIMARY KEY (i));
|
||||
CREATE INDEX idx ON spatial_index_dml (g);
|
||||
SET @v0=ST_GEOMFROMTEXT('POINT(0 0)', 4326);
|
||||
INSERT INTO spatial_index_dml VALUES (1, ST_GEOMFROMTEXT('POINT(0 0)', 4326));
|
||||
DELETE FROM spatial_index_dml WHERE ST_INTERSECTS(g, ST_GEOMFROMTEXT('POINT(0 0)', 4326));
|
||||
SELECT /*+INDEX(spatial_index_dml idx)*/ g FROM spatial_index_dml WHERE ST_INTERSECTS(g, ST_GEOMFROMTEXT('POINT(0 0)', 4326));
|
||||
g
|
||||
DROP TABLE IF EXISTS spatial_index_dml;
|
||||
CREATE TABLE spatial_index_dml (i1 int, i2 int, g GEOMETRY NOT NULL SRID 4326, PRIMARY KEY (i1, i2));
|
||||
CREATE INDEX idx ON spatial_index_dml (g);
|
||||
SET @v0=ST_GEOMFROMTEXT('POINT(0 0)', 4326);
|
||||
INSERT INTO spatial_index_dml VALUES (1, 2, ST_GEOMFROMTEXT('POINT(0 0)', 4326));
|
||||
DELETE FROM spatial_index_dml WHERE ST_INTERSECTS(g, ST_GEOMFROMTEXT('POINT(0 0)', 4326));
|
||||
SELECT /*+INDEX(spatial_index_dml idx)*/ g FROM spatial_index_dml WHERE ST_INTERSECTS(g, ST_GEOMFROMTEXT('POINT(0 0)', 4326));
|
||||
g
|
||||
DROP TABLE IF EXISTS spatial_index_query;
|
||||
SET @v=ST_GEOMFROMTEXT('POINT(0 0)', 4326);
|
||||
CREATE TABLE spatial_index_query (i int, g GEOMETRY NOT NULL SRID 4326, PRIMARY KEY(i));
|
||||
CREATE INDEX idx ON spatial_index_query (g);
|
||||
INSERT INTO spatial_index_query VALUES (0, ST_GEOMFROMTEXT('POINT(0 0)', 4326));
|
||||
INSERT INTO spatial_index_query VALUES (1, ST_GEOMFROMTEXT('POINT(0 0)', 4326));
|
||||
INSERT INTO spatial_index_query VALUES (2, ST_GEOMFROMTEXT('POINT(0 0)', 4326));
|
||||
SELECT /*+INDEX(spatial_index_query idx)*/ st_astext(g) FROM spatial_index_query WHERE ST_INTERSECTS(g, ST_GEOMFROMTEXT('POINT(0 0)', 4326));
|
||||
st_astext(g)
|
||||
POINT(0 0)
|
||||
POINT(0 0)
|
||||
POINT(0 0)
|
||||
DROP TABLE IF EXISTS spatial_index_query;
|
||||
CREATE TABLE spatial_index_query (i int, g GEOMETRY NOT NULL SRID 4326);
|
||||
CREATE INDEX idx ON spatial_index_query (g);
|
||||
SET @v=ST_GEOMFROMTEXT('POINT(1 1)', 4326);
|
||||
INSERT INTO spatial_index_query VALUES (1, ST_GEOMFROMTEXT('POINT(1 1)', 4326));
|
||||
SET @cart_py = ST_GeomFromText('POLYGON((0 0, 10 0, 10 5, 0 5, 0 0))', 4326);
|
||||
SELECT /*+INDEX(spatial_index_query idx)*/ st_astext(g) from spatial_index_query where st_intersects(g, ST_GeomFromText('POLYGON((0 0, 10 0, 10 5, 0 5, 0 0))', 4326));
|
||||
st_astext(g)
|
||||
POINT(1 1)
|
||||
DROP TABLE IF EXISTS spatial_index_rebuild;
|
||||
CREATE TABLE spatial_index_rebuild (i int, g GEOMETRY NOT NULL SRID 4326, PRIMARY KEY(i));
|
||||
SET @v=ST_GEOMFROMTEXT('POINT(0 0)', 4326);
|
||||
INSERT INTO spatial_index_rebuild VALUES (0, ST_GEOMFROMTEXT('POINT(0 0)', 4326));
|
||||
INSERT INTO spatial_index_rebuild VALUES (1, ST_GEOMFROMTEXT('POINT(0 0)', 4326));
|
||||
INSERT INTO spatial_index_rebuild VALUES (2, ST_GEOMFROMTEXT('POINT(0 0)', 4326));
|
||||
CREATE INDEX idx ON spatial_index_rebuild (g);
|
||||
SELECT /*+INDEX(spatial_index_rebuild idx)*/ st_astext(g) FROM spatial_index_rebuild WHERE ST_INTERSECTS(g, ST_GEOMFROMTEXT('POINT(0 0)', 4326));
|
||||
st_astext(g)
|
||||
POINT(0 0)
|
||||
POINT(0 0)
|
||||
POINT(0 0)
|
||||
@ -0,0 +1,375 @@
|
||||
# ----------------------------------------------------------------------
|
||||
# Base test of GEOMETRY spatial index.
|
||||
# ----------------------------------------------------------------------
|
||||
DROP TABLE IF EXISTS t1;
|
||||
create table t1(c1 int primary key, g geometry not null srid 0) partition by hash(c1) partitions 2;
|
||||
create spatial index idx on t1 (g) local;
|
||||
insert into t1 (c1, g) values (0, st_geomfromtext('point(1 1)'));
|
||||
explain select /*+index(t1 idx)*/ st_astext(g) from t1 where st_intersects(g, st_geomfromtext('point(1 1)'));
|
||||
Query Plan
|
||||
=============================================================
|
||||
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
|
||||
-------------------------------------------------------------
|
||||
|0 |PX COORDINATOR | |1 |291 |
|
||||
|1 |└─EXCHANGE OUT DISTR |:EX10000|1 |291 |
|
||||
|2 | └─PX PARTITION ITERATOR| |1 |289 |
|
||||
|3 | └─TABLE FULL SCAN |t1(idx) |1 |289 |
|
||||
=============================================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([INTERNAL_FUNCTION(st_astext(t1.g))]), filter(nil)
|
||||
1 - output([INTERNAL_FUNCTION(st_astext(t1.g))]), filter(nil)
|
||||
dop=1
|
||||
2 - output([t1.g]), filter(nil)
|
||||
force partition granule
|
||||
3 - output([t1.g]), filter([st_intersects(t1.g, st_geomfromtext('point(1 1)'))])
|
||||
access([t1.c1], [t1.g]), partitions(p[0-1])
|
||||
is_index_back=true, is_global_index=false, filter_before_indexback[false],
|
||||
range_key([t1.__cellid_17], [t1.__mbr_17], [t1.c1]), range(1152921504606846977,MIN,MIN ; 1152921504606846977,MAX,MAX), (1152921504606846980,MIN,MIN
|
||||
; 1152921504606846980,MAX,MAX), (1152921504606846992,MIN,MIN ; 1152921504606846992,MAX,MAX), (1152921504606847040,MIN,MIN ; 1152921504606847040,MAX,MAX),
|
||||
(1152921504606847232,MIN,MIN ; 1152921504606847232,MAX,MAX), (1152921504606848000,MIN,MIN ; 1152921504606848000,MAX,MAX), (1152921504606851072,MIN,MIN
|
||||
; 1152921504606851072,MAX,MAX), (1152921504606863360,MIN,MIN ; 1152921504606863360,MAX,MAX), (1152921504606912512,MIN,MIN ; 1152921504606912512,MAX,MAX),
|
||||
(1152921504607109120,MIN,MIN ; 1152921504607109120,MAX,MAX), (1152921504607895552,MIN,MIN ; 1152921504607895552,MAX,MAX), (1152921504611041280,MIN,MIN
|
||||
; 1152921504611041280,MAX,MAX), (1152921504623624192,MIN,MIN ; 1152921504623624192,MAX,MAX), (1152921504673955840,MIN,MIN ; 1152921504673955840,MAX,MAX),
|
||||
(1152921504875282432,MIN,MIN ; 1152921504875282432,MAX,MAX), (1152921505680588800,MIN,MIN ; 1152921505680588800,MAX,MAX), (1152921508901814272,MIN,MIN
|
||||
; 1152921508901814272,MAX,MAX), (1152921521786716160,MIN,MIN ; 1152921521786716160,MAX,MAX), (1152921573326323712,MIN,MIN ; 1152921573326323712,MAX,MAX),
|
||||
(1152921779484753920,MIN,MIN ; 1152921779484753920,MAX,MAX), (1152922604118474752,MIN,MIN ; 1152922604118474752,MAX,MAX), (1152925902653358080,MIN,MIN
|
||||
; 1152925902653358080,MAX,MAX), (1152939096792891392,MIN,MIN ; 1152939096792891392,MAX,MAX), (1152991873351024640,MIN,MIN ; 1152991873351024640,MAX,MAX),
|
||||
(1153202979583557632,MIN,MIN ; 1153202979583557632,MAX,MAX), (1154047404513689600,MIN,MIN ; 1154047404513689600,MAX,MAX), (1157425104234217472,MIN,MIN
|
||||
; 1157425104234217472,MAX,MAX), (1170935903116328960,MIN,MIN ; 1170935903116328960,MAX,MAX), (1224979098644774912,MIN,MIN ; 1224979098644774912,MAX,MAX),
|
||||
(1441151880758558720,MIN,MIN ; 1441151880758558720,MAX,MAX), (1152921504606846976,MIN,MIN ; 1152921504606846976,MAX,MAX)
|
||||
select /*+index(t1 idx)*/ st_astext(g) from t1 where st_intersects(g, st_geomfromtext('point(1 1)'));
|
||||
st_astext(g)
|
||||
POINT(1 1)
|
||||
drop table t1;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
create table t1(c1 int primary key, g geometry not null srid 0) partition by range(c1) ( partition p0 values less than (4),
|
||||
partition p1 values less than (10));
|
||||
create spatial index idx on t1 (g) local;
|
||||
insert into t1 (c1, g) values (0, st_geomfromtext('point(1 1)'));
|
||||
insert into t1 (c1, g) values (1, st_geomfromtext('point(1 1)'));
|
||||
insert into t1 (c1, g) values (2, st_geomfromtext('point(1 1)'));
|
||||
insert into t1 (c1, g) values (3, st_geomfromtext('point(1 1)'));
|
||||
insert into t1 (c1, g) values (4, st_geomfromtext('point(1 1)'));
|
||||
insert into t1 (c1, g) values (5, st_geomfromtext('point(1 1)'));
|
||||
insert into t1 (c1, g) values (6, st_geomfromtext('point(1 1)'));
|
||||
insert into t1 (c1, g) values (7, st_geomfromtext('point(1 1)'));
|
||||
insert into t1 (c1, g) values (8, st_geomfromtext('point(1 1)'));
|
||||
insert into t1 (c1, g) values (9, st_geomfromtext('point(1 1)'));
|
||||
explain select /*+index(t1 idx)*/ st_astext(g) from t1 where st_intersects(g, st_geomfromtext('point(1 1)'));
|
||||
Query Plan
|
||||
=============================================================
|
||||
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
|
||||
-------------------------------------------------------------
|
||||
|0 |PX COORDINATOR | |10 |565 |
|
||||
|1 |└─EXCHANGE OUT DISTR |:EX10000|10 |558 |
|
||||
|2 | └─PX PARTITION ITERATOR| |10 |542 |
|
||||
|3 | └─TABLE FULL SCAN |t1(idx) |10 |542 |
|
||||
=============================================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([INTERNAL_FUNCTION(st_astext(t1.g))]), filter(nil)
|
||||
1 - output([INTERNAL_FUNCTION(st_astext(t1.g))]), filter(nil)
|
||||
dop=1
|
||||
2 - output([t1.g]), filter(nil)
|
||||
force partition granule
|
||||
3 - output([t1.g]), filter([st_intersects(t1.g, st_geomfromtext('point(1 1)'))])
|
||||
access([t1.c1], [t1.g]), partitions(p[0-1])
|
||||
is_index_back=true, is_global_index=false, filter_before_indexback[false],
|
||||
range_key([t1.__cellid_17], [t1.__mbr_17], [t1.c1]), range(1152921504606846977,MIN,MIN ; 1152921504606846977,MAX,MAX), (1152921504606846980,MIN,MIN
|
||||
; 1152921504606846980,MAX,MAX), (1152921504606846992,MIN,MIN ; 1152921504606846992,MAX,MAX), (1152921504606847040,MIN,MIN ; 1152921504606847040,MAX,MAX),
|
||||
(1152921504606847232,MIN,MIN ; 1152921504606847232,MAX,MAX), (1152921504606848000,MIN,MIN ; 1152921504606848000,MAX,MAX), (1152921504606851072,MIN,MIN
|
||||
; 1152921504606851072,MAX,MAX), (1152921504606863360,MIN,MIN ; 1152921504606863360,MAX,MAX), (1152921504606912512,MIN,MIN ; 1152921504606912512,MAX,MAX),
|
||||
(1152921504607109120,MIN,MIN ; 1152921504607109120,MAX,MAX), (1152921504607895552,MIN,MIN ; 1152921504607895552,MAX,MAX), (1152921504611041280,MIN,MIN
|
||||
; 1152921504611041280,MAX,MAX), (1152921504623624192,MIN,MIN ; 1152921504623624192,MAX,MAX), (1152921504673955840,MIN,MIN ; 1152921504673955840,MAX,MAX),
|
||||
(1152921504875282432,MIN,MIN ; 1152921504875282432,MAX,MAX), (1152921505680588800,MIN,MIN ; 1152921505680588800,MAX,MAX), (1152921508901814272,MIN,MIN
|
||||
; 1152921508901814272,MAX,MAX), (1152921521786716160,MIN,MIN ; 1152921521786716160,MAX,MAX), (1152921573326323712,MIN,MIN ; 1152921573326323712,MAX,MAX),
|
||||
(1152921779484753920,MIN,MIN ; 1152921779484753920,MAX,MAX), (1152922604118474752,MIN,MIN ; 1152922604118474752,MAX,MAX), (1152925902653358080,MIN,MIN
|
||||
; 1152925902653358080,MAX,MAX), (1152939096792891392,MIN,MIN ; 1152939096792891392,MAX,MAX), (1152991873351024640,MIN,MIN ; 1152991873351024640,MAX,MAX),
|
||||
(1153202979583557632,MIN,MIN ; 1153202979583557632,MAX,MAX), (1154047404513689600,MIN,MIN ; 1154047404513689600,MAX,MAX), (1157425104234217472,MIN,MIN
|
||||
; 1157425104234217472,MAX,MAX), (1170935903116328960,MIN,MIN ; 1170935903116328960,MAX,MAX), (1224979098644774912,MIN,MIN ; 1224979098644774912,MAX,MAX),
|
||||
(1441151880758558720,MIN,MIN ; 1441151880758558720,MAX,MAX), (1152921504606846976,MIN,MIN ; 1152921504606846976,MAX,MAX)
|
||||
select /*+index(t1 idx)*/ st_astext(g) from t1 where st_intersects(g, st_geomfromtext('point(1 1)'));
|
||||
st_astext(g)
|
||||
POINT(1 1)
|
||||
POINT(1 1)
|
||||
POINT(1 1)
|
||||
POINT(1 1)
|
||||
POINT(1 1)
|
||||
POINT(1 1)
|
||||
POINT(1 1)
|
||||
POINT(1 1)
|
||||
POINT(1 1)
|
||||
POINT(1 1)
|
||||
drop table t1;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
create table t1(c1 int primary key, g geometry not null srid 0) partition by hash(c1) partitions 2;
|
||||
create spatial index idx on t1 (g) global;
|
||||
ERROR 0A000: spatial global index not supported
|
||||
create spatial index idx on t1 (g);
|
||||
drop table t1;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
create table t1(c1 int primary key, g geometry not null srid 0, spatial index(g) global) partition by hash(c1) partitions 2;
|
||||
ERROR 0A000: spatial global index not supported
|
||||
DROP TABLE IF EXISTS t1;
|
||||
create table t1(c1 int primary key, g geometry not null srid 0, spatial index(g)) partition by hash(c1) partitions 2;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
create table t1(c1 int primary key, g geometry not null srid 0, index(g) global) partition by hash(c1) partitions 2;
|
||||
ERROR 0A000: spatial global index not supported
|
||||
DROP TABLE IF EXISTS t1;
|
||||
create table t1(c1 int primary key, g geometry not null srid 0, index(g)) partition by hash(c1) partitions 2;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
create table t1(c1 int primary key, g geometry not null srid 0) partition by hash(c1) partitions 2;
|
||||
alter table t1 add spatial index idx(g);
|
||||
show index from t1;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Visible Expression
|
||||
t1 0 PRIMARY 1 c1 A NULL NULL NULL BTREE available YES NULL
|
||||
t1 1 idx 1 g A NULL NULL NULL SPATIAL available YES NULL
|
||||
drop index idx on t1;
|
||||
alter table t1 add spatial index idx(g) global;
|
||||
ERROR 0A000: spatial global index not supported
|
||||
show index from t1;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Visible Expression
|
||||
t1 0 PRIMARY 1 c1 A NULL NULL NULL BTREE available YES NULL
|
||||
alter table t1 add spatial index idx(g) local;
|
||||
show index from t1;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Visible Expression
|
||||
t1 0 PRIMARY 1 c1 A NULL NULL NULL BTREE available YES NULL
|
||||
t1 1 idx 1 g A NULL NULL NULL SPATIAL available YES NULL
|
||||
drop index idx on t1;
|
||||
show index from t1;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Visible Expression
|
||||
t1 0 PRIMARY 1 c1 A NULL NULL NULL BTREE available YES NULL
|
||||
create index idx on t1(g);
|
||||
show index from t1;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Visible Expression
|
||||
t1 0 PRIMARY 1 c1 A NULL NULL NULL BTREE available YES NULL
|
||||
t1 1 idx 1 g A NULL NULL NULL SPATIAL available YES NULL
|
||||
create index idx on t1(g) global;
|
||||
ERROR 0A000: spatial global index not supported
|
||||
show index from t1;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Visible Expression
|
||||
t1 0 PRIMARY 1 c1 A NULL NULL NULL BTREE available YES NULL
|
||||
t1 1 idx 1 g A NULL NULL NULL SPATIAL available YES NULL
|
||||
drop index idx on t1;
|
||||
create index idx on t1(g) local;
|
||||
show index from t1;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Visible Expression
|
||||
t1 0 PRIMARY 1 c1 A NULL NULL NULL BTREE available YES NULL
|
||||
t1 1 idx 1 g A NULL NULL NULL SPATIAL available YES NULL
|
||||
drop table t1;
|
||||
DROP TABLE IF EXISTS geo_maxpt_coords_100y, geo_maxpt_coords_100y_2, aoi_string_limit10;
|
||||
CREATE TABLE geo_maxpt_coords_100y (
|
||||
poi_id VARCHAR(128) NOT NULL,
|
||||
pwkt VARCHAR(128) NOT NULL DEFAULT '0',
|
||||
geo_pwkt GEOMETRY NOT NULL srid 0,
|
||||
-- PRIMARY KEY (`id`, k)
|
||||
SPATIAL INDEX(geo_pwkt)
|
||||
) PARTITION BY key(poi_id) PARTITIONS 256;
|
||||
CREATE TABLE geo_maxpt_coords_100y_2 (
|
||||
poi_id VARCHAR(128) NOT NULL,
|
||||
pwkt VARCHAR(128) NOT NULL DEFAULT '0',
|
||||
geo_pwkt GEOMETRY NOT NULL /*!80003 srid 0 */,
|
||||
SPATIAL INDEX(geo_pwkt)
|
||||
);
|
||||
explain select count(*) from geo_maxpt_coords_100y where st_intersects(geo_maxpt_coords_100y.geo_pwkt, st_geomfromtext('polygon((0 0,5 0,5 5,0 5,0 0))', 0));
|
||||
Query Plan
|
||||
========================================================================================
|
||||
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
|
||||
----------------------------------------------------------------------------------------
|
||||
|0 |SCALAR GROUP BY | |1 |32285 |
|
||||
|1 |└─PX COORDINATOR | |1 |32285 |
|
||||
|2 | └─EXCHANGE OUT DISTR |:EX10000 |1 |32285 |
|
||||
|3 | └─MERGE GROUP BY | |1 |32285 |
|
||||
|4 | └─PX PARTITION ITERATOR| |1 |32285 |
|
||||
|5 | └─TABLE FULL SCAN |geo_maxpt_coords_100y(geo_pwkt)|1 |32285 |
|
||||
========================================================================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([T_FUN_COUNT_SUM(T_FUN_COUNT(*))]), filter(nil)
|
||||
group(nil), agg_func([T_FUN_COUNT_SUM(T_FUN_COUNT(*))])
|
||||
1 - output([T_FUN_COUNT(*)]), filter(nil)
|
||||
2 - output([T_FUN_COUNT(*)]), filter(nil)
|
||||
dop=1
|
||||
3 - output([T_FUN_COUNT(*)]), filter(nil)
|
||||
group(nil), agg_func([T_FUN_COUNT(*)])
|
||||
4 - output(nil), filter(nil)
|
||||
force partition granule
|
||||
5 - output(nil), filter([st_intersects(geo_maxpt_coords_100y.geo_pwkt, st_geomfromtext('polygon((0 0,5 0,5 5,0 5,0 0))', 0))])
|
||||
access([geo_maxpt_coords_100y.__pk_increment], [geo_maxpt_coords_100y.geo_pwkt]), partitions(p[0-255])
|
||||
is_index_back=true, is_global_index=false, filter_before_indexback[false],
|
||||
range_key([geo_maxpt_coords_100y.__cellid_18], [geo_maxpt_coords_100y.__mbr_18], [geo_maxpt_coords_100y.__pk_increment]), range(1152921504606846977,
|
||||
MIN,MIN ; 1152921504606846983,MAX,MAX), (1152921504606846992,MIN,MIN ; 1152921504606846992,MAX,MAX), (1152921504606847040,MIN,MIN ; 1152921504606847040,
|
||||
MAX,MAX), (1152921504606847232,MIN,MIN ; 1152921504606847232,MAX,MAX), (1152921504606848000,MIN,MIN ; 1152921504606848000,MAX,MAX), (1152921504606851072,
|
||||
MIN,MIN ; 1152921504606851072,MAX,MAX), (1152921504606863360,MIN,MIN ; 1152921504606863360,MAX,MAX), (1152921504606912512,MIN,MIN ; 1152921504606912512,
|
||||
MAX,MAX), (1152921504607109120,MIN,MIN ; 1152921504607109120,MAX,MAX), (1152921504607895552,MIN,MIN ; 1152921504607895552,MAX,MAX), (1152921504611041280,
|
||||
MIN,MIN ; 1152921504611041280,MAX,MAX), (1152921504623624192,MIN,MIN ; 1152921504623624192,MAX,MAX), (1152921504673955840,MIN,MIN ; 1152921504673955840,
|
||||
MAX,MAX), (1152921504875282432,MIN,MIN ; 1152921504875282432,MAX,MAX), (1152921505680588800,MIN,MIN ; 1152921505680588800,MAX,MAX), (1152921508901814272,
|
||||
MIN,MIN ; 1152921508901814272,MAX,MAX), (1152921521786716160,MIN,MIN ; 1152921521786716160,MAX,MAX), (1152921573326323712,MIN,MIN ; 1152921573326323712,
|
||||
MAX,MAX), (1152921779484753920,MIN,MIN ; 1152921779484753920,MAX,MAX), (1152922604118474752,MIN,MIN ; 1152922604118474752,MAX,MAX), (1152925902653358080,
|
||||
MIN,MIN ; 1152925902653358080,MAX,MAX), (1152939096792891392,MIN,MIN ; 1152939096792891392,MAX,MAX), (1152991873351024640,MIN,MIN ; 1152991873351024640,
|
||||
MAX,MAX), (1153202979583557632,MIN,MIN ; 1153202979583557632,MAX,MAX), (1154047404513689600,MIN,MIN ; 1154047404513689600,MAX,MAX), (1157425104234217472,
|
||||
MIN,MIN ; 1157425104234217472,MAX,MAX), (1170935903116328960,MIN,MIN ; 1170935903116328960,MAX,MAX), (1224979098644774912,MIN,MIN ; 1224979098644774912,
|
||||
MAX,MAX), (1441151880758558720,MIN,MIN ; 1441151880758558720,MAX,MAX), (1152921504606846976,MIN,MIN ; 1152921504606846976,MAX,MAX)
|
||||
explain select /*+ parallel(1) */ count(*) from geo_maxpt_coords_100y where st_intersects(geo_maxpt_coords_100y.geo_pwkt, st_geomfromtext('polygon((0 0,5 0,5 5,0 5,0 0))', 0));
|
||||
Query Plan
|
||||
========================================================================================
|
||||
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
|
||||
----------------------------------------------------------------------------------------
|
||||
|0 |SCALAR GROUP BY | |1 |32285 |
|
||||
|1 |└─PX COORDINATOR | |1 |32285 |
|
||||
|2 | └─EXCHANGE OUT DISTR |:EX10000 |1 |32285 |
|
||||
|3 | └─MERGE GROUP BY | |1 |32285 |
|
||||
|4 | └─PX PARTITION ITERATOR| |1 |32285 |
|
||||
|5 | └─TABLE FULL SCAN |geo_maxpt_coords_100y(geo_pwkt)|1 |32285 |
|
||||
========================================================================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([T_FUN_COUNT_SUM(T_FUN_COUNT(*))]), filter(nil)
|
||||
group(nil), agg_func([T_FUN_COUNT_SUM(T_FUN_COUNT(*))])
|
||||
1 - output([T_FUN_COUNT(*)]), filter(nil)
|
||||
2 - output([T_FUN_COUNT(*)]), filter(nil)
|
||||
dop=1
|
||||
3 - output([T_FUN_COUNT(*)]), filter(nil)
|
||||
group(nil), agg_func([T_FUN_COUNT(*)])
|
||||
4 - output(nil), filter(nil)
|
||||
force partition granule
|
||||
5 - output(nil), filter([st_intersects(geo_maxpt_coords_100y.geo_pwkt, st_geomfromtext('polygon((0 0,5 0,5 5,0 5,0 0))', 0))])
|
||||
access([geo_maxpt_coords_100y.__pk_increment], [geo_maxpt_coords_100y.geo_pwkt]), partitions(p[0-255])
|
||||
is_index_back=true, is_global_index=false, filter_before_indexback[false],
|
||||
range_key([geo_maxpt_coords_100y.__cellid_18], [geo_maxpt_coords_100y.__mbr_18], [geo_maxpt_coords_100y.__pk_increment]), range(1152921504606846977,
|
||||
MIN,MIN ; 1152921504606846983,MAX,MAX), (1152921504606846992,MIN,MIN ; 1152921504606846992,MAX,MAX), (1152921504606847040,MIN,MIN ; 1152921504606847040,
|
||||
MAX,MAX), (1152921504606847232,MIN,MIN ; 1152921504606847232,MAX,MAX), (1152921504606848000,MIN,MIN ; 1152921504606848000,MAX,MAX), (1152921504606851072,
|
||||
MIN,MIN ; 1152921504606851072,MAX,MAX), (1152921504606863360,MIN,MIN ; 1152921504606863360,MAX,MAX), (1152921504606912512,MIN,MIN ; 1152921504606912512,
|
||||
MAX,MAX), (1152921504607109120,MIN,MIN ; 1152921504607109120,MAX,MAX), (1152921504607895552,MIN,MIN ; 1152921504607895552,MAX,MAX), (1152921504611041280,
|
||||
MIN,MIN ; 1152921504611041280,MAX,MAX), (1152921504623624192,MIN,MIN ; 1152921504623624192,MAX,MAX), (1152921504673955840,MIN,MIN ; 1152921504673955840,
|
||||
MAX,MAX), (1152921504875282432,MIN,MIN ; 1152921504875282432,MAX,MAX), (1152921505680588800,MIN,MIN ; 1152921505680588800,MAX,MAX), (1152921508901814272,
|
||||
MIN,MIN ; 1152921508901814272,MAX,MAX), (1152921521786716160,MIN,MIN ; 1152921521786716160,MAX,MAX), (1152921573326323712,MIN,MIN ; 1152921573326323712,
|
||||
MAX,MAX), (1152921779484753920,MIN,MIN ; 1152921779484753920,MAX,MAX), (1152922604118474752,MIN,MIN ; 1152922604118474752,MAX,MAX), (1152925902653358080,
|
||||
MIN,MIN ; 1152925902653358080,MAX,MAX), (1152939096792891392,MIN,MIN ; 1152939096792891392,MAX,MAX), (1152991873351024640,MIN,MIN ; 1152991873351024640,
|
||||
MAX,MAX), (1153202979583557632,MIN,MIN ; 1153202979583557632,MAX,MAX), (1154047404513689600,MIN,MIN ; 1154047404513689600,MAX,MAX), (1157425104234217472,
|
||||
MIN,MIN ; 1157425104234217472,MAX,MAX), (1170935903116328960,MIN,MIN ; 1170935903116328960,MAX,MAX), (1224979098644774912,MIN,MIN ; 1224979098644774912,
|
||||
MAX,MAX), (1441151880758558720,MIN,MIN ; 1441151880758558720,MAX,MAX), (1152921504606846976,MIN,MIN ; 1152921504606846976,MAX,MAX)
|
||||
explain select /*+ parallel(3) */ count(*) from geo_maxpt_coords_100y where st_intersects(geo_maxpt_coords_100y.geo_pwkt, st_geomfromtext('polygon((0 0,5 0,5 5,0 5,0 0))', 0));
|
||||
Query Plan
|
||||
========================================================================================
|
||||
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
|
||||
----------------------------------------------------------------------------------------
|
||||
|0 |SCALAR GROUP BY | |1 |32285 |
|
||||
|1 |└─PX COORDINATOR | |1 |32285 |
|
||||
|2 | └─EXCHANGE OUT DISTR |:EX10000 |1 |32285 |
|
||||
|3 | └─MERGE GROUP BY | |1 |32285 |
|
||||
|4 | └─PX PARTITION ITERATOR| |1 |32285 |
|
||||
|5 | └─TABLE FULL SCAN |geo_maxpt_coords_100y(geo_pwkt)|1 |32285 |
|
||||
========================================================================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([T_FUN_COUNT_SUM(T_FUN_COUNT(*))]), filter(nil)
|
||||
group(nil), agg_func([T_FUN_COUNT_SUM(T_FUN_COUNT(*))])
|
||||
1 - output([T_FUN_COUNT(*)]), filter(nil)
|
||||
2 - output([T_FUN_COUNT(*)]), filter(nil)
|
||||
dop=1
|
||||
3 - output([T_FUN_COUNT(*)]), filter(nil)
|
||||
group(nil), agg_func([T_FUN_COUNT(*)])
|
||||
4 - output(nil), filter(nil)
|
||||
force partition granule
|
||||
5 - output(nil), filter([st_intersects(geo_maxpt_coords_100y.geo_pwkt, st_geomfromtext('polygon((0 0,5 0,5 5,0 5,0 0))', 0))])
|
||||
access([geo_maxpt_coords_100y.__pk_increment], [geo_maxpt_coords_100y.geo_pwkt]), partitions(p[0-255])
|
||||
is_index_back=true, is_global_index=false, filter_before_indexback[false],
|
||||
range_key([geo_maxpt_coords_100y.__cellid_18], [geo_maxpt_coords_100y.__mbr_18], [geo_maxpt_coords_100y.__pk_increment]), range(1152921504606846977,
|
||||
MIN,MIN ; 1152921504606846983,MAX,MAX), (1152921504606846992,MIN,MIN ; 1152921504606846992,MAX,MAX), (1152921504606847040,MIN,MIN ; 1152921504606847040,
|
||||
MAX,MAX), (1152921504606847232,MIN,MIN ; 1152921504606847232,MAX,MAX), (1152921504606848000,MIN,MIN ; 1152921504606848000,MAX,MAX), (1152921504606851072,
|
||||
MIN,MIN ; 1152921504606851072,MAX,MAX), (1152921504606863360,MIN,MIN ; 1152921504606863360,MAX,MAX), (1152921504606912512,MIN,MIN ; 1152921504606912512,
|
||||
MAX,MAX), (1152921504607109120,MIN,MIN ; 1152921504607109120,MAX,MAX), (1152921504607895552,MIN,MIN ; 1152921504607895552,MAX,MAX), (1152921504611041280,
|
||||
MIN,MIN ; 1152921504611041280,MAX,MAX), (1152921504623624192,MIN,MIN ; 1152921504623624192,MAX,MAX), (1152921504673955840,MIN,MIN ; 1152921504673955840,
|
||||
MAX,MAX), (1152921504875282432,MIN,MIN ; 1152921504875282432,MAX,MAX), (1152921505680588800,MIN,MIN ; 1152921505680588800,MAX,MAX), (1152921508901814272,
|
||||
MIN,MIN ; 1152921508901814272,MAX,MAX), (1152921521786716160,MIN,MIN ; 1152921521786716160,MAX,MAX), (1152921573326323712,MIN,MIN ; 1152921573326323712,
|
||||
MAX,MAX), (1152921779484753920,MIN,MIN ; 1152921779484753920,MAX,MAX), (1152922604118474752,MIN,MIN ; 1152922604118474752,MAX,MAX), (1152925902653358080,
|
||||
MIN,MIN ; 1152925902653358080,MAX,MAX), (1152939096792891392,MIN,MIN ; 1152939096792891392,MAX,MAX), (1152991873351024640,MIN,MIN ; 1152991873351024640,
|
||||
MAX,MAX), (1153202979583557632,MIN,MIN ; 1153202979583557632,MAX,MAX), (1154047404513689600,MIN,MIN ; 1154047404513689600,MAX,MAX), (1157425104234217472,
|
||||
MIN,MIN ; 1157425104234217472,MAX,MAX), (1170935903116328960,MIN,MIN ; 1170935903116328960,MAX,MAX), (1224979098644774912,MIN,MIN ; 1224979098644774912,
|
||||
MAX,MAX), (1441151880758558720,MIN,MIN ; 1441151880758558720,MAX,MAX), (1152921504606846976,MIN,MIN ; 1152921504606846976,MAX,MAX)
|
||||
explain select count(*) from geo_maxpt_coords_100y_2 where st_intersects(geo_maxpt_coords_100y_2.geo_pwkt, st_geomfromtext('polygon((0 0,5 0,5 5,0 5,0 0))', 0));
|
||||
Query Plan
|
||||
==============================================================================
|
||||
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
|
||||
------------------------------------------------------------------------------
|
||||
|0 |SCALAR GROUP BY | |1 |155 |
|
||||
|1 |└─TABLE FULL SCAN|geo_maxpt_coords_100y_2(geo_pwkt)|1 |155 |
|
||||
==============================================================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([T_FUN_COUNT(*)]), filter(nil)
|
||||
group(nil), agg_func([T_FUN_COUNT(*)])
|
||||
1 - output(nil), filter([st_intersects(geo_maxpt_coords_100y_2.geo_pwkt, st_geomfromtext('polygon((0 0,5 0,5 5,0 5,0 0))', 0))])
|
||||
access([geo_maxpt_coords_100y_2.__pk_increment], [geo_maxpt_coords_100y_2.geo_pwkt]), partitions(p0)
|
||||
is_index_back=true, is_global_index=false, filter_before_indexback[false],
|
||||
range_key([geo_maxpt_coords_100y_2.__cellid_18], [geo_maxpt_coords_100y_2.__mbr_18], [geo_maxpt_coords_100y_2.__pk_increment]), range(1152921504606846977,
|
||||
MIN,MIN ; 1152921504606846983,MAX,MAX), (1152921504606846992,MIN,MIN ; 1152921504606846992,MAX,MAX), (1152921504606847040,MIN,MIN ; 1152921504606847040,
|
||||
MAX,MAX), (1152921504606847232,MIN,MIN ; 1152921504606847232,MAX,MAX), (1152921504606848000,MIN,MIN ; 1152921504606848000,MAX,MAX), (1152921504606851072,
|
||||
MIN,MIN ; 1152921504606851072,MAX,MAX), (1152921504606863360,MIN,MIN ; 1152921504606863360,MAX,MAX), (1152921504606912512,MIN,MIN ; 1152921504606912512,
|
||||
MAX,MAX), (1152921504607109120,MIN,MIN ; 1152921504607109120,MAX,MAX), (1152921504607895552,MIN,MIN ; 1152921504607895552,MAX,MAX), (1152921504611041280,
|
||||
MIN,MIN ; 1152921504611041280,MAX,MAX), (1152921504623624192,MIN,MIN ; 1152921504623624192,MAX,MAX), (1152921504673955840,MIN,MIN ; 1152921504673955840,
|
||||
MAX,MAX), (1152921504875282432,MIN,MIN ; 1152921504875282432,MAX,MAX), (1152921505680588800,MIN,MIN ; 1152921505680588800,MAX,MAX), (1152921508901814272,
|
||||
MIN,MIN ; 1152921508901814272,MAX,MAX), (1152921521786716160,MIN,MIN ; 1152921521786716160,MAX,MAX), (1152921573326323712,MIN,MIN ; 1152921573326323712,
|
||||
MAX,MAX), (1152921779484753920,MIN,MIN ; 1152921779484753920,MAX,MAX), (1152922604118474752,MIN,MIN ; 1152922604118474752,MAX,MAX), (1152925902653358080,
|
||||
MIN,MIN ; 1152925902653358080,MAX,MAX), (1152939096792891392,MIN,MIN ; 1152939096792891392,MAX,MAX), (1152991873351024640,MIN,MIN ; 1152991873351024640,
|
||||
MAX,MAX), (1153202979583557632,MIN,MIN ; 1153202979583557632,MAX,MAX), (1154047404513689600,MIN,MIN ; 1154047404513689600,MAX,MAX), (1157425104234217472,
|
||||
MIN,MIN ; 1157425104234217472,MAX,MAX), (1170935903116328960,MIN,MIN ; 1170935903116328960,MAX,MAX), (1224979098644774912,MIN,MIN ; 1224979098644774912,
|
||||
MAX,MAX), (1441151880758558720,MIN,MIN ; 1441151880758558720,MAX,MAX), (1152921504606846976,MIN,MIN ; 1152921504606846976,MAX,MAX)
|
||||
explain select /*+ parallel(1) */ count(*) from geo_maxpt_coords_100y_2 where st_intersects(geo_maxpt_coords_100y_2.geo_pwkt, st_geomfromtext('polygon((0 0,5 0,5 5,0 5,0 0))', 0));
|
||||
Query Plan
|
||||
==============================================================================
|
||||
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
|
||||
------------------------------------------------------------------------------
|
||||
|0 |SCALAR GROUP BY | |1 |155 |
|
||||
|1 |└─TABLE FULL SCAN|geo_maxpt_coords_100y_2(geo_pwkt)|1 |155 |
|
||||
==============================================================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([T_FUN_COUNT(*)]), filter(nil)
|
||||
group(nil), agg_func([T_FUN_COUNT(*)])
|
||||
1 - output(nil), filter([st_intersects(geo_maxpt_coords_100y_2.geo_pwkt, st_geomfromtext('polygon((0 0,5 0,5 5,0 5,0 0))', 0))])
|
||||
access([geo_maxpt_coords_100y_2.__pk_increment], [geo_maxpt_coords_100y_2.geo_pwkt]), partitions(p0)
|
||||
is_index_back=true, is_global_index=false, filter_before_indexback[false],
|
||||
range_key([geo_maxpt_coords_100y_2.__cellid_18], [geo_maxpt_coords_100y_2.__mbr_18], [geo_maxpt_coords_100y_2.__pk_increment]), range(1152921504606846977,
|
||||
MIN,MIN ; 1152921504606846983,MAX,MAX), (1152921504606846992,MIN,MIN ; 1152921504606846992,MAX,MAX), (1152921504606847040,MIN,MIN ; 1152921504606847040,
|
||||
MAX,MAX), (1152921504606847232,MIN,MIN ; 1152921504606847232,MAX,MAX), (1152921504606848000,MIN,MIN ; 1152921504606848000,MAX,MAX), (1152921504606851072,
|
||||
MIN,MIN ; 1152921504606851072,MAX,MAX), (1152921504606863360,MIN,MIN ; 1152921504606863360,MAX,MAX), (1152921504606912512,MIN,MIN ; 1152921504606912512,
|
||||
MAX,MAX), (1152921504607109120,MIN,MIN ; 1152921504607109120,MAX,MAX), (1152921504607895552,MIN,MIN ; 1152921504607895552,MAX,MAX), (1152921504611041280,
|
||||
MIN,MIN ; 1152921504611041280,MAX,MAX), (1152921504623624192,MIN,MIN ; 1152921504623624192,MAX,MAX), (1152921504673955840,MIN,MIN ; 1152921504673955840,
|
||||
MAX,MAX), (1152921504875282432,MIN,MIN ; 1152921504875282432,MAX,MAX), (1152921505680588800,MIN,MIN ; 1152921505680588800,MAX,MAX), (1152921508901814272,
|
||||
MIN,MIN ; 1152921508901814272,MAX,MAX), (1152921521786716160,MIN,MIN ; 1152921521786716160,MAX,MAX), (1152921573326323712,MIN,MIN ; 1152921573326323712,
|
||||
MAX,MAX), (1152921779484753920,MIN,MIN ; 1152921779484753920,MAX,MAX), (1152922604118474752,MIN,MIN ; 1152922604118474752,MAX,MAX), (1152925902653358080,
|
||||
MIN,MIN ; 1152925902653358080,MAX,MAX), (1152939096792891392,MIN,MIN ; 1152939096792891392,MAX,MAX), (1152991873351024640,MIN,MIN ; 1152991873351024640,
|
||||
MAX,MAX), (1153202979583557632,MIN,MIN ; 1153202979583557632,MAX,MAX), (1154047404513689600,MIN,MIN ; 1154047404513689600,MAX,MAX), (1157425104234217472,
|
||||
MIN,MIN ; 1157425104234217472,MAX,MAX), (1170935903116328960,MIN,MIN ; 1170935903116328960,MAX,MAX), (1224979098644774912,MIN,MIN ; 1224979098644774912,
|
||||
MAX,MAX), (1441151880758558720,MIN,MIN ; 1441151880758558720,MAX,MAX), (1152921504606846976,MIN,MIN ; 1152921504606846976,MAX,MAX)
|
||||
explain select /*+ parallel(3) */ count(*) from geo_maxpt_coords_100y_2 where st_intersects(geo_maxpt_coords_100y_2.geo_pwkt, st_geomfromtext('polygon((0 0,5 0,5 5,0 5,0 0))', 0));
|
||||
Query Plan
|
||||
==============================================================================
|
||||
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
|
||||
------------------------------------------------------------------------------
|
||||
|0 |SCALAR GROUP BY | |1 |155 |
|
||||
|1 |└─TABLE FULL SCAN|geo_maxpt_coords_100y_2(geo_pwkt)|1 |155 |
|
||||
==============================================================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([T_FUN_COUNT(*)]), filter(nil)
|
||||
group(nil), agg_func([T_FUN_COUNT(*)])
|
||||
1 - output(nil), filter([st_intersects(geo_maxpt_coords_100y_2.geo_pwkt, st_geomfromtext('polygon((0 0,5 0,5 5,0 5,0 0))', 0))])
|
||||
access([geo_maxpt_coords_100y_2.__pk_increment], [geo_maxpt_coords_100y_2.geo_pwkt]), partitions(p0)
|
||||
is_index_back=true, is_global_index=false, filter_before_indexback[false],
|
||||
range_key([geo_maxpt_coords_100y_2.__cellid_18], [geo_maxpt_coords_100y_2.__mbr_18], [geo_maxpt_coords_100y_2.__pk_increment]), range(1152921504606846977,
|
||||
MIN,MIN ; 1152921504606846983,MAX,MAX), (1152921504606846992,MIN,MIN ; 1152921504606846992,MAX,MAX), (1152921504606847040,MIN,MIN ; 1152921504606847040,
|
||||
MAX,MAX), (1152921504606847232,MIN,MIN ; 1152921504606847232,MAX,MAX), (1152921504606848000,MIN,MIN ; 1152921504606848000,MAX,MAX), (1152921504606851072,
|
||||
MIN,MIN ; 1152921504606851072,MAX,MAX), (1152921504606863360,MIN,MIN ; 1152921504606863360,MAX,MAX), (1152921504606912512,MIN,MIN ; 1152921504606912512,
|
||||
MAX,MAX), (1152921504607109120,MIN,MIN ; 1152921504607109120,MAX,MAX), (1152921504607895552,MIN,MIN ; 1152921504607895552,MAX,MAX), (1152921504611041280,
|
||||
MIN,MIN ; 1152921504611041280,MAX,MAX), (1152921504623624192,MIN,MIN ; 1152921504623624192,MAX,MAX), (1152921504673955840,MIN,MIN ; 1152921504673955840,
|
||||
MAX,MAX), (1152921504875282432,MIN,MIN ; 1152921504875282432,MAX,MAX), (1152921505680588800,MIN,MIN ; 1152921505680588800,MAX,MAX), (1152921508901814272,
|
||||
MIN,MIN ; 1152921508901814272,MAX,MAX), (1152921521786716160,MIN,MIN ; 1152921521786716160,MAX,MAX), (1152921573326323712,MIN,MIN ; 1152921573326323712,
|
||||
MAX,MAX), (1152921779484753920,MIN,MIN ; 1152921779484753920,MAX,MAX), (1152922604118474752,MIN,MIN ; 1152922604118474752,MAX,MAX), (1152925902653358080,
|
||||
MIN,MIN ; 1152925902653358080,MAX,MAX), (1152939096792891392,MIN,MIN ; 1152939096792891392,MAX,MAX), (1152991873351024640,MIN,MIN ; 1152991873351024640,
|
||||
MAX,MAX), (1153202979583557632,MIN,MIN ; 1153202979583557632,MAX,MAX), (1154047404513689600,MIN,MIN ; 1154047404513689600,MAX,MAX), (1157425104234217472,
|
||||
MIN,MIN ; 1157425104234217472,MAX,MAX), (1170935903116328960,MIN,MIN ; 1170935903116328960,MAX,MAX), (1224979098644774912,MIN,MIN ; 1224979098644774912,
|
||||
MAX,MAX), (1441151880758558720,MIN,MIN ; 1441151880758558720,MAX,MAX), (1152921504606846976,MIN,MIN ; 1152921504606846976,MAX,MAX)
|
||||
@ -0,0 +1,203 @@
|
||||
# ----------------------------------------------------------------------
|
||||
# Base test of GEOMETRY tyoe.
|
||||
# ----------------------------------------------------------------------
|
||||
# Creating the spatial objects
|
||||
DROP TABLE IF EXISTS gis_point,gis_linestring,gis_polygon,gis_multi_point,
|
||||
gis_multi_linestring,gis_multi_polygon,gis_geometrycollection,gis_geometry;
|
||||
CREATE TABLE gis_point (fid INTEGER NOT NULL PRIMARY KEY, g POINT);
|
||||
CREATE TABLE gis_linestring (fid INTEGER NOT NULL PRIMARY KEY, g LINESTRING);
|
||||
CREATE TABLE gis_polygon (fid INTEGER NOT NULL PRIMARY KEY, g POLYGON);
|
||||
CREATE TABLE gis_multi_point (fid INTEGER NOT NULL PRIMARY KEY, g MULTIPOINT);
|
||||
CREATE TABLE gis_multi_linestring (fid INTEGER NOT NULL PRIMARY KEY, g MULTILINESTRING);
|
||||
CREATE TABLE gis_multi_polygon (fid INTEGER NOT NULL PRIMARY KEY, g MULTIPOLYGON);
|
||||
CREATE TABLE gis_geometrycollection (fid INTEGER NOT NULL PRIMARY KEY, g GEOMETRYCOLLECTION);
|
||||
CREATE TABLE gis_geometry (fid INTEGER NOT NULL PRIMARY KEY, g GEOMETRY);
|
||||
# Displaying the created spatial columns
|
||||
SHOW FIELDS FROM gis_point;
|
||||
Field Type Null Key Default Extra
|
||||
fid int(11) NO PRI NULL
|
||||
g point YES NULL
|
||||
SHOW COLUMNS FROM gis_point;
|
||||
Field Type Null Key Default Extra
|
||||
fid int(11) NO PRI NULL
|
||||
g point YES NULL
|
||||
SHOW FIELDS FROM gis_linestring;
|
||||
Field Type Null Key Default Extra
|
||||
fid int(11) NO PRI NULL
|
||||
g linestring YES NULL
|
||||
SHOW COLUMNS FROM gis_linestring;
|
||||
Field Type Null Key Default Extra
|
||||
fid int(11) NO PRI NULL
|
||||
g linestring YES NULL
|
||||
SHOW FIELDS FROM gis_polygon;
|
||||
Field Type Null Key Default Extra
|
||||
fid int(11) NO PRI NULL
|
||||
g polygon YES NULL
|
||||
SHOW COLUMNS FROM gis_polygon;
|
||||
Field Type Null Key Default Extra
|
||||
fid int(11) NO PRI NULL
|
||||
g polygon YES NULL
|
||||
SHOW FIELDS FROM gis_multi_point;
|
||||
Field Type Null Key Default Extra
|
||||
fid int(11) NO PRI NULL
|
||||
g multipoint YES NULL
|
||||
SHOW COLUMNS FROM gis_multi_point;
|
||||
Field Type Null Key Default Extra
|
||||
fid int(11) NO PRI NULL
|
||||
g multipoint YES NULL
|
||||
SHOW FIELDS FROM gis_multi_linestring;
|
||||
Field Type Null Key Default Extra
|
||||
fid int(11) NO PRI NULL
|
||||
g multilinestring YES NULL
|
||||
SHOW COLUMNS FROM gis_multi_linestring;
|
||||
Field Type Null Key Default Extra
|
||||
fid int(11) NO PRI NULL
|
||||
g multilinestring YES NULL
|
||||
SHOW FIELDS FROM gis_multi_polygon;
|
||||
Field Type Null Key Default Extra
|
||||
fid int(11) NO PRI NULL
|
||||
g multipolygon YES NULL
|
||||
SHOW COLUMNS FROM gis_multi_polygon;
|
||||
Field Type Null Key Default Extra
|
||||
fid int(11) NO PRI NULL
|
||||
g multipolygon YES NULL
|
||||
SHOW FIELDS FROM gis_geometrycollection;
|
||||
Field Type Null Key Default Extra
|
||||
fid int(11) NO PRI NULL
|
||||
g geomcollection YES NULL
|
||||
SHOW COLUMNS FROM gis_geometrycollection;
|
||||
Field Type Null Key Default Extra
|
||||
fid int(11) NO PRI NULL
|
||||
g geomcollection YES NULL
|
||||
SHOW FIELDS FROM gis_geometry;
|
||||
Field Type Null Key Default Extra
|
||||
fid int(11) NO PRI NULL
|
||||
g geometry YES NULL
|
||||
SHOW COLUMNS FROM gis_geometry;
|
||||
Field Type Null Key Default Extra
|
||||
fid int(11) NO PRI NULL
|
||||
g geometry YES NULL
|
||||
# Inserting POINT Geometry Values
|
||||
# Check the parent class hierarchy by inserting all values to the GEOMETRY parent class.
|
||||
INSERT INTO gis_geometry SELECT * FROM gis_point;
|
||||
INSERT INTO gis_geometry SELECT * FROM gis_linestring;
|
||||
INSERT INTO gis_geometry SELECT * FROM gis_polygon;
|
||||
INSERT INTO gis_geometry SELECT * FROM gis_multi_point;
|
||||
INSERT INTO gis_geometry SELECT * FROM gis_multi_linestring;
|
||||
INSERT INTO gis_geometry SELECT * FROM gis_multi_polygon;
|
||||
INSERT INTO gis_geometry SELECT * FROM gis_geometrycollection;
|
||||
# Checking the integrity of the above insert statements
|
||||
SELECT COUNT(g) FROM gis_geometry;
|
||||
COUNT(g)
|
||||
0
|
||||
# Displaying the created spatial columns
|
||||
SHOW FIELDS FROM gis_point;
|
||||
Field Type Null Key Default Extra
|
||||
fid int(11) NO PRI NULL
|
||||
g point YES NULL
|
||||
SHOW FIELDS FROM gis_linestring;
|
||||
Field Type Null Key Default Extra
|
||||
fid int(11) NO PRI NULL
|
||||
g linestring YES NULL
|
||||
SHOW FIELDS FROM gis_polygon;
|
||||
Field Type Null Key Default Extra
|
||||
fid int(11) NO PRI NULL
|
||||
g polygon YES NULL
|
||||
SHOW FIELDS FROM gis_multi_point;
|
||||
Field Type Null Key Default Extra
|
||||
fid int(11) NO PRI NULL
|
||||
g multipoint YES NULL
|
||||
SHOW FIELDS FROM gis_multi_linestring;
|
||||
Field Type Null Key Default Extra
|
||||
fid int(11) NO PRI NULL
|
||||
g multilinestring YES NULL
|
||||
SHOW FIELDS FROM gis_multi_polygon;
|
||||
Field Type Null Key Default Extra
|
||||
fid int(11) NO PRI NULL
|
||||
g multipolygon YES NULL
|
||||
SHOW FIELDS FROM gis_geometrycollection;
|
||||
Field Type Null Key Default Extra
|
||||
fid int(11) NO PRI NULL
|
||||
g geomcollection YES NULL
|
||||
SHOW FIELDS FROM gis_geometry;
|
||||
Field Type Null Key Default Extra
|
||||
fid int(11) NO PRI NULL
|
||||
g geometry YES NULL
|
||||
# Analyzing the spatial objets
|
||||
# Check DDL functionality on GIS datatypes
|
||||
DROP TABLE IF EXISTS tab;
|
||||
CREATE TABLE tab(c1 POINT, c2 LINESTRING, c3 POLYGON, c4 MULTIPOINT,
|
||||
c5 MULTILINESTRING, c6 MULTIPOLYGON, c7 GEOMETRYCOLLECTION, c8 GEOMETRY);
|
||||
SELECT sc.COLUMN_NAME, sc.ORDINAL_POSITION, sc.DATA_TYPE, sc.COLUMN_TYPE
|
||||
FROM information_schema.columns sc INNER JOIN information_schema.tables st
|
||||
ON sc.TABLE_NAME=st.TABLE_NAME WHERE st.TABLE_NAME='tab' ORDER BY sc.COLUMN_NAME;
|
||||
COLUMN_NAME ORDINAL_POSITION DATA_TYPE COLUMN_TYPE
|
||||
c1 1 point point
|
||||
c2 2 linestring linestring
|
||||
c3 3 polygon polygon
|
||||
c4 4 multipoint multipoint
|
||||
c5 5 multilinestring multilinestring
|
||||
c6 6 multipolygon multipolygon
|
||||
c7 7 geomcollection geomcollection
|
||||
c8 8 geometry geometry
|
||||
SET @c1 = ST_GEOMFROMTEXT('POINT(10 10)');
|
||||
SET @c2 = ST_GEOMFROMTEXT('LINESTRING(10 10,20 20,30 30)');
|
||||
SET @c3 = ST_GEOMFROMTEXT('POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4))');
|
||||
SET @c4 = ST_GEOMFROMTEXT('MULTIPOINT(0 0,5 5,10 10,20 20)');
|
||||
SET @c5 = ST_GEOMFROMTEXT('MULTILINESTRING((1 1,2 2,3 3),(10 10,20 20,30 30))');
|
||||
SET @c6 = ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0)),((5 5,5 10,10 10,10 5,5 5)))');
|
||||
SET @c7 = ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))');
|
||||
SET @c8 = ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(1 1), LINESTRING(2 2, 3 3))');
|
||||
# Insert the spatial values
|
||||
INSERT INTO tab VALUES (@c1, @c2, @c3, @c4, @c5, @c6, @c7, @c8);
|
||||
# Check the above inserted values
|
||||
SELECT ST_ASTEXT(c1), ST_ASTEXT(c2), ST_ASTEXT(c3), ST_ASTEXT(c4), ST_ASTEXT(c5), ST_ASTEXT(c6), ST_ASTEXT(c7), ST_ASTEXT(c8) FROM tab;
|
||||
ST_ASTEXT(c1) ST_ASTEXT(c2) ST_ASTEXT(c3) ST_ASTEXT(c4) ST_ASTEXT(c5) ST_ASTEXT(c6) ST_ASTEXT(c7) ST_ASTEXT(c8)
|
||||
POINT(10 10) LINESTRING(10 10,20 20,30 30) POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4)) MULTIPOINT((0 0),(5 5),(10 10),(20 20)) MULTILINESTRING((1 1,2 2,3 3),(10 10,20 20,30 30)) MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0)),((5 5,5 10,10 10,10 5,5 5))) GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10)) GEOMETRYCOLLECTION(POINT(1 1),LINESTRING(2 2,3 3))
|
||||
# Cleanup the table
|
||||
TRUNCATE TABLE tab;
|
||||
# Create another table same as tab
|
||||
DROP TABLE IF EXISTS tab2;
|
||||
CREATE TABLE tab2 AS SELECT * FROM tab;
|
||||
# Check the table definition
|
||||
SHOW CREATE TABLE tab2;
|
||||
Table Create Table
|
||||
tab2 CREATE TABLE `tab2` (
|
||||
`c1` point DEFAULT NULL,
|
||||
`c2` linestring DEFAULT NULL,
|
||||
`c3` polygon DEFAULT NULL,
|
||||
`c4` multipoint DEFAULT NULL,
|
||||
`c5` multilinestring DEFAULT NULL,
|
||||
`c6` multipolygon DEFAULT NULL,
|
||||
`c7` geomcollection DEFAULT NULL,
|
||||
`c8` geometry DEFAULT NULL
|
||||
) DEFAULT CHARSET = utf8mb4 ROW_FORMAT = DYNAMIC COMPRESSION = 'zstd_1.3.8' REPLICA_NUM = 1 BLOCK_SIZE = 16384 USE_BLOOM_FILTER = FALSE TABLET_SIZE = 134217728 PCTFREE = 0
|
||||
# Create a tigger and populate the values into tab2
|
||||
CREATE TRIGGER geom_trigger AFTER INSERT ON tab
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
INSERT INTO tab2 VALUES (@c1, @c2, @c3, @c4, @c5, @c6, @c7, @c8);
|
||||
END|
|
||||
SET @c1 = ST_GEOMFROMTEXT('POINT(10 10)');
|
||||
SET @c2 = ST_GEOMFROMTEXT('LINESTRING(10 10,20 20,30 30)');
|
||||
SET @c3 = ST_GEOMFROMTEXT('POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4))');
|
||||
SET @c4 = ST_GEOMFROMTEXT('MULTIPOINT(0 0,5 5,10 10,20 20)');
|
||||
SET @c5 = ST_GEOMFROMTEXT('MULTILINESTRING((1 1,2 2,3 3),(10 10,20 20,30 30))');
|
||||
SET @c6 = ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0)),((5 5,5 10,10 10,10 5,5 5)))');
|
||||
SET @c7 = ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))');
|
||||
SET @c8 = ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(1 1), LINESTRING(2 2, 3 3))');
|
||||
# Insert the spatial values
|
||||
# Check the values whether populated
|
||||
# Cleaning up the trigger
|
||||
DROP TRIGGER geom_trigger;
|
||||
# Final cleanup
|
||||
DROP TABLE gis_point;
|
||||
DROP TABLE gis_linestring;
|
||||
DROP TABLE gis_polygon;
|
||||
DROP TABLE gis_multi_point;
|
||||
DROP TABLE gis_multi_linestring;
|
||||
DROP TABLE gis_multi_polygon;
|
||||
DROP TABLE gis_geometrycollection;
|
||||
DROP TABLE gis_geometry;
|
||||
DROP TABLE tab;
|
||||
DROP TABLE tab2;
|
||||
@ -0,0 +1,328 @@
|
||||
# ----------------------------------------------------------------------
|
||||
# Test of GEOMETRY NLJ JOIN.
|
||||
# ----------------------------------------------------------------------
|
||||
drop table if exists tgnoindex1, tgnoindex2, tgeom1, tgeom2, ptgeom1, ptgeom2;
|
||||
create table tgnoindex1(g1 geometry not null srid 4326);
|
||||
create table tgnoindex2(g2 geometry not null srid 4326);
|
||||
insert into tgnoindex1 values(ST_GeomFromText('POLYGON((0 0, 5 0, 5 5, 0 5, 0 0))', 4326));
|
||||
insert into tgnoindex1 values(ST_GeomFromText('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))', 4326));
|
||||
insert into tgnoindex1 values(ST_GeomFromText('POLYGON((0 0, 15 0, 15 15, 0 15, 0 0))', 4326));
|
||||
insert into tgnoindex2 values(ST_GEOMFROMTEXT('POINT(6 6)', 4326));
|
||||
insert into tgnoindex2 values(ST_GEOMFROMTEXT('POINT(6 6)', 4326));
|
||||
insert into tgnoindex2 values(ST_GEOMFROMTEXT('POINT(6 6)', 4326));
|
||||
insert into tgnoindex2 values(ST_GEOMFROMTEXT('POINT(6 6)', 4326));
|
||||
insert into tgnoindex2 values(ST_GEOMFROMTEXT('POINT(6 6)', 4326));
|
||||
insert into tgnoindex2 values(ST_GEOMFROMTEXT('POINT(12 12)', 4326));
|
||||
insert into tgnoindex2 values(ST_GEOMFROMTEXT('POINT(12 12)', 4326));
|
||||
insert into tgnoindex2 values(ST_GEOMFROMTEXT('POINT(12 12)', 4326));
|
||||
insert into tgnoindex2 values(ST_GEOMFROMTEXT('POINT(12 12)', 4326));
|
||||
insert into tgnoindex2 values(ST_GEOMFROMTEXT('POINT(12 12)', 4326));
|
||||
select st_astext(tgnoindex1.g1),st_astext(tgnoindex2.g2) from tgnoindex1, tgnoindex2 where st_intersects(tgnoindex1.g1, tgnoindex2.g2);
|
||||
st_astext(tgnoindex1.g1) st_astext(tgnoindex2.g2)
|
||||
POLYGON((0 0,10 0,10 10,0 10,0 0)) POINT(6 6)
|
||||
POLYGON((0 0,15 0,15 15,0 15,0 0)) POINT(6 6)
|
||||
POLYGON((0 0,10 0,10 10,0 10,0 0)) POINT(6 6)
|
||||
POLYGON((0 0,15 0,15 15,0 15,0 0)) POINT(6 6)
|
||||
POLYGON((0 0,10 0,10 10,0 10,0 0)) POINT(6 6)
|
||||
POLYGON((0 0,15 0,15 15,0 15,0 0)) POINT(6 6)
|
||||
POLYGON((0 0,10 0,10 10,0 10,0 0)) POINT(6 6)
|
||||
POLYGON((0 0,15 0,15 15,0 15,0 0)) POINT(6 6)
|
||||
POLYGON((0 0,10 0,10 10,0 10,0 0)) POINT(6 6)
|
||||
POLYGON((0 0,15 0,15 15,0 15,0 0)) POINT(6 6)
|
||||
POLYGON((0 0,15 0,15 15,0 15,0 0)) POINT(12 12)
|
||||
POLYGON((0 0,15 0,15 15,0 15,0 0)) POINT(12 12)
|
||||
POLYGON((0 0,15 0,15 15,0 15,0 0)) POINT(12 12)
|
||||
POLYGON((0 0,15 0,15 15,0 15,0 0)) POINT(12 12)
|
||||
POLYGON((0 0,15 0,15 15,0 15,0 0)) POINT(12 12)
|
||||
explain extended_noaddr select * from tgnoindex1, tgnoindex2 where st_intersects(tgnoindex1.g1, tgnoindex2.g2);
|
||||
Query Plan
|
||||
=========================================================
|
||||
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
|
||||
---------------------------------------------------------
|
||||
|0 |NESTED-LOOP JOIN | |8 |582 |
|
||||
|1 |├─TABLE FULL SCAN |tgnoindex2|10 |3 |
|
||||
|2 |└─MATERIAL | |3 |3 |
|
||||
|3 | └─TABLE FULL SCAN|tgnoindex1|3 |3 |
|
||||
=========================================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([tgnoindex1.g1], [tgnoindex2.g2]), filter(nil)
|
||||
conds([BOOL(st_intersects(tgnoindex1.g1, tgnoindex2.g2))]), nl_params_(nil), use_batch=false
|
||||
1 - output([tgnoindex2.g2]), filter(nil)
|
||||
access([tgnoindex2.g2]), partitions(p0)
|
||||
is_index_back=false, is_global_index=false,
|
||||
range_key([tgnoindex2.__pk_increment]), range(MIN ; MAX)always true
|
||||
2 - output([tgnoindex1.g1]), filter(nil)
|
||||
3 - output([tgnoindex1.g1]), filter(nil)
|
||||
access([tgnoindex1.g1]), partitions(p0)
|
||||
is_index_back=false, is_global_index=false,
|
||||
range_key([tgnoindex1.__pk_increment]), range(MIN ; MAX)always true
|
||||
Used Hint:
|
||||
-------------------------------------
|
||||
/*+
|
||||
|
||||
*/
|
||||
Qb name trace:
|
||||
-------------------------------------
|
||||
stmt_id:0, stmt_type:T_EXPLAIN
|
||||
stmt_id:1, SEL$1
|
||||
Outline Data:
|
||||
-------------------------------------
|
||||
/*+
|
||||
BEGIN_OUTLINE_DATA
|
||||
LEADING(@"SEL$1" ("test"."tgnoindex2"@"SEL$1" "test"."tgnoindex1"@"SEL$1"))
|
||||
USE_NL(@"SEL$1" "test"."tgnoindex1"@"SEL$1")
|
||||
USE_NL_MATERIALIZATION(@"SEL$1" "test"."tgnoindex1"@"SEL$1")
|
||||
FULL(@"SEL$1" "test"."tgnoindex2"@"SEL$1")
|
||||
FULL(@"SEL$1" "test"."tgnoindex1"@"SEL$1")
|
||||
OPTIMIZER_FEATURES_ENABLE('4.0.0.0')
|
||||
END_OUTLINE_DATA
|
||||
*/
|
||||
Optimization Info:
|
||||
-------------------------------------
|
||||
tgnoindex2:
|
||||
table_rows:10
|
||||
physical_range_rows:10
|
||||
logical_range_rows:10
|
||||
index_back_rows:0
|
||||
output_rows:10
|
||||
table_dop:1
|
||||
dop_method:Table DOP
|
||||
avaiable_index_name:[tgnoindex2]
|
||||
stats version:0
|
||||
dynamic sampling level:1
|
||||
tgnoindex1:
|
||||
table_rows:3
|
||||
physical_range_rows:3
|
||||
logical_range_rows:3
|
||||
index_back_rows:0
|
||||
output_rows:3
|
||||
table_dop:1
|
||||
dop_method:Table DOP
|
||||
avaiable_index_name:[tgnoindex1]
|
||||
stats version:0
|
||||
dynamic sampling level:1
|
||||
Plan Type:
|
||||
LOCAL
|
||||
Note:
|
||||
Degree of Parallelisim is 1 because of table property
|
||||
create table tgeom1(g1 geometry not null srid 4326);
|
||||
create index gidx1 on tgeom1(g1);
|
||||
create table tgeom2(g2 geometry not null srid 4326);
|
||||
create index gidx2 on tgeom2(g2);
|
||||
insert into tgeom1 values(ST_GeomFromText('POLYGON((0 0, 5 0, 5 5, 0 5, 0 0))', 4326));
|
||||
insert into tgeom1 values(ST_GeomFromText('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))', 4326));
|
||||
insert into tgeom1 values(ST_GeomFromText('POLYGON((0 0, 15 0, 15 15, 0 15, 0 0))', 4326));
|
||||
insert into tgeom2 values(ST_GEOMFROMTEXT('POINT(6 6)', 4326));
|
||||
insert into tgeom2 values(ST_GEOMFROMTEXT('POINT(6 6)', 4326));
|
||||
insert into tgeom2 values(ST_GEOMFROMTEXT('POINT(6 6)', 4326));
|
||||
insert into tgeom2 values(ST_GEOMFROMTEXT('POINT(6 6)', 4326));
|
||||
insert into tgeom2 values(ST_GEOMFROMTEXT('POINT(6 6)', 4326));
|
||||
insert into tgeom2 values(ST_GEOMFROMTEXT('POINT(12 12)', 4326));
|
||||
insert into tgeom2 values(ST_GEOMFROMTEXT('POINT(12 12)', 4326));
|
||||
insert into tgeom2 values(ST_GEOMFROMTEXT('POINT(12 12)', 4326));
|
||||
insert into tgeom2 values(ST_GEOMFROMTEXT('POINT(12 12)', 4326));
|
||||
insert into tgeom2 values(ST_GEOMFROMTEXT('POINT(12 12)', 4326));
|
||||
select st_astext(tgeom1.g1),st_astext(tgeom2.g2) from tgeom1, tgeom2 where st_intersects(tgeom1.g1, tgeom2.g2);
|
||||
st_astext(tgeom1.g1) st_astext(tgeom2.g2)
|
||||
POLYGON((0 0,10 0,10 10,0 10,0 0)) POINT(6 6)
|
||||
POLYGON((0 0,10 0,10 10,0 10,0 0)) POINT(6 6)
|
||||
POLYGON((0 0,10 0,10 10,0 10,0 0)) POINT(6 6)
|
||||
POLYGON((0 0,10 0,10 10,0 10,0 0)) POINT(6 6)
|
||||
POLYGON((0 0,10 0,10 10,0 10,0 0)) POINT(6 6)
|
||||
POLYGON((0 0,15 0,15 15,0 15,0 0)) POINT(6 6)
|
||||
POLYGON((0 0,15 0,15 15,0 15,0 0)) POINT(6 6)
|
||||
POLYGON((0 0,15 0,15 15,0 15,0 0)) POINT(6 6)
|
||||
POLYGON((0 0,15 0,15 15,0 15,0 0)) POINT(6 6)
|
||||
POLYGON((0 0,15 0,15 15,0 15,0 0)) POINT(6 6)
|
||||
POLYGON((0 0,15 0,15 15,0 15,0 0)) POINT(12 12)
|
||||
POLYGON((0 0,15 0,15 15,0 15,0 0)) POINT(12 12)
|
||||
POLYGON((0 0,15 0,15 15,0 15,0 0)) POINT(12 12)
|
||||
POLYGON((0 0,15 0,15 15,0 15,0 0)) POINT(12 12)
|
||||
POLYGON((0 0,15 0,15 15,0 15,0 0)) POINT(12 12)
|
||||
explain extended_noaddr select * from tgeom1, tgeom2 where st_intersects(tgeom1.g1, tgeom2.g2);
|
||||
Query Plan
|
||||
======================================================================
|
||||
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
|
||||
----------------------------------------------------------------------
|
||||
|0 |NESTED-LOOP JOIN | |8 |108 |
|
||||
|1 |├─TABLE FULL SCAN |tgeom1 |3 |3 |
|
||||
|2 |└─DISTRIBUTED TABLE FULL SCAN|tgeom2(gidx2)|3 |35 |
|
||||
======================================================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([tgeom1.g1], [tgeom2.g2]), filter(nil)
|
||||
conds(nil), nl_params_([tgeom1.g1(:0)]), use_batch=false
|
||||
1 - output([tgeom1.g1]), filter(nil)
|
||||
access([tgeom1.g1]), partitions(p0)
|
||||
is_index_back=false, is_global_index=false,
|
||||
range_key([tgeom1.__pk_increment]), range(MIN ; MAX)always true
|
||||
2 - output([tgeom2.g2]), filter([BOOL(st_intersects(:0, tgeom2.g2))])
|
||||
access([tgeom2.__pk_increment], [tgeom2.g2]), partitions(p0)
|
||||
is_index_back=true, is_global_index=false, filter_before_indexback[false],
|
||||
range_key([tgeom2.__cellid_16], [tgeom2.__mbr_16], [tgeom2.__pk_increment]), range(MIN ; MAX)
|
||||
Used Hint:
|
||||
-------------------------------------
|
||||
/*+
|
||||
|
||||
*/
|
||||
Qb name trace:
|
||||
-------------------------------------
|
||||
stmt_id:0, stmt_type:T_EXPLAIN
|
||||
stmt_id:1, SEL$1
|
||||
Outline Data:
|
||||
-------------------------------------
|
||||
/*+
|
||||
BEGIN_OUTLINE_DATA
|
||||
LEADING(@"SEL$1" ("test"."tgeom1"@"SEL$1" "test"."tgeom2"@"SEL$1"))
|
||||
USE_NL(@"SEL$1" "test"."tgeom2"@"SEL$1")
|
||||
FULL(@"SEL$1" "test"."tgeom1"@"SEL$1")
|
||||
INDEX(@"SEL$1" "test"."tgeom2"@"SEL$1" "gidx2")
|
||||
USE_DAS(@"SEL$1" "test"."tgeom2"@"SEL$1")
|
||||
OPTIMIZER_FEATURES_ENABLE('4.0.0.0')
|
||||
END_OUTLINE_DATA
|
||||
*/
|
||||
Optimization Info:
|
||||
-------------------------------------
|
||||
tgeom1:
|
||||
table_rows:3
|
||||
physical_range_rows:3
|
||||
logical_range_rows:3
|
||||
index_back_rows:0
|
||||
output_rows:3
|
||||
table_dop:1
|
||||
dop_method:Table DOP
|
||||
avaiable_index_name:[gidx1, tgeom1]
|
||||
pruned_index_name:[gidx1]
|
||||
stats version:0
|
||||
dynamic sampling level:1
|
||||
tgeom2:
|
||||
table_rows:10
|
||||
physical_range_rows:2
|
||||
logical_range_rows:2
|
||||
index_back_rows:2
|
||||
output_rows:2
|
||||
table_dop:1
|
||||
dop_method:DAS DOP
|
||||
avaiable_index_name:[gidx2, tgeom2]
|
||||
stats version:0
|
||||
dynamic sampling level:1
|
||||
Plan Type:
|
||||
LOCAL
|
||||
Note:
|
||||
Degree of Parallelisim is 1 because of table property
|
||||
create table ptgeom1(c1 int, g1 geometry not null srid 4326) partition by hash(c1) partitions 3;
|
||||
create index pgidx1 on ptgeom1(g1) local;
|
||||
create table ptgeom2(c2 int, g2 geometry not null srid 4326) partition by hash(c2) partitions 3;
|
||||
create index pgidx2 on ptgeom2(g2) local;
|
||||
insert into ptgeom1 values(1, ST_GeomFromText('POLYGON((0 0, 5 0, 5 5, 0 5, 0 0))', 4326));
|
||||
insert into ptgeom1 values(2, ST_GeomFromText('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))', 4326));
|
||||
insert into ptgeom1 values(3, ST_GeomFromText('POLYGON((0 0, 15 0, 15 15, 0 15, 0 0))', 4326));
|
||||
insert into ptgeom2 values(1, ST_GEOMFROMTEXT('POINT(6 6)', 4326));
|
||||
insert into ptgeom2 values(2, ST_GEOMFROMTEXT('POINT(6 6)', 4326));
|
||||
insert into ptgeom2 values(3, ST_GEOMFROMTEXT('POINT(6 6)', 4326));
|
||||
insert into ptgeom2 values(4, ST_GEOMFROMTEXT('POINT(6 6)', 4326));
|
||||
insert into ptgeom2 values(5, ST_GEOMFROMTEXT('POINT(6 6)', 4326));
|
||||
insert into ptgeom2 values(6, ST_GEOMFROMTEXT('POINT(12 12)', 4326));
|
||||
insert into ptgeom2 values(7, ST_GEOMFROMTEXT('POINT(12 12)', 4326));
|
||||
insert into ptgeom2 values(8, ST_GEOMFROMTEXT('POINT(12 12)', 4326));
|
||||
insert into ptgeom2 values(9, ST_GEOMFROMTEXT('POINT(12 12)', 4326));
|
||||
insert into ptgeom2 values(10, ST_GEOMFROMTEXT('POINT(12 12)', 4326));
|
||||
select st_astext(ptgeom1.g1),st_astext(ptgeom2.g2) from ptgeom1, ptgeom2 where st_intersects(ptgeom1.g1, ptgeom2.g2) order by c1,c2;
|
||||
st_astext(ptgeom1.g1) st_astext(ptgeom2.g2)
|
||||
POLYGON((0 0,10 0,10 10,0 10,0 0)) POINT(6 6)
|
||||
POLYGON((0 0,10 0,10 10,0 10,0 0)) POINT(6 6)
|
||||
POLYGON((0 0,10 0,10 10,0 10,0 0)) POINT(6 6)
|
||||
POLYGON((0 0,10 0,10 10,0 10,0 0)) POINT(6 6)
|
||||
POLYGON((0 0,10 0,10 10,0 10,0 0)) POINT(6 6)
|
||||
POLYGON((0 0,15 0,15 15,0 15,0 0)) POINT(6 6)
|
||||
POLYGON((0 0,15 0,15 15,0 15,0 0)) POINT(6 6)
|
||||
POLYGON((0 0,15 0,15 15,0 15,0 0)) POINT(6 6)
|
||||
POLYGON((0 0,15 0,15 15,0 15,0 0)) POINT(6 6)
|
||||
POLYGON((0 0,15 0,15 15,0 15,0 0)) POINT(6 6)
|
||||
POLYGON((0 0,15 0,15 15,0 15,0 0)) POINT(12 12)
|
||||
POLYGON((0 0,15 0,15 15,0 15,0 0)) POINT(12 12)
|
||||
POLYGON((0 0,15 0,15 15,0 15,0 0)) POINT(12 12)
|
||||
POLYGON((0 0,15 0,15 15,0 15,0 0)) POINT(12 12)
|
||||
POLYGON((0 0,15 0,15 15,0 15,0 0)) POINT(12 12)
|
||||
explain extended_noaddr select * from ptgeom1, ptgeom2 where st_intersects(ptgeom1.g1, ptgeom2.g2);
|
||||
Query Plan
|
||||
============================================================================
|
||||
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
|
||||
----------------------------------------------------------------------------
|
||||
|0 |PX COORDINATOR | |8 |275 |
|
||||
|1 |└─EXCHANGE OUT DISTR |:EX10000 |8 |262 |
|
||||
|2 | └─NESTED-LOOP JOIN | |8 |233 |
|
||||
|3 | ├─PX PARTITION ITERATOR | |3 |7 |
|
||||
|4 | │ └─TABLE FULL SCAN |ptgeom1 |3 |7 |
|
||||
|5 | └─DISTRIBUTED TABLE FULL SCAN|ptgeom2(pgidx2)|3 |75 |
|
||||
============================================================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([INTERNAL_FUNCTION(ptgeom1.c1, ptgeom1.g1, ptgeom2.c2, ptgeom2.g2)]), filter(nil)
|
||||
1 - output([INTERNAL_FUNCTION(ptgeom1.c1, ptgeom1.g1, ptgeom2.c2, ptgeom2.g2)]), filter(nil)
|
||||
dop=1
|
||||
2 - output([ptgeom1.g1], [ptgeom1.c1], [ptgeom2.c2], [ptgeom2.g2]), filter(nil)
|
||||
conds(nil), nl_params_([ptgeom1.g1(:0)]), use_batch=false
|
||||
3 - output([ptgeom1.c1], [ptgeom1.g1]), filter(nil)
|
||||
force partition granule
|
||||
4 - output([ptgeom1.c1], [ptgeom1.g1]), filter(nil)
|
||||
access([ptgeom1.c1], [ptgeom1.g1]), partitions(p[0-2])
|
||||
is_index_back=false, is_global_index=false,
|
||||
range_key([ptgeom1.__pk_increment]), range(MIN ; MAX)always true
|
||||
5 - output([ptgeom2.c2], [ptgeom2.g2]), filter([BOOL(st_intersects(:0, ptgeom2.g2))])
|
||||
access([ptgeom2.__pk_increment], [ptgeom2.c2], [ptgeom2.g2]), partitions(p[0-2])
|
||||
is_index_back=true, is_global_index=false, filter_before_indexback[false],
|
||||
range_key([ptgeom2.__cellid_17], [ptgeom2.__mbr_17], [ptgeom2.__pk_increment]), range(MIN ; MAX)
|
||||
Used Hint:
|
||||
-------------------------------------
|
||||
/*+
|
||||
|
||||
*/
|
||||
Qb name trace:
|
||||
-------------------------------------
|
||||
stmt_id:0, stmt_type:T_EXPLAIN
|
||||
stmt_id:1, SEL$1
|
||||
Outline Data:
|
||||
-------------------------------------
|
||||
/*+
|
||||
BEGIN_OUTLINE_DATA
|
||||
LEADING(@"SEL$1" ("test"."ptgeom1"@"SEL$1" "test"."ptgeom2"@"SEL$1"))
|
||||
USE_NL(@"SEL$1" "test"."ptgeom2"@"SEL$1")
|
||||
PQ_DISTRIBUTE(@"SEL$1" "test"."ptgeom2"@"SEL$1" NONE ALL)
|
||||
FULL(@"SEL$1" "test"."ptgeom1"@"SEL$1")
|
||||
INDEX(@"SEL$1" "test"."ptgeom2"@"SEL$1" "pgidx2")
|
||||
USE_DAS(@"SEL$1" "test"."ptgeom2"@"SEL$1")
|
||||
OPTIMIZER_FEATURES_ENABLE('4.0.0.0')
|
||||
END_OUTLINE_DATA
|
||||
*/
|
||||
Optimization Info:
|
||||
-------------------------------------
|
||||
ptgeom1:
|
||||
table_rows:3
|
||||
physical_range_rows:3
|
||||
logical_range_rows:3
|
||||
index_back_rows:0
|
||||
output_rows:3
|
||||
table_dop:1
|
||||
dop_method:Table DOP
|
||||
avaiable_index_name:[pgidx1, ptgeom1]
|
||||
pruned_index_name:[pgidx1]
|
||||
stats version:0
|
||||
dynamic sampling level:1
|
||||
ptgeom2:
|
||||
table_rows:10
|
||||
physical_range_rows:2
|
||||
logical_range_rows:2
|
||||
index_back_rows:2
|
||||
output_rows:2
|
||||
table_dop:1
|
||||
dop_method:DAS DOP
|
||||
avaiable_index_name:[pgidx2, ptgeom2]
|
||||
stats version:0
|
||||
dynamic sampling level:1
|
||||
Plan Type:
|
||||
DISTRIBUTED
|
||||
Note:
|
||||
Degree of Parallelisim is 1 because of table property
|
||||
drop table tgnoindex1, tgnoindex2, tgeom1, tgeom2, ptgeom1, ptgeom2;
|
||||
@ -0,0 +1,300 @@
|
||||
# ----------------------------------------------------------------------
|
||||
# Test of GEOMETRY ST_Area.
|
||||
# ----------------------------------------------------------------------
|
||||
SELECT ST_AREA('');
|
||||
ERROR 22023: Invalid GIS data provided to function st_area.
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('POINT(0 0)'));
|
||||
ERROR 22S01: POLYGON/MULTIPOLYGON value is a geometry of unexpected type POINT in st_area.
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('MULTIPOINT(0 0)'));
|
||||
ERROR 22S01: POLYGON/MULTIPOLYGON value is a geometry of unexpected type MULTIPOINT in st_area.
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('LINESTRING(0 0, 1 0)'));
|
||||
ERROR 22S01: POLYGON/MULTIPOLYGON value is a geometry of unexpected type LINESTRING in st_area.
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('MULTILINESTRING((0 0, 1 0))'));
|
||||
ERROR 22S01: POLYGON/MULTIPOLYGON value is a geometry of unexpected type MULTILINESTRING in st_area.
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION()'));
|
||||
ERROR 22S01: POLYGON/MULTIPOLYGON value is a geometry of unexpected type GEOMETRYCOLLECTION in st_area.
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('POLYGON((0 0, 0 1e308, 1e308 1e308, 0 0))'));
|
||||
ERROR 22003: Result value is out of range in 'st_area'
|
||||
SELECT
|
||||
ROUND(
|
||||
ST_AREA(ST_GEOMFROMTEXT('POLYGON((0 0, 1 0, 1 1, 0 0))', 0)),
|
||||
2
|
||||
) AS area;
|
||||
area
|
||||
0.50
|
||||
SELECT
|
||||
ROUND(
|
||||
ST_AREA(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0, 1 0, 1 1, 0 0)))', 0)),
|
||||
2
|
||||
) AS area;
|
||||
area
|
||||
0.50
|
||||
SELECT
|
||||
ROUND(
|
||||
ST_AREA(ST_GEOMFROMTEXT('POLYGON((0 0, 0 1, 1 1, 0 0))', 4326)),
|
||||
2
|
||||
) AS area;
|
||||
area
|
||||
6154785747.34
|
||||
SELECT
|
||||
ROUND(
|
||||
ST_AREA(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0, 0 1, 1 1, 0 0)))', 4326)),
|
||||
2
|
||||
) AS area;
|
||||
area
|
||||
6154785747.34
|
||||
drop table if exists gis_geometrycollection;
|
||||
CREATE TABLE gis_geometrycollection (fid INTEGER NOT NULL PRIMARY KEY, g GEOMETRY);
|
||||
SET @star_elem_vertical= 'POLYGON((5 0,15 25,25 0,15 5,5 0))';
|
||||
SET @star_elem_horizontal= 'POLYGON((25 0,0 15,30 15,22 10,25 0))';
|
||||
SET @star_center= 'POINT(15 10)';
|
||||
SET @star_top= 'POINT(15 25)';
|
||||
SET @star_bottom_left= 'POINT(5 0)';
|
||||
SET @star_bottom_right= 'POINT(25 0)';
|
||||
SET @star_bottom_points= 'MULTIPOINT(5 0,25 0)';
|
||||
SET @star_all_points= 'MULTIPOINT(5 0,25 0,15 10,15 25)';
|
||||
SET @star_line_horizontal= 'LINESTRING(10 15,20 15)';
|
||||
SET @star_line_vertical= 'LINESTRING(15 5,15 25)';
|
||||
SET @star_top_to_center= 'LINESTRING(15 25,15 10)';
|
||||
SET @star_lines_near_horizontal= 'MULTILINESTRING((25 0,0 15,15 30,0 5))';
|
||||
SET @star_lines_near_vertical= 'MULTILINESTRING((0 5,15 25,0 25))';
|
||||
SET @star= 'POLYGON((5 0,7 10,0 15,10 15,15 25,20 15,30 15,22 10,25 0,15 5,5 0))';
|
||||
SET @star_elem_vertical_val= '((5 0,15 25,25 0,15 5,5 0))';
|
||||
SET @star_elem_horizontal_val= '((25 0,0 15,30 15,22 10,25 0))';
|
||||
SET @star_of_elems='MULTIPOLYGON(((5 0,15 25,25 0,15 5,5 0)),((25 0,0 15,30 15,22 10,25 0)))';
|
||||
SET @star_collection_elems='GEOMETRYCOLLECTION(MULTIPOLYGON(((5 0,15 25,25 0,15 5,5 0)),((25 0,0 15,30 15,22 10,25 0))),POLYGON((5 0,7 10,0 15,10 15,15 25,20 15,30 15,22 10,25 0,15 5,5 0)),LINESTRING(15 25,15 10),MULTIPOINT(5 0,25 0),POINT(15 25))';
|
||||
SET @star_collection_multilinestr='GEOMETRYCOLLECTION(MULTIPOLYGON(((5 0,15 25,25 0,15 5,5 0)),((25 0,0 15,30 15,22 10,25 0))),POLYGON((5 0,7 10,0 15,10 15,15 25,20 15,30 15,22 10,25 0,15 5,5 0)),MULTILINESTRING((25 0,0 15,15 30,0 5)),LINESTRING(15 25,15 10),MULTIPOINT(5 0,25 0),POINT(15 25))';
|
||||
INSERT INTO gis_geometrycollection VALUES
|
||||
(100,ST_GEOMFROMTEXT(@star)),
|
||||
(101,ST_GEOMFROMTEXT(@star_elem_vertical)),
|
||||
(102,ST_GEOMFROMTEXT(@star_elem_horizontal)),
|
||||
(103,ST_GEOMFROMTEXT(@star_of_elems)),
|
||||
(104,ST_GEOMFROMTEXT(@star_top)),
|
||||
(105,ST_GEOMFROMTEXT(@star_center)),
|
||||
(106,ST_GEOMFROMTEXT(@star_bottom_left)),
|
||||
(107,ST_GEOMFROMTEXT(@star_bottom_right)),
|
||||
(108,ST_GEOMFROMTEXT(@star_bottom_points)),
|
||||
(109,ST_GEOMFROMTEXT(@star_all_points)),
|
||||
(110,ST_GEOMFROMTEXT(@star_line_horizontal)),
|
||||
(111,ST_GEOMFROMTEXT(@star_line_vertical)),
|
||||
(112,ST_GEOMFROMTEXT(@star_top_to_center)),
|
||||
(113,ST_GEOMFROMTEXT(@star_lines_near_horizontal)),
|
||||
(114,ST_GEOMFROMTEXT(@star_lines_near_vertical)),
|
||||
(115,ST_GEOMFROMTEXT(@star_collection_elems)),
|
||||
(116,ST_GEOMFROMTEXT(@star_collection_multilinestr)),
|
||||
(200,ST_GEOMFROMTEXT('POLYGON((0 0,6 7,8 8,3 9,0 0),(3 6,4 6,4 7,3 6))')),
|
||||
(201,ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0)), ((2 2,4 5,6 2,2 2)))'));
|
||||
#test ST_AREA POLYGON
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT(@star));
|
||||
ST_AREA(ST_GEOMFROMTEXT(@star))
|
||||
287.5
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT(@star_elem_vertical));
|
||||
ST_AREA(ST_GEOMFROMTEXT(@star_elem_vertical))
|
||||
200
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('POLYGON((0 0,0 5,5 5, 0 0))'));
|
||||
ST_AREA(ST_GEOMFROMTEXT('POLYGON((0 0,0 5,5 5, 0 0))'))
|
||||
12.5
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('POLYGON((0 0,0 10,10 10,10 0,0 0))'));
|
||||
ST_AREA(ST_GEOMFROMTEXT('POLYGON((0 0,0 10,10 10,10 0,0 0))'))
|
||||
100
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('POLYGON((0 0,0 10,10 10,10 0,0 0,-10 0,-10 -10,0 -10, 0 0))'));
|
||||
ST_AREA(ST_GEOMFROMTEXT('POLYGON((0 0,0 10,10 10,10 0,0 0,-10 0,-10 -10,0 -10, 0 0))'))
|
||||
0
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4))'));
|
||||
ST_AREA(ST_GEOMFROMTEXT('POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4))'))
|
||||
96
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('POLYGON((0 0,0 10,10 10,10 0,0 0),(0 0,0 10,10 10,10 0,0 0))'));
|
||||
ST_AREA(ST_GEOMFROMTEXT('POLYGON((0 0,0 10,10 10,10 0,0 0),(0 0,0 10,10 10,10 0,0 0))'))
|
||||
0
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('POLYGON((4 4,4 6,6 6,6 4,4 4),(0 0,0 10,10 10,10 0,0 0))'));
|
||||
ST_AREA(ST_GEOMFROMTEXT('POLYGON((4 4,4 6,6 6,6 4,4 4),(0 0,0 10,10 10,10 0,0 0))'))
|
||||
-96
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('POLYGON((4 4,4 6,6 6,6 4,4 4),(8 8,8 10,10 10,10 8,8 8))'));
|
||||
ST_AREA(ST_GEOMFROMTEXT('POLYGON((4 4,4 6,6 6,6 4,4 4),(8 8,8 10,10 10,10 8,8 8))'))
|
||||
0
|
||||
SELECT ST_AREA(g) FROM gis_geometrycollection WHERE fid=100;
|
||||
ST_AREA(g)
|
||||
287.5
|
||||
SELECT CRC32(ST_Area(g)) FROM gis_geometrycollection WHERE fid=200;
|
||||
CRC32(ST_Area(g))
|
||||
534598600
|
||||
SELECT CRC32(ST_Area(g)) FROM gis_geometrycollection WHERE fid=201;
|
||||
CRC32(ST_Area(g))
|
||||
3832313845
|
||||
#test ST_AREA MULTIPOLYGON
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT(@star_of_elems));
|
||||
ST_AREA(ST_GEOMFROMTEXT(@star_of_elems))
|
||||
377.5
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,0 5,5 5, 0 0)))'));
|
||||
ST_AREA(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,0 5,5 5, 0 0)))'))
|
||||
12.5
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 10,10 0,0 0, 0 10)),((0 0,10 10,10 0, 0 0)))'));
|
||||
ST_AREA(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 10,10 0,0 0, 0 10)),((0 0,10 10,10 0, 0 0)))'))
|
||||
100
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,0 10,10 10, 0 0)),((10 10,10 15,15 15,10 10)))'));
|
||||
ST_AREA(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,0 10,10 10, 0 0)),((10 10,10 15,15 15,10 10)))'))
|
||||
62.5
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)),((4 4,4 6,6 6,6 4, 4 4)))'));
|
||||
ST_AREA(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)),((4 4,4 6,6 6,6 4, 4 4)))'))
|
||||
104
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,0 10,10 10,10 0, 0 0),(4 4,4 6,6 6,6 4, 4 4)))'));
|
||||
ST_AREA(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,0 10,10 10,10 0, 0 0),(4 4,4 6,6 6,6 4, 4 4)))'))
|
||||
96
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(0 0,0 10,10 10,10 0,0 0)))'));
|
||||
ST_AREA(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(0 0,0 10,10 10,10 0,0 0)))'))
|
||||
0
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('MULTIPOLYGON(((4 4,4 6,6 6,6 4,4 4),(0 0,0 10,10 10,10 0,0 0)))'));
|
||||
ST_AREA(ST_GEOMFROMTEXT('MULTIPOLYGON(((4 4,4 6,6 6,6 4,4 4),(0 0,0 10,10 10,10 0,0 0)))'))
|
||||
-96
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('MULTIPOLYGON(((4 4,4 6,6 6,6 4,4 4),(8 8,8 10,10 10,10 8,8 8)))'));
|
||||
ST_AREA(ST_GEOMFROMTEXT('MULTIPOLYGON(((4 4,4 6,6 6,6 4,4 4),(8 8,8 10,10 10,10 8,8 8)))'))
|
||||
0
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('MULTIPOLYGON(((10 10,10 0,5 10,10 10)),((0 10,0 20,5 10,0 10)))'));
|
||||
ST_AREA(ST_GEOMFROMTEXT('MULTIPOLYGON(((10 10,10 0,5 10,10 10)),((0 10,0 20,5 10,0 10)))'))
|
||||
50
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(0 0,0 10,10 10,10 0,0 0)),((0 0,0 10,10 10,10 0,0 0)))'));
|
||||
ST_AREA(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(0 0,0 10,10 10,10 0,0 0)),((0 0,0 10,10 10,10 0,0 0)))'))
|
||||
100
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(0 0,0 10,10 10,10 0,0 0)),((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6, 4 4)))'));
|
||||
ST_AREA(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(0 0,0 10,10 10,10 0,0 0)),((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6, 4 4)))'))
|
||||
98
|
||||
SELECT ST_AREA(g) FROM gis_geometrycollection WHERE fid=103;
|
||||
ST_AREA(g)
|
||||
377.5
|
||||
#test with invalid srid
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT(@star_center,-1024));
|
||||
ERROR 22003: SRID value is out of range in 'st_geomfromtext'
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT(@star_all_points,-1));
|
||||
ERROR 22003: SRID value is out of range in 'st_geomfromtext'
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT(@star_of_elems,4294967296));
|
||||
ERROR 22003: SRID value is out of range in 'st_geomfromtext'
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT(@star_collection_elems,4294967295000));
|
||||
ERROR 22003: SRID value is out of range in 'st_geomfromtext'
|
||||
#test ST_AREA with invalid input
|
||||
SELECT ST_AREA();
|
||||
ERROR 42000: Incorrect parameter count in the call to native function 'ST_AREA'
|
||||
SELECT ST_AREA(NULL);
|
||||
ST_AREA(NULL)
|
||||
NULL
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('POINT()'));
|
||||
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('LINESTRING()'));
|
||||
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('POLYGON(())'));
|
||||
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('MULTIPOINT()'));
|
||||
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('MULTILINESTRING(())'));
|
||||
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('MULTIPOLYGON((()))'));
|
||||
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('POINT(a 0)'));
|
||||
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('POINT(! 0)'));
|
||||
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('POINT('!' 0)'));
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '!' 0)'))' at line 1
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('POINT(12,34 0)'));
|
||||
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('LINESTRING(a 0,10 10)'));
|
||||
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('LINESTRING(0 0,! 10)'));
|
||||
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('LINESTRING('!' 0,10 10)'));
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '!' 0,10 10)'))' at line 1
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('LINESTRING(12,34 0,10 10)'));
|
||||
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('POLYGON((a 0,10 10,10 0,0 0))'));
|
||||
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('POLYGON((0 0,! 10,10 0,0 0))'));
|
||||
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('POLYGON(('!' 0,10 10,10 0,0 0))'));
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '!' 0,10 10,10 0,0 0))'))' at line 1
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('POLYGON((12,34 0,10 10,10 0,0 0))'));
|
||||
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('POLYGON((0 0))'));
|
||||
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('POLYGON((0 0,5 5))'));
|
||||
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('POLYGON((0 0,5 5,10 10))'));
|
||||
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('POLYGON((0 0,0 5,10 10),(0 0))'));
|
||||
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,5 5,10 10)),((10 10)))'));
|
||||
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,5 5,10 10)),((10 10))'));
|
||||
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
|
||||
#test ST_AREA out of range
|
||||
# Assume SRID 10 is not defined.
|
||||
SELECT ST_AREA(x'0A000000010100000000000000000000000000000000000000');
|
||||
ERROR SR001: There's no spatial reference system with SRID 10.
|
||||
# MYSQL Bug#28301552 ASSERTION FAILED: STD::ISFINITE(*RESULT)
|
||||
SELECT ST_Area(
|
||||
POLYGON(
|
||||
LINESTRING(
|
||||
POINT(4.271317e+307,-18656),
|
||||
POINT(-29177,-15475),
|
||||
POINT(8554,3430),
|
||||
POINT(4.271317e+307,-18656)
|
||||
)
|
||||
)
|
||||
);
|
||||
ERROR 22003: Result value is out of range in 'st_area'
|
||||
SELECT ST_Area(POLYGON(
|
||||
LINESTRING(
|
||||
POINT(3006,-15963),
|
||||
POINT(-17919,-15105),
|
||||
POINT(9.466488e+307,1.280303e+308),
|
||||
POINT(3006,-15963)
|
||||
)
|
||||
)
|
||||
);
|
||||
ERROR 22003: Result value is out of range in 'st_area'
|
||||
truncate table gis_geometrycollection;
|
||||
drop table gis_geometrycollection;
|
||||
#other tests
|
||||
#error codes
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('POLYGON((0 0,5 5, 0 0))'));
|
||||
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
|
||||
SET @star_of_elems='MULTIPOLYGON(((5 0,15 25,25 0,15 5,5 0)),((25 0,0 15,30 15,22 10,25 0)))';
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT(@star_of_elems));
|
||||
ST_AREA(ST_GEOMFROMTEXT(@star_of_elems))
|
||||
377.5
|
||||
Select ST_Area(ST_GEOMFROMTEXT('POLYGON((0 0, 30 30, 30 0, 0 5, 0 0, 30 5, 30 0, 0 10, 0 0, 30 10, 30 0, 0 0))')) as Result;
|
||||
Result
|
||||
450
|
||||
Select ST_Area(ST_GEOMFROMTEXT('POLYGON((1 1, 10 1, 1 0, 10 0, 1 -1, 10 -1, 7 2, 7 -2, 4 2, 4 -2, 1 1))')) as Result;
|
||||
Result
|
||||
0
|
||||
drop table if exists tbl_polygon;
|
||||
create table tbl_polygon(id varchar(32), geom GEOMETRY);
|
||||
insert into tbl_polygon (id, geom) values ('POLY1',ST_GeomFromText('POLYGON((0 0,0 10,10 10,10 0,0 0))'));
|
||||
insert into tbl_polygon (id, geom) values ('POLY2',ST_GeomFromText('POLYGON((0 0,0 -10,10 -10,10 0,0 0))'));
|
||||
select 100, st_area(t.geom) from tbl_polygon t where t.id like 'POLY%';
|
||||
100 st_area(t.geom)
|
||||
100 100
|
||||
100 100
|
||||
drop table tbl_polygon;
|
||||
drop table if exists ponds, named_places;
|
||||
CREATE TABLE ponds (
|
||||
fid INTEGER NOT NULL PRIMARY KEY,
|
||||
name VARCHAR(64),
|
||||
type VARCHAR(64),
|
||||
shores GEOMETRY);
|
||||
INSERT INTO ponds VALUES(120, NULL, 'Stock Pond', ST_GEOMFROMTEXT(
|
||||
'MULTIPOLYGON( ( ( 24 44, 22 42, 24 40, 24 44) ), ( ( 26 44, 26 40, 28 42, 26 44) ) )', 0));
|
||||
SELECT ST_Area(shores)
|
||||
FROM ponds
|
||||
WHERE fid = 120;
|
||||
ST_Area(shores)
|
||||
8
|
||||
CREATE TABLE named_places (
|
||||
fid INTEGER NOT NULL PRIMARY KEY,
|
||||
name VARCHAR(64),
|
||||
boundary GEOMETRY);
|
||||
INSERT INTO named_places VALUES(117, 'Ashton', ST_GEOMFROMTEXT('POLYGON( ( 62 48, 84 48, 84 30, 56 30, 56 34, 62 48) )', 0));
|
||||
INSERT INTO named_places VALUES(118, 'Goose Island', ST_GEOMFROMTEXT('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )', 0));
|
||||
SELECT ST_Area(boundary) FROM named_places WHERE name = 'Goose Island';
|
||||
ST_Area(boundary)
|
||||
40
|
||||
drop table ponds, named_places;
|
||||
@ -0,0 +1,424 @@
|
||||
# ----------------------------------------------------------------------
|
||||
# Test of ST_AsText/ST_ASWKT/_st_asewkt.
|
||||
# ----------------------------------------------------------------------
|
||||
SET @wkt_pt = 'POINT(0 0)';
|
||||
SET @wkt_ln = 'LINESTRING(0 0,2 2,4 4,6 6,8 8, 10 10)';
|
||||
SET @wkt_py = 'POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4))';
|
||||
SET @wkt_mpt = 'MULTIPOINT(0 0,2 2,4 4,6 6)';
|
||||
SET @wkt_mln = 'MULTILINESTRING((0 0,2 2,4 4),(6 6,8 8,10 10))';
|
||||
SET @wkt_mpy = 'MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4)),'
|
||||
'((10 10,10 12,12 12,12 10,10 10)))';
|
||||
SET @wkt_gc = 'GEOMETRYCOLLECTION('
|
||||
'POINT(0 0),'
|
||||
'LINESTRING(0 0,10 10),'
|
||||
'POLYGON((0 0,0 10,10 10,10 0, 0 0)),'
|
||||
'MULTIPOINT(0 0,2 2,4 4,6 6,8 8,10 10),'
|
||||
'MULTILINESTRING((0 0,10 10),(0 10,10 0)),'
|
||||
'MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0)),((5 5,5 10,10 10,10 5,5 5))))';
|
||||
SELECT ST_AsText(ST_GeomFromText(@wkt_pt));
|
||||
ST_AsText(ST_GeomFromText(@wkt_pt))
|
||||
POINT(0 0)
|
||||
SELECT ST_AsText(ST_GeomFromText(@wkt_ln));
|
||||
ST_AsText(ST_GeomFromText(@wkt_ln))
|
||||
LINESTRING(0 0,2 2,4 4,6 6,8 8,10 10)
|
||||
SELECT ST_AsText(ST_GeomFromText(@wkt_py));
|
||||
ST_AsText(ST_GeomFromText(@wkt_py))
|
||||
POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4))
|
||||
SELECT ST_AsText(ST_GeomFromText(@wkt_mpt));
|
||||
ST_AsText(ST_GeomFromText(@wkt_mpt))
|
||||
MULTIPOINT((0 0),(2 2),(4 4),(6 6))
|
||||
SELECT ST_AsText(ST_GeomFromText(@wkt_mln));
|
||||
ST_AsText(ST_GeomFromText(@wkt_mln))
|
||||
MULTILINESTRING((0 0,2 2,4 4),(6 6,8 8,10 10))
|
||||
SELECT ST_AsText(ST_GeomFromText(@wkt_mpy));
|
||||
ST_AsText(ST_GeomFromText(@wkt_mpy))
|
||||
MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4)),((10 10,10 12,12 12,12 10,10 10)))
|
||||
SELECT ST_AsText(ST_GeomFromText(@wkt_gc));
|
||||
ST_AsText(ST_GeomFromText(@wkt_gc))
|
||||
GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10),POLYGON((0 0,0 10,10 10,10 0,0 0)),MULTIPOINT((0 0),(2 2),(4 4),(6 6),(8 8),(10 10)),MULTILINESTRING((0 0,10 10),(0 10,10 0)),MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0)),((5 5,5 10,10 10,10 5,5 5))))
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION EMPTY'));
|
||||
ST_ASTEXT(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION EMPTY'))
|
||||
GEOMETRYCOLLECTION EMPTY
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION()'));
|
||||
ST_ASTEXT(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION()'))
|
||||
GEOMETRYCOLLECTION EMPTY
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION()', 4326));
|
||||
ST_ASTEXT(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION()', 4326))
|
||||
GEOMETRYCOLLECTION EMPTY
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMTEXT(' GEOMETRYCOLLECTION EMPTY '));
|
||||
ST_ASTEXT(ST_GEOMFROMTEXT(' GEOMETRYCOLLECTION EMPTY '))
|
||||
GEOMETRYCOLLECTION EMPTY
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMTEXT(
|
||||
'GEOMETRYCOLLECTION(
|
||||
GEOMETRYCOLLECTION(
|
||||
GEOMETRYCOLLECTION EMPTY,
|
||||
GEOMETRYCOLLECTION ()
|
||||
)
|
||||
)'
|
||||
));
|
||||
ST_ASTEXT(ST_GEOMFROMTEXT(
|
||||
'GEOMETRYCOLLECTION(
|
||||
GEOMETRYCOLLECTION(
|
||||
GEOMETRYCOLLECTION EMPTY,
|
||||
GEOMETRYCOLLECTION ()
|
||||
)
|
||||
)'
|
||||
))
|
||||
GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION EMPTY,GEOMETRYCOLLECTION EMPTY))
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMTEXT(
|
||||
'GEOMETRYCOLLECTION(
|
||||
GEOMETRYCOLLECTION(
|
||||
GEOMETRYCOLLECTION ()
|
||||
)
|
||||
)'
|
||||
));
|
||||
ST_ASTEXT(ST_GEOMFROMTEXT(
|
||||
'GEOMETRYCOLLECTION(
|
||||
GEOMETRYCOLLECTION(
|
||||
GEOMETRYCOLLECTION ()
|
||||
)
|
||||
)'
|
||||
))
|
||||
GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION EMPTY))
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMTEXT(
|
||||
'GEOMETRYCOLLECTION(
|
||||
GEOMETRYCOLLECTION(
|
||||
MULTIPOINT((0 0), (1 1)),
|
||||
GEOMETRYCOLLECTION ()
|
||||
)
|
||||
)'
|
||||
));
|
||||
ST_ASTEXT(ST_GEOMFROMTEXT(
|
||||
'GEOMETRYCOLLECTION(
|
||||
GEOMETRYCOLLECTION(
|
||||
MULTIPOINT((0 0), (1 1)),
|
||||
GEOMETRYCOLLECTION ()
|
||||
)
|
||||
)'
|
||||
))
|
||||
GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(MULTIPOINT((0 0),(1 1)),GEOMETRYCOLLECTION EMPTY))
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMTEXT(
|
||||
'GEOMETRYCOLLECTION(
|
||||
GEOMETRYCOLLECTION(
|
||||
MULTIPOINT((0 0), (1 1)),
|
||||
GEOMETRYCOLLECTION ()
|
||||
),
|
||||
GEOMETRYCOLLECTION(
|
||||
MULTIPOINT((0 0), (1 1)),
|
||||
GEOMETRYCOLLECTION ()
|
||||
)
|
||||
)'
|
||||
));
|
||||
ST_ASTEXT(ST_GEOMFROMTEXT(
|
||||
'GEOMETRYCOLLECTION(
|
||||
GEOMETRYCOLLECTION(
|
||||
MULTIPOINT((0 0), (1 1)),
|
||||
GEOMETRYCOLLECTION ()
|
||||
),
|
||||
GEOMETRYCOLLECTION(
|
||||
MULTIPOINT((0 0), (1 1)),
|
||||
GEOMETRYCOLLECTION ()
|
||||
)
|
||||
|
||||
GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(MULTIPOINT((0 0),(1 1)),GEOMETRYCOLLECTION EMPTY),GEOMETRYCOLLECTION(MULTIPOINT((0 0),(1 1)),GEOMETRYCOLLECTION EMPTY))
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(3 5),
|
||||
POLYGON((0 0,10 0,10 10,0 10,0 0)),
|
||||
MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(4 4,4 6,6 6,6 4, 4 4)),
|
||||
((0 0,-2 -2,0 -2, 0 0))))', 4326,'axis-order=long-lat'));
|
||||
ST_ASTEXT(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(3 5),
|
||||
POLYGON((0 0,10 0,10 10,0 10,0 0)),
|
||||
MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(4 4,4 6,6 6,6 4, 4 4)),
|
||||
((0 0,-2 -2,0 -2, 0 0))))', 4326,'axis-order=long-lat'))
|
||||
GEOMETRYCOLLECTION(POINT(5 3),POLYGON((0 0,0 10,10 10,10 0,0 0)),MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6,4 4)),((0 0,-2 -2,-2 0,0 0))))
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(3 5),
|
||||
POLYGON((0 0,0 10,10 10,10 0,0 0)),
|
||||
MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6, 4 4)),
|
||||
((0 0,-2 -2,-2 0, 0 0))))', 4326,'axis-order=lat-long'));
|
||||
ST_ASTEXT(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(3 5),
|
||||
POLYGON((0 0,0 10,10 10,10 0,0 0)),
|
||||
MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6, 4 4)),
|
||||
((0 0,-2 -2,-2 0, 0 0))))', 4326,'axis-order=lat-long'))
|
||||
GEOMETRYCOLLECTION(POINT(3 5),POLYGON((0 0,0 10,10 10,10 0,0 0)),MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6,4 4)),((0 0,-2 -2,-2 0,0 0))))
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(3 5),
|
||||
POLYGON((0 0,0 10,10 10,10 0,0 0)),
|
||||
MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6, 4 4)),
|
||||
((0 0,-2 -2,-2 0, 0 0))))', 4326,'axis-order=srid-defined'));
|
||||
ST_ASTEXT(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(3 5),
|
||||
POLYGON((0 0,0 10,10 10,10 0,0 0)),
|
||||
MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6, 4 4)),
|
||||
((0 0,-2 -2,-2 0, 0 0))))', 4326,'axis-order=srid-defined'))
|
||||
GEOMETRYCOLLECTION(POINT(3 5),POLYGON((0 0,0 10,10 10,10 0,0 0)),MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6,4 4)),((0 0,-2 -2,-2 0,0 0))))
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(3 5),
|
||||
POLYGON((0 0,10 0,10 10,0 10,0 0)),
|
||||
MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(4 4,4 6,6 6,6 4, 4 4)),
|
||||
((0 0,-2 -2,0 -2, 0 0))))', 4326,'axis-order=srid-defined'));
|
||||
ST_ASTEXT(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(3 5),
|
||||
POLYGON((0 0,10 0,10 10,0 10,0 0)),
|
||||
MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(4 4,4 6,6 6,6 4, 4 4)),
|
||||
((0 0,-2 -2,0 -2, 0 0))))', 4326,'axis-order=srid-defined'))
|
||||
GEOMETRYCOLLECTION(POINT(3 5),POLYGON((0 0,10 0,10 10,0 10,0 0)),MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(4 4,4 6,6 6,6 4,4 4)),((0 0,-2 -2,0 -2,0 0))))
|
||||
drop table if exists t;
|
||||
create table t(g geometry NOT NULL);
|
||||
INSERT INTO t (g) VALUES
|
||||
(ST_GeomFromText('POINT(0 0)')),
|
||||
(ST_GeomFromText('POINT(1 1)')),
|
||||
(ST_GeomFromText('POINT(2 2)')),
|
||||
(ST_GeomFromText('POINT(3 3)')),
|
||||
(ST_GeomFromText('POINT(4 4)')),
|
||||
(ST_GeomFromText('POINT(5 5)')),
|
||||
(ST_GeomFromText('POINT(6 6)')),
|
||||
(ST_GeomFromText('POINT(7 7)'));
|
||||
SELECT ST_ASTEXT(g) FROM t;
|
||||
ST_ASTEXT(g)
|
||||
POINT(0 0)
|
||||
POINT(1 1)
|
||||
POINT(2 2)
|
||||
POINT(3 3)
|
||||
POINT(4 4)
|
||||
POINT(5 5)
|
||||
POINT(6 6)
|
||||
POINT(7 7)
|
||||
drop table t;
|
||||
select ST_ASTEXT(x'00000000010100000000000000000000000000000000000000');
|
||||
ST_ASTEXT(x'00000000010100000000000000000000000000000000000000')
|
||||
POINT(0 0)
|
||||
select ST_ASTEXT(x'00000000010500000002000000010200000003000000000000000000000000000000000000000000000000000040000000000000004000000000000010400000000000001040010200000003000000000000000000184000000000000018400000000000002040000000000000204000000000000024400000000000002440');
|
||||
ST_ASTEXT(x'000000000105000000020000000102000000030000000000000000000000000000000000000000000000000000400000000000000040000000000000104000000000000010400102000000030000000000000000001840000000000000184000000000000020400000000000002040000000000000244000000
|
||||
MULTILINESTRING((0 0,2 2,4 4),(6 6,8 8,10 10))
|
||||
select ST_ASWKT(x'00000000010100000000000000000000000000000000000000');
|
||||
ST_ASWKT(x'00000000010100000000000000000000000000000000000000')
|
||||
POINT(0 0)
|
||||
select ST_ASWKT(x'00000000010500000002000000010200000003000000000000000000000000000000000000000000000000000040000000000000004000000000000010400000000000001040010200000003000000000000000000184000000000000018400000000000002040000000000000204000000000000024400000000000002440');
|
||||
ST_ASWKT(x'0000000001050000000200000001020000000300000000000000000000000000000000000000000000000000004000000000000000400000000000001040000000000000104001020000000300000000000000000018400000000000001840000000000000204000000000000020400000000000002440000000
|
||||
MULTILINESTRING((0 0,2 2,4 4),(6 6,8 8,10 10))
|
||||
SELECT ST_ASWKT();
|
||||
ERROR 42000: Incorrect parameter count in the call to native function 'ST_ASWKT'
|
||||
SELECT ST_ASTEXT(NULL);
|
||||
ST_ASTEXT(NULL)
|
||||
NULL
|
||||
SELECT ST_AsText(ST_GeomFromText(@wkt_pt), NULL);
|
||||
ST_AsText(ST_GeomFromText(@wkt_pt), NULL)
|
||||
NULL
|
||||
SELECT ST_ASTEXT();
|
||||
ERROR 42000: Incorrect parameter count in the call to native function 'ST_ASTEXT'
|
||||
SELECT ST_ASTEXT(ST_GeomFromText(@wkt_pt),ST_GeomFromText(@wkt_pt),'axis-order=srid-defin');
|
||||
ERROR 42000: Incorrect parameter count in the call to native function 'st_astext'
|
||||
select ST_ASTEXT(ST_GeomFromText('POINT(1 2)',4326), 'axis-order=lat-long');
|
||||
ST_ASTEXT(ST_GeomFromText('POINT(1 2)',4326), 'axis-order=lat-long')
|
||||
POINT(1 2)
|
||||
select ST_ASTEXT(ST_GeomFromText('POINT(1 2)',4326), 'axis-order=long-lat');
|
||||
ST_ASTEXT(ST_GeomFromText('POINT(1 2)',4326), 'axis-order=long-lat')
|
||||
POINT(2 1)
|
||||
set @p=st_geomfromtext('point(10 -10)', 4326);
|
||||
select st_astext(@p);
|
||||
st_astext(@p)
|
||||
POINT(10 -10)
|
||||
select st_astext(@p);
|
||||
st_astext(@p)
|
||||
POINT(10 -10)
|
||||
select st_astext(@p);
|
||||
st_astext(@p)
|
||||
POINT(10 -10)
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('POINT(0 0)'));
|
||||
ST_ASTEXT(ST_GEOMFROMTEXT('POINT(0 0)'))
|
||||
POINT(0 0)
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('MULTIPOINT(0 0, 2 0)'));
|
||||
ST_ASTEXT(ST_GEOMFROMTEXT('MULTIPOINT(0 0, 2 0)'))
|
||||
MULTIPOINT((0 0),(2 0))
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('MULTIPOINT((0 0), (2 0))'));
|
||||
ST_ASTEXT(ST_GEOMFROMTEXT('MULTIPOINT((0 0), (2 0))'))
|
||||
MULTIPOINT((0 0),(2 0))
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('LINESTRING(0 0, 1 1)'));
|
||||
ST_ASTEXT(ST_GEOMFROMTEXT('LINESTRING(0 0, 1 1)'))
|
||||
LINESTRING(0 0,1 1)
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('MULTILINESTRING((0 0, 2 0))'));
|
||||
ST_ASTEXT(ST_GEOMFROMTEXT('MULTILINESTRING((0 0, 2 0))'))
|
||||
MULTILINESTRING((0 0,2 0))
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('MULTILINESTRING((0 0, 2 0), (1 1, 2 2))'));
|
||||
ST_ASTEXT(ST_GEOMFROMTEXT('MULTILINESTRING((0 0, 2 0), (1 1, 2 2))'))
|
||||
MULTILINESTRING((0 0,2 0),(1 1,2 2))
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('POLYGON((0 0,1 0,1 1,0 1,0 0))'));
|
||||
ST_ASTEXT(ST_GEOMFROMTEXT('POLYGON((0 0,1 0,1 1,0 1,0 0))'))
|
||||
POLYGON((0 0,1 0,1 1,0 1,0 0))
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('POLYGON((0 0,10 0,10 10,0 10,0 0),(2 2,2 5,5 5,5 2,2 2))'));
|
||||
ST_ASTEXT(ST_GEOMFROMTEXT('POLYGON((0 0,10 0,10 10,0 10,0 0),(2 2,2 5,5 5,5 2,2 2))'))
|
||||
POLYGON((0 0,10 0,10 10,0 10,0 0),(2 2,2 5,5 5,5 2,2 2))
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(2 2,2 5,5 5,5 2,2 2)))'));
|
||||
ST_ASTEXT(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(2 2,2 5,5 5,5 2,2 2)))'))
|
||||
MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(2 2,2 5,5 5,5 2,2 2)))
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION EMPTY'));
|
||||
ST_ASTEXT(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION EMPTY'))
|
||||
GEOMETRYCOLLECTION EMPTY
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(2 2,2 5,5 5,5 2,2 2))),POINT(0 0),MULTILINESTRING((0 0, 2 0),(1 1, 2 2)))'));
|
||||
ST_ASTEXT(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(2 2,2 5,5 5,5 2,2 2))),POINT(0 0),MULTILINESTRING((0 0, 2 0),(1 1, 2 2)))'))
|
||||
GEOMETRYCOLLECTION(MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(2 2,2 5,5 5,5 2,2 2))),POINT(0 0),MULTILINESTRING((0 0,2 0),(1 1,2 2)))
|
||||
SELECT _st_asewkt(ST_GEOMFROMTEXT('POINT(0 0)', 4326));
|
||||
_st_asewkt(ST_GEOMFROMTEXT('POINT(0 0)', 4326))
|
||||
SRID=4326;POINT(0 0)
|
||||
SELECT _st_asewkt(ST_GEOMFROMTEXT('MULTIPOINT(0 0, 2 0)', 4326));
|
||||
_st_asewkt(ST_GEOMFROMTEXT('MULTIPOINT(0 0, 2 0)', 4326))
|
||||
SRID=4326;MULTIPOINT((0 0),(0 2))
|
||||
SELECT _st_asewkt(ST_GEOMFROMTEXT('MULTIPOINT((0 0), (2 0))', 4326));
|
||||
_st_asewkt(ST_GEOMFROMTEXT('MULTIPOINT((0 0), (2 0))', 4326))
|
||||
SRID=4326;MULTIPOINT((0 0),(0 2))
|
||||
SELECT _st_asewkt(ST_GEOMFROMTEXT('LINESTRING(0 0, 1 1)', 4326));
|
||||
_st_asewkt(ST_GEOMFROMTEXT('LINESTRING(0 0, 1 1)', 4326))
|
||||
SRID=4326;LINESTRING(0 0,1 1)
|
||||
SELECT _st_asewkt(ST_GEOMFROMTEXT('MULTILINESTRING((0 0, 2 0))', 4326));
|
||||
_st_asewkt(ST_GEOMFROMTEXT('MULTILINESTRING((0 0, 2 0))', 4326))
|
||||
SRID=4326;MULTILINESTRING((0 0,0 2))
|
||||
SELECT _st_asewkt(ST_GEOMFROMTEXT('MULTILINESTRING((0 0, 2 0), (1 1, 2 2))', 4326));
|
||||
_st_asewkt(ST_GEOMFROMTEXT('MULTILINESTRING((0 0, 2 0), (1 1, 2 2))', 4326))
|
||||
SRID=4326;MULTILINESTRING((0 0,0 2),(1 1,2 2))
|
||||
SELECT _st_asewkt(ST_GEOMFROMTEXT('POLYGON((0 0,1 0,1 1,0 1,0 0))', 4326));
|
||||
_st_asewkt(ST_GEOMFROMTEXT('POLYGON((0 0,1 0,1 1,0 1,0 0))', 4326))
|
||||
SRID=4326;POLYGON((0 0,0 1,1 1,1 0,0 0))
|
||||
SELECT _st_asewkt(ST_GEOMFROMTEXT('POLYGON((0 0,10 0,10 10,0 10,0 0),(2 2,2 5,5 5,5 2,2 2))', 4326));
|
||||
_st_asewkt(ST_GEOMFROMTEXT('POLYGON((0 0,10 0,10 10,0 10,0 0),(2 2,2 5,5 5,5 2,2 2))', 4326))
|
||||
SRID=4326;POLYGON((0 0,0 10,10 10,10 0,0 0),(2 2,5 2,5 5,2 5,2 2))
|
||||
SELECT _st_asewkt(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(2 2,2 5,5 5,5 2,2 2)))', 4326));
|
||||
_st_asewkt(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(2 2,2 5,5 5,5 2,2 2)))', 4326))
|
||||
SRID=4326;MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(2 2,5 2,5 5,2 5,2 2)))
|
||||
SELECT _st_asewkt(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION EMPTY', 4326));
|
||||
_st_asewkt(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION EMPTY', 4326))
|
||||
SRID=4326;GEOMETRYCOLLECTION EMPTY
|
||||
SELECT _st_asewkt(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(2 2,2 5,5 5,5 2,2 2))),POINT(0 0),MULTILINESTRING((0 0, 2 0),(1 1, 2 2)))', 4326));
|
||||
_st_asewkt(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(2 2,2 5,5 5,5 2,2 2))),POINT(0 0),MULTILINESTRING((0 0, 2 0),(1 1, 2 2)))', 4326))
|
||||
SRID=4326;GEOMETRYCOLLECTION(MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(2 2,5 2,5 5,2 5,2 2))),POINT(0 0),MULTILINESTRING((0 0,0 2),(1 1,2 2)))
|
||||
SELECT _st_asewkt(ST_GEOMFROMTEXT('POINT(25.416666666666666666666666668 -25.416666666666666666666666668)'), 3);
|
||||
_st_asewkt(ST_GEOMFROMTEXT('POINT(25.416666666666666666666666668 -25.416666666666666666666666668)'), 3)
|
||||
POINT(25.417 -25.417)
|
||||
SELECT _st_asewkt(_ST_GeomFromEWKT('SRID=4269;point(0.1234567898765432123456789 -0.12345678998765432123456789)'));
|
||||
_st_asewkt(_ST_GeomFromEWKT('SRID=4269;point(0.1234567898765432123456789 -0.12345678998765432123456789)'))
|
||||
SRID=4269;POINT(0.123456789876543 -0.123456789987654)
|
||||
SELECT _st_asewkt(_ST_GeomFromEWKT('SRID=4269;POLYGON((0 0.000035379323451,0.000006466490655 0.000008682268431,0.000026970365057 0.000024413715792,0.000151654188725 0.000034529750537,0.00006579467362 -0.00010449622015,-0.000025454219399 -0.000110606436693,-0.000062701646319 -0.000019388332115,0 0.000035379323451)) '),20) t;
|
||||
t
|
||||
SRID=4269;POLYGON((0 0.000035379323451,0.000006466490655 0.000008682268431,0.000026970365057 0.000024413715792,0.000151654188725 0.000034529750537,0.00006579467362 -0.00010449622015,-0.000025454219399 -0.000110606436693,-0.000062701646319 -0.000019388332115,0 0.000035379323451))
|
||||
SELECT _st_asewkt(_ST_GeomFromEWKT('SRID=4269;POLYGON((0.123456789876543212345678987654321 0.123456789876543212345678987654321, 0.123456789876543212345678987654321 0.123456789876543212345678987654321,
|
||||
0.123456789876543212345678987654321 0.123456789876543212345678987654321,
|
||||
0.123456789876543212345678987654321 0.123456789876543212345678987654321)) '),31) t;
|
||||
t
|
||||
SRID=4269;POLYGON((0.12345678987654321 0.12345678987654321,0.12345678987654321 0.12345678987654321,0.12345678987654321 0.12345678987654321,0.12345678987654321 0.12345678987654321))
|
||||
SELECT _st_asewkt(_ST_GeomFromEWKT('SRID=4269;POLYGON((0 0.000035379323451,0.000006466490655 0.000008682268431,0.000026970365057 0.000024413715792,0.000151654188725 0.000034529750537,0.00006579467362 -0.00010449622015,-0.000025454219399 -0.000110606436693,-0.000062701646319 -0.000019388332115,0 0.000035379323451)) '),15.5) t;
|
||||
ERROR HY000: invalid type given for an argument
|
||||
select _st_asewkt(_st_geomfromewkb(x'01010000008C10000000000000008056400000000000806640'));
|
||||
_st_asewkt(_st_geomfromewkb(x'01010000008C10000000000000008056400000000000806640'))
|
||||
POINT(2.093e-320 5.332997387e-315)
|
||||
select _st_asewkt(_st_geomfromewkb(x'01010000002669000000000000008066400000000000805640'));
|
||||
_st_asewkt(_st_geomfromewkb(x'01010000002669000000000000008066400000000000805640'))
|
||||
POINT(1.32993e-319 5.33817804e-315)
|
||||
SELECT _st_asewkt(_ST_GeomFromEWKT('SRID=4269;POLYGON((0 0.000035379323451,0.000006466490655 0.000008682268431,0.000026970365057 0.000024413715792,0.000151654188725 0.000034529750537,0.00006579467362 -0.00010449622015,-0.000025454219399 -0.000110606436693,-0.000062701646319 -0.000019388332115,0 0.000035379323451)) '),1) t;
|
||||
t
|
||||
SRID=4269;POLYGON((0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0))
|
||||
SELECT _st_asewkt(_st_geomfromewkt('srid=4269;point(0.000008682268431 0.000026970365057)'), 3);
|
||||
_st_asewkt(_st_geomfromewkt('srid=4269;point(0.000008682268431 0.000026970365057)'), 3)
|
||||
SRID=4269;POINT(0 0)
|
||||
SELECT _st_asewkt(_ST_GeomFromEWKT('SRID=4269;POLYGON((0 0.000035379323451,0.000006466490655 0.000008682268431,0.000026970365057 0.000024413715792,0.000151654188725 0.000034529750537,0.00006579467362 -0.00010449622015,-0.000025454219399 -0.000110606436693,-0.000062701646319 -0.000019388332115,0 0.000035379323451)) '),4) t;
|
||||
t
|
||||
SRID=4269;POLYGON((0 0,0 0,0 0,0.0002 0,0.0001 -0.0001,0 -0.0001,-0.0001 0,0 0))
|
||||
SELECT _st_asewkt(_ST_GeomFromEWKT('SRID=4269;POLYGON((0 0.000035379323451,0.000006466490655 0.000008682268431,0.000026970365057 0.000024413715792,0.000151654188725 0.000034529750537,0.00006579467362 -0.00010449622015,-0.000025454219399 -0.000110606436693,-0.000062701646319 -0.000019388332115,0 0.000035379323451)) '),7) t;
|
||||
t
|
||||
SRID=4269;POLYGON((0 0.0000354,0.0000065 0.0000087,0.000027 0.0000244,0.0001517 0.0000345,0.0000658 -0.0001045,-0.0000255 -0.0001106,-0.0000627 -0.0000194,0 0.0000354))
|
||||
select _st_asewkt(_st_geomfromewkt('srid=4269;point(1e-15 1e-15)'), 1);
|
||||
_st_asewkt(_st_geomfromewkt('srid=4269;point(1e-15 1e-15)'), 1)
|
||||
SRID=4269;POINT(1e-15 1e-15)
|
||||
select _st_asewkt(_st_geomfromewkt('srid=4269;point(0.1e-15 1e-15)'), 1);
|
||||
_st_asewkt(_st_geomfromewkt('srid=4269;point(0.1e-15 1e-15)'), 1)
|
||||
SRID=4269;POINT(1e-16 1e-15)
|
||||
select _st_asewkt(_st_geomfromewkt('srid=4269;point(1.123456789e-15 1.123456789e-15)'), 1);
|
||||
_st_asewkt(_st_geomfromewkt('srid=4269;point(1.123456789e-15 1.123456789e-15)'), 1)
|
||||
SRID=4269;POINT(1.1e-15 1.1e-15)
|
||||
select _st_asewkt(_st_geomfromewkt('srid=4269;point(1e-6 1e-10)'), 3);
|
||||
_st_asewkt(_st_geomfromewkt('srid=4269;point(1e-6 1e-10)'), 3)
|
||||
SRID=4269;POINT(0 1e-10)
|
||||
select _st_asewkt(_st_geomfromewkt('srid=4269;point(1e-7 1e-10)'));
|
||||
_st_asewkt(_st_geomfromewkt('srid=4269;point(1e-7 1e-10)'))
|
||||
SRID=4269;POINT(0.0000001 1e-10)
|
||||
select _st_asewkt(_st_geomfromewkt('srid=4269;point(7000e-7 1e-10)'),6);
|
||||
_st_asewkt(_st_geomfromewkt('srid=4269;point(7000e-7 1e-10)'),6)
|
||||
SRID=4269;POINT(0.0007 1e-10)
|
||||
select _st_asewkt(_st_geomfromewkt('srid=4269;point(0.7e-7 1e-10)'),8);
|
||||
_st_asewkt(_st_geomfromewkt('srid=4269;point(0.7e-7 1e-10)'),8)
|
||||
SRID=4269;POINT(0.00000007 1e-10)
|
||||
select _st_asewkt(_st_geomfromewkt('point(1.001110000000000000009e-15 1e-16)'));
|
||||
_st_asewkt(_st_geomfromewkt('point(1.001110000000000000009e-15 1e-16)'))
|
||||
POINT(1.00111e-15 1e-16)
|
||||
select _st_asewkt(_st_geomfromewkt('point(1.001110000000000000009e-15 1e-16)'), 3);
|
||||
_st_asewkt(_st_geomfromewkt('point(1.001110000000000000009e-15 1e-16)'), 3)
|
||||
POINT(1.001e-15 1e-16)
|
||||
select _st_asewkt(_st_geomfromewkt('point(1.001110000000000000009e-15 1e-16)'), 2);
|
||||
_st_asewkt(_st_geomfromewkt('point(1.001110000000000000009e-15 1e-16)'), 2)
|
||||
POINT(1e-15 1e-16)
|
||||
select _st_asewkt(_st_geomfromewkt('point(1e-16 1.001410000000000000009e-16)'), 3);
|
||||
_st_asewkt(_st_geomfromewkt('point(1e-16 1.001410000000000000009e-16)'), 3)
|
||||
POINT(1e-16 1.001e-16)
|
||||
select _st_asewkt(_st_geomfromewkt('point(1e-16 1.001510000000000000009e-16)'), 3);
|
||||
_st_asewkt(_st_geomfromewkt('point(1e-16 1.001510000000000000009e-16)'), 3)
|
||||
POINT(1e-16 1.002e-16)
|
||||
select _st_asewkt(st_geomfromtext('point(1 2)',4326,'axis-order=long-lat'));
|
||||
_st_asewkt(st_geomfromtext('point(1 2)',4326,'axis-order=long-lat'))
|
||||
SRID=4326;POINT(1 2)
|
||||
select _st_asewkt(_st_geomfromewkb(_st_asewkb(st_geomfromtext('point(1 1)', 4326))));
|
||||
_st_asewkt(_st_geomfromewkb(_st_asewkb(st_geomfromtext('point(1 1)', 4326))))
|
||||
SRID=4326;POINT(1 1)
|
||||
select st_astext(x'00000000000100000000000000000024C000000000000034C0');
|
||||
ERROR HY000: Geometry byte string must be little endian.
|
||||
select st_astext(x'000000000100000000000000000024C000000000000034C0');
|
||||
ERROR 22023: Invalid GIS data provided to function st_astext.
|
||||
select st_astext(x'00000001010100000000000000000024C000000000000034C0');
|
||||
st_astext(x'00000001010100000000000000000024C000000000000034C0')
|
||||
POINT(-10 -20)
|
||||
Warnings:
|
||||
Warning 3548 There's no spatial reference system with SRID 16777216.
|
||||
select st_astext(x'010100000000000000000024C000000000000034C0');
|
||||
ERROR HY000: Geometry byte string must be little endian.
|
||||
select st_astext(x'00000000010200000000000000000024C000000000000034C0');
|
||||
ERROR 22023: Invalid GIS data provided to function st_astext.
|
||||
select st_astext(x'00000000010300000000000000000024C000000000000034C0');
|
||||
ERROR 22023: Invalid GIS data provided to function st_astext.
|
||||
select st_astext(x'00000000010400000000000000000024C000000000000034C0');
|
||||
ERROR 22023: Invalid GIS data provided to function st_astext.
|
||||
select st_astext(x'00000000010500000000000000000024C000000000000034C0');
|
||||
ERROR 22023: Invalid GIS data provided to function st_astext.
|
||||
select st_astext(x'00000000010600000000000000000024C000000000000034C0');
|
||||
ERROR 22023: Invalid GIS data provided to function st_astext.
|
||||
select st_astext(x'00000000010700000000000000000024C000000000000034C0');
|
||||
ERROR 22023: Invalid GIS data provided to function st_astext.
|
||||
select st_astext(x'00000000010100000003000000010100000000000000000024400000000000002440010100000000000000000024C000000000000034C00102000000020000000000000000002E400000000000002E4000000000000034400000000000003440');
|
||||
ERROR 22023: Invalid GIS data provided to function st_astext.
|
||||
select st_astext(x'0000000001050000000300000001020000000200000000000000000024400000000000002440000000000000344000000000000034400102000000020000000000000000002E400000000000002E400000000000003E400000000000002E40');
|
||||
ERROR 22023: Invalid GIS data provided to function st_astext.
|
||||
SELECT ST_ASTEXT('MULTIPOINT(1 1)');
|
||||
ERROR HY000: Geometry byte string must be little endian.
|
||||
SELECT ST_ASWKT('MULTIPOINT(1 1)');
|
||||
ERROR HY000: Geometry byte string must be little endian.
|
||||
select st_aswkt('');
|
||||
ERROR 22023: Invalid GIS data provided to function st_aswkt.
|
||||
select st_astext('');
|
||||
ERROR 22023: Invalid GIS data provided to function st_astext.
|
||||
select st_aswkb('');
|
||||
ERROR 22023: Invalid GIS data provided to function st_aswkb.
|
||||
drop table if exists gis_point_and_int_with_spatial_index;
|
||||
CREATE TABLE gis_point_and_int_with_spatial_index (fid INTEGER NOT NULL PRIMARY KEY, g POINT NOT NULL SRID 0, a int, index (a) );
|
||||
INSERT INTO gis_point_and_int_with_spatial_index VALUES
|
||||
(101, ST_GEOMFROMTEXT('POINT(10 10)'),1),
|
||||
(102, ST_GEOMFROMTEXT('point(10 20)'),21),
|
||||
(103, ST_GEOMFROMTEXT('point(100 20)'),3),
|
||||
(104, ST_GEOMFROMTEXT('POINT(101 20)'),3);
|
||||
SELECT ST_AsText(g) FROM gis_point_and_int_with_spatial_index WHERE ST_AsText(g) LIKE "%point%";
|
||||
ST_AsText(g)
|
||||
POINT(10 10)
|
||||
POINT(10 20)
|
||||
POINT(100 20)
|
||||
POINT(101 20)
|
||||
drop table gis_point_and_int_with_spatial_index;
|
||||
drop view if exists v;
|
||||
create or replace view v as select cast(Point(0,0) as Multipoint) a;
|
||||
select st_astext(v.a) from v;
|
||||
st_astext(v.a)
|
||||
MULTIPOINT((0 0))
|
||||
drop view v;
|
||||
select st_astext(cast(x'000000000107000000070000000101000000000000000000244000000000000014400102000000020000000000000000002E400000000000002E400000000000003440000000000000344001030000000100000004000000000000000000F03F00000000000000000000000000002440000000000000000000000000000024400000000000002440000000000000F03F000000000000000001040000000200000001010000000000000000000000000000000000000001010000000000000000003440000000000000344001050000000200000001020000000200000000000000000014400000000000002440000000000000144000000000000034400102000000020000000000000000002E4000000000000024400000000000003E400000000000002E4001060000000200000001030000000100000005000000000000000000F03F0000000000000000000000000000244000000000000000000000000000002440000000000000244000000000000000000000000000002440000000000000F03F000000000000000001030000000100000005000000000000000000184000000000000014400000000000001C4000000000000014400000000000001C400000000000001C4000000000000014400000000000001C4000000000000018400000000000001440' as GEOMETRYCOLLECTION));
|
||||
ERROR 22023: Invalid GIS data provided to function cast_as_geometrycollection.
|
||||
select st_astext(ST_GeometryFromWKB(x'0103000000020000000500000000000000000034C00000000000002440000000000000544000000000008056C000000000000054C000000000000034C00000000000000000000000000000544000000000000034C00000000000002440',4326,'axis-order=lat-long'));
|
||||
ERROR 22023: Invalid GIS data provided to function st_geometryfromwkb.
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,416 @@
|
||||
# ----------------------------------------------------------------------
|
||||
# Test of GEOMETRY ST_BESTSRID
|
||||
# ----------------------------------------------------------------------
|
||||
# st_transform is the same as mysql, use _st_transform instead
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-70 0)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-70 0)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-70 0)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-70 0)', 4326))))
|
||||
POINT(0 2221670.8874961706)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(70 0)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(70 0)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(70 0)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(70 0)', 4326))))
|
||||
POINT(385526.28525420243 7768690.108775233)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 180)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 180)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 180)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 180)', 4326))))
|
||||
POINT(667294.8211244522 6655205.483634564)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -180)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -180)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 -180)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -180)', 4326))))
|
||||
POINT(667294.8211244522 6655205.483634564)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 180)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 180)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 180)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 180)', 4326))))
|
||||
POINT(667294.8211244522 3344794.516365436)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -180)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -180)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 -180)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -180)', 4326))))
|
||||
POINT(667294.8211244522 3344794.516365436)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(40 160)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(40 160)', 4326), ST_GeomFromText('POINT(-40 -160)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(40 160)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(40 160)', 4326), ST_GeomFromText('POINT(-40 -160)', 4326))))
|
||||
POINT(17811118.526923772 4838471.398061137)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -177)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -177)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 -177)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -177)', 4326))))
|
||||
POINT(500000 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -171)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -171)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 -171)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -171)', 4326))))
|
||||
POINT(500000 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -165)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -165)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 -165)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -165)', 4326))))
|
||||
POINT(500000 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -159)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -159)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 -159)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -159)', 4326))))
|
||||
POINT(500000 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -153)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -153)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 -153)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -153)', 4326))))
|
||||
POINT(500000 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -147)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -147)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 -147)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -147)', 4326))))
|
||||
POINT(500000 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -141)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -141)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 -141)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -141)', 4326))))
|
||||
POINT(500000 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -135)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -135)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 -135)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -135)', 4326))))
|
||||
POINT(500000 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -129)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -129)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 -129)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -129)', 4326))))
|
||||
POINT(500000 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -123)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -123)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 -123)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -123)', 4326))))
|
||||
POINT(500000 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -117)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -117)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 -117)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -117)', 4326))))
|
||||
POINT(500000 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -111)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -111)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 -111)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -111)', 4326))))
|
||||
POINT(500000 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -105)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -105)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 -105)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -105)', 4326))))
|
||||
POINT(499999.9999999993 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -99)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -99)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 -99)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -99)', 4326))))
|
||||
POINT(499999.9999999993 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -93)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -93)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 -93)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -93)', 4326))))
|
||||
POINT(500000 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -87)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -87)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 -87)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -87)', 4326))))
|
||||
POINT(500000.0000000007 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -81)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -81)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 -81)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -81)', 4326))))
|
||||
POINT(500000 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -75)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -75)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 -75)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -75)', 4326))))
|
||||
POINT(500000 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -69)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -69)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 -69)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -69)', 4326))))
|
||||
POINT(500000 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -63)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -63)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 -63)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -63)', 4326))))
|
||||
POINT(500000 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -57)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -57)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 -57)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -57)', 4326))))
|
||||
POINT(500000.00000000105 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -51)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -51)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 -51)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -51)', 4326))))
|
||||
POINT(500000.0000000007 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -45)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -45)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 -45)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -45)', 4326))))
|
||||
POINT(500000 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -39)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -39)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 -39)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -39)', 4326))))
|
||||
POINT(499999.99999999965 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -33)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -33)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 -33)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -33)', 4326))))
|
||||
POINT(500000.00000000035 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -27)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -27)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 -27)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -27)', 4326))))
|
||||
POINT(500000 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -21)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -21)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 -21)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -21)', 4326))))
|
||||
POINT(499999.9999999995 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -15)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -15)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 -15)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -15)', 4326))))
|
||||
POINT(499999.9999999991 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -9)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -9)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 -9)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -9)', 4326))))
|
||||
POINT(500000 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -3)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -3)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 -3)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -3)', 4326))))
|
||||
POINT(499999.99999999953 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 177)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 177)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 177)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 177)', 4326))))
|
||||
POINT(500000.0000000014 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 171)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 171)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 171)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 171)', 4326))))
|
||||
POINT(500000 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 165)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 165)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 165)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 165)', 4326))))
|
||||
POINT(499999.9999999986 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 159)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 159)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 159)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 159)', 4326))))
|
||||
POINT(500000.0000000014 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 153)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 153)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 153)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 153)', 4326))))
|
||||
POINT(500000 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 147)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 147)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 147)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 147)', 4326))))
|
||||
POINT(500000.00000000285 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 141)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 141)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 141)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 141)', 4326))))
|
||||
POINT(500000 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 135)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 135)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 135)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 135)', 4326))))
|
||||
POINT(500000 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 129)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 129)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 129)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 129)', 4326))))
|
||||
POINT(500000.0000000014 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 123)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 123)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 123)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 123)', 4326))))
|
||||
POINT(500000.0000000014 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 117)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 117)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 117)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 117)', 4326))))
|
||||
POINT(500000 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 111)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 111)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 111)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 111)', 4326))))
|
||||
POINT(500000.00000000215 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 105)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 105)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 105)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 105)', 4326))))
|
||||
POINT(499999.9999999986 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 99)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 99)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 99)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 99)', 4326))))
|
||||
POINT(500000.0000000007 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 93)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 93)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 93)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 93)', 4326))))
|
||||
POINT(499999.9999999986 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 87)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 87)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 87)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 87)', 4326))))
|
||||
POINT(499999.99999999785 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 81)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 81)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 81)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 81)', 4326))))
|
||||
POINT(500000 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 75)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 75)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 75)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 75)', 4326))))
|
||||
POINT(499999.9999999993 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 69)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 69)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 69)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 69)', 4326))))
|
||||
POINT(499999.99999999785 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 63)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 63)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 63)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 63)', 4326))))
|
||||
POINT(500000 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 57)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 57)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 57)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 57)', 4326))))
|
||||
POINT(499999.99999999895 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 51)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 51)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 51)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 51)', 4326))))
|
||||
POINT(500000.0000000007 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 45)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 45)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 45)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 45)', 4326))))
|
||||
POINT(500000 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 39)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 39)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 39)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 39)', 4326))))
|
||||
POINT(500000.00000000035 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 33)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 33)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 33)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 33)', 4326))))
|
||||
POINT(499999.99999999965 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 27)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 27)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 27)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 27)', 4326))))
|
||||
POINT(500000 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 21)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 21)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 21)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 21)', 4326))))
|
||||
POINT(500000.0000000005 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 15)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 15)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 15)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 15)', 4326))))
|
||||
POINT(500000.0000000009 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 9)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 9)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 9)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 9)', 4326))))
|
||||
POINT(500000 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 3)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 3)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(60 3)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 3)', 4326))))
|
||||
POINT(500000.00000000047 6651411.190362714)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -177)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -177)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 -177)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -177)', 4326))))
|
||||
POINT(500000 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -171)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -171)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 -171)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -171)', 4326))))
|
||||
POINT(500000 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -165)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -165)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 -165)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -165)', 4326))))
|
||||
POINT(500000 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -159)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -159)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 -159)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -159)', 4326))))
|
||||
POINT(500000 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -153)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -153)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 -153)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -153)', 4326))))
|
||||
POINT(500000 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -147)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -147)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 -147)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -147)', 4326))))
|
||||
POINT(500000 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -141)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -141)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 -141)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -141)', 4326))))
|
||||
POINT(500000 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -135)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -135)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 -135)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -135)', 4326))))
|
||||
POINT(500000 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -129)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -129)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 -129)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -129)', 4326))))
|
||||
POINT(500000 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -123)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -123)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 -123)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -123)', 4326))))
|
||||
POINT(500000 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -117)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -117)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 -117)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -117)', 4326))))
|
||||
POINT(500000 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -111)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -111)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 -111)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -111)', 4326))))
|
||||
POINT(500000 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -105)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -105)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 -105)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -105)', 4326))))
|
||||
POINT(499999.9999999993 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -99)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -99)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 -99)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -99)', 4326))))
|
||||
POINT(499999.9999999993 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -93)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -93)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 -93)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -93)', 4326))))
|
||||
POINT(500000 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -87)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -87)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 -87)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -87)', 4326))))
|
||||
POINT(500000.0000000007 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -81)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -81)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 -81)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -81)', 4326))))
|
||||
POINT(500000 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -75)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -75)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 -75)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -75)', 4326))))
|
||||
POINT(500000 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -69)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -69)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 -69)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -69)', 4326))))
|
||||
POINT(500000 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -63)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -63)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 -63)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -63)', 4326))))
|
||||
POINT(500000 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -57)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -57)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 -57)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -57)', 4326))))
|
||||
POINT(500000.00000000105 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -51)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -51)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 -51)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -51)', 4326))))
|
||||
POINT(500000.0000000007 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -45)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -45)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 -45)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -45)', 4326))))
|
||||
POINT(500000 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -39)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -39)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 -39)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -39)', 4326))))
|
||||
POINT(499999.99999999965 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -33)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -33)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 -33)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -33)', 4326))))
|
||||
POINT(500000.00000000035 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -27)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -27)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 -27)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -27)', 4326))))
|
||||
POINT(500000 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -21)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -21)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 -21)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -21)', 4326))))
|
||||
POINT(499999.9999999995 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -15)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -15)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 -15)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -15)', 4326))))
|
||||
POINT(499999.9999999991 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -9)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -9)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 -9)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -9)', 4326))))
|
||||
POINT(500000 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -3)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -3)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 -3)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -3)', 4326))))
|
||||
POINT(499999.99999999953 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 177)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 177)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 177)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 177)', 4326))))
|
||||
POINT(500000.0000000014 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 171)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 171)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 171)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 171)', 4326))))
|
||||
POINT(500000 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 165)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 165)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 165)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 165)', 4326))))
|
||||
POINT(499999.9999999986 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 159)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 159)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 159)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 159)', 4326))))
|
||||
POINT(500000.0000000014 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 153)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 153)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 153)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 153)', 4326))))
|
||||
POINT(500000 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 147)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 147)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 147)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 147)', 4326))))
|
||||
POINT(500000.00000000285 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 141)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 141)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 141)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 141)', 4326))))
|
||||
POINT(500000 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 135)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 135)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 135)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 135)', 4326))))
|
||||
POINT(500000 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 129)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 129)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 129)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 129)', 4326))))
|
||||
POINT(500000.0000000014 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 123)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 123)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 123)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 123)', 4326))))
|
||||
POINT(500000.0000000014 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 117)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 117)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 117)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 117)', 4326))))
|
||||
POINT(500000 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 111)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 111)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 111)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 111)', 4326))))
|
||||
POINT(500000.00000000215 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 105)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 105)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 105)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 105)', 4326))))
|
||||
POINT(499999.9999999986 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 99)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 99)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 99)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 99)', 4326))))
|
||||
POINT(500000.0000000007 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 93)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 93)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 93)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 93)', 4326))))
|
||||
POINT(499999.9999999986 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 87)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 87)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 87)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 87)', 4326))))
|
||||
POINT(499999.99999999785 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 81)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 81)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 81)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 81)', 4326))))
|
||||
POINT(500000 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 75)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 75)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 75)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 75)', 4326))))
|
||||
POINT(499999.9999999993 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 69)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 69)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 69)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 69)', 4326))))
|
||||
POINT(499999.99999999785 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 63)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 63)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 63)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 63)', 4326))))
|
||||
POINT(500000 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 57)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 57)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 57)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 57)', 4326))))
|
||||
POINT(499999.99999999895 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 51)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 51)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 51)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 51)', 4326))))
|
||||
POINT(500000.0000000007 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 45)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 45)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 45)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 45)', 4326))))
|
||||
POINT(500000 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 39)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 39)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 39)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 39)', 4326))))
|
||||
POINT(500000.00000000035 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 33)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 33)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 33)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 33)', 4326))))
|
||||
POINT(499999.99999999965 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 27)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 27)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 27)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 27)', 4326))))
|
||||
POINT(500000 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 21)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 21)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 21)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 21)', 4326))))
|
||||
POINT(500000.0000000005 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 15)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 15)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 15)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 15)', 4326))))
|
||||
POINT(500000.0000000009 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 9)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 9)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 9)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 9)', 4326))))
|
||||
POINT(500000 3348588.809637286)
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 3)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 3)', 4326))));
|
||||
st_astext(_st_transform(ST_GeomFromText('point(-60 3)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 3)', 4326))))
|
||||
POINT(500000.00000000047 3348588.809637286)
|
||||
select _st_bestsrid(st_geomfromtext('MULTILINESTRING((0 0,2 2,2 1,0 1),(0 0,1 1,0 0))',4326),null);
|
||||
_st_bestsrid(st_geomfromtext('MULTILINESTRING((0 0,2 2,2 1,0 1),(0 0,1 1,0 0))',4326),null)
|
||||
NULL
|
||||
select _st_bestsrid(null);
|
||||
_st_bestsrid(null)
|
||||
NULL
|
||||
select _st_bestsrid(st_geomfromtext('point(12.321 -32.123)',26918));
|
||||
ERROR 22S00: _st_bestsrid(POINT) has not been implemented for projected spatial reference systems.
|
||||
select _st_bestsrid(st_geomfromtext('GEOMETRYCOLLECTION empty',4326,'axis-order=long-lat'));
|
||||
_st_bestsrid(st_geomfromtext('GEOMETRYCOLLECTION empty',4326,'axis-order=long-lat'))
|
||||
999000
|
||||
drop table if exists shape;
|
||||
create table shape(id int, geo geometry NOT NULL SRID 4326);
|
||||
INSERT INTO shape (id, geo) VALUES
|
||||
(1, ST_GeomFromText('POINT(1 1)', 4326, 'axis-order=long-lat')),
|
||||
(2, ST_GeomFromText('LINESTRING(1 1, 2 2)', 4326, 'axis-order=long-lat')),
|
||||
(3, ST_GeomFromText('POLYGON((1 1, 2 2, 3 0, 1 1))', 4326, 'axis-order=long-lat')),
|
||||
(4, ST_GeomFromText('MULTIPOINT(5 0,2 3,8 7,15 25)', 4326, 'axis-order=long-lat')),
|
||||
(5, ST_GeomFromText('MULTILINESTRING((2.5 0,0 1.5,1.5 3.0,0 5))', 4326, 'axis-order=long-lat')),
|
||||
(6, ST_GeomFromText('MULTIPOLYGON(((5 0,1.5 2.5,2.5 0,1.5 5,5 0)),((2.5 0,0 1.5,3.0 1.5,2.2 1.0,2.5 0)))', 4326, 'axis-order=long-lat')),
|
||||
(7, ST_GeomFromText('GEOMETRYCOLLECTION(MULTIPOLYGON(((5 0,1.5 2.5,2.5 0,1.5 5,5 0)),((2.5 0,0 1.5,3.0 1.5,2.2 1.0,2.5 0))),POLYGON((5 0,7 1.0,0 1.5,1.0 1.5,1.5 2.5,2.0 1.5,3.0 1.5,2.2 1.0,2.5 0,1.5 5,5 0)),LINESTRING(1.5 2.5,1.5 1.0),MULTIPOINT(5 0,2.5 0),POINT(1.5 2.5))', 4326, 'axis-order=long-lat'));
|
||||
select _st_bestsrid(geo) from shape;
|
||||
_st_bestsrid(geo)
|
||||
999031
|
||||
999031
|
||||
999031
|
||||
999000
|
||||
999031
|
||||
999031
|
||||
999229
|
||||
drop table shape;
|
||||
File diff suppressed because one or more lines are too long
@ -0,0 +1,179 @@
|
||||
# ----------------------------------------------------------------------
|
||||
# Test of GEOMETRY _ST_Buffer.
|
||||
# ----------------------------------------------------------------------
|
||||
drop table if exists buffer_transform, geom_operators_test;
|
||||
SELECT 'T2.5', ST_AsText(_ST_Buffer(ST_GeomFromText('GEOMETRYCOLLECTION EMPTY', 4326), 1));
|
||||
T2.5 ST_AsText(_ST_Buffer(ST_GeomFromText('GEOMETRYCOLLECTION EMPTY', 4326), 1))
|
||||
T2.5 GEOMETRYCOLLECTION EMPTY
|
||||
SELECT 'T2.6', ST_AsText(_ST_Buffer(ST_GeomFromText('GEOMETRYCOLLECTION EMPTY'), 1));
|
||||
T2.6 ST_AsText(_ST_Buffer(ST_GeomFromText('GEOMETRYCOLLECTION EMPTY'), 1))
|
||||
T2.6 GEOMETRYCOLLECTION EMPTY
|
||||
SELECT '1', ST_AsText(_ST_Buffer(ST_GeomFromText('POINT(4 0)'), 2, 1));
|
||||
1 ST_AsText(_ST_Buffer(ST_GeomFromText('POINT(4 0)'), 2, 1))
|
||||
1 POLYGON((6 0,3.9999999999999996 2,2 -2.4492935982947064e-16,4 -2,6 0))
|
||||
SELECT 'point quadsegs=2', ST_AsText(_ST_Buffer(ST_GeomFromText('POINT(0 0)'), 1, 'quad_segs=2'));
|
||||
point quadsegs=2 ST_AsText(_ST_Buffer(ST_GeomFromText('POINT(0 0)'), 1, 'quad_segs=2'))
|
||||
point quadsegs=2 POLYGON((1 0,0.7071067811865474 0.7071067811865477,-1.8369701987210297e-16 1,-0.7071067811865477 0.7071067811865475,-1 -1.2246467991473532e-16,-0.7071067811865475 -0.7071067811865476,6.123233995736766e-17 -1,0.7071067811865476 -0.7071067811865475,1 0))
|
||||
SELECT 'point quadsegs=2', ST_AsText(_ST_Buffer(ST_GeomFromText('POINT(0 0)'), 1, ST_Buffer_Strategy('point_circle', 8)));
|
||||
point quadsegs=2 ST_AsText(_ST_Buffer(ST_GeomFromText('POINT(0 0)'), 1, ST_Buffer_Strategy('point_circle', 8)))
|
||||
point quadsegs=2 POLYGON((1 0,0.7071067811865474 0.7071067811865477,-1.8369701987210297e-16 1,-0.7071067811865477 0.7071067811865475,-1 -1.2246467991473532e-16,-0.7071067811865475 -0.7071067811865476,6.123233995736766e-17 -1,0.7071067811865476 -0.7071067811865475,1 0))
|
||||
SELECT 'line quadsegs=2', ST_AsText(_ST_Buffer(ST_GeomFromText('LINESTRING(0 0, 10 0)'), 2));
|
||||
line quadsegs=2 ST_AsText(_ST_Buffer(ST_GeomFromText('LINESTRING(0 0, 10 0)'), 2))
|
||||
line quadsegs=2 POLYGON((0 2,-0.3901806440322521 1.9615705608064617,-0.7653668647301758 1.847759065022575,-1.1111404660392015 1.6629392246050925,-1.4142135623730927 1.4142135623730974,-1.662939224605089 1.1111404660392068,-1.8477590650225726 0.7653668647301818,-1.9615705608064604 0.39018064403225844,-2 0.0000000000000015314274795707798,-1.961570560806461 -0.39018064403225544,-1.8477590650225737 -0.7653668647301789,-1.6629392246050907 -1.1111404660392044,-1.414213562373095 -1.4142135623730951,-1.111140466039204 -1.662939224605091,-0.7653668647301795 -1.8477590650225735,-0.3901806440322564 -1.9615705608064609,0 -2,10 -2,10 -2,10.390180644032256 -1.9615705608064609,10.76536686473018 -1.8477590650225735,11.111140466039204 -1.6629392246050905,11.414213562373096 -1.414213562373095,11.66293922460509 -1.1111404660392044,11.847759065022574 -0.7653668647301796,11.96157056080646 -0.3901806440322565,12 0,11.96157056080646 0.3901806440322565,11.847759065022574 0.7653668647301796,11.66293922460509 1.1111404660392044,11.414213562373096 1.414213562373095,11.111140466039204 1.6629392246050905,10.76536686473018 1.8477590650225735,10.390180644032256 1.9615705608064609,10 2,0 2))
|
||||
# Test for distance = 0
|
||||
SELECT ST_ASTEXT(_ST_BUFFER(ST_GEOMFROMTEXT('POLYGON((0 0,10 0,10 10,0 10,0 0))'), 0));
|
||||
ST_ASTEXT(_ST_BUFFER(ST_GEOMFROMTEXT('POLYGON((0 0,10 0,10 10,0 10,0 0))'), 0))
|
||||
POLYGON((0 0,10 0,10 10,0 10,0 0))
|
||||
SELECT ST_ASTEXT(_ST_BUFFER(ST_GEOMFROMTEXT('POLYGON((0 0,0 10,10 10,10 0,0 0))'), 0));
|
||||
ST_ASTEXT(_ST_BUFFER(ST_GEOMFROMTEXT('POLYGON((0 0,0 10,10 10,10 0,0 0))'), 0))
|
||||
POLYGON((0 0,10 0,10 10,0 10,0 0))
|
||||
SELECT 'line quadsegs=2 endcap=flat', ST_AsText(_ST_Buffer(ST_GeomFromText('LINESTRING(0 0, 10 0)'), 2, 'quad_segs=2 endcap=flat'));
|
||||
line quadsegs=2 endcap=flat ST_AsText(_ST_Buffer(ST_GeomFromText('LINESTRING(0 0, 10 0)'), 2, 'quad_segs=2 endcap=flat'))
|
||||
line quadsegs=2 endcap=flat POLYGON((0 2,0 -2,10 -2,10 -2,10 2,0 2))
|
||||
SELECT 'line quadsegs=2 endcap=butt', ST_AsText(_ST_Buffer(ST_GeomFromText('LINESTRING(0 0, 10 0)'), 2, 'quad_segs=2 endcap=butt'));
|
||||
line quadsegs=2 endcap=butt ST_AsText(_ST_Buffer(ST_GeomFromText('LINESTRING(0 0, 10 0)'), 2, 'quad_segs=2 endcap=butt'))
|
||||
line quadsegs=2 endcap=butt POLYGON((0 2,0 -2,10 -2,10 -2,10 2,0 2))
|
||||
SELECT 'line quadsegs=2 endcap=flat', ST_AsText(_ST_Buffer(ST_GeomFromText('LINESTRING(0 0, 10 0)'), 2, ST_Buffer_Strategy('end_flat')));
|
||||
line quadsegs=2 endcap=flat ST_AsText(_ST_Buffer(ST_GeomFromText('LINESTRING(0 0, 10 0)'), 2, ST_Buffer_Strategy('end_flat')))
|
||||
line quadsegs=2 endcap=flat POLYGON((0 2,0 -2,10 -2,10 -2,10 2,0 2))
|
||||
SELECT 'line join=mitre mitre_limit=1.0 side=both', ST_AsText(_ST_Buffer(ST_GeomFromText('LINESTRING(50 50,150 150,150 50)'),10,'join=mitre mitre_limit=1.0'));
|
||||
line join=mitre mitre_limit=1.0 side=both ST_AsText(_ST_Buffer(ST_GeomFromText('LINESTRING(50 50,150 150,150 50)'),10,'join=mitre mitre_limit=1.0'))
|
||||
line join=mitre mitre_limit=1.0 side=both POLYGON((140 125.85787143148572,140 50,140.1921471959677 48.04909677983872,140.76120467488713 46.17316567634911,141.68530387697456 44.44429766980398,142.92893218813452 42.928932188134524,144.44429766980397 41.685303876974544,146.1731656763491 40.76120467488713,148.04909677983872 40.19214719596769,150 40,151.95090322016128 40.19214719596769,153.8268343236509 40.76120467488713,155.55570233019603 41.685303876974544,157.07106781186548 42.928932188134524,158.31469612302544 44.44429766980398,159.23879532511287 46.1731656763491,159.8078528040323 48.04909677983872,160 50,160 150,153.8268343236509 159.23879532511287,142.92893218813452 157.07106781186548,42.928932188134524 57.071067811865476,41.68530387697456 55.555702330196034,40.76120467488714 53.82683432365091,40.1921471959677 51.950903220161294,40 50.00000000000001,40.19214719596769 48.04909677983872,40.76120467488713 46.17316567634911,41.685303876974544 44.44429766980398,42.928932188134524 42.928932188134524,44.44429766980398 41.685303876974544,46.1731656763491 40.76120467488713,48.04909677983872 40.19214719596769,50 40,51.95090322016128 40.19214719596769,53.8268343236509 40.76120467488713,55.55570233019602 41.685303876974544,57.071067811865476 42.928932188134524,140 125.85787143148572))
|
||||
SELECT 'line join=mitre mitre_limit=1.0 side=both', ST_AsText(_ST_Buffer(ST_GeomFromText('LINESTRING(50 50,150 150,150 50)'),10, ST_Buffer_Strategy('join_miter', 1.0)));
|
||||
line join=mitre mitre_limit=1.0 side=both ST_AsText(_ST_Buffer(ST_GeomFromText('LINESTRING(50 50,150 150,150 50)'),10, ST_Buffer_Strategy('join_miter', 1.0)))
|
||||
line join=mitre mitre_limit=1.0 side=both POLYGON((140 125.85787143148572,140 50,140.1921471959677 48.04909677983872,140.76120467488713 46.17316567634911,141.68530387697456 44.44429766980398,142.92893218813452 42.928932188134524,144.44429766980397 41.685303876974544,146.1731656763491 40.76120467488713,148.04909677983872 40.19214719596769,150 40,151.95090322016128 40.19214719596769,153.8268343236509 40.76120467488713,155.55570233019603 41.685303876974544,157.07106781186548 42.928932188134524,158.31469612302544 44.44429766980398,159.23879532511287 46.1731656763491,159.8078528040323 48.04909677983872,160 50,160 150,153.8268343236509 159.23879532511287,142.92893218813452 157.07106781186548,42.928932188134524 57.071067811865476,41.68530387697456 55.555702330196034,40.76120467488714 53.82683432365091,40.1921471959677 51.950903220161294,40 50.00000000000001,40.19214719596769 48.04909677983872,40.76120467488713 46.17316567634911,41.685303876974544 44.44429766980398,42.928932188134524 42.928932188134524,44.44429766980398 41.685303876974544,46.1731656763491 40.76120467488713,48.04909677983872 40.19214719596769,50 40,51.95090322016128 40.19214719596769,53.8268343236509 40.76120467488713,55.55570233019602 41.685303876974544,57.071067811865476 42.928932188134524,140 125.85787143148572))
|
||||
SELECT 'poly quadsegs=2 join=round', ST_AsText(_ST_Buffer(ST_GeomFromText('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))'), 2, 'quad_segs=2 join=round'));
|
||||
poly quadsegs=2 join=round ST_AsText(_ST_Buffer(ST_GeomFromText('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))'), 2, 'quad_segs=2 join=round'))
|
||||
poly quadsegs=2 join=round POLYGON((-2 0,-1.414213562373095 -1.4142135623730951,0 -2,10 -2,11.414213562373096 -1.414213562373095,12 0,12 10,11.414213562373096 11.414213562373096,10 12,0 12,-1.414213562373095 11.414213562373096,-2 10,-2 0))
|
||||
SELECT 'poly quadsegs=2 join=round', ST_AsText(_ST_Buffer(ST_GeomFromText('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))'), 2, ST_Buffer_Strategy('join_round', 8)));
|
||||
poly quadsegs=2 join=round ST_AsText(_ST_Buffer(ST_GeomFromText('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))'), 2, ST_Buffer_Strategy('join_round', 8)))
|
||||
poly quadsegs=2 join=round POLYGON((-2 0,-1.414213562373095 -1.4142135623730951,0 -2,10 -2,11.414213562373096 -1.414213562373095,12 0,12 10,11.414213562373096 11.414213562373096,10 12,0 12,-1.414213562373095 11.414213562373096,-2 10,-2 0))
|
||||
SELECT 'poly quadsegs=2 join=mitre', ST_AsText(_ST_Buffer(ST_GeomFromText('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))'), 2, 'quad_segs=2 join=mitre'));
|
||||
poly quadsegs=2 join=mitre ST_AsText(_ST_Buffer(ST_GeomFromText('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))'), 2, 'quad_segs=2 join=mitre'))
|
||||
poly quadsegs=2 join=mitre POLYGON((-2 0,-2 -2,0 -2,10 -2,12 -2,12 0,12 10,12 12,10 12,0 12,-2 12,-2 10,-2 0))
|
||||
SELECT 'poly quadsegs=2 join=mitre', ST_AsText(_ST_Buffer(ST_GeomFromText('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))'), 2, ST_Buffer_Strategy('join_miter', 5.0)));
|
||||
poly quadsegs=2 join=mitre ST_AsText(_ST_Buffer(ST_GeomFromText('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))'), 2, ST_Buffer_Strategy('join_miter', 5.0)))
|
||||
poly quadsegs=2 join=mitre POLYGON((-2 0,-2 -2,0 -2,10 -2,12 -2,12 0,12 10,12 12,10 12,0 12,-2 12,-2 10,-2 0))
|
||||
SELECT 'poly quadsegs=2 join=mitre mitre_limit=1', ST_AsText(_ST_Buffer(ST_GeomFromText('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))'), 2, 'quad_segs=2 join=mitre mitre_limit=1'));
|
||||
poly quadsegs=2 join=mitre mitre_limit=1 ST_AsText(_ST_Buffer(ST_GeomFromText('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))'), 2, 'quad_segs=2 join=mitre mitre_limit=1'))
|
||||
poly quadsegs=2 join=mitre mitre_limit=1 POLYGON((-2 0,-1.414213562373095 -1.414213562373095,0 -2,10 -2,11.414213562373096 -1.414213562373095,12 0,12 10,11.414213562373096 11.414213562373096,10 12,0 12,-1.414213562373095 11.414213562373096,-2 10,-2 0))
|
||||
SELECT 'poly quadsegs=2 join=mitre mitre_limit=1', ST_AsText(_ST_Buffer(ST_GeomFromText('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))'), 2, ST_Buffer_Strategy('join_miter', 1.0)));
|
||||
poly quadsegs=2 join=mitre mitre_limit=1 ST_AsText(_ST_Buffer(ST_GeomFromText('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))'), 2, ST_Buffer_Strategy('join_miter', 1.0)))
|
||||
poly quadsegs=2 join=mitre mitre_limit=1 POLYGON((-2 0,-1.414213562373095 -1.414213562373095,0 -2,10 -2,11.414213562373096 -1.414213562373095,12 0,12 10,11.414213562373096 11.414213562373096,10 12,0 12,-1.414213562373095 11.414213562373096,-2 10,-2 0))
|
||||
SELECT 'poly quadsegs=2 join=miter miter_limit=1', ST_AsText(_ST_Buffer(ST_GeomFromText('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))'), 2, 'quad_segs=2 join=miter miter_limit=1'));
|
||||
poly quadsegs=2 join=miter miter_limit=1 ST_AsText(_ST_Buffer(ST_GeomFromText('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))'), 2, 'quad_segs=2 join=miter miter_limit=1'))
|
||||
poly quadsegs=2 join=miter miter_limit=1 POLYGON((-2 0,-1.414213562373095 -1.414213562373095,0 -2,10 -2,11.414213562373096 -1.414213562373095,12 0,12 10,11.414213562373096 11.414213562373096,10 12,0 12,-1.414213562373095 11.414213562373096,-2 10,-2 0))
|
||||
SELECT 'poly quadsegs=2 join=miter miter_limit=1', ST_AsText(_ST_Buffer(ST_GeomFromText('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))'), 2, ST_Buffer_Strategy('join_miter', 1.0)));
|
||||
poly quadsegs=2 join=miter miter_limit=1 ST_AsText(_ST_Buffer(ST_GeomFromText('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))'), 2, ST_Buffer_Strategy('join_miter', 1.0)))
|
||||
poly quadsegs=2 join=miter miter_limit=1 POLYGON((-2 0,-1.414213562373095 -1.414213562373095,0 -2,10 -2,11.414213562373096 -1.414213562373095,12 0,12 10,11.414213562373096 11.414213562373096,10 12,0 12,-1.414213562373095 11.414213562373096,-2 10,-2 0))
|
||||
SELECT '#145a', ST_AsText(_ST_Buffer(ST_GeomFromText('LINESTRING(-116.93414544665981 34.16033385105459,-116.87777514700957 34.10831080544884,-116.86972224705954 34.086748622072776,-116.9327074288116 34.08458099517253,-117.00216369088065 34.130329331330216,-117.00216369088065 34.130329331330216)', 4326, 'axis-order=long-lat'), 0));
|
||||
#145a ST_AsText(_ST_Buffer(ST_GeomFromText('LINESTRING(-116.93414544665981 34.16033385105459,-116.87777514700957 34.10831080544884,-116.86972224705954 34.086748622072776,-116.9327074288116 34.08458099517253,-117.00216369088065 34.130329331330216,-117.0021636908
|
||||
#145a LINESTRING(34.16033385105459 -116.93414544665981,34.10831080544884 -116.87777514700957,34.086748622072776 -116.86972224705954,34.08458099517253 -116.9327074288116,34.130329331330216 -117.00216369088065,34.130329331330216 -117.00216369088065)
|
||||
SELECT '#145b', ST_Area(_ST_Buffer(ST_GeomFromText('LINESTRING(-116.93414544665981 34.16033385105459,-116.87777514700957 34.10831080544884,-116.86972224705954 34.086748622072776,-116.9327074288116 34.08458099517253,-117.00216369088065 34.130329331330216,-117.00216369088065 34.130329331330216)', 4326, 'axis-order=long-lat'), 0.1));
|
||||
#145b ST_Area(_ST_Buffer(ST_GeomFromText('LINESTRING(-116.93414544665981 34.16033385105459,-116.87777514700957 34.10831080544884,-116.86972224705954 34.086748622072776,-116.9327074288116 34.08458099517253,-117.00216369088065 34.130329331330216,-117.002163690880
|
||||
#145b 5976.177649226362
|
||||
SELECT '#145c', ST_Area(_ST_Buffer(ST_GeomFromText('LINESTRING(-116.93414544665981 34.16033385105459,-116.87777514700957 34.10831080544884,-116.86972224705954 34.086748622072776,-116.9327074288116 34.08458099517253,-117.00216369088065 34.130329331330216,-117.00216369088065 34.130329331330216)', 'axis-order=long-lat'), 0.1));
|
||||
#145c ST_Area(_ST_Buffer(ST_GeomFromText('LINESTRING(-116.93414544665981 34.16033385105459,-116.87777514700957 34.10831080544884,-116.86972224705954 34.086748622072776,-116.9327074288116 34.08458099517253,-117.00216369088065 34.130329331330216,-117.002163690880
|
||||
#145c 0.06844040204139576
|
||||
create table buffer_transform(the_pt geometry, utm_srid int);
|
||||
insert into buffer_transform values
|
||||
(ST_GeomFromText('POINT(-170 -80)', 4326, 'axis-order=long-lat'), 32702),
|
||||
(ST_GeomFromText('POINT(-160 -80)', 4326, 'axis-order=long-lat'), 32704),
|
||||
(ST_GeomFromText('POINT(-150 -80)', 4326, 'axis-order=long-lat'), 32706),
|
||||
(ST_GeomFromText('POINT(-140 -80)', 4326, 'axis-order=long-lat'), 32707),
|
||||
(ST_GeomFromText('POINT(-130 -80)', 4326, 'axis-order=long-lat'), 32709),
|
||||
(ST_GeomFromText('POINT(-120 -80)', 4326, 'axis-order=long-lat'), 32711),
|
||||
(ST_GeomFromText('POINT(-110 -80)', 4326, 'axis-order=long-lat'), 32712),
|
||||
(ST_GeomFromText('POINT(-100 -80)', 4326, 'axis-order=long-lat'), 32714),
|
||||
(ST_GeomFromText('POINT(-90 -80)', 4326, 'axis-order=long-lat'), 32716),
|
||||
(ST_GeomFromText('POINT(-80 -80)', 4326, 'axis-order=long-lat'), 32717);
|
||||
select st_astext(the_pt), utm_srid, st_area(_ST_Buffer(the_pt, 10)) as the_area,
|
||||
st_area(_st_transform(_ST_Buffer(_st_transform(the_pt, utm_srid), 10), 4326)) as utm_area
|
||||
from buffer_transform;
|
||||
st_astext(the_pt) utm_srid the_area utm_area
|
||||
POINT(-80 -170) 32702 3858.8656304584724 2191.1863998823683
|
||||
POINT(-80 -160) 32704 3858.8693084350816 2191.157418960413
|
||||
POINT(-80 -150) 32706 3858.864925427529 12274.807470264064
|
||||
POINT(-80 -140) 32707 3858.875287256144 2191.1733906029717
|
||||
POINT(-80 -130) 32709 3858.8145325860187 2191.1650214056344
|
||||
POINT(-80 -120) 32711 3858.8533964753988 12274.797528114472
|
||||
POINT(-80 -110) 32712 3858.831707920471 2191.1682183199237
|
||||
POINT(-80 -100) 32714 3858.8685214839284 2191.193872283011
|
||||
POINT(-80 -90) 32716 3858.8621217931404 12274.817163450669
|
||||
POINT(-80 -80) 32717 3858.859502998974 2191.1675683808953
|
||||
select st_asText(_ST_Buffer(ST_GeomFromText('point(-10 40)', 4326, 'axis-order=long-lat'), 40), 'axis-order=long-lat');
|
||||
st_asText(_ST_Buffer(ST_GeomFromText('point(-10 40)', 4326, 'axis-order=long-lat'), 40), 'axis-order=long-lat')
|
||||
POLYGON((-9.999999531579846 40.00036024826207,-10.000090924779336 40.00035339643826,-10.000178823737203 40.00033296371987,-10.00025985050028 40.00029973533636,-10.00033089122505 40.00025498825309,-10.000389215845544 40.000200442095746,-10.00043258298988 40.00013819306295,-10.000459326113273 40.00007063336738,-10.000468417537839 40.00000035930183,-10.00045950793879 39.99993007146334,-10.000432939760671 39.99986247097012,-10.000389734049207 39.99980015565971,-10.000331551206136 39.999745520257285,-10.000260627176242 39.99970066435035,-10.000179687519648 39.999667311705906,-10.00009184267169 39.99964674403009,-10.00000046841523 39.99963975171534,-9.999909076158115 39.999646603468804,-9.999821177999907 39.999667035985034,-9.999740151772027 39.99970026406551,-9.999669111236516 39.999745010791,-9.999610786430528 39.999799556590254,-9.999567418754191 39.999861805319206,-9.999540674833275 39.999929364811415,-9.999531582467085 39.99999963880504,-9.999540491123758 40.000069926714026,-9.999567058502222 40.00013752740939,-9.999610263678486 40.000199843022834,-9.999668446332297 40.000254478783056,-9.999739370547685 40.00029933504806,-9.99982031073628 40.00033268799637,-9.99990815638176 40.00035325587558,-9.999999531579846 40.00036024826207))
|
||||
CREATE TABLE geom_operators_test (
|
||||
description varchar(64) PRIMARY KEY,
|
||||
geom GEOMETRY
|
||||
);
|
||||
INSERT INTO geom_operators_test VALUES
|
||||
('NULL', NULL),
|
||||
('Square (left)', ST_GeomFromText('POLYGON((-1.0 0.0, 0.0 0.0, 0.0 1.0, -1.0 1.0, -1.0 0.0))')),
|
||||
('Point middle of Left Square', ST_GeomFromText('POINT(-0.5 0.5)')),
|
||||
('Square (right)', ST_GeomFromText('POLYGON((0.0 0.0, 1.0 0.0, 1.0 1.0, 0.0 1.0, 0.0 0.0))')),
|
||||
('Point middle of Right Square', ST_GeomFromText('POINT(0.5 0.5)')),
|
||||
('Square overlapping left and right square', ST_GeomFromText('POLYGON((-0.1 0.0, 1.0 0.0, 1.0 1.0, -0.1 1.0, -0.1 0.0))')),
|
||||
('Line going through left and right square', ST_GeomFromText('LINESTRING(-0.5 0.5, 0.5 0.5)')),
|
||||
('Faraway point', ST_GeomFromText('POINT(5.0 5.0)')),
|
||||
('Empty LineString', ST_GeomFromText('GEOMETRYCOLLECTION EMPTY')),
|
||||
('Empty Point', ST_GeomFromText('GEOMETRYCOLLECTION EMPTY')),
|
||||
('Empty GeometryCollection', ST_GeomFromText('GEOMETRYCOLLECTION EMPTY')),
|
||||
('Nested Geometry Collection', ST_GeomFromText('GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(POINT(0 0)))'));
|
||||
SELECT
|
||||
a.description,
|
||||
ST_AsText(_ST_Buffer(a.geom, 10)),
|
||||
ST_AsText(_ST_Buffer(a.geom, 10, 'endcap=flat'))
|
||||
FROM geom_operators_test a
|
||||
ORDER BY a.description;
|
||||
description ST_AsText(_ST_Buffer(a.geom, 10)) ST_AsText(_ST_Buffer(a.geom, 10, 'endcap=flat'))
|
||||
Empty GeometryCollection GEOMETRYCOLLECTION EMPTY GEOMETRYCOLLECTION EMPTY
|
||||
Empty LineString GEOMETRYCOLLECTION EMPTY GEOMETRYCOLLECTION EMPTY
|
||||
Empty Point GEOMETRYCOLLECTION EMPTY GEOMETRYCOLLECTION EMPTY
|
||||
Faraway point POLYGON((15 5,14.807852804032311 6.950903220161244,14.238795325112882 8.826834323650862,13.314696123025472 10.555702330195993,12.071067811865499 12.07106781186545,10.555702330196048 13.314696123025435,8.826834323650925 14.238795325112857,6.950903220161309 14.807852804032299,5.000000000000025 15,3.0490967798387394 14.807852804032308,1.1731656763491212 14.238795325112875,-0.5557023301960076 13.314696123025463,-2.071067811865463 12.071067811865486,-3.3146961230254455 10.555702330196034,-4.2387953251128625 8.826834323650909,-4.8078528040323025 6.950903220161292,-5 5.000000000000008,-4.807852804032306 3.049096779838723,-4.238795325112868 1.1731656763491056,-3.3146961230254526 -0.5557023301960218,-2.0710678118654746 -2.0710678118654755,-0.55570233019602 -3.3146961230254544,1.173165676349103 -4.238795325112868,3.049096779838718 -4.807852804032304,5.000000000000001 -5,6.950903220161283 -4.807852804032304,8.826834323650898 -4.238795325112868,10.555702330196024 -3.3146961230254526,12.071067811865476 -2.0710678118654746,13.314696123025453 -0.5557023301960218,14.238795325112868 1.173165676349102,14.807852804032304 3.0490967798387176,15 5)) POLYGON((15 5,14.807852804032311 6.950903220161244,14.238795325112882 8.826834323650862,13.314696123025472 10.555702330195993,12.071067811865499 12.07106781186545,10.555702330196048 13.314696123025435,8.826834323650925 14.238795325112857,6.950903220161309 14.807852804032299,5.000000000000025 15,3.0490967798387394 14.807852804032308,1.1731656763491212 14.238795325112875,-0.5557023301960076 13.314696123025463,-2.071067811865463 12.071067811865486,-3.3146961230254455 10.555702330196034,-4.2387953251128625 8.826834323650909,-4.8078528040323025 6.950903220161292,-5 5.000000000000008,-4.807852804032306 3.049096779838723,-4.238795325112868 1.1731656763491056,-3.3146961230254526 -0.5557023301960218,-2.0710678118654746 -2.0710678118654755,-0.55570233019602 -3.3146961230254544,1.173165676349103 -4.238795325112868,3.049096779838718 -4.807852804032304,5.000000000000001 -5,6.950903220161283 -4.807852804032304,8.826834323650898 -4.238795325112868,10.555702330196024 -3.3146961230254526,12.071067811865476 -2.0710678118654746,13.314696123025453 -0.5557023301960218,14.238795325112868 1.173165676349102,14.807852804032304 3.0490967798387176,15 5))
|
||||
Line going through left and right square POLYGON((-0.5 10.5,-2.4509032201612606 10.307852804032308,-4.326834323650878 9.738795325112875,-6.055702330196008 8.814696123025463,-7.571067811865463 7.571067811865487,-8.814696123025445 6.055702330196034,-9.738795325112862 4.326834323650909,-10.307852804032303 2.450903220161292,-10.5 0.5000000000000077,-10.307852804032306 -1.4509032201612773,-9.738795325112868 -3.3268343236508944,-8.814696123025453 -5.055702330196022,-7.571067811865475 -6.5710678118654755,-6.05570233019602 -7.814696123025454,-4.326834323650897 -8.738795325112868,-2.450903220161282 -9.307852804032304,-0.5 -9.5,0.5 -9.5,0.5 -9.5,2.4509032201612833 -9.307852804032304,4.326834323650898 -8.738795325112868,6.055702330196023 -7.814696123025453,7.5710678118654755 -6.571067811865475,8.814696123025453 -5.055702330196022,9.738795325112868 -3.326834323650898,10.307852804032304 -1.4509032201612824,10.5 0.5,10.307852804032304 2.4509032201612824,9.738795325112868 4.326834323650898,8.814696123025453 6.055702330196022,7.5710678118654755 7.571067811865475,6.055702330196023 8.814696123025453,4.326834323650898 9.738795325112868,2.4509032201612833 10.307852804032304,0.5 10.5,-0.5 10.5)) POLYGON((-0.5 10.5,-0.5 -9.5,0.5 -9.5,0.5 -9.5,0.5 10.5,-0.5 10.5))
|
||||
Nested Geometry Collection POLYGON((10 0,9.807852804032311 1.9509032201612437,9.238795325112882 3.826834323650863,8.314696123025472 5.555702330195993,7.071067811865499 7.0710678118654515,5.555702330196048 8.314696123025435,3.8268343236509246 9.238795325112857,1.950903220161309 9.807852804032299,0.000000000000024808382392282727 10,-1.9509032201612606 9.807852804032308,-3.826834323650879 9.238795325112875,-5.555702330196008 8.314696123025463,-7.071067811865463 7.071067811865487,-8.314696123025445 5.555702330196034,-9.238795325112862 3.826834323650909,-9.807852804032303 1.9509032201612921,-10 0.0000000000000076571373978539,-9.807852804032306 -1.9509032201612773,-9.238795325112868 -3.8268343236508944,-8.314696123025453 -5.555702330196022,-7.071067811865475 -7.0710678118654755,-5.55570233019602 -8.314696123025454,-3.826834323650897 -9.238795325112868,-1.950903220161282 -9.807852804032304,6.123233995736766e-16 -10,1.9509032201612833 -9.807852804032304,3.8268343236508984 -9.238795325112868,5.555702330196023 -8.314696123025453,7.0710678118654755 -7.071067811865475,8.314696123025453 -5.555702330196022,9.238795325112868 -3.826834323650898,9.807852804032304 -1.9509032201612824,10 0)) POLYGON((10 0,9.807852804032311 1.9509032201612437,9.238795325112882 3.826834323650863,8.314696123025472 5.555702330195993,7.071067811865499 7.0710678118654515,5.555702330196048 8.314696123025435,3.8268343236509246 9.238795325112857,1.950903220161309 9.807852804032299,0.000000000000024808382392282727 10,-1.9509032201612606 9.807852804032308,-3.826834323650879 9.238795325112875,-5.555702330196008 8.314696123025463,-7.071067811865463 7.071067811865487,-8.314696123025445 5.555702330196034,-9.238795325112862 3.826834323650909,-9.807852804032303 1.9509032201612921,-10 0.0000000000000076571373978539,-9.807852804032306 -1.9509032201612773,-9.238795325112868 -3.8268343236508944,-8.314696123025453 -5.555702330196022,-7.071067811865475 -7.0710678118654755,-5.55570233019602 -8.314696123025454,-3.826834323650897 -9.238795325112868,-1.950903220161282 -9.807852804032304,6.123233995736766e-16 -10,1.9509032201612833 -9.807852804032304,3.8268343236508984 -9.238795325112868,5.555702330196023 -8.314696123025453,7.0710678118654755 -7.071067811865475,8.314696123025453 -5.555702330196022,9.238795325112868 -3.826834323650898,9.807852804032304 -1.9509032201612824,10 0))
|
||||
NULL NULL NULL
|
||||
Point middle of Left Square POLYGON((9.5 0.5,9.307852804032311 2.4509032201612437,8.738795325112882 4.326834323650862,7.814696123025472 6.055702330195993,6.571067811865499 7.5710678118654515,5.055702330196048 8.814696123025435,3.3268343236509246 9.738795325112857,1.450903220161309 10.307852804032299,-0.4999999999999752 10.5,-2.4509032201612606 10.307852804032308,-4.326834323650878 9.738795325112875,-6.055702330196008 8.814696123025463,-7.571067811865463 7.571067811865487,-8.814696123025445 6.055702330196034,-9.738795325112862 4.326834323650909,-10.307852804032303 2.450903220161292,-10.5 0.5000000000000077,-10.307852804032306 -1.4509032201612773,-9.738795325112868 -3.3268343236508944,-8.814696123025453 -5.055702330196022,-7.571067811865475 -6.5710678118654755,-6.05570233019602 -7.814696123025454,-4.326834323650897 -8.738795325112868,-2.450903220161282 -9.307852804032304,-0.4999999999999994 -9.5,1.4509032201612833 -9.307852804032304,3.3268343236508984 -8.738795325112868,5.055702330196023 -7.814696123025453,6.5710678118654755 -6.571067811865475,7.814696123025453 -5.055702330196022,8.738795325112868 -3.326834323650898,9.307852804032304 -1.4509032201612824,9.5 0.5)) POLYGON((9.5 0.5,9.307852804032311 2.4509032201612437,8.738795325112882 4.326834323650862,7.814696123025472 6.055702330195993,6.571067811865499 7.5710678118654515,5.055702330196048 8.814696123025435,3.3268343236509246 9.738795325112857,1.450903220161309 10.307852804032299,-0.4999999999999752 10.5,-2.4509032201612606 10.307852804032308,-4.326834323650878 9.738795325112875,-6.055702330196008 8.814696123025463,-7.571067811865463 7.571067811865487,-8.814696123025445 6.055702330196034,-9.738795325112862 4.326834323650909,-10.307852804032303 2.450903220161292,-10.5 0.5000000000000077,-10.307852804032306 -1.4509032201612773,-9.738795325112868 -3.3268343236508944,-8.814696123025453 -5.055702330196022,-7.571067811865475 -6.5710678118654755,-6.05570233019602 -7.814696123025454,-4.326834323650897 -8.738795325112868,-2.450903220161282 -9.307852804032304,-0.4999999999999994 -9.5,1.4509032201612833 -9.307852804032304,3.3268343236508984 -8.738795325112868,5.055702330196023 -7.814696123025453,6.5710678118654755 -6.571067811865475,7.814696123025453 -5.055702330196022,8.738795325112868 -3.326834323650898,9.307852804032304 -1.4509032201612824,9.5 0.5))
|
||||
Point middle of Right Square POLYGON((10.5 0.5,10.307852804032311 2.4509032201612437,9.738795325112882 4.326834323650862,8.814696123025472 6.055702330195993,7.571067811865499 7.5710678118654515,6.055702330196048 8.814696123025435,4.326834323650925 9.738795325112857,2.450903220161309 10.307852804032299,0.5000000000000248 10.5,-1.4509032201612606 10.307852804032308,-3.326834323650879 9.738795325112875,-5.055702330196008 8.814696123025463,-6.571067811865463 7.571067811865487,-7.8146961230254455 6.055702330196034,-8.738795325112862 4.326834323650909,-9.307852804032303 2.450903220161292,-9.5 0.5000000000000077,-9.307852804032306 -1.4509032201612773,-8.738795325112868 -3.3268343236508944,-7.814696123025453 -5.055702330196022,-6.571067811865475 -6.5710678118654755,-5.05570233019602 -7.814696123025454,-3.326834323650897 -8.738795325112868,-1.450903220161282 -9.307852804032304,0.5000000000000007 -9.5,2.4509032201612833 -9.307852804032304,4.326834323650898 -8.738795325112868,6.055702330196023 -7.814696123025453,7.5710678118654755 -6.571067811865475,8.814696123025453 -5.055702330196022,9.738795325112868 -3.326834323650898,10.307852804032304 -1.4509032201612824,10.5 0.5)) POLYGON((10.5 0.5,10.307852804032311 2.4509032201612437,9.738795325112882 4.326834323650862,8.814696123025472 6.055702330195993,7.571067811865499 7.5710678118654515,6.055702330196048 8.814696123025435,4.326834323650925 9.738795325112857,2.450903220161309 10.307852804032299,0.5000000000000248 10.5,-1.4509032201612606 10.307852804032308,-3.326834323650879 9.738795325112875,-5.055702330196008 8.814696123025463,-6.571067811865463 7.571067811865487,-7.8146961230254455 6.055702330196034,-8.738795325112862 4.326834323650909,-9.307852804032303 2.450903220161292,-9.5 0.5000000000000077,-9.307852804032306 -1.4509032201612773,-8.738795325112868 -3.3268343236508944,-7.814696123025453 -5.055702330196022,-6.571067811865475 -6.5710678118654755,-5.05570233019602 -7.814696123025454,-3.326834323650897 -8.738795325112868,-1.450903220161282 -9.307852804032304,0.5000000000000007 -9.5,2.4509032201612833 -9.307852804032304,4.326834323650898 -8.738795325112868,6.055702330196023 -7.814696123025453,7.5710678118654755 -6.571067811865475,8.814696123025453 -5.055702330196022,9.738795325112868 -3.326834323650898,10.307852804032304 -1.4509032201612824,10.5 0.5))
|
||||
Square (left) POLYGON((-11 0,-10.807852804032306 -1.9509032201612773,-10.238795325112868 -3.8268343236508944,-9.314696123025453 -5.555702330196022,-8.071067811865476 -7.0710678118654755,-6.55570233019602 -8.314696123025454,-4.826834323650897 -9.238795325112868,-2.950903220161282 -9.807852804032304,-1 -10,0 -10,1.9509032201612833 -9.807852804032304,3.8268343236508984 -9.238795325112868,5.555702330196023 -8.314696123025453,7.0710678118654755 -7.071067811865475,8.314696123025453 -5.555702330196022,9.238795325112868 -3.826834323650898,9.807852804032304 -1.9509032201612824,10 0,10 1,9.807852804032304 2.9509032201612824,9.238795325112868 4.826834323650898,8.314696123025453 6.555702330196022,7.0710678118654755 8.071067811865476,5.555702330196023 9.314696123025453,3.8268343236508984 10.238795325112868,1.9509032201612833 10.807852804032304,0 11,-1 11,-2.950903220161271 10.807852804032306,-4.826834323650887 10.238795325112871,-6.555702330196012 9.31469612302546,-8.071067811865468 8.071067811865483,-9.314696123025447 6.555702330196029,-10.238795325112864 4.826834323650903,-10.807852804032304 2.950903220161286,-11 1,-11 0)) POLYGON((-11 0,-10.807852804032306 -1.9509032201612773,-10.238795325112868 -3.8268343236508944,-9.314696123025453 -5.555702330196022,-8.071067811865476 -7.0710678118654755,-6.55570233019602 -8.314696123025454,-4.826834323650897 -9.238795325112868,-2.950903220161282 -9.807852804032304,-1 -10,0 -10,1.9509032201612833 -9.807852804032304,3.8268343236508984 -9.238795325112868,5.555702330196023 -8.314696123025453,7.0710678118654755 -7.071067811865475,8.314696123025453 -5.555702330196022,9.238795325112868 -3.826834323650898,9.807852804032304 -1.9509032201612824,10 0,10 1,9.807852804032304 2.9509032201612824,9.238795325112868 4.826834323650898,8.314696123025453 6.555702330196022,7.0710678118654755 8.071067811865476,5.555702330196023 9.314696123025453,3.8268343236508984 10.238795325112868,1.9509032201612833 10.807852804032304,0 11,-1 11,-2.950903220161271 10.807852804032306,-4.826834323650887 10.238795325112871,-6.555702330196012 9.31469612302546,-8.071067811865468 8.071067811865483,-9.314696123025447 6.555702330196029,-10.238795325112864 4.826834323650903,-10.807852804032304 2.950903220161286,-11 1,-11 0))
|
||||
Square (right) POLYGON((-10 0,-9.807852804032306 -1.9509032201612773,-9.238795325112868 -3.8268343236508944,-8.314696123025453 -5.555702330196022,-7.071067811865475 -7.0710678118654755,-5.55570233019602 -8.314696123025454,-3.826834323650897 -9.238795325112868,-1.950903220161282 -9.807852804032304,0 -10,1 -10,2.9509032201612833 -9.807852804032304,4.826834323650898 -9.238795325112868,6.555702330196023 -8.314696123025453,8.071067811865476 -7.071067811865475,9.314696123025453 -5.555702330196022,10.238795325112868 -3.826834323650898,10.807852804032304 -1.9509032201612824,11 0,11 1,10.807852804032304 2.9509032201612824,10.238795325112868 4.826834323650898,9.314696123025453 6.555702330196022,8.071067811865476 8.071067811865476,6.555702330196023 9.314696123025453,4.826834323650898 10.238795325112868,2.9509032201612833 10.807852804032304,1 11,0 11,-1.950903220161271 10.807852804032306,-3.826834323650887 10.238795325112871,-5.555702330196012 9.31469612302546,-7.071067811865468 8.071067811865483,-8.314696123025447 6.555702330196029,-9.238795325112864 4.826834323650903,-9.807852804032304 2.950903220161286,-10 1,-10 0)) POLYGON((-10 0,-9.807852804032306 -1.9509032201612773,-9.238795325112868 -3.8268343236508944,-8.314696123025453 -5.555702330196022,-7.071067811865475 -7.0710678118654755,-5.55570233019602 -8.314696123025454,-3.826834323650897 -9.238795325112868,-1.950903220161282 -9.807852804032304,0 -10,1 -10,2.9509032201612833 -9.807852804032304,4.826834323650898 -9.238795325112868,6.555702330196023 -8.314696123025453,8.071067811865476 -7.071067811865475,9.314696123025453 -5.555702330196022,10.238795325112868 -3.826834323650898,10.807852804032304 -1.9509032201612824,11 0,11 1,10.807852804032304 2.9509032201612824,10.238795325112868 4.826834323650898,9.314696123025453 6.555702330196022,8.071067811865476 8.071067811865476,6.555702330196023 9.314696123025453,4.826834323650898 10.238795325112868,2.9509032201612833 10.807852804032304,1 11,0 11,-1.950903220161271 10.807852804032306,-3.826834323650887 10.238795325112871,-5.555702330196012 9.31469612302546,-7.071067811865468 8.071067811865483,-8.314696123025447 6.555702330196029,-9.238795325112864 4.826834323650903,-9.807852804032304 2.950903220161286,-10 1,-10 0))
|
||||
Square overlapping left and right square POLYGON((-10.1 0,-9.907852804032306 -1.9509032201612773,-9.338795325112867 -3.8268343236508944,-8.414696123025452 -5.555702330196022,-7.171067811865474 -7.0710678118654755,-5.65570233019602 -8.314696123025454,-3.926834323650897 -9.238795325112868,-2.050903220161282 -9.807852804032304,-0.1 -10,1 -10,2.9509032201612833 -9.807852804032304,4.826834323650898 -9.238795325112868,6.555702330196023 -8.314696123025453,8.071067811865476 -7.071067811865475,9.314696123025453 -5.555702330196022,10.238795325112868 -3.826834323650898,10.807852804032304 -1.9509032201612824,11 0,11 1,10.807852804032304 2.9509032201612824,10.238795325112868 4.826834323650898,9.314696123025453 6.555702330196022,8.071067811865476 8.071067811865476,6.555702330196023 9.314696123025453,4.826834323650898 10.238795325112868,2.9509032201612833 10.807852804032304,1 11,-0.1 11,-2.050903220161271 10.807852804032306,-3.926834323650887 10.238795325112871,-5.655702330196012 9.31469612302546,-7.171067811865468 8.071067811865483,-8.414696123025447 6.555702330196029,-9.338795325112864 4.826834323650903,-9.907852804032304 2.950903220161286,-10.1 1,-10.1 0)) POLYGON((-10.1 0,-9.907852804032306 -1.9509032201612773,-9.338795325112867 -3.8268343236508944,-8.414696123025452 -5.555702330196022,-7.171067811865474 -7.0710678118654755,-5.65570233019602 -8.314696123025454,-3.926834323650897 -9.238795325112868,-2.050903220161282 -9.807852804032304,-0.1 -10,1 -10,2.9509032201612833 -9.807852804032304,4.826834323650898 -9.238795325112868,6.555702330196023 -8.314696123025453,8.071067811865476 -7.071067811865475,9.314696123025453 -5.555702330196022,10.238795325112868 -3.826834323650898,10.807852804032304 -1.9509032201612824,11 0,11 1,10.807852804032304 2.9509032201612824,10.238795325112868 4.826834323650898,9.314696123025453 6.555702330196022,8.071067811865476 8.071067811865476,6.555702330196023 9.314696123025453,4.826834323650898 10.238795325112868,2.9509032201612833 10.807852804032304,1 11,-0.1 11,-2.050903220161271 10.807852804032306,-3.926834323650887 10.238795325112871,-5.655702330196012 9.31469612302546,-7.171067811865468 8.071067811865483,-8.414696123025447 6.555702330196029,-9.338795325112864 4.826834323650903,-9.907852804032304 2.950903220161286,-10.1 1,-10.1 0))
|
||||
SELECT ST_AsText(_ST_Buffer(ST_GeomFromText('POINT(0 0)', 4326, 'axis-order=long-lat'), 10.0));
|
||||
ST_AsText(_ST_Buffer(ST_GeomFromText('POINT(0 0)', 4326, 'axis-order=long-lat'), 10.0))
|
||||
POLYGON((0.00009043690205834696 0.00000008983151301475171,0.00008871682575996444 -0.000017437147542780015,0.00008358741165992818 -0.00003429402684084791,0.00007524578019769127 -0.000049833005966448834,0.00006401249554786816 -0.00006345693063403321,0.000050319246542238885 -0.0000746422410297824,0.000034692257086531106 -0.00008295909194411213,0.00001773206364056466 -0.00008808787147094533,0.0000000904369326323936 -0.00008983148349619179,-0.000017554665215903647 -0.00008812292198871517,-0.0000345251514244642 -0.00008302784600794263,-0.00005016885541975851 -0.00007474205645966471,-0.00006388459841173081 -0.00006358397157904537,-0.0000751452920633201 -0.00004998239031414649,-0.00008351819422976948 -0.000034460013834145505,-0.00008868153902038555 -0.00001761335839441037,-0.00009043690205836663 -0.00000008983151301486148,-0.00008871682575996458 0.00001743714754278013,-0.00008358741165992815 0.00003429402684084804,-0.00007524578019769122 0.00004983300596644897,-0.00006401249554786805 0.00006345693063403335,-0.00005031924654223872 0.00007464224102978251,-0.0000346922570865309 0.0000829590919441122,-0.00001773206364056444 0.0000880878714709454,-0.00000009043693263217271 0.00008983148349619179,0.000017554665215903864 0.00008812292198871513,0.00003452515142446441 0.00008302784600794254,0.000050168855419758694 0.0000747420564596646,0.00006388459841173093 0.00006358397157904524,0.0000751452920633202 0.00004998239031414635,0.00008351819422976952 0.000034460013834145376,0.00008868153902038546 0.00001761335839441024,0.00009043690205834696 0.00000008983151301475171))
|
||||
drop table buffer_transform, geom_operators_test;
|
||||
select st_astext(_st_buffer(ST_GeomFromText('POINT(15 20)'),1,-1));
|
||||
st_astext(_st_buffer(ST_GeomFromText('POINT(15 20)'),1,-1))
|
||||
POLYGON((16 20,15.98078528040323 20.195090322016124,15.923879532511288 20.382683432365088,15.831469612302547 20.555570233019598,15.70710678118655 20.707106781186546,15.555570233019605 20.831469612302545,15.382683432365093 20.923879532511286,15.195090322016132 20.98078528040323,15.000000000000002 21,14.804909677983874 20.980785280403232,14.617316567634912 20.923879532511286,14.444429766980399 20.831469612302545,14.292893218813454 20.70710678118655,14.168530387697455 20.555570233019605,14.076120467488714 20.38268343236509,14.01921471959677 20.195090322016128,14 20,14.01921471959677 19.804909677983872,14.076120467488714 19.617316567634912,14.168530387697455 19.4444297669804,14.292893218813452 19.292893218813454,14.444429766980399 19.168530387697455,14.61731656763491 19.076120467488714,14.804909677983872 19.019214719596768,15 19,15.195090322016128 19.019214719596768,15.38268343236509 19.076120467488714,15.555570233019603 19.168530387697455,15.707106781186548 19.292893218813454,15.831469612302545 19.4444297669804,15.923879532511286 19.61731656763491,15.98078528040323 19.804909677983872,16 20))
|
||||
select st_astext(_st_buffer(ST_GeomFromText('POINT(15 20)'),1,0));
|
||||
st_astext(_st_buffer(ST_GeomFromText('POINT(15 20)'),1,0))
|
||||
POLYGON((16 20,15.98078528040323 20.195090322016124,15.923879532511288 20.382683432365088,15.831469612302547 20.555570233019598,15.70710678118655 20.707106781186546,15.555570233019605 20.831469612302545,15.382683432365093 20.923879532511286,15.195090322016132 20.98078528040323,15.000000000000002 21,14.804909677983874 20.980785280403232,14.617316567634912 20.923879532511286,14.444429766980399 20.831469612302545,14.292893218813454 20.70710678118655,14.168530387697455 20.555570233019605,14.076120467488714 20.38268343236509,14.01921471959677 20.195090322016128,14 20,14.01921471959677 19.804909677983872,14.076120467488714 19.617316567634912,14.168530387697455 19.4444297669804,14.292893218813452 19.292893218813454,14.444429766980399 19.168530387697455,14.61731656763491 19.076120467488714,14.804909677983872 19.019214719596768,15 19,15.195090322016128 19.019214719596768,15.38268343236509 19.076120467488714,15.555570233019603 19.168530387697455,15.707106781186548 19.292893218813454,15.831469612302545 19.4444297669804,15.923879532511286 19.61731656763491,15.98078528040323 19.804909677983872,16 20))
|
||||
select _st_asewkt(_st_buffer(ST_GeomFromText('POINT(15 20)',26918),1,'quad_segs=0'));
|
||||
_st_asewkt(_st_buffer(ST_GeomFromText('POINT(15 20)',26918),1,'quad_segs=0'))
|
||||
SRID=26918;POLYGON((16 20,15.98078528040323 20.195090322016124,15.923879532511288 20.382683432365088,15.831469612302547 20.555570233019598,15.70710678118655 20.707106781186546,15.555570233019605 20.831469612302545,15.382683432365093 20.923879532511286,15.195090322016132 20.98078528040323,15.000000000000002 21,14.804909677983874 20.980785280403232,14.617316567634912 20.923879532511286,14.444429766980399 20.831469612302545,14.292893218813454 20.70710678118655,14.168530387697455 20.555570233019605,14.076120467488714 20.38268343236509,14.01921471959677 20.195090322016128,14 20,14.01921471959677 19.804909677983872,14.076120467488714 19.617316567634912,14.168530387697455 19.4444297669804,14.292893218813452 19.292893218813454,14.444429766980399 19.168530387697455,14.61731656763491 19.076120467488714,14.804909677983872 19.019214719596768,15 19,15.195090322016128 19.019214719596768,15.38268343236509 19.076120467488714,15.555570233019603 19.168530387697455,15.707106781186548 19.292893218813454,15.831469612302545 19.4444297669804,15.923879532511286 19.61731656763491,15.98078528040323 19.804909677983872,16 20))
|
||||
select _st_asewkt(_st_buffer(ST_GeomFromText('POINT(15 20)',26918),1,'quad_segs=null'));
|
||||
_st_asewkt(_st_buffer(ST_GeomFromText('POINT(15 20)',26918),1,'quad_segs=null'))
|
||||
SRID=26918;POLYGON((16 20,15.98078528040323 20.195090322016124,15.923879532511288 20.382683432365088,15.831469612302547 20.555570233019598,15.70710678118655 20.707106781186546,15.555570233019605 20.831469612302545,15.382683432365093 20.923879532511286,15.195090322016132 20.98078528040323,15.000000000000002 21,14.804909677983874 20.980785280403232,14.617316567634912 20.923879532511286,14.444429766980399 20.831469612302545,14.292893218813454 20.70710678118655,14.168530387697455 20.555570233019605,14.076120467488714 20.38268343236509,14.01921471959677 20.195090322016128,14 20,14.01921471959677 19.804909677983872,14.076120467488714 19.617316567634912,14.168530387697455 19.4444297669804,14.292893218813452 19.292893218813454,14.444429766980399 19.168530387697455,14.61731656763491 19.076120467488714,14.804909677983872 19.019214719596768,15 19,15.195090322016128 19.019214719596768,15.38268343236509 19.076120467488714,15.555570233019603 19.168530387697455,15.707106781186548 19.292893218813454,15.831469612302545 19.4444297669804,15.923879532511286 19.61731656763491,15.98078528040323 19.804909677983872,16 20))
|
||||
select _st_buffer(ST_GeomFromText('POINT(15 20)'),'');
|
||||
ERROR 22023: Invalid GIS data provided to function _st_buffer.
|
||||
select _st_buffer(ST_GeomFromText('POINT(15 20)'),1,'test');
|
||||
ERROR HY000: Incorrect arguments to _st_buffer
|
||||
select st_buffer(ST_GeomFromText('POINT'),null);
|
||||
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
|
||||
select _st_buffer(ST_GeomFromText('POINT'),null);
|
||||
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
|
||||
select _st_asewkt(_st_buffer(ST_GeomFromText('POINT(15 20)',26918),2,9999999));
|
||||
ERROR HY000: Parameter points_per_circle exceeds the maximum number of points in a geometry (65536) in function _st_buffer.
|
||||
select _st_buffer(x'0000000001060000000200000001030000000100000005000000000000000000000000000000000000000000000000002440000000000000000000000000000024400000000000002440000000000000000000000000000024400000000000000000000000000000000001030000000100000005000000000000000000144000000000000014400000000000001C4000000000000014400000000000001C400000000000001C4000000000000014400000000000001C4000000000000014400000000000001441',1);
|
||||
ERROR 22023: Invalid GIS data provided to function _st_buffer.
|
||||
select _st_asewkt(_st_buffer(ST_GeomFromText('MULTIPOLYGON(((0 1,10 0,10 10,0 10,0 1)))',4326),1));
|
||||
_st_asewkt(_st_buffer(ST_GeomFromText('MULTIPOLYGON(((0 1,10 0,10 10,0 10,0 1)))',4326),1))
|
||||
SRID=4326;POLYGON((0.999991057879892 -0.000001024681905,0.999991343409445 -0.000002655311391,0.999991921577137 -0.000004196177432,0.999992772837874 -0.000005595190674,0.999993868414576 -0.000006805057143,0.999995171271009 -0.000007784877007,0.999996637363799 -0.000008501527211,0.999998217131321 -0.000008930781227,0.999999857169148 -0.000009058128019,9.999999763841377 -0.000009111486118,10.000001335537663 -0.000008994016551,10.000002865572117 -0.000008595980388,10.000004306215603 -0.000007929794299,10.000005612527538 -0.000007016239812,10.000006743757769 -0.000005883815098,10.00000766461779 -0.000004567845919,10.000008346381552 -0.000003109383665,10.000008767781564 -0.000001553924797,10.00000891567233 0.000000050008458,10.00000912044631 10.00000006765241,10.000008942113512 10.000001796596374,10.000008433116587 10.000003458537165,10.000007612277368 10.000004992019045,10.000006509949088 10.000006340336467,10.00000516689397 10.000007453630937,10.0000036327759 10.000008290734733,10.000001964323959 10.000008820693173,10.00000022323466 10.000009023909296,-0.000000087169914 10.000008960982653,-0.000001787968286 10.000008770279965,-0.000003426809312 10.000008275133851,-0.000004946903248 10.000007492702316,-0.000006295575204 10.00000645009847,-0.000007426090516 10.000005183451016,-0.000008299274134 10.000003736652301,-0.000008884868177 10.00000215983734,-0.000009162580417 10.000000507646522,-0.00000912278749 9.999998837332182,0.999991057879892 -0.000001024681905))
|
||||
select _st_asewkt(_st_buffer(ST_GeomFromText('POINT(15 20)',4236),1,1));
|
||||
_st_asewkt(_st_buffer(ST_GeomFromText('POINT(15 20)',4236),1,1))
|
||||
SRID=4326;POLYGON((19.99722874851131 14.999664554748017,19.997219440562965 14.999655525253292,19.997228730146585 14.999646477912428,19.99723803809493 14.999655507402725,19.99722874851131 14.999664554748017))
|
||||
select _st_asewkt(_st_buffer(ST_GeomFromText('POINT(15 20)',4267),1,1));
|
||||
_st_asewkt(_st_buffer(ST_GeomFromText('POINT(15 20)',4267),1,1))
|
||||
SRID=4326;POLYGON((20.001992210504945 14.999751531481529,20.002001498815 14.999742484834657,20.00199219157466 14.999733456589583,20.001982903264594 14.999742503234902,20.001992210504945 14.999751531481529))
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,556 @@
|
||||
# ----------------------------------------------------------------------
|
||||
# Base test of st_distance_sphere.
|
||||
# ----------------------------------------------------------------------
|
||||
SELECT ST_DISTANCE_SPHERE(NULL, NULL);
|
||||
ST_DISTANCE_SPHERE(NULL, NULL)
|
||||
NULL
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(0 0)'), NULL);
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(0 0)'), NULL)
|
||||
NULL
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)', 4326), ST_GEOMFROMTEXT('POINT(0 0)'));
|
||||
ERROR HY000: Binary geometry function st_distance_sphere given two geometries of different srids: 4326 and 0, which should have been identical.
|
||||
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 ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(1 1)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(1 1)'))
|
||||
157249.0357231545
|
||||
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('MULTIPOINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(1 1)'), 1);
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(1 1)'), 1)
|
||||
0.024682056391766436
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)', 4047), ST_GEOMFROMTEXT('POINT(1 1)', 4047));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)', 4047), ST_GEOMFROMTEXT('POINT(1 1)', 4047))
|
||||
0
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(0 0)', 4047), ST_GEOMFROMTEXT('MULTIPOINT(1 1)', 4047));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(0 0)', 4047), ST_GEOMFROMTEXT('MULTIPOINT(1 1)', 4047))
|
||||
0
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)', 4326), ST_GEOMFROMTEXT('POINT(1 1)', 4326));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)', 4326), ST_GEOMFROMTEXT('POINT(1 1)', 4326))
|
||||
157249.59776850493
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(0 0)', 4326), ST_GEOMFROMTEXT('MULTIPOINT(1 1)', 4326));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(0 0)', 4326), ST_GEOMFROMTEXT('MULTIPOINT(1 1)', 4326))
|
||||
157249.59776850493
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)', 3857), ST_GEOMFROMTEXT('POINT(1 1)', 3857), 1);
|
||||
ERROR 22S00: st_distance_sphere(POINT, POINT) has not been implemented for projected spatial reference systems.
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'), 0);
|
||||
ERROR 22023: Invalid radius provided to function st_distance_sphere: Radius(0.000000) must be greater than zero.
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'), -1);
|
||||
ERROR 22023: Invalid radius provided to function st_distance_sphere: Radius(-1.000000) must be greater than zero.
|
||||
SELECT ST_Distance_Sphere(POINT(-50, -50), POINT(50, 50), 1.0e308);
|
||||
ERROR 42000: Out of range
|
||||
# Creating the spatial Geometry object
|
||||
USE test;
|
||||
drop table if exists gis_geometrycollection;
|
||||
CREATE TABLE gis_geometrycollection (fid INTEGER NOT NULL PRIMARY KEY, g GEOMETRY);
|
||||
SET @star_elem_vertical= 'POLYGON((5 0,15 25,25 0,15 5,5 0))';
|
||||
SET @star_elem_horizontal= 'POLYGON((25 0,0 15,30 15,22 10,25 0))';
|
||||
SET @star_center= 'POINT(15 10)';
|
||||
SET @star_top= 'POINT(15 25)';
|
||||
SET @star_bottom_left= 'POINT(5 0)';
|
||||
SET @star_bottom_right= 'POINT(25 0)';
|
||||
SET @star_bottom_points= 'MULTIPOINT(5 0,25 0)';
|
||||
SET @star_all_points= 'MULTIPOINT(5 0,25 0,15 10,15 25)';
|
||||
SET @star_line_horizontal= 'LINESTRING(10 15,20 15)';
|
||||
SET @star_line_vertical= 'LINESTRING(15 5,15 25)';
|
||||
SET @star_top_to_center= 'LINESTRING(15 25,15 10)';
|
||||
SET @star_lines_near_horizontal= 'MULTILINESTRING((25 0,0 15,15 30,0 5))';
|
||||
SET @star_lines_near_vertical= 'MULTILINESTRING((0 5,15 25,0 25))';
|
||||
SET @star= 'POLYGON((5 0,7 10,0 15,10 15,15 25,20 15,30 15,22 10,25 0,15 5,5 0))';
|
||||
SET @star_of_elems='MULTIPOLYGON(((5 0,15 25,25 0,15 5,5 0)),((25 0,0 15,30 15,22 10,25 0)))';
|
||||
SET @star_collection_elems='GEOMETRYCOLLECTION(MULTIPOLYGON(((5 0,15 25,25 0,15 5,5 0)),((25 0,0 15,30 15,22 10,25 0))),POLYGON((5 0,7 10,0 15,10 15,15 25,20 15,30 15,22 10,25 0,15 5,5 0)),LINESTRING(15 25,15 10),MULTIPOINT(5 0,25 0),POINT(15 25))';
|
||||
SET @star_collection_multilinestr='GEOMETRYCOLLECTION(MULTIPOLYGON(((5 0,15 25,25 0,15 5,5 0)),((25 0,0 15,30 15,22 10,25 0))),POLYGON((5 0,7 10,0 15,10 15,15 25,20 15,30 15,22 10,25 0,15 5,5 0)),MULTILINESTRING((25 0,0 15,15 30,0 5)),LINESTRING(15 25,15 10),MULTIPOINT(5 0,25 0),POINT(15 25))';
|
||||
#INSERT base star
|
||||
INSERT INTO gis_geometrycollection VALUES
|
||||
(100,ST_GEOMFROMTEXT(@star)),
|
||||
(101,ST_GEOMFROMTEXT(@star_elem_vertical)),
|
||||
(102,ST_GEOMFROMTEXT(@star_elem_horizontal)),
|
||||
(103,ST_GEOMFROMTEXT(@star_of_elems)),
|
||||
(104,ST_GEOMFROMTEXT(@star_top)),
|
||||
(105,ST_GEOMFROMTEXT(@star_center)),
|
||||
(106,ST_GEOMFROMTEXT(@star_bottom_left)),
|
||||
(107,ST_GEOMFROMTEXT(@star_bottom_right)),
|
||||
(108,ST_GEOMFROMTEXT(@star_bottom_points)),
|
||||
(109,ST_GEOMFROMTEXT(@star_all_points)),
|
||||
(110,ST_GEOMFROMTEXT(@star_line_horizontal)),
|
||||
(111,ST_GEOMFROMTEXT(@star_line_vertical)),
|
||||
(112,ST_GEOMFROMTEXT(@star_top_to_center)),
|
||||
(113,ST_GEOMFROMTEXT(@star_lines_near_horizontal)),
|
||||
(114,ST_GEOMFROMTEXT(@star_lines_near_vertical)),
|
||||
(115,ST_GEOMFROMTEXT(@star_collection_elems)),
|
||||
(116,ST_GEOMFROMTEXT(@star_collection_multilinestr));
|
||||
# Checking the integrity of the above create/insert statements
|
||||
# 17 rows.
|
||||
SELECT count(ST_ASTEXT(g) != 'NULL') FROM gis_geometrycollection;
|
||||
count(ST_ASTEXT(g) != 'NULL')
|
||||
17
|
||||
#####################################################################################
|
||||
# ST_DISTANCE_SPHERE(point, point)
|
||||
#####################################################################################
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(0 0)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(0 0)'))
|
||||
0
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(180 0)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(180 0)'))
|
||||
20015042.813723423
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(0 90)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(0 90)'))
|
||||
10007521.40686
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(-179 0)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(-179 0)'))
|
||||
19903848.13142
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(0 -90)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(0 -90)'))
|
||||
10007521.40686
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(180 90)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(180 90)'))
|
||||
10007521.40686
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(180 -90)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(180 -90)'))
|
||||
10007521.40686
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(-179 90)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(-179 90)'))
|
||||
10007521.40686
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(-179 -90)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(-179 -90)'))
|
||||
10007521.40686
|
||||
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 ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(0.0000 -0.000)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(0.0000 -0.000)'))
|
||||
0
|
||||
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 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 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 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 ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(90 45)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(90 45)'))
|
||||
10007521.406861713
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(90 -45)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(90 -45)'))
|
||||
10007521.406861713
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(-90 45)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(-90 45)'))
|
||||
10007521.406861713
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(-90 -45)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(-90 -45)'))
|
||||
10007521.406861713
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(180 90)'), ST_GEOMFROMTEXT('POINT(180 90)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(180 90)'), ST_GEOMFROMTEXT('POINT(180 90)'))
|
||||
0
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(180 -90)'), ST_GEOMFROMTEXT('POINT(180 -90)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(180 -90)'), ST_GEOMFROMTEXT('POINT(180 -90)'))
|
||||
0
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(-179.999 -90)'), ST_GEOMFROMTEXT('POINT(-179.999 -90)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(-179.999 -90)'), ST_GEOMFROMTEXT('POINT(-179.999 -90)'))
|
||||
0
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(-179.999 -89.999)'), ST_GEOMFROMTEXT('POINT(-179.999 -89.999)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(-179.999 -89.999)'), ST_GEOMFROMTEXT('POINT(-179.999 -89.999)'))
|
||||
0
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(-179.9 90)'), ST_GEOMFROMTEXT('POINT(-179.99 90)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(-179.9 90)'), ST_GEOMFROMTEXT('POINT(-179.99 90)'))
|
||||
0.000000000000613
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(-179.9 -90)'), ST_GEOMFROMTEXT('POINT(-179.9999 -90)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(-179.9 -90)'), ST_GEOMFROMTEXT('POINT(-179.9999 -90)'))
|
||||
0.00000000000068
|
||||
#####################################################################################
|
||||
# ST_DISTANCE_SPHERE(point, multipoint)
|
||||
#####################################################################################
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(0 0)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(0 0)'))
|
||||
0
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(180 0)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(180 0)'))
|
||||
20015042.813723423
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(0 90)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(0 90)'))
|
||||
10007521.40686
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(-179 0)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(-179 0)'))
|
||||
19903848.13142
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(0 0,1 1,2 2)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(0 0,1 1,2 2)'))
|
||||
0
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(0 0,180 90)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(0 0,180 90)'))
|
||||
0
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(180 90,0 0,-179 -90)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(180 90,0 0,-179 -90)'))
|
||||
0
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(0 1)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(0 1)'))
|
||||
111194.68229846345
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(0 1,1 0,1 1)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(0 1,1 0,1 1)'))
|
||||
111194.68229846345
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(180 90)'), ST_GEOMFROMTEXT('MULTIPOINT(180 -90,-179 90,-179 -90)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(180 90)'), ST_GEOMFROMTEXT('MULTIPOINT(180 -90,-179 90,-179 -90)'))
|
||||
0.00000000000681
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(37 -42)'), ST_GEOMFROMTEXT('MULTIPOINT(57 32)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(37 -42)'), ST_GEOMFROMTEXT('MULTIPOINT(57 32)'))
|
||||
8478959.246920772
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(-85 48)'), ST_GEOMFROMTEXT('MULTIPOINT(159 -49)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(-85 48)'), ST_GEOMFROMTEXT('MULTIPOINT(159 -49)'))
|
||||
15442376.75883719
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(168 -21)'), ST_GEOMFROMTEXT('MULTIPOINT(-22 -32)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(168 -21)'), ST_GEOMFROMTEXT('MULTIPOINT(-22 -32)'))
|
||||
14026307.891828652
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(-64 67)'), ST_GEOMFROMTEXT('MULTIPOINT(-103 45,155 57,-166 85)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(-64 67)'), ST_GEOMFROMTEXT('MULTIPOINT(-103 45,155 57,-166 85)'))
|
||||
2724877.06508
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(-36 -41)'), ST_GEOMFROMTEXT('MULTIPOINT(-37 45,-49 23,97 -19)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(-36 -41)'), ST_GEOMFROMTEXT('MULTIPOINT(-37 45,-49 23,97 -19)'))
|
||||
7242075.616184488
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(138 86)'), ST_GEOMFROMTEXT('MULTIPOINT(15 -79,-110 -76,49 31)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(138 86)'), ST_GEOMFROMTEXT('MULTIPOINT(15 -79,-110 -76,49 31)'))
|
||||
6562054.98174
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(164 -41)'), ST_GEOMFROMTEXT('MULTIPOINT(-11 2,-81 3,161 62,-119 31)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(164 -41)'), ST_GEOMFROMTEXT('MULTIPOINT(-11 2,-81 3,161 62,-119 31)'))
|
||||
11240807.17994
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(-106 -23)'), ST_GEOMFROMTEXT('MULTIPOINT(-152 72,89 -3,-23 -42,126 59)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(-106 -23)'), ST_GEOMFROMTEXT('MULTIPOINT(-152 72,89 -3,-23 -42,126 59)'))
|
||||
7764654.2944
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(168 -15)'), ST_GEOMFROMTEXT('MULTIPOINT(68 73,157 -55,-178 -29,46 78,-133 59,180 59)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(168 -15)'), ST_GEOMFROMTEXT('MULTIPOINT(68 73,157 -55,-178 -29,46 78,-133 59,180 59)'))
|
||||
2118904.21786
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(106 76)'), ST_GEOMFROMTEXT('MULTIPOINT(53 20,148 -40,-61 -90,170 -37,-64 -82,-167 85)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(106 76)'), ST_GEOMFROMTEXT('MULTIPOINT(53 20,148 -40,-61 -90,170 -37,-64 -82,-167 85)'))
|
||||
1623498.34154
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(-50 36)'), ST_GEOMFROMTEXT('MULTIPOINT(-32 -64,-116 -35,148 89,-75 16,-99 87,-51 -2,-113 24,93 46,168 53)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(-50 36)'), ST_GEOMFROMTEXT('MULTIPOINT(-32 -64,-116 -35,148 89,-75 16,-99 87,-51 -2,-113 24,93 46,168 53)'))
|
||||
3325569.686282281
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(-139 54)'), ST_GEOMFROMTEXT('MULTIPOINT(151 -57,-74 61,10 28,170 -47,97 -45,-5 -82,121 -21,-96 -44,81 -68)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(-139 54)'), ST_GEOMFROMTEXT('MULTIPOINT(151 -57,-74 61,10 28,170 -47,97 -45,-5 -82,121 -21,-96 -44,81 -68)'))
|
||||
3792274.55936
|
||||
#####################################################################################
|
||||
# ST_DISTANCE_SPHERE(multipoint, point)
|
||||
#####################################################################################
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(0 0)'), ST_GEOMFROMTEXT('POINT(0 0)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(0 0)'), ST_GEOMFROMTEXT('POINT(0 0)'))
|
||||
0
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(0 0)'), ST_GEOMFROMTEXT('POINT(180 0)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(0 0)'), ST_GEOMFROMTEXT('POINT(180 0)'))
|
||||
20015042.813723423
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(0 0)'), ST_GEOMFROMTEXT('POINT(0 90)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(0 0)'), ST_GEOMFROMTEXT('POINT(0 90)'))
|
||||
10007521.40686
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(0 0)'), ST_GEOMFROMTEXT('POINT(-179 0)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(0 0)'), ST_GEOMFROMTEXT('POINT(-179 0)'))
|
||||
19903848.13142
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(0 0,1 1,2 2)'), ST_GEOMFROMTEXT('POINT(0 0)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(0 0,1 1,2 2)'), ST_GEOMFROMTEXT('POINT(0 0)'))
|
||||
0
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(180 90,0 0,180 -90)'), ST_GEOMFROMTEXT('POINT(-0 0)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(180 90,0 0,180 -90)'), ST_GEOMFROMTEXT('POINT(-0 0)'))
|
||||
0
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-179 90,0 0,-179 -90)'), ST_GEOMFROMTEXT('POINT(-179 0)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-179 90,0 0,-179 -90)'), ST_GEOMFROMTEXT('POINT(-179 0)'))
|
||||
10007521.40686
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-179 90,0 0,-179 -90)'), ST_GEOMFROMTEXT('POINT(-179 -90)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-179 90,0 0,-179 -90)'), ST_GEOMFROMTEXT('POINT(-179 -90)'))
|
||||
0
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-172 -70)'), ST_GEOMFROMTEXT('POINT(45 90)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-172 -70)'), ST_GEOMFROMTEXT('POINT(45 90)'))
|
||||
17791149.16775415
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-157 -67)'), ST_GEOMFROMTEXT('POINT(-92 -88)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-157 -67)'), ST_GEOMFROMTEXT('POINT(-92 -88)'))
|
||||
2471277.69445
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(156 -64,-96 57,-15 -18)'), ST_GEOMFROMTEXT('POINT(-73 -1)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(156 -64,-96 57,-15 -18)'), ST_GEOMFROMTEXT('POINT(-73 -1)'))
|
||||
6603053.68396362
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-110 43,-79 -82,-32 24)'), ST_GEOMFROMTEXT('POINT(61 27)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-110 43,-79 -82,-32 24)'), ST_GEOMFROMTEXT('POINT(61 27)'))
|
||||
9099422.92395
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-85 87,-155 48,-163 -84)'), ST_GEOMFROMTEXT('POINT(-95 84)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-85 87,-155 48,-163 -84)'), ST_GEOMFROMTEXT('POINT(-95 84)'))
|
||||
343552.51114
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(33 -49,174 -25,-4 -56)'), ST_GEOMFROMTEXT('POINT(48 46)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(33 -49,174 -25,-4 -56)'), ST_GEOMFROMTEXT('POINT(48 46)'))
|
||||
10662878.71627671
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-36 -87,-75 20,-157 78)'), ST_GEOMFROMTEXT('POINT(-165 18)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-36 -87,-75 20,-157 78)'), ST_GEOMFROMTEXT('POINT(-165 18)'))
|
||||
6685828.523608761
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(151 17,-150 -43,-165 76,87 53)'), ST_GEOMFROMTEXT('POINT(152 27)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(151 17,-150 -43,-165 76,87 53)'), ST_GEOMFROMTEXT('POINT(152 27)'))
|
||||
1116698.09539
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-159 -88,-177 -82,17 76,79 1)'), ST_GEOMFROMTEXT('POINT(35 -74)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-159 -88,-177 -82,17 76,79 1)'), ST_GEOMFROMTEXT('POINT(35 -74)'))
|
||||
1995604.718606601
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-130 -20,-118 -63,-57 0)'), ST_GEOMFROMTEXT('POINT(-156 89)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-130 -20,-118 -63,-57 0)'), ST_GEOMFROMTEXT('POINT(-156 89)'))
|
||||
10024915.226
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-84 25,-52 53,125 -50,-171 51,55 -13,-4 -69)'), ST_GEOMFROMTEXT('POINT(-127 52)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-84 25,-52 53,125 -50,-171 51,55 -13,-4 -69)'), ST_GEOMFROMTEXT('POINT(-127 52)'))
|
||||
3000854.92226
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(56 -45,158 84,112 2,85 21,88 89,-151 33,-158 40)'), ST_GEOMFROMTEXT('POINT(-172 87)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(56 -45,158 84,112 2,85 21,88 89,-151 33,-158 40)'), ST_GEOMFROMTEXT('POINT(-172 87)'))
|
||||
369477.73572
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-6 -56,-73 54,20 -74,-160 72,-4 42,-120 -62,-54 -8,-85 48,159 -49,100 -75)'),
|
||||
ST_GEOMFROMTEXT('POINT(167 -17)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-6 -56,-73 54,20 -74,-160 72,-4 42,-120 -62,-54 -8,-85 48,159 -49,100 -75)'),
|
||||
ST_GEOMFROMTEXT('POINT(167 -17)'))
|
||||
3630973.43292
|
||||
#####################################################################################
|
||||
# ST_DISTANCE_SPHERE(multipoint, multipoint)
|
||||
#####################################################################################
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(0 0)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(0 0)'))
|
||||
0
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(180 0)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(180 0)'))
|
||||
20015042.813723423
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(0 90)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(0 90)'))
|
||||
10007521.40686
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(-179 0)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(-179 0)'))
|
||||
19903848.13142
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(0 0,1 1,2 2)'), ST_GEOMFROMTEXT('MULTIPOINT(1 1,0 0,2 2)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(0 0,1 1,2 2)'), ST_GEOMFROMTEXT('MULTIPOINT(1 1,0 0,2 2)'))
|
||||
0
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(180 90,0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(180 90)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(180 90,0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(180 90)'))
|
||||
0
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(180 0,0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(180 0,0 90)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(180 0,0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(180 0,0 90)'))
|
||||
0
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-179 90,0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(-179 0,0 -90)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-179 90,0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(-179 0,0 -90)'))
|
||||
10007521.40686
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(111 11,11 1)'), ST_GEOMFROMTEXT('MULTIPOINT(1 11,11 11)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(111 11,11 1)'), ST_GEOMFROMTEXT('MULTIPOINT(1 11,11 11)'))
|
||||
1111946.8229846344
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(10 10,20 20,30 30)'), ST_GEOMFROMTEXT('MULTIPOINT(15 15,20 20,25 25)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(10 10,20 20,30 30)'), ST_GEOMFROMTEXT('MULTIPOINT(15 15,20 20,25 25)'))
|
||||
0
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-10 -10,-20 -20,-30 -30)'), ST_GEOMFROMTEXT('MULTIPOINT(180 0,-30 -30,180 -90)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-10 -10,-20 -20,-30 -30)'), ST_GEOMFROMTEXT('MULTIPOINT(180 0,-30 -30,180 -90)'))
|
||||
0
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-150 -79)'), ST_GEOMFROMTEXT('MULTIPOINT(145 -2)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-150 -79)'), ST_GEOMFROMTEXT('MULTIPOINT(145 -2)'))
|
||||
9274204.820691504
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(164 -37)'), ST_GEOMFROMTEXT('MULTIPOINT(67 59)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(164 -37)'), ST_GEOMFROMTEXT('MULTIPOINT(67 59)'))
|
||||
13840477.43111
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(135 62)'), ST_GEOMFROMTEXT('MULTIPOINT(-116 -22)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(135 62)'), ST_GEOMFROMTEXT('MULTIPOINT(-116 -22)'))
|
||||
13142652.165808784
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-123 85)'), ST_GEOMFROMTEXT('MULTIPOINT(-54 -40)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-123 85)'), ST_GEOMFROMTEXT('MULTIPOINT(-54 -40)'))
|
||||
14239014.67884
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(152 43)'), ST_GEOMFROMTEXT('MULTIPOINT(106 76,53 20,148 -40)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(152 43)'), ST_GEOMFROMTEXT('MULTIPOINT(106 76,53 20,148 -40)'))
|
||||
4260092.91225
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-177 -88,-165 9,153 40,2 17)'), ST_GEOMFROMTEXT('MULTIPOINT(-150 -4)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-177 -88,-165 9,153 40,2 17)'), ST_GEOMFROMTEXT('MULTIPOINT(-150 -4)'))
|
||||
2203222.520729071
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(154 84,-124 37,17 50)'), ST_GEOMFROMTEXT('MULTIPOINT(42 34)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(154 84,-124 37,17 50)'), ST_GEOMFROMTEXT('MULTIPOINT(42 34)'))
|
||||
2703109.6592360293
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(88 -65,49 85,68 77)'), ST_GEOMFROMTEXT('MULTIPOINT(125 82,-83 -5,3 -40)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(88 -65,49 85,68 77)'), ST_GEOMFROMTEXT('MULTIPOINT(125 82,-83 -5,3 -40)'))
|
||||
926947.16374
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(174 59,91 24,26 28)'), ST_GEOMFROMTEXT('MULTIPOINT(-35 -33,-171 -37,-30 -43)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(174 59,91 24,26 28)'), ST_GEOMFROMTEXT('MULTIPOINT(-35 -33,-171 -37,-30 -43)'))
|
||||
9348158.18192
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-140 -63,103 -42,160 -53)'), ST_GEOMFROMTEXT('MULTIPOINT(-78 -80,-133 -24,73 -15)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-140 -63,103 -42,160 -53)'), ST_GEOMFROMTEXT('MULTIPOINT(-78 -80,-133 -24,73 -15)'))
|
||||
2653984.28106
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(137 -65,-63 13,38 9)'), ST_GEOMFROMTEXT('MULTIPOINT(-166 -35,107 -18,-83 -18,91 -24)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(137 -65,-63 13,38 9)'), ST_GEOMFROMTEXT('MULTIPOINT(-166 -35,107 -18,-83 -18,91 -24)'))
|
||||
4086108.7033282355
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-128 90,90 -17,-176 -37,40 -78,156 -82,37 -42)'), ST_GEOMFROMTEXT('MULTIPOINT(57 32,-3 22,24 -88)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-128 90,90 -17,-176 -37,40 -78,156 -82,37 -42)'), ST_GEOMFROMTEXT('MULTIPOINT(57 32,-3 22,24 -88)'))
|
||||
1051350.22799
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(87 -12,-25 31,-47 23,134 83,120 69,39 -41)'), ST_GEOMFROMTEXT('MULTIPOINT(-9 -4,-171 -82,140 -26)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(87 -12,-25 31,-47 23,134 83,120 69,39 -41)'), ST_GEOMFROMTEXT('MULTIPOINT(-9 -4,-171 -82,140 -26)'))
|
||||
4245876.626705522
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-119 50,28 22,-122 -74)'), ST_GEOMFROMTEXT('MULTIPOINT(134 14,-32 -84,96 74,44 59,-88 73,-136 12)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-119 50,28 22,-122 -74)'), ST_GEOMFROMTEXT('MULTIPOINT(134 14,-32 -84,96 74,44 59,-88 73,-136 12)'))
|
||||
1897030.29194
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-144 73,81 61,-78 4,50 -28)'),
|
||||
ST_GEOMFROMTEXT('MULTIPOINT(-176 48,-154 -39,-140 -60,135 72,-97 28,-35 69)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-144 73,81 61,-78 4,50 -28)'),
|
||||
ST_GEOMFROMTEXT('MULTIPOINT(-176 48,-154 -39,-140 -60,135 72,-97 28,-35 69)'))
|
||||
2505975.110979326
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-14 49)'),
|
||||
ST_GEOMFROMTEXT('MULTIPOINT(-160 -51,-141 72,50 -30,96 -64,-41 -59,-128 -28,0 -77,179 -78,-84 -67)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-14 49)'),
|
||||
ST_GEOMFROMTEXT('MULTIPOINT(-160 -51,-141 72,50 -30,96 -64,-41 -59,-128 -28,0 -77,179 -78,-84 -67)'))
|
||||
5941456.90499
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-165 61,-43 -47,-89 40,-137 -64,11 26,-8 -31,28 -77,37 -44,124 51)'),
|
||||
ST_GEOMFROMTEXT('MULTIPOINT(63 39,98 14,-123 79,-30 -27)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-165 61,-43 -47,-89 40,-137 -64,11 26,-8 -31,28 -77,37 -44,124 51)'),
|
||||
ST_GEOMFROMTEXT('MULTIPOINT(63 39,98 14,-123 79,-30 -27)'))
|
||||
2181430.45407528
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(11 -38,-17 54,-104 73)'),
|
||||
ST_GEOMFROMTEXT('MULTIPOINT(167 -50,103 -21,-122 24,-122 80,-41 37,-175 -25,-155 48,-23 -34,-105 48)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(11 -38,-17 54,-104 73)'),
|
||||
ST_GEOMFROMTEXT('MULTIPOINT(167 -50,103 -21,-122 24,-122 80,-41 37,-175 -25,-155 48,-23 -34,-105 48)'))
|
||||
898973.2896405652
|
||||
#####################################################################################
|
||||
# ST_DISTANCE_SPHERE with different earth radius value
|
||||
#####################################################################################
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 1)'), ST_GEOMFROMTEXT('POINT(0 0)'), 1);
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 1)'), ST_GEOMFROMTEXT('POINT(0 0)'), 1)
|
||||
0.024682056391766436
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 1)'), ST_GEOMFROMTEXT('POINT(0 0)'), 10);
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 1)'), ST_GEOMFROMTEXT('POINT(0 0)'), 10)
|
||||
0.24682056391766435
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 1)'), ST_GEOMFROMTEXT('POINT(0 0)'), 100);
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 1)'), ST_GEOMFROMTEXT('POINT(0 0)'), 100)
|
||||
2.468205639176644
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 1)'), ST_GEOMFROMTEXT('POINT(0 0)'), 2000);
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 1)'), ST_GEOMFROMTEXT('POINT(0 0)'), 2000)
|
||||
49.364112783532875
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 1)'), ST_GEOMFROMTEXT('POINT(0 0)'), 1234567);
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 1)'), ST_GEOMFROMTEXT('POINT(0 0)'), 1234567)
|
||||
30471.652313413913
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 1)'), ST_GEOMFROMTEXT('POINT(0 0)'), 6370986);
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 1)'), ST_GEOMFROMTEXT('POINT(0 0)'), 6370986)
|
||||
157249.0357231545
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 1)'), ST_GEOMFROMTEXT('POINT(0 0)'), 6370987);
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 1)'), ST_GEOMFROMTEXT('POINT(0 0)'), 6370987)
|
||||
157249.06040521088
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 1)'), ST_GEOMFROMTEXT('POINT(0 0)'), 1234567890);
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 1)'), ST_GEOMFROMTEXT('POINT(0 0)'), 1234567890)
|
||||
30471674.280444104
|
||||
#####################################################################################
|
||||
# Invalid function calls
|
||||
#####################################################################################
|
||||
SELECT ST_DISTANCE_SPHERE();
|
||||
ERROR 42000: Incorrect parameter count in the call to native function 'ST_DISTANCE_SPHERE'
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(10 10)'));
|
||||
ERROR 42000: Incorrect parameter count in the call to native function 'ST_DISTANCE_SPHERE'
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(10 10)'),NULL);
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(10 10)'),NULL)
|
||||
NULL
|
||||
SELECT ST_DISTANCE_SPHERE(NULL,ST_GEOMFROMTEXT('POINT(10 10)'));
|
||||
ST_DISTANCE_SPHERE(NULL,ST_GEOMFROMTEXT('POINT(10 10)'))
|
||||
NULL
|
||||
SELECT ST_DISTANCE_SPHERE(NULL,ST_GEOMFROMTEXT(@star_top));
|
||||
ST_DISTANCE_SPHERE(NULL,ST_GEOMFROMTEXT(@star_top))
|
||||
NULL
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT(@star_of_elems),NULL);
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT(@star_of_elems),NULL)
|
||||
NULL
|
||||
SELECT ST_DISTANCE_SPHERE(NULL,NULL);
|
||||
ST_DISTANCE_SPHERE(NULL,NULL)
|
||||
NULL
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT()'),ST_GEOMFROMTEXT('POINT(0 0)'));
|
||||
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(a 0)'),ST_GEOMFROMTEXT('POINT(0 0)'));
|
||||
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(! 0)'),ST_GEOMFROMTEXT('POINT(0 0)'));
|
||||
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT('!' 0)'),ST_GEOMFROMTEXT('POINT(0 0)'));
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '!' 0)'),ST_GEOMFROMTEXT('POINT(0 0)'))' at line 1
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(12,34 0)'),ST_GEOMFROMTEXT('POINT(0 0)'));
|
||||
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT()'),ST_GEOMFROMTEXT('POINT(0 0)'));
|
||||
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 12,34 a)'),ST_GEOMFROMTEXT('POINT(0 0)'));
|
||||
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 12,34 0,1)'),ST_GEOMFROMTEXT('POINT(0 0)'));
|
||||
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 1,2 2,'!' 0)'),ST_GEOMFROMTEXT('POINT(0 0)'));
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near '!' 0)'),ST_GEOMFROMTEXT('POINT(0 0)'))' at line 1
|
||||
SELECT ST_DISTANCE_SPHERE(,);
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near ',)' at line 1
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT(@star_of_elems),);
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near ')' at line 1
|
||||
SELECT ST_DISTANCE_SPHERE(,ST_GEOMFROMTEXT(@star_top));
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near ',ST_GEOMFROMTEXT(@star_top))' at line 1
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 1)'), ST_GEOMFROMTEXT('LINESTRING(0 0,10 10)'));
|
||||
ERROR 22S00: It has not been implemented for Cartesian spatial reference systems.
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 1)'), ST_GEOMFROMTEXT('POLYGON((0 0,0 5,5 5,5 0,0 0))'));
|
||||
ERROR 22S00: It has not been implemented for Cartesian spatial reference systems.
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 1)'), ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(0 0))'));
|
||||
ERROR 22S00: It has not been implemented for Cartesian spatial reference systems.
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(1 1))'), ST_GEOMFROMTEXT('POINT(0 0)'));
|
||||
ERROR 22S00: It has not been implemented for Cartesian spatial reference systems.
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 1)'), ST_GEOMFROMTEXT('GEOMETRYCOLLECTION()'));
|
||||
ERROR 22S00: It has not been implemented for Cartesian spatial reference systems.
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 1)'), ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(POINT(0 0)))'));
|
||||
ERROR 22S00: It has not been implemented for Cartesian spatial reference systems.
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 1)'), ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(0 0),GEOMETRYCOLLECTION())'));
|
||||
ERROR 22S00: It has not been implemented for Cartesian spatial reference systems.
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(0 1)'), ST_GEOMFROMTEXT('LINESTRING(0 0,10 10)'));
|
||||
ERROR 22S00: It has not been implemented for Cartesian spatial reference systems.
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(0 1)'), ST_GEOMFROMTEXT('POLYGON((0 0,0 5,5 5,5 0,0 0))'));
|
||||
ERROR 22S00: It has not been implemented for Cartesian spatial reference systems.
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(0 1)'), ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(0 0))'));
|
||||
ERROR 22S00: It has not been implemented for Cartesian spatial reference systems.
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(MULTIPOINT(1 1))'), ST_GEOMFROMTEXT('POINT(0 0)'));
|
||||
ERROR 22S00: It has not been implemented for Cartesian spatial reference systems.
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(0 1)'), ST_GEOMFROMTEXT('GEOMETRYCOLLECTION()'));
|
||||
ERROR 22S00: It has not been implemented for Cartesian spatial reference systems.
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(0 1)'), ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(POINT(0 0)))'));
|
||||
ERROR 22S00: It has not been implemented for Cartesian spatial reference systems.
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(0 1)'), ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(0 0),GEOMETRYCOLLECTION())'));
|
||||
ERROR 22S00: It has not been implemented for Cartesian spatial reference systems.
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION()'), ST_GEOMFROMTEXT('GEOMETRYCOLLECTION()'));
|
||||
ERROR 22S00: It has not been implemented for Cartesian spatial reference systems.
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 1)'), ST_GEOMFROMTEXT('POINT(0 0)'), -200);
|
||||
ERROR 22023: Invalid radius provided to function st_distance_sphere: Radius(-200.000000) must be greater than zero.
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 1)'), ST_GEOMFROMTEXT('POINT(0 0)'), -1);
|
||||
ERROR 22023: Invalid radius provided to function st_distance_sphere: Radius(-1.000000) must be greater than zero.
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 1)'), ST_GEOMFROMTEXT('POINT(0 0)'), 0);
|
||||
ERROR 22023: Invalid radius provided to function st_distance_sphere: Radius(0.000000) must be greater than zero.
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(200 1)'), ST_GEOMFROMTEXT('POINT(0 0)'), 200);
|
||||
ERROR 22S02: Longitude 200.000000 is out of range in function st_distance_sphere. It must be within (-180.000000, 180.000000].
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(20 1)'), ST_GEOMFROMTEXT('POINT(0 100)'), 200);
|
||||
ERROR 22S03: Latitude 100.000000 is out of range in function st_distance_sphere. It must be within [-90.000000, 90.000000].
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 1)'), ST_GEOMFROMTEXT('POINT(0 0)'), 200, 300);
|
||||
ERROR 42000: Incorrect parameter count in the call to native function 'ST_DISTANCE_SPHERE'
|
||||
# Clean up
|
||||
DROP TABLE gis_geometrycollection;
|
||||
#
|
||||
# WL#8579 Spatial Reference Systems
|
||||
#
|
||||
# SRID 0 (should pass)
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)', 0), ST_GEOMFROMTEXT('POINT(1 1)', 0));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)', 0), ST_GEOMFROMTEXT('POINT(1 1)', 0))
|
||||
157249.03572
|
||||
# Projected SRS (should error)
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)', 2000), ST_GEOMFROMTEXT('POINT(1 1)', 2000));
|
||||
ERROR 22S00: st_distance_sphere(POINT, POINT) has not been implemented for projected spatial reference systems.
|
||||
# Geographic SRS (should pass)
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)', 4326), ST_GEOMFROMTEXT('POINT(1 1)', 4326));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)', 4326), ST_GEOMFROMTEXT('POINT(1 1)', 4326))
|
||||
157249.59776850493
|
||||
#
|
||||
# WL#11096 Don't do Cartesian computations on geographic geometries
|
||||
#
|
||||
# Assume SRID 10 is not defined.
|
||||
SELECT ST_DISTANCE_SPHERE(
|
||||
x'0A000000010100000000000000000000000000000000000000',
|
||||
x'0A000000010100000000000000000000000000000000000000'
|
||||
);
|
||||
ERROR SR001: There's no spatial reference system with SRID 10.
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(-1 -1)'),ST_GEOMFROMTEXT('MULTIPOINT(200 -200)'));
|
||||
ERROR 22S02: Longitude 200.000000 is out of range in function st_distance_sphere. It must be within (-180.000000, 180.000000].
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(-1 -1)'),ST_GEOMFROMTEXT('MULTIPOINT(20 -200)'));
|
||||
ERROR 22S03: Latitude -200.000000 is out of range in function st_distance_sphere. It must be within [-90.000000, 90.000000].
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 1)'),ST_GEOMFROMTEXT('MULTIPOINT(90 -90)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 1)'),ST_GEOMFROMTEXT('MULTIPOINT(90 -90)'))
|
||||
10118716.089160174
|
||||
SELECT ST_DISTANCE_SPHERE('POINT(1 1)','POINT(1 1)');
|
||||
ERROR SR001: There's no spatial reference system with SRID 1313427280.
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMETRYFROMTEXT('MULTIPOINT((1E-15 1E-15),(1E-14 1E-14))'),ST_GEOMETRYFROMTEXT('MULTIPOINT((1E-15 1E-15),(-90 90))'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMETRYFROMTEXT('MULTIPOINT((1E-15 1E-15),(1E-14 1E-14))'),ST_GEOMETRYFROMTEXT('MULTIPOINT((1E-15 1E-15),(-90 90))'))
|
||||
0.000000001415277249932291
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMETRYFROMTEXT('MULTIPOINT((1E-15 1E-15),(1E-14 1E-14))'),ST_GEOMETRYFROMTEXT('POINT(1E-15 1E-15)'));
|
||||
ST_DISTANCE_SPHERE(ST_GEOMETRYFROMTEXT('MULTIPOINT((1E-15 1E-15),(1E-14 1E-14))'),ST_GEOMETRYFROMTEXT('POINT(1E-15 1E-15)'))
|
||||
0.000000001415277249932291
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,131 @@
|
||||
# ----------------------------------------------------------------------
|
||||
# Test of ST_GEOMETRY_COLUMNS.
|
||||
# ----------------------------------------------------------------------
|
||||
drop table if exists geo;
|
||||
create table geo(id int primary key auto_increment, g1 geometry not null srid 4326);
|
||||
select * from INFORMATION_SCHEMA.ST_GEOMETRY_COLUMNS where TABLE_SCHEMA = 'test' and TABLE_NAME = 'geo' ORDER BY COLUMN_NAME;
|
||||
TABLE_SCHEMA TABLE_NAME COLUMN_NAME SRS_NAME SRS_ID GEOMETRY_TYPE_NAME
|
||||
test geo g1 WGS 84 4326 geometry
|
||||
alter table geo add column g2 geometry;
|
||||
select * from INFORMATION_SCHEMA.ST_GEOMETRY_COLUMNS where TABLE_SCHEMA = 'test' and TABLE_NAME = 'geo' ORDER BY COLUMN_NAME;
|
||||
TABLE_SCHEMA TABLE_NAME COLUMN_NAME SRS_NAME SRS_ID GEOMETRY_TYPE_NAME
|
||||
test geo g1 WGS 84 4326 geometry
|
||||
test geo g2 NULL NULL geometry
|
||||
alter table geo add column g3 point srid 2000;
|
||||
select * from INFORMATION_SCHEMA.ST_GEOMETRY_COLUMNS where TABLE_SCHEMA = 'test' and TABLE_NAME = 'geo' ORDER BY COLUMN_NAME;
|
||||
TABLE_SCHEMA TABLE_NAME COLUMN_NAME SRS_NAME SRS_ID GEOMETRY_TYPE_NAME
|
||||
test geo g1 WGS 84 4326 geometry
|
||||
test geo g2 NULL NULL geometry
|
||||
test geo g3 Anguilla 1957 / British West Indies Grid 2000 point
|
||||
alter table geo add column g4 linestring srid 3857;
|
||||
select * from INFORMATION_SCHEMA.ST_GEOMETRY_COLUMNS where TABLE_SCHEMA = 'test' and TABLE_NAME = 'geo' ORDER BY COLUMN_NAME;
|
||||
TABLE_SCHEMA TABLE_NAME COLUMN_NAME SRS_NAME SRS_ID GEOMETRY_TYPE_NAME
|
||||
test geo g1 WGS 84 4326 geometry
|
||||
test geo g2 NULL NULL geometry
|
||||
test geo g3 Anguilla 1957 / British West Indies Grid 2000 point
|
||||
test geo g4 WGS 84 / Pseudo-Mercator 3857 linestring
|
||||
alter table geo add column g5 polygon srid 32766;
|
||||
select * from INFORMATION_SCHEMA.ST_GEOMETRY_COLUMNS where TABLE_SCHEMA = 'test' and TABLE_NAME = 'geo' ORDER BY COLUMN_NAME;
|
||||
TABLE_SCHEMA TABLE_NAME COLUMN_NAME SRS_NAME SRS_ID GEOMETRY_TYPE_NAME
|
||||
test geo g1 WGS 84 4326 geometry
|
||||
test geo g2 NULL NULL geometry
|
||||
test geo g3 Anguilla 1957 / British West Indies Grid 2000 point
|
||||
test geo g4 WGS 84 / Pseudo-Mercator 3857 linestring
|
||||
test geo g5 WGS 84 / TM 36 SE 32766 polygon
|
||||
alter table geo add column g6 multipoint srid 32766;
|
||||
select * from INFORMATION_SCHEMA.ST_GEOMETRY_COLUMNS where TABLE_SCHEMA = 'test' and TABLE_NAME = 'geo' ORDER BY COLUMN_NAME;
|
||||
TABLE_SCHEMA TABLE_NAME COLUMN_NAME SRS_NAME SRS_ID GEOMETRY_TYPE_NAME
|
||||
test geo g1 WGS 84 4326 geometry
|
||||
test geo g2 NULL NULL geometry
|
||||
test geo g3 Anguilla 1957 / British West Indies Grid 2000 point
|
||||
test geo g4 WGS 84 / Pseudo-Mercator 3857 linestring
|
||||
test geo g5 WGS 84 / TM 36 SE 32766 polygon
|
||||
test geo g6 WGS 84 / TM 36 SE 32766 multipoint
|
||||
alter table geo add column g7 multilinestring srid 3857;
|
||||
select * from INFORMATION_SCHEMA.ST_GEOMETRY_COLUMNS where TABLE_SCHEMA = 'test' and TABLE_NAME = 'geo' ORDER BY COLUMN_NAME;
|
||||
TABLE_SCHEMA TABLE_NAME COLUMN_NAME SRS_NAME SRS_ID GEOMETRY_TYPE_NAME
|
||||
test geo g1 WGS 84 4326 geometry
|
||||
test geo g2 NULL NULL geometry
|
||||
test geo g3 Anguilla 1957 / British West Indies Grid 2000 point
|
||||
test geo g4 WGS 84 / Pseudo-Mercator 3857 linestring
|
||||
test geo g5 WGS 84 / TM 36 SE 32766 polygon
|
||||
test geo g6 WGS 84 / TM 36 SE 32766 multipoint
|
||||
test geo g7 WGS 84 / Pseudo-Mercator 3857 multilinestring
|
||||
alter table geo add column g8 multipolygon srid 2000;
|
||||
select * from INFORMATION_SCHEMA.ST_GEOMETRY_COLUMNS where TABLE_SCHEMA = 'test' and TABLE_NAME = 'geo' ORDER BY COLUMN_NAME;
|
||||
TABLE_SCHEMA TABLE_NAME COLUMN_NAME SRS_NAME SRS_ID GEOMETRY_TYPE_NAME
|
||||
test geo g1 WGS 84 4326 geometry
|
||||
test geo g2 NULL NULL geometry
|
||||
test geo g3 Anguilla 1957 / British West Indies Grid 2000 point
|
||||
test geo g4 WGS 84 / Pseudo-Mercator 3857 linestring
|
||||
test geo g5 WGS 84 / TM 36 SE 32766 polygon
|
||||
test geo g6 WGS 84 / TM 36 SE 32766 multipoint
|
||||
test geo g7 WGS 84 / Pseudo-Mercator 3857 multilinestring
|
||||
test geo g8 Anguilla 1957 / British West Indies Grid 2000 multipolygon
|
||||
alter table geo add column g9 geometrycollection srid 4326;
|
||||
select * from INFORMATION_SCHEMA.ST_GEOMETRY_COLUMNS where TABLE_SCHEMA = 'test' and TABLE_NAME = 'geo' ORDER BY COLUMN_NAME;
|
||||
TABLE_SCHEMA TABLE_NAME COLUMN_NAME SRS_NAME SRS_ID GEOMETRY_TYPE_NAME
|
||||
test geo g1 WGS 84 4326 geometry
|
||||
test geo g2 NULL NULL geometry
|
||||
test geo g3 Anguilla 1957 / British West Indies Grid 2000 point
|
||||
test geo g4 WGS 84 / Pseudo-Mercator 3857 linestring
|
||||
test geo g5 WGS 84 / TM 36 SE 32766 polygon
|
||||
test geo g6 WGS 84 / TM 36 SE 32766 multipoint
|
||||
test geo g7 WGS 84 / Pseudo-Mercator 3857 multilinestring
|
||||
test geo g8 Anguilla 1957 / British West Indies Grid 2000 multipolygon
|
||||
test geo g9 WGS 84 4326 geomcollection
|
||||
alter table geo drop column g1;
|
||||
select * from INFORMATION_SCHEMA.ST_GEOMETRY_COLUMNS where TABLE_SCHEMA = 'test' and TABLE_NAME = 'geo' ORDER BY COLUMN_NAME;
|
||||
TABLE_SCHEMA TABLE_NAME COLUMN_NAME SRS_NAME SRS_ID GEOMETRY_TYPE_NAME
|
||||
test geo g2 NULL NULL geometry
|
||||
test geo g3 Anguilla 1957 / British West Indies Grid 2000 point
|
||||
test geo g4 WGS 84 / Pseudo-Mercator 3857 linestring
|
||||
test geo g5 WGS 84 / TM 36 SE 32766 polygon
|
||||
test geo g6 WGS 84 / TM 36 SE 32766 multipoint
|
||||
test geo g7 WGS 84 / Pseudo-Mercator 3857 multilinestring
|
||||
test geo g8 Anguilla 1957 / British West Indies Grid 2000 multipolygon
|
||||
test geo g9 WGS 84 4326 geomcollection
|
||||
alter table geo drop column g2;
|
||||
select * from INFORMATION_SCHEMA.ST_GEOMETRY_COLUMNS where TABLE_SCHEMA = 'test' and TABLE_NAME = 'geo' ORDER BY COLUMN_NAME;
|
||||
TABLE_SCHEMA TABLE_NAME COLUMN_NAME SRS_NAME SRS_ID GEOMETRY_TYPE_NAME
|
||||
test geo g3 Anguilla 1957 / British West Indies Grid 2000 point
|
||||
test geo g4 WGS 84 / Pseudo-Mercator 3857 linestring
|
||||
test geo g5 WGS 84 / TM 36 SE 32766 polygon
|
||||
test geo g6 WGS 84 / TM 36 SE 32766 multipoint
|
||||
test geo g7 WGS 84 / Pseudo-Mercator 3857 multilinestring
|
||||
test geo g8 Anguilla 1957 / British West Indies Grid 2000 multipolygon
|
||||
test geo g9 WGS 84 4326 geomcollection
|
||||
alter table geo drop column g3;
|
||||
select * from INFORMATION_SCHEMA.ST_GEOMETRY_COLUMNS where TABLE_SCHEMA = 'test' and TABLE_NAME = 'geo' ORDER BY COLUMN_NAME;
|
||||
TABLE_SCHEMA TABLE_NAME COLUMN_NAME SRS_NAME SRS_ID GEOMETRY_TYPE_NAME
|
||||
test geo g4 WGS 84 / Pseudo-Mercator 3857 linestring
|
||||
test geo g5 WGS 84 / TM 36 SE 32766 polygon
|
||||
test geo g6 WGS 84 / TM 36 SE 32766 multipoint
|
||||
test geo g7 WGS 84 / Pseudo-Mercator 3857 multilinestring
|
||||
test geo g8 Anguilla 1957 / British West Indies Grid 2000 multipolygon
|
||||
test geo g9 WGS 84 4326 geomcollection
|
||||
alter table geo drop column g4;
|
||||
select * from INFORMATION_SCHEMA.ST_GEOMETRY_COLUMNS where TABLE_SCHEMA = 'test' and TABLE_NAME = 'geo' ORDER BY COLUMN_NAME;
|
||||
TABLE_SCHEMA TABLE_NAME COLUMN_NAME SRS_NAME SRS_ID GEOMETRY_TYPE_NAME
|
||||
test geo g5 WGS 84 / TM 36 SE 32766 polygon
|
||||
test geo g6 WGS 84 / TM 36 SE 32766 multipoint
|
||||
test geo g7 WGS 84 / Pseudo-Mercator 3857 multilinestring
|
||||
test geo g8 Anguilla 1957 / British West Indies Grid 2000 multipolygon
|
||||
test geo g9 WGS 84 4326 geomcollection
|
||||
alter table geo drop column g5;
|
||||
select * from INFORMATION_SCHEMA.ST_GEOMETRY_COLUMNS where TABLE_SCHEMA = 'test' and TABLE_NAME = 'geo' ORDER BY COLUMN_NAME;
|
||||
TABLE_SCHEMA TABLE_NAME COLUMN_NAME SRS_NAME SRS_ID GEOMETRY_TYPE_NAME
|
||||
test geo g6 WGS 84 / TM 36 SE 32766 multipoint
|
||||
test geo g7 WGS 84 / Pseudo-Mercator 3857 multilinestring
|
||||
test geo g8 Anguilla 1957 / British West Indies Grid 2000 multipolygon
|
||||
test geo g9 WGS 84 4326 geomcollection
|
||||
truncate table geo;
|
||||
select * from INFORMATION_SCHEMA.ST_GEOMETRY_COLUMNS where TABLE_SCHEMA = 'test' and TABLE_NAME = 'geo' ORDER BY COLUMN_NAME;
|
||||
TABLE_SCHEMA TABLE_NAME COLUMN_NAME SRS_NAME SRS_ID GEOMETRY_TYPE_NAME
|
||||
test geo g6 WGS 84 / TM 36 SE 32766 multipoint
|
||||
test geo g7 WGS 84 / Pseudo-Mercator 3857 multilinestring
|
||||
test geo g8 Anguilla 1957 / British West Indies Grid 2000 multipolygon
|
||||
test geo g9 WGS 84 4326 geomcollection
|
||||
drop table geo;
|
||||
select * from INFORMATION_SCHEMA.ST_GEOMETRY_COLUMNS where TABLE_SCHEMA = 'test' and TABLE_NAME = 'geo' ORDER BY COLUMN_NAME;
|
||||
TABLE_SCHEMA TABLE_NAME COLUMN_NAME SRS_NAME SRS_ID GEOMETRY_TYPE_NAME
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,216 @@
|
||||
# ----------------------------------------------------------------------
|
||||
# Test of GEOMETRY st_geomfromwkb
|
||||
# ----------------------------------------------------------------------
|
||||
select ST_AsText(st_geomfromwkb(x'010100000000000000000044400000000000004440'));
|
||||
ST_AsText(st_geomfromwkb(x'010100000000000000000044400000000000004440'))
|
||||
POINT(40 40)
|
||||
select ST_AsText(st_geomfromwkb(x'01010000000000000000004e400000000000005e40'));
|
||||
ST_AsText(st_geomfromwkb(x'01010000000000000000004e400000000000005e40'))
|
||||
POINT(60 120)
|
||||
select ST_AsText(st_geomfromwkb(x'010100000000000000000044400000000000004440'));
|
||||
ST_AsText(st_geomfromwkb(x'010100000000000000000044400000000000004440'))
|
||||
POINT(40 40)
|
||||
select ST_AsText(st_geomfromwkb(x'01010000000000000000004e400000000000004e40'));
|
||||
ST_AsText(st_geomfromwkb(x'01010000000000000000004e400000000000004e40'))
|
||||
POINT(60 60)
|
||||
SET @wkb_pt = ST_GeomFromText('POINT(0 1)');
|
||||
SET @wkb_ln = ST_GeomFromText('LINESTRING(0 1,2 3,4 5,6 7,8 9, 10 11)');
|
||||
SET @wkb_py = ST_GeomFromText('POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4))');
|
||||
SET @wkb_mpt = ST_GeomFromText('MULTIPOINT(0 1,2 3,4 5,6 7)');
|
||||
SET @wkb_mln = ST_GeomFromText('MULTILINESTRING((0 1,2 3,4 5),(6 7,8 9,10 11))');
|
||||
SET @wkb_mpy = ST_GeomFromText('MULTIPOLYGON(((0 1,0 10,10 11,10 0,0 1),(4 5,4 6,6 7,6 4,4 5)),'
|
||||
'((10 11,10 12,12 13,12 10,10 11)))');
|
||||
SET @wkb_gc = ST_GeomFromText('GEOMETRYCOLLECTION('
|
||||
'POINT(0 1),'
|
||||
'LINESTRING(0 1,10 11),'
|
||||
'POLYGON((0 0,0 10,10 10,10 0, 0 0)),'
|
||||
'MULTIPOINT(0 1,2 3,4 5,6 7,8 9,10 11),'
|
||||
'MULTILINESTRING((0 1,10 11),(0 10,10 0)),'
|
||||
'MULTIPOLYGON(((0 1,0 5,5 6,5 0,0 1)),((5 4,5 10,10 11,10 5,5 4))))');
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_pt)));
|
||||
ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_pt)))
|
||||
POINT(0 1)
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_ln)));
|
||||
ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_ln)))
|
||||
LINESTRING(0 1,2 3,4 5,6 7,8 9,10 11)
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_py)));
|
||||
ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_py)))
|
||||
POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4))
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_mpt)));
|
||||
ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_mpt)))
|
||||
MULTIPOINT((0 1),(2 3),(4 5),(6 7))
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_mln)));
|
||||
ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_mln)))
|
||||
MULTILINESTRING((0 1,2 3,4 5),(6 7,8 9,10 11))
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_mpy)));
|
||||
ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_mpy)))
|
||||
MULTIPOLYGON(((0 1,0 10,10 11,10 0,0 1),(4 5,4 6,6 7,6 4,4 5)),((10 11,10 12,12 13,12 10,10 11)))
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_gc)));
|
||||
ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_gc)))
|
||||
GEOMETRYCOLLECTION(POINT(0 1),LINESTRING(0 1,10 11),POLYGON((0 0,0 10,10 10,10 0,0 0)),MULTIPOINT((0 1),(2 3),(4 5),(6 7),(8 9),(10 11)),MULTILINESTRING((0 1,10 11),(0 10,10 0)),MULTIPOLYGON(((0 1,0 5,5 6,5 0,0 1)),((5 4,5 10,10 11,10 5,5 4))))
|
||||
SELECT ST_AsText(ST_GeometryFromWKB(st_aswkb(@wkb_pt)));
|
||||
ST_AsText(ST_GeometryFromWKB(st_aswkb(@wkb_pt)))
|
||||
POINT(0 1)
|
||||
SELECT ST_AsText(ST_GeometryFromWKB(st_aswkb(@wkb_ln)));
|
||||
ST_AsText(ST_GeometryFromWKB(st_aswkb(@wkb_ln)))
|
||||
LINESTRING(0 1,2 3,4 5,6 7,8 9,10 11)
|
||||
SELECT ST_AsText(ST_GeometryFromWKB(st_aswkb(@wkb_py)));
|
||||
ST_AsText(ST_GeometryFromWKB(st_aswkb(@wkb_py)))
|
||||
POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4))
|
||||
SELECT ST_AsText(ST_GeometryFromWKB(st_aswkb(@wkb_mpt)));
|
||||
ST_AsText(ST_GeometryFromWKB(st_aswkb(@wkb_mpt)))
|
||||
MULTIPOINT((0 1),(2 3),(4 5),(6 7))
|
||||
SELECT ST_AsText(ST_GeometryFromWKB(st_aswkb(@wkb_mln)));
|
||||
ST_AsText(ST_GeometryFromWKB(st_aswkb(@wkb_mln)))
|
||||
MULTILINESTRING((0 1,2 3,4 5),(6 7,8 9,10 11))
|
||||
SELECT ST_AsText(ST_GeometryFromWKB(st_aswkb(@wkb_mpy)));
|
||||
ST_AsText(ST_GeometryFromWKB(st_aswkb(@wkb_mpy)))
|
||||
MULTIPOLYGON(((0 1,0 10,10 11,10 0,0 1),(4 5,4 6,6 7,6 4,4 5)),((10 11,10 12,12 13,12 10,10 11)))
|
||||
SELECT ST_AsText(ST_GeometryFromWKB(st_aswkb(@wkb_gc)));
|
||||
ST_AsText(ST_GeometryFromWKB(st_aswkb(@wkb_gc)))
|
||||
GEOMETRYCOLLECTION(POINT(0 1),LINESTRING(0 1,10 11),POLYGON((0 0,0 10,10 10,10 0,0 0)),MULTIPOINT((0 1),(2 3),(4 5),(6 7),(8 9),(10 11)),MULTILINESTRING((0 1,10 11),(0 10,10 0)),MULTIPOLYGON(((0 1,0 5,5 6,5 0,0 1)),((5 4,5 10,10 11,10 5,5 4))))
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_pt), 2000));
|
||||
ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_pt), 2000))
|
||||
POINT(0 1)
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_ln), 2000));
|
||||
ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_ln), 2000))
|
||||
LINESTRING(0 1,2 3,4 5,6 7,8 9,10 11)
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_py), 2000));
|
||||
ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_py), 2000))
|
||||
POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4))
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_mpt), 2000));
|
||||
ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_mpt), 2000))
|
||||
MULTIPOINT((0 1),(2 3),(4 5),(6 7))
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_mln), 2000));
|
||||
ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_mln), 2000))
|
||||
MULTILINESTRING((0 1,2 3,4 5),(6 7,8 9,10 11))
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_mpy), 2000));
|
||||
ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_mpy), 2000))
|
||||
MULTIPOLYGON(((0 1,0 10,10 11,10 0,0 1),(4 5,4 6,6 7,6 4,4 5)),((10 11,10 12,12 13,12 10,10 11)))
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_gc), 2000));
|
||||
ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_gc), 2000))
|
||||
GEOMETRYCOLLECTION(POINT(0 1),LINESTRING(0 1,10 11),POLYGON((0 0,0 10,10 10,10 0,0 0)),MULTIPOINT((0 1),(2 3),(4 5),(6 7),(8 9),(10 11)),MULTILINESTRING((0 1,10 11),(0 10,10 0)),MULTIPOLYGON(((0 1,0 5,5 6,5 0,0 1)),((5 4,5 10,10 11,10 5,5 4))))
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_pt), 2000, 'axis-order=long-lat'));
|
||||
ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_pt), 2000, 'axis-order=long-lat'))
|
||||
POINT(0 1)
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_ln), 2000, 'axis-order=long-lat'));
|
||||
ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_ln), 2000, 'axis-order=long-lat'))
|
||||
LINESTRING(0 1,2 3,4 5,6 7,8 9,10 11)
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_py), 2000, 'axis-order=long-lat'));
|
||||
ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_py), 2000, 'axis-order=long-lat'))
|
||||
POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4))
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_mpt), 2000, 'axis-order=long-lat'));
|
||||
ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_mpt), 2000, 'axis-order=long-lat'))
|
||||
MULTIPOINT((0 1),(2 3),(4 5),(6 7))
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_mln), 2000, 'axis-order=long-lat'));
|
||||
ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_mln), 2000, 'axis-order=long-lat'))
|
||||
MULTILINESTRING((0 1,2 3,4 5),(6 7,8 9,10 11))
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_mpy), 2000, 'axis-order=long-lat'));
|
||||
ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_mpy), 2000, 'axis-order=long-lat'))
|
||||
MULTIPOLYGON(((0 1,0 10,10 11,10 0,0 1),(4 5,4 6,6 7,6 4,4 5)),((10 11,10 12,12 13,12 10,10 11)))
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_gc), 2000, 'axis-order=long-lat'));
|
||||
ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_gc), 2000, 'axis-order=long-lat'))
|
||||
GEOMETRYCOLLECTION(POINT(0 1),LINESTRING(0 1,10 11),POLYGON((0 0,0 10,10 10,10 0,0 0)),MULTIPOINT((0 1),(2 3),(4 5),(6 7),(8 9),(10 11)),MULTILINESTRING((0 1,10 11),(0 10,10 0)),MULTIPOLYGON(((0 1,0 5,5 6,5 0,0 1)),((5 4,5 10,10 11,10 5,5 4))))
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_pt), 4326));
|
||||
ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_pt), 4326))
|
||||
POINT(0 1)
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_ln), 4326));
|
||||
ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_ln), 4326))
|
||||
LINESTRING(0 1,2 3,4 5,6 7,8 9,10 11)
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_py), 4326));
|
||||
ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_py), 4326))
|
||||
POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4))
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_mpt), 4326));
|
||||
ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_mpt), 4326))
|
||||
MULTIPOINT((0 1),(2 3),(4 5),(6 7))
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_mln), 4326));
|
||||
ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_mln), 4326))
|
||||
MULTILINESTRING((0 1,2 3,4 5),(6 7,8 9,10 11))
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_mpy), 4326));
|
||||
ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_mpy), 4326))
|
||||
MULTIPOLYGON(((0 1,0 10,10 11,10 0,0 1),(4 5,4 6,6 7,6 4,4 5)),((10 11,10 12,12 13,12 10,10 11)))
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_gc), 4326));
|
||||
ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_gc), 4326))
|
||||
GEOMETRYCOLLECTION(POINT(0 1),LINESTRING(0 1,10 11),POLYGON((0 0,0 10,10 10,10 0,0 0)),MULTIPOINT((0 1),(2 3),(4 5),(6 7),(8 9),(10 11)),MULTILINESTRING((0 1,10 11),(0 10,10 0)),MULTIPOLYGON(((0 1,0 5,5 6,5 0,0 1)),((5 4,5 10,10 11,10 5,5 4))))
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_pt), 4326, 'axis-order=long-lat'));
|
||||
ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_pt), 4326, 'axis-order=long-lat'))
|
||||
POINT(1 0)
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_ln), 4326, 'axis-order=long-lat'));
|
||||
ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_ln), 4326, 'axis-order=long-lat'))
|
||||
LINESTRING(1 0,3 2,5 4,7 6,9 8,11 10)
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_py), 4326, 'axis-order=long-lat'));
|
||||
ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_py), 4326, 'axis-order=long-lat'))
|
||||
POLYGON((0 0,10 0,10 10,0 10,0 0),(4 4,6 4,6 6,4 6,4 4))
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_mpt), 4326, 'axis-order=long-lat'));
|
||||
ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_mpt), 4326, 'axis-order=long-lat'))
|
||||
MULTIPOINT((1 0),(3 2),(5 4),(7 6))
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_mln), 4326, 'axis-order=long-lat'));
|
||||
ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_mln), 4326, 'axis-order=long-lat'))
|
||||
MULTILINESTRING((1 0,3 2,5 4),(7 6,9 8,11 10))
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_mpy), 4326, 'axis-order=long-lat'));
|
||||
ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_mpy), 4326, 'axis-order=long-lat'))
|
||||
MULTIPOLYGON(((1 0,10 0,11 10,0 10,1 0),(5 4,6 4,7 6,4 6,5 4)),((11 10,12 10,13 12,10 12,11 10)))
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_gc), 4326, 'axis-order=long-lat'));
|
||||
ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_gc), 4326, 'axis-order=long-lat'))
|
||||
GEOMETRYCOLLECTION(POINT(1 0),LINESTRING(1 0,11 10),POLYGON((0 0,10 0,10 10,0 10,0 0)),MULTIPOINT((1 0),(3 2),(5 4),(7 6),(9 8),(11 10)),MULTILINESTRING((1 0,11 10),(10 0,0 10)),MULTIPOLYGON(((1 0,5 0,6 5,0 5,1 0)),((4 5,10 5,11 10,5 10,4 5))))
|
||||
SELECT ST_GeomFromWKB();
|
||||
ERROR 42000: Incorrect parameter count in the call to native function 'ST_GeomFromWKB'
|
||||
SELECT ST_GeomFromWKB(NULL);
|
||||
ST_GeomFromWKB(NULL)
|
||||
NULL
|
||||
SELECT ST_GeomFromWKB(ST_GeomFromText('POINT()'));
|
||||
ERROR 22023: Invalid GIS data provided to function st_geomfromwkb.
|
||||
SELECT ST_GeomFromWKB(ST_GeomFromText('LINESTRING(0 0,! 10)'));
|
||||
ERROR 22023: Invalid GIS data provided to function st_geomfromwkb.
|
||||
select ST_GeometryFromWKB(x'010100000000000000000034C00000000000002E4000000000000034400000000000003440');
|
||||
ERROR 22023: Invalid GIS data provided to function st_geometryfromwkb.
|
||||
select ST_GeomFromWKB(x'010100000000000000000034C00000000000002E4000000000000034400000000000003440');
|
||||
ERROR 22023: Invalid GIS data provided to function st_geomfromwkb.
|
||||
select ST_GeometryFromWKB(x'0101000000');
|
||||
ERROR 22023: Invalid GIS data provided to function st_geometryfromwkb.
|
||||
select ST_GeomFromWKB(x'01020000000200000000000000000059400000000000005e400000000000005940');
|
||||
ERROR 22023: Invalid GIS data provided to function st_geomfromwkb.
|
||||
select st_geomfromwkb(x'01020000000200000000000000000059400000000000005e4000000000000059400000000000006e40',4326);
|
||||
ERROR 22S03: Latitude 100.000000 is out of range in function st_geomfromwkb. It must be within [-90.000000, 90.000000].
|
||||
select st_geomfromwkb(x'010100000000000000008046400000000000006940',4326);
|
||||
ERROR 22S02: Longitude 200.000000 is out of range in function st_geomfromwkb. It must be within (-180.000000, 180.000000].
|
||||
SELECT ST_GeomFromWKB(0x020100000000000000000000000000000000000000);
|
||||
ERROR 22023: Invalid GIS data provided to function st_geomfromwkb.
|
||||
SELECT ST_GeomFromWKB(0x01040000000100000001020000000100000000000000000000000000000000000000);
|
||||
ERROR 22023: Invalid GIS data provided to function st_geomfromwkb.
|
||||
SELECT ST_GeomFromWKB(0x01040000000100000002020000000100000000000000000000000000000000000000);
|
||||
ERROR 22023: Invalid GIS data provided to function st_geomfromwkb.
|
||||
SELECT ST_GeomFromWKB(0x01050000000100000001040000000100000000000000000000000000000000000000);
|
||||
ERROR 22023: Invalid GIS data provided to function st_geomfromwkb.
|
||||
SELECT ST_GeomFromWKB(0x01050000000100000002040000000100000000000000000000000000000000000000);
|
||||
ERROR 22023: Invalid GIS data provided to function st_geomfromwkb.
|
||||
SELECT ST_GeomFromWKB(0x01060000000100000001020000000100000000000000000000000000000000000000);
|
||||
ERROR 22023: Invalid GIS data provided to function st_geomfromwkb.
|
||||
SELECT ST_GeomFromWKB(0x01060000000100000003020000000100000000000000000000000000000000000000);
|
||||
ERROR 22023: Invalid GIS data provided to function st_geomfromwkb.
|
||||
SELECT ST_GeomFromWKB(0x01070000000100000002010000000000000000000000);
|
||||
ERROR 22023: Invalid GIS data provided to function st_geomfromwkb.
|
||||
select ST_GeomFromWKB(x'010300000001000000050000000000000000C056C000000000004054400000000000C0564000000000008056C000000000000054C000000000000034C000000000000000000000000000C056400000000000C056C00000000000405490');
|
||||
ERROR 22023: Invalid GIS data provided to function st_geomfromwkb.
|
||||
select ST_AsText(ST_GeometryFromWKB(x'010100000000000000000034C00000000000002E40',26918,'axis-order=lat-long'));
|
||||
ST_AsText(ST_GeometryFromWKB(x'010100000000000000000034C00000000000002E40',26918,'axis-order=lat-long'))
|
||||
POINT(-20 15)
|
||||
select ST_AsText(ST_GeomFromWKB(x'010100000000000000000034C00000000000002E40',26918,'axis-order=lat-long'));
|
||||
ST_AsText(ST_GeomFromWKB(x'010100000000000000000034C00000000000002E40',26918,'axis-order=lat-long'))
|
||||
POINT(-20 15)
|
||||
select ST_GeometryFromWKB(x'010100000000000000000034C00000000000002E40',4326,'axis-order=long-long');
|
||||
ERROR 22023: Invalid value 'long-long' for option 'axis-order' in function 'st_geometryfromwkb'.
|
||||
select ST_GeomFromWKB(x'010100000000000000000034C00000000000002E40',4326,'axis-order=lat-lat');
|
||||
ERROR 22023: Invalid value 'lat-lat' for option 'axis-order' in function 'st_geomfromwkb'.
|
||||
select ST_GeomFromWKB(x'010100000000000000000034C00000000000002E40',4326,'axis-ord');
|
||||
ERROR 22023: The string 'axis-ord' is not a valid key = value pair in function st_geomfromwkb.
|
||||
select ST_GeometryFromWKB(x'010100000000000000000034C00000000000002E40',4326,'axis-ord');
|
||||
ERROR 22023: The string 'axis-ord' is not a valid key = value pair in function st_geometryfromwkb.
|
||||
select ST_GeomFromWKB(x'010100000000000000000034C00000000000002E40',4326,11);
|
||||
ERROR 22023: The string '11' is not a valid key = value pair in function st_geomfromwkb.
|
||||
select ST_GeometryFromWKB(x'010100000000000000000034C00000000000002E40',4326,11);
|
||||
ERROR 22023: The string '11' is not a valid key = value pair in function st_geometryfromwkb.
|
||||
select ST_GeometryFromWKB(x'010100000000000000000034C00000000000002E40','axis-order=long-lat','srid=4326');
|
||||
ERROR 22023: Invalid option key 'srid' in function st_geometryfromwkb.
|
||||
select ST_GeomFromWKB(x'010100000000000000000034C00000000000002E40','axis-order=long-lat','srid=4326');
|
||||
ERROR 22023: Invalid option key 'srid' in function st_geomfromwkb.
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,402 @@
|
||||
# ----------------------------------------------------------------------
|
||||
# Test of GEOMETRY ST_Intersects (cases from postgis).
|
||||
# ----------------------------------------------------------------------
|
||||
drop table if exists gis_geometrycollection, gis_geometrycollection_2, tbl_polygon;
|
||||
SELECT ST_INTERSECTS(st_geomfromtext('LINESTRING(0 10, 0 -10)'), st_geomfromtext('LINESTRING(0 0, 1 1)'));
|
||||
ST_INTERSECTS(st_geomfromtext('LINESTRING(0 10, 0 -10)'), st_geomfromtext('LINESTRING(0 0, 1 1)'))
|
||||
1
|
||||
SELECT ST_INTERSECTS(st_geomfromtext('POINT(5 5)'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'));
|
||||
ST_INTERSECTS(st_geomfromtext('POINT(5 5)'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'))
|
||||
1
|
||||
SELECT ST_INTERSECTS(st_geomfromtext('POINT(0 0)'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'));
|
||||
ST_INTERSECTS(st_geomfromtext('POINT(0 0)'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'))
|
||||
1
|
||||
SELECT ST_INTERSECTS(st_geomfromtext('POINT(-1 0)'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'));
|
||||
ST_INTERSECTS(st_geomfromtext('POINT(-1 0)'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'))
|
||||
0
|
||||
SELECT ST_INTERSECTS(st_geomfromtext('POINT(0 5)'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'));
|
||||
ST_INTERSECTS(st_geomfromtext('POINT(0 5)'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'))
|
||||
1
|
||||
SELECT ST_INTERSECTS(st_geomfromtext('POINT(0 12)'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'));
|
||||
ST_INTERSECTS(st_geomfromtext('POINT(0 12)'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'))
|
||||
0
|
||||
SELECT ST_INTERSECTS(st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), st_geomfromtext('POINT(5 5)'));
|
||||
ST_INTERSECTS(st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), st_geomfromtext('POINT(5 5)'))
|
||||
1
|
||||
SELECT ST_INTERSECTS(st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), st_geomfromtext('POINT(5 5)'));
|
||||
ST_INTERSECTS(st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), st_geomfromtext('POINT(5 5)'))
|
||||
1
|
||||
SELECT ST_INTERSECTS(st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), st_geomfromtext('POINT(0 0)'));
|
||||
ST_INTERSECTS(st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), st_geomfromtext('POINT(0 0)'))
|
||||
1
|
||||
SELECT ST_INTERSECTS(st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), st_geomfromtext('POINT(-1 0)'));
|
||||
ST_INTERSECTS(st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), st_geomfromtext('POINT(-1 0)'))
|
||||
0
|
||||
SELECT ST_INTERSECTS(st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), st_geomfromtext('POINT(0 5)'));
|
||||
ST_INTERSECTS(st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), st_geomfromtext('POINT(0 5)'))
|
||||
1
|
||||
SELECT ST_INTERSECTS(st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), st_geomfromtext('POINT(0 12)'));
|
||||
ST_INTERSECTS(st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), st_geomfromtext('POINT(0 12)'))
|
||||
0
|
||||
# intersects105
|
||||
SELECT ST_INTERSECTS(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631), ST_GeomFromText('POINT(521513 5377804)', 32631));
|
||||
ST_INTERSECTS(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631), ST_GeomFromText('POINT(521513 5377804)', 32631))
|
||||
1
|
||||
SELECT ST_INTERSECTS(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631), ST_GeomFromText('POINT(521513 5377804)', 32631));
|
||||
ST_INTERSECTS(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631), ST_GeomFromText('POINT(521513 5377804)', 32631))
|
||||
1
|
||||
SELECT ST_INTERSECTS(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631), ST_GeomFromText('POINT(521513 5377804)', 32631));
|
||||
ST_INTERSECTS(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631), ST_GeomFromText('POINT(521513 5377804)', 32631))
|
||||
1
|
||||
# intersects106
|
||||
SELECT ST_INTERSECTS(ST_GeomFromText('POINT(521513 5377804)', 32631), ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631));
|
||||
ST_INTERSECTS(ST_GeomFromText('POINT(521513 5377804)', 32631), ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631))
|
||||
1
|
||||
SELECT ST_INTERSECTS(ST_GeomFromText('POINT(521513 5377804)', 32631), ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631));
|
||||
ST_INTERSECTS(ST_GeomFromText('POINT(521513 5377804)', 32631), ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631))
|
||||
1
|
||||
SELECT ST_INTERSECTS(ST_GeomFromText('POINT(521513 5377804)', 32631), ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631));
|
||||
ST_INTERSECTS(ST_GeomFromText('POINT(521513 5377804)', 32631), ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631))
|
||||
1
|
||||
# intersects107
|
||||
SELECT ST_INTERSECTS(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631), ST_GeomFromText('POINT(521513 5377804)', 32631));
|
||||
ST_INTERSECTS(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631), ST_GeomFromText('POINT(521513 5377804)', 32631))
|
||||
1
|
||||
SELECT ST_INTERSECTS(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631), ST_GeomFromText('POINT(521513 5377804)', 32631));
|
||||
ST_INTERSECTS(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631), ST_GeomFromText('POINT(521513 5377804)', 32631))
|
||||
1
|
||||
SELECT ST_INTERSECTS(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631), ST_GeomFromText('POINT(521513 5377804)', 32631));
|
||||
ST_INTERSECTS(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631), ST_GeomFromText('POINT(521513 5377804)', 32631))
|
||||
1
|
||||
# intersects108
|
||||
SELECT ST_INTERSECTS(ST_GeomFromText('POINT(521513 5377804)', 32631), ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631));
|
||||
ST_INTERSECTS(ST_GeomFromText('POINT(521513 5377804)', 32631), ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631))
|
||||
1
|
||||
SELECT ST_INTERSECTS(ST_GeomFromText('POINT(521513 5377804)', 32631), ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631));
|
||||
ST_INTERSECTS(ST_GeomFromText('POINT(521513 5377804)', 32631), ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631))
|
||||
1
|
||||
SELECT ST_INTERSECTS(ST_GeomFromText('POINT(521513 5377804)', 32631), ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631));
|
||||
ST_INTERSECTS(ST_GeomFromText('POINT(521513 5377804)', 32631), ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631))
|
||||
1
|
||||
drop table if exists t1, t2;
|
||||
# intersects20x types100 types114
|
||||
create table t1 (p1 geometry, p2 geometry);
|
||||
insert into t1(p1, p2) values
|
||||
(ST_GeomFromText('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), ST_GeomFromText('POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))')),
|
||||
(ST_GeomFromText('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), ST_GeomFromText('POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))')),
|
||||
(ST_GeomFromText('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), ST_GeomFromText('POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))')),
|
||||
(ST_GeomFromText('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), ST_GeomFromText('POLYGON((-5 -5, 5 -5, 5 5, -5 5, -5 -5))')),
|
||||
(ST_GeomFromText('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), ST_GeomFromText('POLYGON((-2 -2, -2 -3, -3 -3, -3 -2, -2 -2))')),
|
||||
(ST_GeomFromText('POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))'), ST_GeomFromText('POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))')),
|
||||
(ST_GeomFromText('POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))'), ST_GeomFromText('POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))')),
|
||||
(ST_GeomFromText('POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))'), ST_GeomFromText('POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))')),
|
||||
(ST_GeomFromText('POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))'), ST_GeomFromText('POLYGON((-5 -5, 5 -5, 5 5, -5 5, -5 -5))')),
|
||||
(ST_GeomFromText('POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))'), ST_GeomFromText('POLYGON((-2 -2, -2 -3, -3 -3, -3 -2, -2 -2))')),
|
||||
(ST_GeomFromText('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), ST_GeomFromText('POINT(5 5)')),
|
||||
(ST_GeomFromText('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), ST_GeomFromText('POINT(5 5)')),
|
||||
(ST_GeomFromText('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), ST_GeomFromText('POINT(5 5)')),
|
||||
(ST_GeomFromText('LINESTRING(0 0, 0 10, 10 10, 10 0)'), ST_GeomFromText('POINT(5 5)')),
|
||||
(ST_GeomFromText('LINESTRING(0 0, 0 10, 10 10, 10 0)'), ST_GeomFromText('POINT(5 5)')),
|
||||
(ST_GeomFromText('LINESTRING(0 0, 0 10, 10 10, 10 0)'), ST_GeomFromText('POINT(5 5)')),
|
||||
(ST_GeomFromText('POINT(5 5)'), ST_GeomFromText('POINT(5 5)')),
|
||||
(ST_GeomFromText('POINT(5 5)'), ST_GeomFromText('POINT(5 5)')),
|
||||
(ST_GeomFromText('POINT(5 5)'), ST_GeomFromText('POINT(5 5)')),
|
||||
(ST_GeomFromText('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), ST_GeomFromText('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))')),
|
||||
(ST_GeomFromText('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), ST_GeomFromText('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))')),
|
||||
(ST_GeomFromText('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), ST_GeomFromText('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))')),
|
||||
(ST_GeomFromText('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), ST_GeomFromText('LINESTRING(0 0, 0 10, 10 10, 10 0)')),
|
||||
(ST_GeomFromText('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), ST_GeomFromText('LINESTRING(0 0, 0 10, 10 10, 10 0)')),
|
||||
(ST_GeomFromText('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), ST_GeomFromText('LINESTRING(0 0, 0 10, 10 10, 10 0)'));
|
||||
select ST_Intersects(p1, p2) AS intersects_p1p2, ST_Intersects(p2, p1) AS intersects_p2p1 from t1;
|
||||
intersects_p1p2 intersects_p2p1
|
||||
1 1
|
||||
1 1
|
||||
1 1
|
||||
1 1
|
||||
0 0
|
||||
1 1
|
||||
1 1
|
||||
1 1
|
||||
1 1
|
||||
0 0
|
||||
1 1
|
||||
1 1
|
||||
1 1
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
1 1
|
||||
1 1
|
||||
1 1
|
||||
1 1
|
||||
1 1
|
||||
1 1
|
||||
1 1
|
||||
1 1
|
||||
1 1
|
||||
drop table t1;
|
||||
# intersects310
|
||||
SELECT ST_INTERSECTS(st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), st_geomfromtext('LINESTRING(1 10, 9 10, 9 8)'));
|
||||
ST_INTERSECTS(st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), st_geomfromtext('LINESTRING(1 10, 9 10, 9 8)'))
|
||||
1
|
||||
SELECT ST_INTERSECTS(st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), st_geomfromtext('LINESTRING(1 10, 9 10, 9 8)'));
|
||||
ST_INTERSECTS(st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), st_geomfromtext('LINESTRING(1 10, 9 10, 9 8)'))
|
||||
1
|
||||
SELECT ST_INTERSECTS(st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), st_geomfromtext('LINESTRING(1 10, 9 10, 9 8)'));
|
||||
ST_INTERSECTS(st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), st_geomfromtext('LINESTRING(1 10, 9 10, 9 8)'))
|
||||
1
|
||||
# intersects311
|
||||
SELECT ST_INTERSECTS(st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), st_geomfromtext('LINESTRING(1 10, 10 10, 10 8)'));
|
||||
ST_INTERSECTS(st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), st_geomfromtext('LINESTRING(1 10, 10 10, 10 8)'))
|
||||
1
|
||||
SELECT ST_INTERSECTS(st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), st_geomfromtext('LINESTRING(1 10, 10 10, 10 8)'));
|
||||
ST_INTERSECTS(st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), st_geomfromtext('LINESTRING(1 10, 10 10, 10 8)'))
|
||||
1
|
||||
SELECT ST_INTERSECTS(st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), st_geomfromtext('LINESTRING(1 10, 10 10, 10 8)'));
|
||||
ST_INTERSECTS(st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), st_geomfromtext('LINESTRING(1 10, 10 10, 10 8)'))
|
||||
1
|
||||
# multipoint on polygon vertex
|
||||
SELECT 'intersects111', ST_Intersects(st_geomfromtext('MULTIPOINT ((0 0))'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'));
|
||||
intersects111 ST_Intersects(st_geomfromtext('MULTIPOINT ((0 0))'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'))
|
||||
intersects111 1
|
||||
# multipoint outside polygon
|
||||
SELECT 'intersects112', ST_intersects(st_geomfromtext('MULTIPOINT ((-1 0))'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'));
|
||||
intersects112 ST_intersects(st_geomfromtext('MULTIPOINT ((-1 0))'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'))
|
||||
intersects112 0
|
||||
# multipoint on polygon edge
|
||||
SELECT 'intersects113', ST_intersects(st_geomfromtext('MULTIPOINT ((0 5))'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'));
|
||||
intersects113 ST_intersects(st_geomfromtext('MULTIPOINT ((0 5))'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'))
|
||||
intersects113 1
|
||||
SELECT 'intersects114', ST_intersects(st_geomfromtext('MULTIPOINT ((0 5), (0 8))'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'));
|
||||
intersects114 ST_intersects(st_geomfromtext('MULTIPOINT ((0 5), (0 8))'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'))
|
||||
intersects114 1
|
||||
# multipoint in line with polygon edge
|
||||
SELECT 'intersects115', ST_intersects(st_geomfromtext('MULTIPOINT ((0 12))'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'));
|
||||
intersects115 ST_intersects(st_geomfromtext('MULTIPOINT ((0 12))'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'))
|
||||
intersects115 0
|
||||
# multipoint vertically aligned with polygon vertex
|
||||
SELECT 'intersects116', ST_intersects(ST_GeomFromText('MULTIPOINT ((521513 5377804))', 32631), ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631));
|
||||
intersects116 ST_intersects(ST_GeomFromText('MULTIPOINT ((521513 5377804))', 32631), ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631))
|
||||
intersects116 1
|
||||
# repeated vertex
|
||||
SELECT 'intersects117', ST_intersects(ST_GeomFromText('MULTIPOINT ((521543 5377804))', 32631), ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631));
|
||||
intersects117 ST_intersects(ST_GeomFromText('MULTIPOINT ((521543 5377804))', 32631), ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631))
|
||||
intersects117 0
|
||||
# multipoint within polygon
|
||||
SELECT 'intersects118', ST_intersects(st_geomfromtext('MULTIPOINT ((5 5))'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'));
|
||||
intersects118 ST_intersects(st_geomfromtext('MULTIPOINT ((5 5))'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'))
|
||||
intersects118 1
|
||||
SELECT 'intersects119', ST_intersects(st_geomfromtext('MULTIPOINT ((5 5), (7 7))'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'));
|
||||
intersects119 ST_intersects(st_geomfromtext('MULTIPOINT ((5 5), (7 7))'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'))
|
||||
intersects119 1
|
||||
# multipoint partially within polygon
|
||||
SELECT 'intersects120', ST_intersects(st_geomfromtext('MULTIPOINT ((5 5), (15 5))'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'));
|
||||
intersects120 ST_intersects(st_geomfromtext('MULTIPOINT ((5 5), (15 5))'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'))
|
||||
intersects120 1
|
||||
SELECT 'intersects121', ST_intersects(st_geomfromtext('MULTIPOINT ((15 5), (5 5))'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'));
|
||||
intersects121 ST_intersects(st_geomfromtext('MULTIPOINT ((15 5), (5 5))'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'))
|
||||
intersects121 1
|
||||
# point within polygon
|
||||
SELECT 'intersects150', ST_intersects(st_geomfromtext('POINT(5 5)'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'));
|
||||
intersects150 ST_intersects(st_geomfromtext('POINT(5 5)'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'))
|
||||
intersects150 1
|
||||
# point on polygon vertex
|
||||
SELECT 'intersects151', ST_intersects(st_geomfromtext('POINT(0 0)'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'));
|
||||
intersects151 ST_intersects(st_geomfromtext('POINT(0 0)'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'))
|
||||
intersects151 1
|
||||
# point outside polygon
|
||||
SELECT 'intersects152', ST_intersects(st_geomfromtext('POINT(-1 0)'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'));
|
||||
intersects152 ST_intersects(st_geomfromtext('POINT(-1 0)'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'))
|
||||
intersects152 0
|
||||
# point on polygon edge
|
||||
SELECT 'intersects153', ST_intersects(st_geomfromtext('POINT(0 5)'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'));
|
||||
intersects153 ST_intersects(st_geomfromtext('POINT(0 5)'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'))
|
||||
intersects153 1
|
||||
# point in line with polygon edge
|
||||
SELECT 'intersects154', ST_intersects(st_geomfromtext('POINT(0 12)'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'));
|
||||
intersects154 ST_intersects(st_geomfromtext('POINT(0 12)'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'))
|
||||
intersects154 0
|
||||
select 'intersects', ST_intersects(
|
||||
st_geomfromtext('POLYGON((0.0 0.0,1.0 0.0,1.0 1.0,1.0 0.0,0.0 0.0))'),
|
||||
st_geomfromtext('POLYGON((0.0 2.0,1.0 2.0,1.0 3.0,0.0 3.0,0.0 2.0))'));
|
||||
intersects ST_intersects(
|
||||
st_geomfromtext('POLYGON((0.0 0.0,1.0 0.0,1.0 1.0,1.0 0.0,0.0 0.0))'),
|
||||
st_geomfromtext('POLYGON((0.0 2.0,1.0 2.0,1.0 3.0,0.0 3.0,0.0 2.0))'))
|
||||
intersects 0
|
||||
select 'intersects', ST_intersects(
|
||||
st_geomfromtext('POLYGON((0.0 0.0,1.0 0.0,1.0 1.0,1.0 0.0,0.0 0.0))', 4326),
|
||||
st_geomfromtext('POLYGON((0.0 2.0,1.0 2.0,1.0 3.0,0.0 3.0,0.0 2.0))', 4326));
|
||||
intersects ST_intersects(
|
||||
st_geomfromtext('POLYGON((0.0 0.0,1.0 0.0,1.0 1.0,1.0 0.0,0.0 0.0))', 4326),
|
||||
st_geomfromtext('POLYGON((0.0 2.0,1.0 2.0,1.0 3.0,0.0 3.0,0.0 2.0))', 4326))
|
||||
intersects 0
|
||||
select 'intersects', ST_intersects(
|
||||
st_geomfromtext('POLYGON((0.0 0.0,1.0 0.0,1.0 1.0,1.0 0.0,0.0 0.0))', 32631),
|
||||
st_geomfromtext('POLYGON((0.0 2.0,1.0 2.0,1.0 3.0,0.0 3.0,0.0 2.0))', 32631));
|
||||
intersects ST_intersects(
|
||||
st_geomfromtext('POLYGON((0.0 0.0,1.0 0.0,1.0 1.0,1.0 0.0,0.0 0.0))', 32631),
|
||||
st_geomfromtext('POLYGON((0.0 2.0,1.0 2.0,1.0 3.0,0.0 3.0,0.0 2.0))', 32631))
|
||||
intersects 0
|
||||
select 'intersects', ST_intersects(
|
||||
st_geomfromtext('POLYGON((0.0 0.0,1.0 0.0,1.0 1.0,1.0 0.0,0.0 0.0))', 4326),
|
||||
st_geomfromtext('POLYGON((0.0 2.0,1.0 2.0,1.0 3.0,0.0 3.0,0.0 2.0))', 32631));
|
||||
ERROR HY000: Binary geometry function given two geometries of different srids.
|
||||
SELECT '#845', ST_Intersects(st_geomfromtext('POINT(169.69960846592 -46.5061209281002)'), st_geomfromtext('POLYGON((169.699607857174 -46.5061218662,169.699607857174 -46.5061195965597,169.699608806526 -46.5061195965597,169.699608806526 -46.5061218662,169.699607857174 -46.5061218662))'));
|
||||
#845 ST_Intersects(st_geomfromtext('POINT(169.69960846592 -46.5061209281002)'), st_geomfromtext('POLYGON((169.699607857174 -46.5061218662,169.699607857174 -46.5061195965597,169.699608806526 -46.5061195965597,169.699608806526 -46.5061218662,169.699607857174 -46
|
||||
#845 1
|
||||
CREATE TABLE t2 (id int, g geometry);
|
||||
insert into t2(id, g) values
|
||||
(1, st_geomfromtext('POINT(0.5 0.5000000000001)')),
|
||||
(2, st_geomfromtext('POINT(0.5 0.5000000000001)'));
|
||||
select id,st_astext(g) from t2;
|
||||
id st_astext(g)
|
||||
1 POINT(0.5 0.5000000000001)
|
||||
2 POINT(0.5 0.5000000000001)
|
||||
select '#852.1', id,
|
||||
st_intersects(g, st_geomfromtext('POLYGON((0 0, 10 10, 1 0, 0 0))')),
|
||||
st_intersects(g, st_geomfromtext('POLYGON((0 0, 1 1, 1 0, 0 0))')) from t2;
|
||||
#852.1 id st_intersects(g, st_geomfromtext('POLYGON((0 0, 10 10, 1 0, 0 0))')) st_intersects(g, st_geomfromtext('POLYGON((0 0, 1 1, 1 0, 0 0))'))
|
||||
#852.1 1 0 0
|
||||
#852.1 2 0 0
|
||||
UPDATE t2 SET g = st_geomfromtext('POINT(0.5 0.5)');
|
||||
select id,st_astext(g) from t2;
|
||||
id st_astext(g)
|
||||
1 POINT(0.5 0.5)
|
||||
2 POINT(0.5 0.5)
|
||||
drop table t2;
|
||||
SELECT '#4176', ST_Intersects(st_geomfromtext('POLYGON((0 0, 10 10, 3 5, 0 0))'), st_geomfromtext('GEOMETRYCOLLECTION(POINT(10 10), LINESTRING(0 0, 3 3))'));
|
||||
#4176 ST_Intersects(st_geomfromtext('POLYGON((0 0, 10 10, 3 5, 0 0))'), st_geomfromtext('GEOMETRYCOLLECTION(POINT(10 10), LINESTRING(0 0, 3 3))'))
|
||||
#4176 1
|
||||
drop table if exists geo_table, geo_table2, geo_table3, geo_table4, ltable, rtable, rtable2;
|
||||
create table geo_table( k int primary key, geom geometry not null);
|
||||
create index geom_index on geo_table(geom);
|
||||
INSERT INTO geo_table VALUES
|
||||
(1, ST_GeomFromText('POINT(1.0 1.0)')),
|
||||
(2, ST_GeomFromText('LINESTRING(1.0 1.0, 2.0 2.0)')),
|
||||
(3, ST_GeomFromText('POINT(3.0 3.0)')),
|
||||
(4, ST_GeomFromText('LINESTRING(4.0 4.0, 5.0 5.0)')),
|
||||
(5, ST_GeomFromText('LINESTRING(40.0 40.0, 41.0 41.0)')),
|
||||
(6, ST_GeomFromText('POLYGON((1.0 1.0, 5.0 1.0, 5.0 5.0, 1.0 5.0, 1.0 1.0))'));
|
||||
SELECT k FROM geo_table WHERE ST_Intersects(ST_GeomFromText('POINT(3.0 3.0)'), geom) ORDER BY k;
|
||||
k
|
||||
3
|
||||
6
|
||||
SELECT k FROM geo_table WHERE ST_Intersects(ST_GeomFromText('POINT(4.5 4.5)'), geom) ORDER BY k;
|
||||
k
|
||||
4
|
||||
6
|
||||
SELECT k FROM geo_table WHERE ST_Intersects(ST_GeomFromText('POINT(2.5 2.5)'), geom) ORDER BY k;
|
||||
k
|
||||
6
|
||||
CREATE TABLE geo_table2(k int, geom geometry not null, k_plus_one int, PRIMARY KEY (k, k_plus_one));
|
||||
create index geom_index2 on geo_table2(geom);
|
||||
INSERT INTO geo_table2 VALUES
|
||||
(1, ST_GeomFromText('LINESTRING(1.0 1.0, 2.0 2.0)'), 2),
|
||||
(2, ST_GeomFromText('POLYGON((1.0 1.0, 5.0 1.0, 5.0 5.0, 1.0 5.0, 1.0 1.0))'), 3);
|
||||
SELECT k FROM geo_table2 WHERE ST_Intersects(ST_GeomFromText('POINT(3.0 3.0)'), geom);
|
||||
k
|
||||
2
|
||||
SELECT k, k_plus_one FROM geo_table2 WHERE ST_Intersects(ST_GeomFromText('POINT(3.0 3.0)'), geom);
|
||||
k k_plus_one
|
||||
2 3
|
||||
SELECT k, k_plus_one, st_astext(geom) FROM geo_table2 WHERE ST_Intersects(ST_GeomFromText('POINT(3.0 3.0)'), geom);
|
||||
k k_plus_one st_astext(geom)
|
||||
2 3 POLYGON((1 1,5 1,5 5,1 5,1 1))
|
||||
create table geo_table3( k int primary key, geom geometry not null);
|
||||
create index geom_index3 on geo_table3(geom);
|
||||
INSERT INTO geo_table3 VALUES
|
||||
(1, ST_GeomFromText('POINT(1 1)')),
|
||||
(2, ST_GeomFromText('LINESTRING(1 1, 2 2)')),
|
||||
(3, ST_GeomFromText('POINT(3 3)')),
|
||||
(4, ST_GeomFromText('LINESTRING(4 4, 5 5)')),
|
||||
(5, ST_GeomFromText('LINESTRING(40 40, 41 41)')),
|
||||
(6, ST_GeomFromText('POLYGON((1 1, 5 1, 5 5, 1 5, 1 1))')),
|
||||
(7, ST_GeomFromText('LINESTRING(1 1, 3 3)'));
|
||||
SELECT k FROM geo_table3 WHERE ST_Intersects(ST_GeomFromText('MULTIPOINT((2.2 2.2), (3.0 3.0))'), geom) ORDER BY k;
|
||||
k
|
||||
3
|
||||
6
|
||||
7
|
||||
create table geo_table4( k int primary key, geom geometry not null);
|
||||
create index geom_index4 on geo_table4(geom);
|
||||
INSERT INTO geo_table4 VALUES
|
||||
(1, ST_GeomFromText('POINT(400001 4000001)')),
|
||||
(2, ST_GeomFromText('LINESTRING(400001 4000001, 400002 4000002)')),
|
||||
(3, ST_GeomFromText('POINT(400003 4000003)')),
|
||||
(4, ST_GeomFromText('LINESTRING(400004 4000004, 400005 4000005)')),
|
||||
(5, ST_GeomFromText('LINESTRING(400040 4000040, 400041 4000041)')),
|
||||
(6, ST_GeomFromText('POLYGON((400001 4000001, 400005 4000001, 400005 4000005, 400001 4000005, 400001 4000001))'));
|
||||
SELECT k FROM geo_table4 WHERE ST_Intersects(ST_GeomFromText('POINT(400003 4000003)'), geom) ORDER BY k;
|
||||
k
|
||||
3
|
||||
6
|
||||
DROP TABLE geo_table4;
|
||||
create table geo_table4( k int primary key, geom geometry not null);
|
||||
create index geom_index4 on geo_table4(geom);
|
||||
INSERT INTO geo_table4 VALUES
|
||||
(1, ST_GeomFromText('POINT(400001 4000001)')),
|
||||
(2, ST_GeomFromText('LINESTRING(400001 4000001, 400002 4000002)')),
|
||||
(3, ST_GeomFromText('POINT(400003 4000003)')),
|
||||
(4, ST_GeomFromText('LINESTRING(400004 4000004, 400005 4000005)')),
|
||||
(5, ST_GeomFromText('LINESTRING(400040 4000040, 400041 4000041)')),
|
||||
(6, ST_GeomFromText('POLYGON((400001 4000001, 400005 4000001, 400005 4000005, 400001 4000005, 400001 4000001))'));
|
||||
SELECT k FROM geo_table4 WHERE ST_Intersects(ST_GeomFromText('POINT(400003 4000003)'), geom) ORDER BY k;
|
||||
k
|
||||
3
|
||||
6
|
||||
create table ltable( lk int primary key, geom1 geometry, geom2 geometry);
|
||||
INSERT INTO ltable VALUES
|
||||
(1, ST_GeomFromText('POINT(3.0 3.0)'), ST_GeomFromText('POINT(3.0 3.0)')),
|
||||
(2, ST_GeomFromText('POINT(4.5 4.5)'), ST_GeomFromText('POINT(3.0 3.0)')),
|
||||
(3, ST_GeomFromText('POINT(1.5 1.5)'), ST_GeomFromText('POINT(3.0 3.0)')),
|
||||
(4, NULL, ST_GeomFromText('POINT(3.0 3.0)')),
|
||||
(5, ST_GeomFromText('POINT(1.5 1.5)'), NULL),
|
||||
(6, NULL, NULL);
|
||||
create table rtable( rk int primary key, i int, geom geometry not null);
|
||||
create index igeom_idx on rtable(geom);
|
||||
INSERT INTO rtable VALUES
|
||||
(11, 10, ST_GeomFromText('POINT(1.0 1.0)')),
|
||||
(12, 10, ST_GeomFromText('LINESTRING(1.0 1.0, 2.0 2.0)')),
|
||||
(13, 10, ST_GeomFromText('POINT(3.0 3.0)')),
|
||||
(14, 10, ST_GeomFromText('LINESTRING(4.0 4.0, 5.0 5.0)')),
|
||||
(15, 10, ST_GeomFromText('LINESTRING(40.0 40.0, 41.0 41.0)')),
|
||||
(16, 10, ST_GeomFromText('POLYGON((1.0 1.0, 5.0 1.0, 5.0 5.0, 1.0 5.0, 1.0 1.0))')),
|
||||
(17, 20, ST_GeomFromText('POINT(1.0 1.0)')),
|
||||
(18, 20, ST_GeomFromText('LINESTRING(1.0 1.0, 2.0 2.0)')),
|
||||
(19, 20, ST_GeomFromText('POINT(3.0 3.0)')),
|
||||
(20, 20, ST_GeomFromText('LINESTRING(4.0 4.0, 5.0 5.0)')),
|
||||
(21, 20, ST_GeomFromText('LINESTRING(40.0 40.0, 41.0 41.0)')),
|
||||
(22, 20, ST_GeomFromText('POLYGON((1.0 1.0, 5.0 1.0, 5.0 5.0, 1.0 5.0, 1.0 1.0))'));
|
||||
create table rtable2( rk int primary key, geom geometry not null);
|
||||
create index igeom_idx2 on rtable2(geom);
|
||||
INSERT INTO rtable2 VALUES
|
||||
(11, ST_GeomFromText('POINT(1.0 1.0)')),
|
||||
(12, ST_GeomFromText('LINESTRING(1.0 1.0, 2.0 2.0)')),
|
||||
(13, ST_GeomFromText('POINT(3.0 3.0)')),
|
||||
(14, ST_GeomFromText('LINESTRING(4.0 4.0, 5.0 5.0)')),
|
||||
(15, ST_GeomFromText('LINESTRING(40.0 40.0, 41.0 41.0)')),
|
||||
(16, ST_GeomFromText('POLYGON((1.0 1.0, 5.0 1.0, 5.0 5.0, 1.0 5.0, 1.0 1.0))'));
|
||||
SELECT lk FROM ltable WHERE EXISTS (SELECT * FROM rtable2 WHERE ST_Intersects(ltable.geom2, rtable2.geom));
|
||||
lk
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
SELECT rk FROM rtable2 WHERE EXISTS (SELECT * FROM ltable WHERE ST_Intersects(ltable.geom2, rtable2.geom))
|
||||
ORDER BY rk;
|
||||
rk
|
||||
13
|
||||
16
|
||||
SELECT lk FROM ltable WHERE NOT EXISTS (SELECT * FROM rtable2 WHERE ST_Intersects(ltable.geom2, rtable2.geom))
|
||||
ORDER BY lk;
|
||||
lk
|
||||
5
|
||||
6
|
||||
SELECT rk FROM rtable2 WHERE NOT EXISTS (SELECT * FROM ltable WHERE ST_Intersects(ltable.geom2, rtable2.geom))
|
||||
ORDER BY rk;
|
||||
rk
|
||||
11
|
||||
12
|
||||
14
|
||||
15
|
||||
drop table if exists geo_table, geo_table2, geo_table3, geo_table4, ltable, rtable, rtable2;
|
||||
@ -0,0 +1,106 @@
|
||||
# ----------------------------------------------------------------------
|
||||
# Test of GEOMETRY ST_Latitude
|
||||
# ----------------------------------------------------------------------
|
||||
# NULL as one of the parameters must result in NULL return value.
|
||||
SELECT ST_LATITUDE(NULL);
|
||||
ST_LATITUDE(NULL)
|
||||
NULL
|
||||
SELECT ST_LATITUDE(NULL, NULL);
|
||||
ST_LATITUDE(NULL, NULL)
|
||||
NULL
|
||||
SELECT ST_LATITUDE(NULL, 1);
|
||||
ST_LATITUDE(NULL, 1)
|
||||
NULL
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 4326), NULL);
|
||||
ST_LATITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 4326), NULL)
|
||||
NULL
|
||||
# Invalid data is not allowed.
|
||||
#todo@dazhi
|
||||
# New value must be within the allowed range.
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 4326), -90.000000001);
|
||||
ERROR 22S03: Latitude -90.000000 is out of range in function st_latitude. It must be within [-90.000000, 90.000000].
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 4326), 90.000000001);
|
||||
ERROR 22S03: Latitude 90.000000 is out of range in function st_latitude. It must be within [-90.000000, 90.000000].
|
||||
# First parameter must be a point.
|
||||
# Cartesian SRID 0
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('LINESTRING(0 0, 1 1)', 0));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type LINESTRING in st_latitude.
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('POLYGON((0 0, 0 1, 1 1, 0 0))', 0));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type POLYGON in st_latitude.
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('MULTIPOINT((0 0))', 0));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type MULTIPOINT in st_latitude.
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('MULTIPOINT((0 0), (1 1))', 0));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type MULTIPOINT in st_latitude.
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('MULTILINESTRING((0 0, 1 1))', 0));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type MULTILINESTRING in st_latitude.
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0, 0 1, 1 1, 0 0)))', 0));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type MULTIPOLYGON in st_latitude.
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(0 0))', 0));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type GEOMETRYCOLLECTION in st_latitude.
|
||||
# Projected
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('LINESTRING(0 0, 1 1)', 3857));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type LINESTRING in st_latitude.
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('POLYGON((0 0, 0 1, 1 1, 0 0))', 3857));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type POLYGON in st_latitude.
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('MULTIPOINT((0 0))', 3857));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type MULTIPOINT in st_latitude.
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('MULTIPOINT((0 0), (1 1))', 3857));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type MULTIPOINT in st_latitude.
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('MULTILINESTRING((0 0, 1 1))', 3857));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type MULTILINESTRING in st_latitude.
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0, 0 1, 1 1, 0 0)))', 3857));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type MULTIPOLYGON in st_latitude.
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(0 0))', 3857));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type GEOMETRYCOLLECTION in st_latitude.
|
||||
# Geographic
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('LINESTRING(0 0, 1 1)', 4326));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type LINESTRING in st_latitude.
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('POLYGON((0 0, 0 1, 1 1, 0 0))', 4326));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type POLYGON in st_latitude.
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('MULTIPOINT((0 0))', 4326));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type MULTIPOINT in st_latitude.
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('MULTIPOINT((0 0), (1 1))', 4326));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type MULTIPOINT in st_latitude.
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('MULTILINESTRING((0 0, 1 1))', 4326));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type MULTILINESTRING in st_latitude.
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0, 0 1, 1 1, 0 0)))', 4326));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type MULTIPOLYGON in st_latitude.
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(0 0))', 4326));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type GEOMETRYCOLLECTION in st_latitude.
|
||||
# Point must be geographic.
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 0));
|
||||
ERROR 22S00: Function st_latitude is only defined for geographic spatial reference systems, but one of its arguments is in SRID 0, which is not geographic.
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 3857));
|
||||
ERROR 22S00: Function st_latitude is only defined for geographic spatial reference systems, but one of its arguments is in SRID 3857, which is not geographic.
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 4326));
|
||||
ST_LATITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 4326))
|
||||
0
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 0), 1);
|
||||
ERROR 22S00: Function st_latitude is only defined for geographic spatial reference systems, but one of its arguments is in SRID 0, which is not geographic.
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 3857), 1);
|
||||
ERROR 22S00: Function st_latitude is only defined for geographic spatial reference systems, but one of its arguments is in SRID 3857, which is not geographic.
|
||||
SELECT ST_ASTEXT(ST_LATITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 4326), 1));
|
||||
ST_ASTEXT(ST_LATITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 4326), 1))
|
||||
POINT(1 0)
|
||||
# Get or set the latitude of a point in a lat-long SRS.
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('POINT(1 0)', 4326));
|
||||
ST_LATITUDE(ST_GEOMFROMTEXT('POINT(1 0)', 4326))
|
||||
1
|
||||
SELECT ST_ASTEXT(ST_LATITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 4326), 1));
|
||||
ST_ASTEXT(ST_LATITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 4326), 1))
|
||||
POINT(1 0)
|
||||
# Get or set the latitude of a point in a long-lat SRS.
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('POINT(0 1)', 7035));
|
||||
ST_LATITUDE(ST_GEOMFROMTEXT('POINT(0 1)', 7035))
|
||||
1
|
||||
SELECT ST_ASTEXT(ST_LATITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 7035), 1));
|
||||
ST_ASTEXT(ST_LATITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 7035), 1))
|
||||
POINT(0 1)
|
||||
# Get or set the latitude of a point in a lat-long SRS with a meridian
|
||||
# that doesn't go through Greenwich.
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('POINT(1 0)', 4801));
|
||||
ST_LATITUDE(ST_GEOMFROMTEXT('POINT(1 0)', 4801))
|
||||
1
|
||||
SELECT ST_ASTEXT(ST_LATITUDE(ST_GEOMFROMTEXT('POINT(1 0)', 4801), 1));
|
||||
ST_ASTEXT(ST_LATITUDE(ST_GEOMFROMTEXT('POINT(1 0)', 4801), 1))
|
||||
POINT(1 0)
|
||||
@ -0,0 +1,106 @@
|
||||
# ----------------------------------------------------------------------
|
||||
# Test of GEOMETRY ST_Longitude
|
||||
# ----------------------------------------------------------------------
|
||||
# NULL as one of the parameters must result in NULL return value.
|
||||
SELECT ST_LONGITUDE(NULL);
|
||||
ST_LONGITUDE(NULL)
|
||||
NULL
|
||||
SELECT ST_LONGITUDE(NULL, NULL);
|
||||
ST_LONGITUDE(NULL, NULL)
|
||||
NULL
|
||||
SELECT ST_LONGITUDE(NULL, 1);
|
||||
ST_LONGITUDE(NULL, 1)
|
||||
NULL
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 4326), NULL);
|
||||
ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 4326), NULL)
|
||||
NULL
|
||||
# Invalid data is not allowed. todo@dazhi
|
||||
# New value must be within the allowed range.
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 4326), -180.000000001);
|
||||
ERROR 22S02: Longitude -180.000000 is out of range in function st_longitude. It must be within (-180.000000, 180.000000].
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 4326), 180.000000001);
|
||||
ERROR 22S02: Longitude 180.000000 is out of range in function st_longitude. It must be within (-180.000000, 180.000000].
|
||||
# First parameter must be a point.
|
||||
# Cartesian SRID 0
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('LINESTRING(0 0, 1 1)', 0));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type LINESTRING in st_longitude.
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('POLYGON((0 0, 0 1, 1 1, 0 0))', 0));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type POLYGON in st_longitude.
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('MULTIPOINT((0 0))', 0));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type MULTIPOINT in st_longitude.
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('MULTIPOINT((0 0), (1 1))', 0));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type MULTIPOINT in st_longitude.
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('MULTILINESTRING((0 0, 1 1))', 0));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type MULTILINESTRING in st_longitude.
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0, 0 1, 1 1, 0 0)))', 0));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type MULTIPOLYGON in st_longitude.
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(0 0))', 0));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type GEOMETRYCOLLECTION in st_longitude.
|
||||
# Projected
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('LINESTRING(0 0, 1 1)', 3857));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type LINESTRING in st_longitude.
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('POLYGON((0 0, 0 1, 1 1, 0 0))', 3857));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type POLYGON in st_longitude.
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('MULTIPOINT((0 0))', 3857));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type MULTIPOINT in st_longitude.
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('MULTIPOINT((0 0), (1 1))', 3857));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type MULTIPOINT in st_longitude.
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('MULTILINESTRING((0 0, 1 1))', 3857));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type MULTILINESTRING in st_longitude.
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0, 0 1, 1 1, 0 0)))', 3857));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type MULTIPOLYGON in st_longitude.
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(0 0))', 3857));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type GEOMETRYCOLLECTION in st_longitude.
|
||||
# Geographic
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('LINESTRING(0 0, 1 1)', 4326));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type LINESTRING in st_longitude.
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('POLYGON((0 0, 0 1, 1 1, 0 0))', 4326));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type POLYGON in st_longitude.
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('MULTIPOINT((0 0))', 4326));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type MULTIPOINT in st_longitude.
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('MULTIPOINT((0 0), (1 1))', 4326));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type MULTIPOINT in st_longitude.
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('MULTILINESTRING((0 0, 1 1))', 4326));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type MULTILINESTRING in st_longitude.
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0, 0 1, 1 1, 0 0)))', 4326));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type MULTIPOLYGON in st_longitude.
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(0 0))', 4326));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type GEOMETRYCOLLECTION in st_longitude.
|
||||
# Point must be geographic.
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 0));
|
||||
ERROR 22S00: Function st_longitude is only defined for geographic spatial reference systems, but one of its arguments is in SRID 0, which is not geographic.
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 3857));
|
||||
ERROR 22S00: Function st_longitude is only defined for geographic spatial reference systems, but one of its arguments is in SRID 3857, which is not geographic.
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 4326));
|
||||
ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 4326))
|
||||
0
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 0), 1);
|
||||
ERROR 22S00: Function st_longitude is only defined for geographic spatial reference systems, but one of its arguments is in SRID 0, which is not geographic.
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 3857), 1);
|
||||
ERROR 22S00: Function st_longitude is only defined for geographic spatial reference systems, but one of its arguments is in SRID 3857, which is not geographic.
|
||||
SELECT ST_ASTEXT(ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 4326), 1));
|
||||
ST_ASTEXT(ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 4326), 1))
|
||||
POINT(0 1)
|
||||
# Get or set the longitude of a point in a lat-long SRS.
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(0 1)', 4326));
|
||||
ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(0 1)', 4326))
|
||||
1
|
||||
SELECT ST_ASTEXT(ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(0 1)', 4326), 1));
|
||||
ST_ASTEXT(ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(0 1)', 4326), 1))
|
||||
POINT(0 1)
|
||||
# Get or set the longitude of a point in a long-lat SRS.
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(1 0)', 7035));
|
||||
ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(1 0)', 7035))
|
||||
1
|
||||
SELECT ST_ASTEXT(ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 7035), 1));
|
||||
ST_ASTEXT(ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 7035), 1))
|
||||
POINT(1 0)
|
||||
# Get or set the longitude of a point in a lat-long SRS with a meridian
|
||||
# that doesn't go through Greenwich.
|
||||
# todo@dazhi: different result w.r.t mysql8
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(0 1)', 4801));
|
||||
ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(0 1)', 4801))
|
||||
1
|
||||
SELECT ST_ASTEXT(ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(0 1)', 4801), 1));
|
||||
ST_ASTEXT(ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(0 1)', 4801), 1))
|
||||
POINT(0 1)
|
||||
@ -0,0 +1,58 @@
|
||||
# ----------------------------------------------------------------------
|
||||
# Base test of _ST_POINT.
|
||||
# ----------------------------------------------------------------------
|
||||
SELECT HEX(_ST_POINT(0, 0));
|
||||
HEX(_ST_POINT(0, 0))
|
||||
00000000010100000000000000000000000000000000000000
|
||||
SELECT HEX(_ST_POINT('0', '0'));
|
||||
HEX(_ST_POINT('0', '0'))
|
||||
00000000010100000000000000000000000000000000000000
|
||||
SELECT HEX(_ST_POINT(NULL, NULL));
|
||||
HEX(_ST_POINT(NULL, NULL))
|
||||
NULL
|
||||
SELECT HEX(_ST_POINT('NULL', 'NULL'));
|
||||
ERROR 01000: Truncated incorrect DOUBLE value
|
||||
SELECT HEX(_ST_POINT(0, 0, 0));
|
||||
HEX(_ST_POINT(0, 0, 0))
|
||||
00000000010100000000000000000000000000000000000000
|
||||
SELECT HEX(_ST_POINT('0', '0', '0'));
|
||||
HEX(_ST_POINT('0', '0', '0'))
|
||||
00000000010100000000000000000000000000000000000000
|
||||
SELECT HEX(_ST_POINT(NULL, NULL, NULL));
|
||||
HEX(_ST_POINT(NULL, NULL, NULL))
|
||||
NULL
|
||||
SELECT HEX(_ST_POINT('NULL', 'NULL', 'NULL'));
|
||||
ERROR 22007: Incorrect value
|
||||
SELECT HEX(_ST_POINT(1, 1, 'NULL'));
|
||||
ERROR 22007: Incorrect value
|
||||
SELECT HEX(_ST_POINT(1, 2, 4326));
|
||||
HEX(_ST_POINT(1, 2, 4326))
|
||||
E61000000101000000000000000000F03F0000000000000040
|
||||
SELECT HEX(_ST_POINT(1, 2, '4326'));
|
||||
HEX(_ST_POINT(1, 2, '4326'))
|
||||
E61000000101000000000000000000F03F0000000000000040
|
||||
SELECT HEX(_ST_POINT(1, 2, 43267));
|
||||
ERROR SR001: There's no spatial reference system with SRID 43267.
|
||||
SELECT _ST_POINT('','');
|
||||
ERROR 01000: Truncated incorrect DOUBLE value
|
||||
SELECT HEX(_ST_POINT('ABC','CBA'));
|
||||
ERROR 01000: Truncated incorrect DOUBLE value
|
||||
SELECT HEX(_ST_POINT(true,false));
|
||||
ERROR 22000: Invalid data type for the operation
|
||||
SELECT HEX(_ST_POINT(DATE('2000-11-11'),DATE('2000-11-11')));
|
||||
ERROR 22000: Invalid data type for the operation
|
||||
SELECT HEX(_ST_POINT(1E-324,1E-324));
|
||||
HEX(_ST_POINT(1E-324,1E-324))
|
||||
00000000010100000000000000000000000000000000000000
|
||||
SELECT HEX(_ST_POINT(11,22,'4326.123'));
|
||||
ERROR 22007: Incorrect value
|
||||
SELECT HEX(_ST_POINT(11,22,'4326ABCD'));
|
||||
ERROR 22007: Incorrect value
|
||||
SELECT HEX(_ST_POINT(11,22,'CBA4326ABCD'));
|
||||
ERROR 22007: Incorrect value
|
||||
SELECT HEX(_ST_POINT(11,22,'false'));
|
||||
ERROR 22007: Incorrect value
|
||||
SELECT HEX(_ST_POINT(11,22,''));
|
||||
ERROR 22007: Incorrect value
|
||||
SELECT HEX(_ST_POINT(11,22,false));
|
||||
ERROR 22000: Invalid data type for the operation
|
||||
@ -0,0 +1,150 @@
|
||||
# ----------------------------------------------------------------------
|
||||
# Test of GEOMETRY ST_SRID
|
||||
# ----------------------------------------------------------------------
|
||||
# Must return 0.
|
||||
SELECT ST_SRID(CAST(ST_GEOMFROMTEXT('POINT(1 1)', 0) AS POINT));
|
||||
ST_SRID(CAST(ST_GEOMFROMTEXT('POINT(1 1)', 0) AS POINT))
|
||||
0
|
||||
#
|
||||
# Must return 4326.
|
||||
SELECT ST_SRID(CAST(ST_GEOMFROMTEXT('POINT(45 90)', 4326) AS POINT));
|
||||
ST_SRID(CAST(ST_GEOMFROMTEXT('POINT(45 90)', 4326) AS POINT))
|
||||
4326
|
||||
#
|
||||
#
|
||||
SET @g = ST_GeomFromText('LineString(1 1,2 2)', 0);
|
||||
SELECT ST_SRID(@g);
|
||||
ST_SRID(@g)
|
||||
0
|
||||
SELECT ST_ASTEXT(ST_SRID(@g, 4326));
|
||||
ST_ASTEXT(ST_SRID(@g, 4326))
|
||||
LINESTRING(1 1,2 2)
|
||||
#
|
||||
#
|
||||
SET @g = ST_GeomFromText('MULTIPOINT(1 1, 11 11, 11 21, 21 21)', 2343);
|
||||
SELECT ST_SRID(@g);
|
||||
ST_SRID(@g)
|
||||
2343
|
||||
SELECT ST_ASTEXT(ST_SRID(@g, 3234));
|
||||
ST_ASTEXT(ST_SRID(@g, 3234))
|
||||
MULTIPOINT((1 1),(11 11),(11 21),(21 21))
|
||||
#
|
||||
#
|
||||
SET @g = ST_GeomFromText('Polygon((0 0, 0 8, 8 8, 8 10, -10 10, -10 0, 0 0))', 4326);
|
||||
SELECT ST_SRID(@g);
|
||||
ST_SRID(@g)
|
||||
4326
|
||||
SELECT ST_ASTEXT(ST_SRID(@g, 2343));
|
||||
ST_ASTEXT(ST_SRID(@g, 2343))
|
||||
POLYGON((0 0,8 0,8 8,10 8,10 -10,0 -10,0 0))
|
||||
#
|
||||
#
|
||||
SET @g = ST_GeomFromText('GEOMETRYCOLLECTION(POLYGON((0 0,50 45,40 50,0 0)),LINESTRING(-10 -10,0 0),LINESTRING(46.666666666666664 46.666666666666664,200 200,199 201,45.333333333333336 47.333333333333336),LINESTRING(8 10,-11 -9))', 2343);
|
||||
SELECT ST_SRID(@g);
|
||||
ST_SRID(@g)
|
||||
2343
|
||||
SELECT ST_ASTEXT(ST_SRID(@g, 2343));
|
||||
ST_ASTEXT(ST_SRID(@g, 2343))
|
||||
GEOMETRYCOLLECTION(POLYGON((0 0,50 45,40 50,0 0)),LINESTRING(-10 -10,0 0),LINESTRING(46.666666666666664 46.666666666666664,200 200,199 201,45.333333333333336 47.333333333333336),LINESTRING(8 10,-11 -9))
|
||||
#
|
||||
#
|
||||
SET @g = ST_GeomFromText('GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(),GEOMETRYCOLLECTION EMPTY, GEOMETRYCOLLECTION(POINT(1 1)), MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48)), MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18))), MULTIPOINT((0 0),(10 10),(10 20),(20 20)), MULTIPOINT(1 1, 11 11, 11 21, 21 21), GEOMETRYCOLLECTION(LINESTRING(1 1,2 2)), GEOMETRYCOLLECTION(POLYGON((0 0,50 45,40 50,0 0)),LINESTRING(-10 -10,0 0),LINESTRING(46.666666666666664 46.666666666666664,200 200,199 201,45.333333333333336 47.333333333333336),LINESTRING(8 10,-11 -9)))', 2343);
|
||||
SELECT ST_SRID(@g);
|
||||
ST_SRID(@g)
|
||||
2343
|
||||
SELECT ST_ASTEXT(ST_SRID(@g, 0));
|
||||
ST_ASTEXT(ST_SRID(@g, 0))
|
||||
GEOMETRYCOLLECTION(GEOMETRYCOLLECTION EMPTY,GEOMETRYCOLLECTION EMPTY,GEOMETRYCOLLECTION(POINT(1 1)),MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48)),MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18))),MULTIPOINT((0 0),(10 10),(10 20),(20 20)),MULTIPOINT((1 1),(11 11),(11 21),(21 21)),GEOMETRYCOLLECTION(LINESTRING(1 1,2 2)),GEOMETRYCOLLECTION(POLYGON((0 0,50 45,40 50,0 0)),LINESTRING(-10 -10,0 0),LINESTRING(46.666666666666664 46.666666666666664,200 200,199 201,45.333333333333336 47.333333333333336),LINESTRING(8 10,-11 -9)))
|
||||
#
|
||||
# Test for String (creates the geometry in SRID 0, then casts it to SRID 4326)
|
||||
SELECT ST_ASTEXT(ST_SRID(Point(1, 1), 4326));
|
||||
ST_ASTEXT(ST_SRID(Point(1, 1), 4326))
|
||||
POINT(1 1)
|
||||
SELECT ST_ASTEXT(ST_SRID(POINT(25.416666666666668, 25.416666666666668), 4326));
|
||||
ST_ASTEXT(ST_SRID(POINT(25.416666666666668, 25.416666666666668), 4326))
|
||||
POINT(25.416666666666668 25.416666666666668)
|
||||
SELECT ST_SRID(Point(1, 1), -1);
|
||||
ERROR 22003: SRID value is out of range in 'st_srid'
|
||||
SELECT ST_SRID(Point(1, 1), 1e30);
|
||||
ERROR 22003: SRID value is out of range in 'st_srid'
|
||||
#
|
||||
# Test for ->srid 0
|
||||
select ST_ASTEXT(st_srid(st_geomfromtext('point(90 90)', 4326), 0));
|
||||
ST_ASTEXT(st_srid(st_geomfromtext('point(90 90)', 4326), 0))
|
||||
POINT(90 90)
|
||||
select ST_ASTEXT(st_srid(st_geomfromtext('point(90 90)', 4396), 0));
|
||||
ST_ASTEXT(st_srid(st_geomfromtext('point(90 90)', 4396), 0))
|
||||
POINT(90 90)
|
||||
# Test for invalid input data
|
||||
select st_srid(st_geomfromtext('point(100 100)'), 4326);
|
||||
ERROR 22S03: A parameter of function st_srid contains a geometry with latitude 100.000000, which is out of range. It must be within [-90.000000, 90.000000].
|
||||
#
|
||||
# Test for setsrid
|
||||
select ST_ASTEXT(_st_setsrid(point(90,90), 4326));
|
||||
ST_ASTEXT(_st_setsrid(point(90,90), 4326))
|
||||
POINT(90 90)
|
||||
set @g = _st_setsrid(point(100,100), 4326);
|
||||
ERROR 22S03: A parameter of function _st_setsrid contains a geometry with latitude 100.000000, which is out of range. It must be within [-90.000000, 90.000000].
|
||||
select _st_setsrid(point(100,100), 4326);
|
||||
ERROR 22S03: A parameter of function _st_setsrid contains a geometry with latitude 100.000000, which is out of range. It must be within [-90.000000, 90.000000].
|
||||
# Test for invalid srid
|
||||
select ST_ASTEXT(st_srid(point(90,90), ''));
|
||||
ST_ASTEXT(st_srid(point(90,90), ''))
|
||||
POINT(90 90)
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect INTEGER value: ''
|
||||
select ST_ASTEXT(st_srid(point(90,90), 'invalid'));
|
||||
ST_ASTEXT(st_srid(point(90,90), 'invalid'))
|
||||
POINT(90 90)
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect INTEGER value: 'invalid'
|
||||
#
|
||||
# Test for srid!=0 && srs_item == null
|
||||
select st_srid(x'02000000010100000000000000000000000000000000000000');
|
||||
st_srid(x'02000000010100000000000000000000000000000000000000')
|
||||
2
|
||||
Warnings:
|
||||
Warning 3519 There's no spatial reference system with SRID 2.
|
||||
#
|
||||
# Test unusual input (different from st_x/st_buffer..)
|
||||
select st_srid(1.1);
|
||||
ERROR 22023: Invalid GIS data provided to function st_srid.
|
||||
select st_srid(10.2);
|
||||
ERROR 22023: Invalid GIS data provided to function st_srid.
|
||||
select st_srid(102342);
|
||||
ERROR 22023: Invalid GIS data provided to function st_srid.
|
||||
select st_srid('sdfwefqwe');
|
||||
ERROR 22023: Invalid GIS data provided to function st_srid.
|
||||
select st_isvalid(x'e610000001040000000000000000002EC000000000000034C0');
|
||||
ERROR 22023: Invalid GIS data provided to function st_isvalid.
|
||||
select st_srid(x'0000000001030000000200000005000000000000000000000000000000000000000000000000002440000000000000000000000000000024400000000000002440000000000000000000000000000024400000000000000000000000000000000005000000000000000000144000000000000014400000000000001C4000000000000014400000000000001C400000000000001C4000000000000014400000000000001C4000000000000014400000000000001441');
|
||||
st_srid(x'00000000010300000002000000050000000000000000000000000000000000000000000000000024400000000000000000000000000000244000000000000024400000000000000000000000000000244000000000000000000000000000000000050000000000000000001440000000000000144000000000000
|
||||
0
|
||||
SELECT _ST_SETSRID(NULL,4326);
|
||||
ERROR 22023: Invalid GIS data provided to function _st_setsrid.
|
||||
SELECT _ST_SETSRID('NULL',4326);
|
||||
ERROR 22023: Invalid GIS data provided to function _st_setsrid.
|
||||
SELECT _ST_SETSRID(x'02000000010100000000000000000000000000000000000000',NULL);
|
||||
ERROR 22023: Invalid GIS data provided to function _st_setsrid.
|
||||
SELECT ST_ASTEXT(_ST_SETSRID(ST_GEOMFROMTEXT('POINT(1 2)'),NULL));
|
||||
ST_ASTEXT(_ST_SETSRID(ST_GEOMFROMTEXT('POINT(1 2)'),NULL))
|
||||
NULL
|
||||
SELECT _ST_SETSRID(ST_GEOMFROMTEXT('POINT(1 2)'),'NULL');
|
||||
ERROR 22007: Incorrect value
|
||||
SELECT ST_ASTEXT(_ST_SETSRID(ST_GEOMFROMTEXT('POINT(1 2)'),4326));
|
||||
ST_ASTEXT(_ST_SETSRID(ST_GEOMFROMTEXT('POINT(1 2)'),4326))
|
||||
POINT(2 1)
|
||||
SELECT ST_ASTEXT(_ST_SETSRID(ST_GEOMFROMTEXT('POINT(1 2)'),'4326'));
|
||||
ST_ASTEXT(_ST_SETSRID(ST_GEOMFROMTEXT('POINT(1 2)'),'4326'))
|
||||
POINT(2 1)
|
||||
SELECT ST_ASTEXT(_ST_SETSRID(ST_GEOMFROMTEXT('POINT(1 2)'),'4326abc'));
|
||||
ERROR 22007: Incorrect value
|
||||
SELECT ST_ASTEXT(_ST_SETSRID(ST_GEOMFROMTEXT('POINT(1 2)'),'true'));
|
||||
ERROR 22007: Incorrect value
|
||||
SELECT ST_ASTEXT(_ST_SETSRID(ST_GEOMFROMTEXT('POINT(1 2)'),true));
|
||||
ERROR 22000: Invalid data type for the operation
|
||||
SELECT _ST_SETSRID(ST_GEOMFROMTEXT('POINT'),NULL);
|
||||
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
|
||||
select st_astext(st_srid(x'0000000001030000000300000005000000000010000000000000000000000000000000000000002440000000000000000000000000000024400000000000002440000000000000000000000000000024400000000000000000000000000000000005000000000000000000144000000000000014400000000000001C4000000000000014400000000000001C400000000000001C4000000000000014400000000000001C40000000000000144000000000000014410500000000000000000014C000000000000014C00000000000001CC000000000000014C00000000000001CC00000000000001CC000000000000014C00000000000001CC000000000000014C000000000000014C0',0));
|
||||
st_astext(st_srid(x'0000000001030000000300000005000000000010000000000000000000000000000000000000002440000000000000000000000000000024400000000000002440000000000000000000000000000024400000000000000000000000000000000005000000000000000000144000000000000014400
|
||||
POLYGON((5.180654e-318 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7,5 327680),(-5 -5,-7 -5,-7 -7,-5 -7,-5 -5))
|
||||
@ -0,0 +1,498 @@
|
||||
# ----------------------------------------------------------------------
|
||||
# Test of GEOMETRY ST_Transform.
|
||||
# ----------------------------------------------------------------------
|
||||
# Test for st_transform
|
||||
#
|
||||
# NULL values.
|
||||
#
|
||||
# At least one NULL parameter. Should return NULL.
|
||||
SELECT ST_TRANSFORM(NULL, NULL);
|
||||
ST_TRANSFORM(NULL, NULL)
|
||||
NULL
|
||||
SELECT ST_TRANSFORM(NULL, 4326);
|
||||
ST_TRANSFORM(NULL, 4326)
|
||||
NULL
|
||||
SELECT ST_TRANSFORM(ST_GEOMFROMTEXT('POINT(0 0)', 4326), NULL);
|
||||
ST_TRANSFORM(ST_GEOMFROMTEXT('POINT(0 0)', 4326), NULL)
|
||||
NULL
|
||||
SELECT ST_ASTEXT(ST_TRANSFORM(ST_GEOMFROMTEXT('LINESTRING(0 0,1 1,1 0,0 1)',4326,NULL),4269));
|
||||
ST_ASTEXT(ST_TRANSFORM(ST_GEOMFROMTEXT('LINESTRING(0 0,1 1,1 0,0 1)',4326,NULL),4269))
|
||||
NULL
|
||||
#
|
||||
# Invalid parameters.
|
||||
#
|
||||
# Invalid geometry. Should raise error.
|
||||
SELECT ST_TRANSFORM(x'00000000DEADBEEF', 4326);
|
||||
ERROR 22023: Invalid GIS data provided to function st_transform.
|
||||
# Non-existing SRID. Should raise error.
|
||||
SELECT ST_TRANSFORM(
|
||||
x'94007735010100000000000000000000000000000000000000',
|
||||
4326
|
||||
);
|
||||
ERROR SR001: There's no spatial reference system with SRID 896991380.
|
||||
SELECT ST_TRANSFORM(ST_GEOMFROMTEXT('POINT(0 0)', 4326), 1000000000);
|
||||
ERROR SR001: There's no spatial reference system with SRID 1000000000.
|
||||
#
|
||||
# Transformation to/from SRID 0.
|
||||
#
|
||||
# Transformation between SRID 0 and geographic SRS. Should raise error.
|
||||
SELECT ST_TRANSFORM(ST_GEOMFROMTEXT('POINT(0 0)'), 4326);
|
||||
ERROR 22S00: Transformation from SRID 0 is not supported.
|
||||
SELECT ST_TRANSFORM(ST_GEOMFROMTEXT('POINT(0 0)', 4326), 0);
|
||||
ERROR 22S00: Transformation to SRID 0 is not supported.
|
||||
SELECT ST_TRANSFORM(ST_GEOMFROMTEXT('POINT(0 0)'), 4047);
|
||||
ERROR 22S00: Transformation from SRID 0 is not supported.
|
||||
SELECT ST_TRANSFORM(ST_GEOMFROMTEXT('POINT(0 0)', 4047), 0);
|
||||
ERROR 22S00: Transformation to SRID 0 is not supported.
|
||||
# Transformation between SRID 0 and projected SRS. Should raise error.
|
||||
SELECT ST_TRANSFORM(ST_GEOMFROMTEXT('POINT(0 0)'), 3857);
|
||||
ERROR 22S00: Transformation from SRID 0 is not supported.
|
||||
SELECT ST_TRANSFORM(ST_GEOMFROMTEXT('POINT(0 0)', 3857), 0);
|
||||
ERROR 22S00: Transformation to SRID 0 is not supported.
|
||||
#
|
||||
# Transformation between geographic SRSs.
|
||||
#
|
||||
# Transformation of every geometry type. Should succeed.
|
||||
SELECT ST_ASTEXT(ST_TRANSFORM(ST_GEOMFROMTEXT('POINT(0 0)', 4326), 3819));
|
||||
ST_ASTEXT(ST_TRANSFORM(ST_GEOMFROMTEXT('POINT(0 0)', 4326), 3819))
|
||||
POINT(-0.005482665093475376 -0.0013302987518482513)
|
||||
SELECT ST_ASTEXT(ST_TRANSFORM(ST_GEOMFROMTEXT('LINESTRING(0 0, 1 1)', 4326), 3819));
|
||||
ST_ASTEXT(ST_TRANSFORM(ST_GEOMFROMTEXT('LINESTRING(0 0, 1 1)', 4326), 3819))
|
||||
LINESTRING(-0.005482665093475376 -0.0013302987518482513,0.9945714665851071 0.9987826546610272)
|
||||
SELECT ST_ASTEXT(ST_TRANSFORM(ST_GEOMFROMTEXT('POLYGON((0 0, 0 1, 1 1, 0 0))', 4326), 3819));
|
||||
ST_ASTEXT(ST_TRANSFORM(ST_GEOMFROMTEXT('POLYGON((0 0, 0 1, 1 1, 0 0))', 4326), 3819))
|
||||
POLYGON((-0.005482665093475376 -0.0013302987518482513,-0.005502626686269334 0.9987632352664167,0.9945714665851071 0.9987826546610272,-0.005482665093475376 -0.0013302987518482513))
|
||||
SELECT ST_ASTEXT(ST_TRANSFORM(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(0 0))', 4326), 3819));
|
||||
ST_ASTEXT(ST_TRANSFORM(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(0 0))', 4326), 3819))
|
||||
GEOMETRYCOLLECTION(POINT(-0.005482665093475376 -0.0013302987518482513))
|
||||
SELECT ST_ASTEXT(ST_TRANSFORM(ST_GEOMFROMTEXT('MULTIPOINT((0 0))', 4326), 3819));
|
||||
ST_ASTEXT(ST_TRANSFORM(ST_GEOMFROMTEXT('MULTIPOINT((0 0))', 4326), 3819))
|
||||
MULTIPOINT((-0.005482665093475376 -0.0013302987518482513))
|
||||
SELECT ST_ASTEXT(ST_TRANSFORM(ST_GEOMFROMTEXT('MULTILINESTRING((0 0, 1 1))', 4326), 3819));
|
||||
ST_ASTEXT(ST_TRANSFORM(ST_GEOMFROMTEXT('MULTILINESTRING((0 0, 1 1))', 4326), 3819))
|
||||
MULTILINESTRING((-0.005482665093475376 -0.0013302987518482513,0.9945714665851071 0.9987826546610272))
|
||||
SELECT ST_ASTEXT(ST_TRANSFORM(
|
||||
ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0, 0 1, 1 1, 0 0)))', 4326),
|
||||
3819
|
||||
));
|
||||
ST_ASTEXT(ST_TRANSFORM(
|
||||
ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0, 0 1, 1 1, 0 0)))', 4326),
|
||||
3819
|
||||
))
|
||||
MULTIPOLYGON(((-0.005482665093475376 -0.0013302987518482513,-0.005502626686269334 0.9987632352664167,0.9945714665851071 0.9987826546610272,-0.005482665093475376 -0.0013302987518482513)))
|
||||
# Verify that it isn't possible to transform to/from a projection.
|
||||
# Transformation between SRID 0 and geographic SRSs should fail.
|
||||
SELECT ST_TRANSFORM(ST_GEOMFROMTEXT('POINT(0 0)', 4326), 3857);
|
||||
ERROR 22S00: Transformation to SRID 3857 is not supported.
|
||||
SELECT ST_TRANSFORM(ST_GEOMFROMTEXT('POINT(0 0)', 3857), 4326);
|
||||
ERROR 22S00: Transformation from SRID 3857 is not supported.
|
||||
# Test for st_transform end
|
||||
#
|
||||
#
|
||||
# Test for _st_transform
|
||||
#
|
||||
# NULL values.
|
||||
#
|
||||
# At least one NULL parameter. Should return NULL.
|
||||
SELECT _ST_Transform(NULL, NULL);
|
||||
_ST_Transform(NULL, NULL)
|
||||
NULL
|
||||
SELECT _ST_Transform(NULL, 4326);
|
||||
_ST_Transform(NULL, 4326)
|
||||
NULL
|
||||
SELECT _ST_Transform(ST_GEOMFROMTEXT('POINT(0 0)', 4326), NULL);
|
||||
_ST_Transform(ST_GEOMFROMTEXT('POINT(0 0)', 4326), NULL)
|
||||
NULL
|
||||
#
|
||||
# Invalid parameters.
|
||||
#
|
||||
# Invalid geometry. Should raise error. toSELECT@dazhi
|
||||
SELECT _ST_Transform(x'00000000DEADBEEF', 4326);
|
||||
ERROR 22023: Invalid GIS data provided to function _st_transform.
|
||||
# Non-existing SRID. Should raise error.
|
||||
SELECT _ST_Transform(
|
||||
x'94007735010100000000000000000000000000000000000000',
|
||||
4326
|
||||
);
|
||||
ERROR SR001: There's no spatial reference system with SRID 896991380.
|
||||
SELECT _ST_Transform(ST_GEOMFROMTEXT('POINT(0 0)', 4326), 1000000000);
|
||||
ERROR SR001: There's no spatial reference system with SRID 1000000000.
|
||||
#
|
||||
# Transformation to/from SRID 0.
|
||||
#
|
||||
# Transformation between SRID 0 and geographic SRS. Should raise error.
|
||||
SELECT _ST_Transform(ST_GEOMFROMTEXT('POINT(0 0)'), 4326);
|
||||
ERROR 22S00: Transformation from SRID 0 is not supported.
|
||||
SELECT _ST_Transform(ST_GEOMFROMTEXT('POINT(0 0)', 4326), 0);
|
||||
ERROR 22S00: Transformation to SRID 0 is not supported.
|
||||
SELECT _ST_Transform(ST_GEOMFROMTEXT('POINT(0 0)'), 4047);
|
||||
ERROR 22S00: Transformation from SRID 0 is not supported.
|
||||
SELECT _ST_Transform(ST_GEOMFROMTEXT('POINT(0 0)', 4047), 0);
|
||||
ERROR 22S00: Transformation to SRID 0 is not supported.
|
||||
# Transformation between SRID 0 and projected SRS. Should raise error.
|
||||
SELECT _ST_Transform(ST_GEOMFROMTEXT('POINT(0 0)'), 3857);
|
||||
ERROR 22S00: Transformation from SRID 0 is not supported.
|
||||
SELECT _ST_Transform(ST_GEOMFROMTEXT('POINT(0 0)', 3857), 0);
|
||||
ERROR 22S00: Transformation to SRID 0 is not supported.
|
||||
#
|
||||
# Transformation between geographic SRSs.
|
||||
#
|
||||
# Transformation of every geometry type. Should succeed.
|
||||
SELECT ST_ASTEXT(_ST_Transform(ST_GEOMFROMTEXT('POINT(0 0)', 4326), 3819));
|
||||
ST_ASTEXT(_ST_Transform(ST_GEOMFROMTEXT('POINT(0 0)', 4326), 3819))
|
||||
POINT(-0.005482665093475376 -0.0013302987518482513)
|
||||
SELECT ST_ASTEXT(_ST_Transform(ST_GEOMFROMTEXT('LINESTRING(0 0, 1 1)', 4326), 3819));
|
||||
ST_ASTEXT(_ST_Transform(ST_GEOMFROMTEXT('LINESTRING(0 0, 1 1)', 4326), 3819))
|
||||
LINESTRING(-0.005482665093475376 -0.0013302987518482513,0.9945714665851079 0.9987826546610282)
|
||||
SELECT ST_ASTEXT(_ST_Transform(ST_GEOMFROMTEXT('POLYGON((0 0, 0 1, 1 1, 0 0))', 4326), 3819));
|
||||
ST_ASTEXT(_ST_Transform(ST_GEOMFROMTEXT('POLYGON((0 0, 0 1, 1 1, 0 0))', 4326), 3819))
|
||||
POLYGON((-0.005482665093475376 -0.0013302987518482513,-0.005502626686269334 0.9987632352664177,0.9945714665851079 0.9987826546610282,-0.005482665093475376 -0.0013302987518482513))
|
||||
SELECT ST_ASTEXT(_ST_Transform(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(0 0))', 4326), 3819));
|
||||
ST_ASTEXT(_ST_Transform(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(0 0))', 4326), 3819))
|
||||
GEOMETRYCOLLECTION(POINT(-0.005482665093475376 -0.0013302987518482513))
|
||||
SELECT ST_ASTEXT(_ST_Transform(ST_GEOMFROMTEXT('MULTIPOINT((0 0))', 4326), 3819));
|
||||
ST_ASTEXT(_ST_Transform(ST_GEOMFROMTEXT('MULTIPOINT((0 0))', 4326), 3819))
|
||||
MULTIPOINT((-0.005482665093475376 -0.0013302987518482513))
|
||||
SELECT ST_ASTEXT(_ST_Transform(ST_GEOMFROMTEXT('MULTILINESTRING((0 0, 1 1))', 4326), 3819));
|
||||
ST_ASTEXT(_ST_Transform(ST_GEOMFROMTEXT('MULTILINESTRING((0 0, 1 1))', 4326), 3819))
|
||||
MULTILINESTRING((-0.005482665093475376 -0.0013302987518482513,0.9945714665851079 0.9987826546610282))
|
||||
SELECT ST_ASTEXT(_ST_Transform(
|
||||
ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0, 0 1, 1 1, 0 0)))', 4326),
|
||||
3819
|
||||
));
|
||||
ST_ASTEXT(_ST_Transform(
|
||||
ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0, 0 1, 1 1, 0 0)))', 4326),
|
||||
3819
|
||||
))
|
||||
MULTIPOLYGON(((-0.005482665093475376 -0.0013302987518482513,-0.005502626686269334 0.9987632352664177,0.9945714665851079 0.9987826546610282,-0.005482665093475376 -0.0013302987518482513)))
|
||||
# Transformations between European Datum 1950 (ED50) and WGS 84.
|
||||
# Positions in Western Europe will be further North and East in ED50 than
|
||||
# in WGS 84.
|
||||
# Trondheim.
|
||||
SELECT
|
||||
ST_ASTEXT(
|
||||
_ST_Transform(
|
||||
ST_GEOMFROMTEXT('POINT(63.426912 10.396918)', 4326),
|
||||
4230
|
||||
)
|
||||
) AS ED50;
|
||||
ED50
|
||||
POINT(63.42724 10.398502)
|
||||
SELECT
|
||||
ST_ASTEXT(
|
||||
_ST_Transform(
|
||||
ST_GEOMFROMTEXT('POINT(63.42724 10.398502)', 4230),
|
||||
4326
|
||||
)
|
||||
) AS WGS84;
|
||||
WGS84
|
||||
POINT(63.426912 10.396918)
|
||||
# Telegrafenberg, Potsdam (origin of ED50).
|
||||
SELECT
|
||||
ST_ASTEXT(
|
||||
_ST_Transform(
|
||||
ST_GEOMFROMTEXT('POINT(52.381389 13.064444)', 4326),
|
||||
4230
|
||||
)
|
||||
) AS ED50;
|
||||
ED50
|
||||
POINT(52.382086 13.065521)
|
||||
SELECT
|
||||
ST_ASTEXT(
|
||||
_ST_Transform(
|
||||
ST_GEOMFROMTEXT('POINT(52.382086 13.065521)', 4230),
|
||||
4326
|
||||
)
|
||||
) AS WGS84;
|
||||
WGS84
|
||||
POINT(52.381389 13.064444)
|
||||
# the polygon in wrong ring order should be corrected before call bg function
|
||||
select st_astext(_ST_Transform(st_geomfromtext('Polygon((2 2,2 8,8 8,8 2,2 2))', 4326), 4231));
|
||||
st_astext(_ST_Transform(st_geomfromtext('Polygon((2 2,2 8,8 8,8 2,2 2))', 4326), 4231))
|
||||
POLYGON((2.001077072074475 2.000836431360278,2.0010740529842637 8.000750503988575,8.001143363806776 8.000757467426062,8.001155241248204 2.0008443180478546,2.001077072074475 2.000836431360278))
|
||||
select st_astext(_ST_Transform(st_geomfromtext('Polygon((2 2,8 2,8 8,2 8,2 2))', 4326), 4231));
|
||||
st_astext(_ST_Transform(st_geomfromtext('Polygon((2 2,8 2,8 8,2 8,2 2))', 4326), 4231))
|
||||
POLYGON((2.001077072074475 2.000836431360278,2.0010740529842637 8.000750503988575,8.001143363806776 8.000757467426062,8.001155241248204 2.0008443180478546,2.001077072074475 2.000836431360278))
|
||||
#########################################
|
||||
# postgis test
|
||||
#
|
||||
# regress proj adhoc
|
||||
#
|
||||
# some transform() regression
|
||||
# prime spatial_ref_sys table with two projections
|
||||
# EPSG 100001 : WGS 84 / UTM zone 33N
|
||||
# EPSG 100002 : WGS 84
|
||||
# test #0: NULL values
|
||||
SELECT 0, ST_AsText(_ST_Transform(NULL, @proj100001));
|
||||
0 ST_AsText(_ST_Transform(NULL, @proj100001))
|
||||
0 NULL
|
||||
test #6: re-projecting a projected value
|
||||
SELECT 6,round(ST_Longitude(_ST_Transform(_ST_Transform(ST_GeomFromText('POINT(16 48)', 4236, 'axis-order=long-lat'), 3065), 4236)), 8) as X, round(ST_Latitude(_ST_Transform(_ST_Transform(ST_GeomFromText('POINT(16 48)', 4236, 'axis-order=long-lat'), 3065), 4236)), 8) as Y;
|
||||
6 X Y
|
||||
6 15.99999966 48.00000022
|
||||
#7: Should yield an error since input SRID is unknown
|
||||
SELECT 7, _ST_Transform(ST_GeomFromText('POINT(0 0)', 0, 'axis-order=long-lat'), '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs ') as geometry;
|
||||
ERROR 22S00: Transformation from SRID 0 is not supported.
|
||||
#8: Transforming to same SRID
|
||||
SELECT 8,ST_AsText(_ST_Transform(_ST_Transform(ST_GeomFromText('POINT(0 0)', 4326, 'axis-order=long-lat'), 4326), 4326)) as geometry;
|
||||
8 geometry
|
||||
8 POINT(0 0)
|
||||
#9: Transform to_proj
|
||||
SELECT 9, ST_ASTEXT(_ST_Transform(
|
||||
ST_GeomFromText('POINT(16 48)', 4236, 'axis-order=long-lat'),
|
||||
'+proj=utm +zone=33 +ellps=WGS84 +datum=WGS84 +units=m +no_defs ')) as geometry;
|
||||
9 geometry
|
||||
9 POINT(574238.6629953053 5317120.094526642)
|
||||
test #10: Transform from_proj to_proj
|
||||
SELECT 10, ST_AsText(_ST_Transform(
|
||||
ST_GeomFromText('POINT(16 48)', 4236, 'axis-order=long-lat'),
|
||||
'+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs ',
|
||||
'+proj=utm +zone=33 +ellps=WGS84 +datum=WGS84 +units=m +no_defs ')) as geometry;
|
||||
10 geometry
|
||||
10 POINT(574595.1124860339 5316784.009235403)
|
||||
test #11: Transform from_proj to_srid
|
||||
SELECT 11, ST_AsText(_ST_Transform(
|
||||
ST_GeomFromText('POINT(16 48)', 0, 'axis-order=long-lat'),
|
||||
'+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs ', 4236)) as geometry;
|
||||
11 geometry
|
||||
11 POINT(47.99693549401747 16.004718085400047)
|
||||
test #12: Transform with bad to_proj
|
||||
SELECT 12, _ST_Transform(
|
||||
ST_GeomFromText('POINT(16 48)', 4236),
|
||||
'invalid projection');
|
||||
ERROR HY000: Unknown exception thrown in function.
|
||||
#
|
||||
# regress proj basic
|
||||
#
|
||||
# some transform() regression
|
||||
test #1: a simple projection
|
||||
SELECT 1,ST_AsText(_ST_Transform(ST_GeomFromText('POINT(16 48)', 4326, 'axis-order=long-lat'), 3065));
|
||||
1 ST_AsText(_ST_Transform(ST_GeomFromText('POINT(16 48)', 4326, 'axis-order=long-lat'), 3065))
|
||||
1 POINT(574595.1124860339 5316784.009235403)
|
||||
test #4: LINESTRING projection, 2 points
|
||||
SELECT 4,ST_AsText(_ST_Transform(ST_GeomFromText('LINESTRING(16 48, 16 49)', 4326, 'axis-order=long-lat'), 3065)) as geometry;
|
||||
4 geometry
|
||||
4 LINESTRING(574595.1124860339 5316784.009235403,573142.0122827202 5427937.523464922)
|
||||
SELECT 'M1', ST_AsText(_ST_Transform(ST_GeomFromText('POINT(-20 -20)', 4326, 'axis-order=long-lat'), 3065)) as geometry;
|
||||
M1 geometry
|
||||
M1 POINT(-3345527.4198776903 -2652698.674177202)
|
||||
SELECT 'M2', ST_AsText(_ST_Transform(ST_GeomFromText('POINT(-20 -21.5)', 4326, 'axis-order=long-lat'), 3065)) as geometry;
|
||||
M2 geometry
|
||||
M2 POINT(-3298015.597990941 -2843775.4055208303)
|
||||
SELECT 'M3', ST_AsText(_ST_Transform(ST_GeomFromText('POINT(-30 -21.5)', 4326, 'axis-order=long-lat'), 3065)) as geometry;
|
||||
M3 geometry
|
||||
M3 POINT(-4535797.865108145 -3228356.4454949675)
|
||||
SELECT 'M4', ST_AsText(_ST_Transform(ST_GeomFromText('POINT(-72.345 41.3)', 4326, 'axis-order=long-lat'), 3065)) as geometry;
|
||||
M4 geometry
|
||||
M4 POINT(-5713160.571357482 9662432.583766244)
|
||||
SELECT 'M5', ST_AsText(_ST_Transform(ST_GeomFromText('POINT(71.999 -42.5)', 4326, 'axis-order=long-lat'), 3065)) as geometry;
|
||||
M5 geometry
|
||||
M5 POINT(5111719.904548044 -6576329.479659087)
|
||||
#
|
||||
# regress proj cache overflow
|
||||
#
|
||||
# Overflow proj cache
|
||||
SELECT 13, count(*) FROM
|
||||
(
|
||||
SELECT _ST_Transform(ST_GeomFromText('POINT(0 0)', 4326), srs_id) AS g
|
||||
FROM
|
||||
( Select srs_id from oceanbase.__all_spatial_reference_systems where srs_id IN (3819, 3821, 3824, 3889, 3906, 4001, 4002, 4003, 4004, 4005, 4006, 4007, 4008, 4009, 4010, 4011, 4012, 4013, 4014, 4015, 4016, 4018, 4019, 4020, 4021, 4022, 4023, 4024, 4025, 4027, 4028, 4029, 4030, 4031, 4032, 4033, 4034, 4035, 4036, 4041, 4042, 4043, 4044, 4045, 4046, 4047, 4052, 4053, 4054, 4055, 4075, 4081, 4120, 4121, 4122, 4123, 4124, 4125, 4126, 4127, 4128, 4129, 4130, 4131, 4132, 4133, 4134, 4135, 4139, 4140, 4141, 4142, 4143, 4144, 4145, 4146, 4147, 4148, 4149, 4150, 4151, 4152, 4153, 4154, 4155, 4156, 4157, 4158, 4159, 4160, 4161, 4162, 4163, 4164, 4165, 4166, 4167, 4168, 4169, 4170, 4171, 4172, 4173, 4174, 4175, 4176, 4178, 4179, 4180, 4181, 4182, 4183, 4184, 4185, 4188, 4189, 4190, 4191, 4192, 4193, 4194, 4195, 4196, 4197, 4198, 4199, 4200, 4201, 4202, 4203, 4204, 4205, 4206, 4207, 4208, 4209, 4210, 4211, 4212, 4213, 4214, 4215, 4216, 4218, 4219, 4220, 4221)) _a
|
||||
) _b WHERE g IS NOT NULL;
|
||||
13 count(*)
|
||||
13 139
|
||||
########################################################
|
||||
# customized test for bestsrid generated proj4text
|
||||
########################################################
|
||||
set @proj1 = '+proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs';
|
||||
set @proj2 = '+proj=utm +zone=1 +ellps=WGS84 +datum=WGS84 +units=m +no_defs';
|
||||
set @proj3 = '+proj=laea +lat_0=90 +lon_0=-40 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs';
|
||||
set @proj4 = '+proj=stere +lat_0=90 +lat_ts=71 +lon_0=0 +k=1 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs';
|
||||
set @proj5 = '+proj=utm +zone=1 +south +ellps=WGS84 +datum=WGS84 +units=m +no_defs';
|
||||
set @proj6 = '+proj=laea +lat_0=-90 +lon_0=0 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs';
|
||||
set @pt = ST_GeomFromText('POINT(123.45 -67.89)', 4326, 'axis-order=long-lat');
|
||||
set @li = ST_GeomFromText('LINESTRING(123.45 -67.89, 10.11 -12.13)', 4326, 'axis-order=long-lat');
|
||||
set @po = ST_GeomFromText('POLYGON((0 0,1 0,1 1,0 1,0 0))', 4326, 'axis-order=long-lat');
|
||||
set @mpt = ST_GeomFromText('MULTIPOINT(9 9,8 1,1 5)', 4326, 'axis-order=long-lat');
|
||||
set @mli = ST_GeomFromText('MULTILINESTRING((0 0,5 5,0 0),(0 0,-5 -5,0 0))', 4326, 'axis-order=long-lat');
|
||||
set @mpo = ST_GeomFromText('MULTIPOLYGON(((0 0, 3 0, 3 3, 0 3, 0 0)))', 4326, 'axis-order=long-lat');
|
||||
set @gc = ST_GeomFromText('GEOMETRYCOLLECTION(Point(9 9),LINESTRING(1 5,0 0),POLYGON((2 2,2 8,8 8,8 2,2 2)))', 4326, 'axis-order=long-lat');
|
||||
SELECT 11, ST_AsText(_ST_Transform(ST_GeomFromText('POINT(123.45 -67.89)', 4326, 'axis-order=long-lat'), '+proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs')) as geometry;
|
||||
11 geometry
|
||||
11 POINT(13742391.13843 -10374752.862955)
|
||||
SELECT 21, ST_AsText(_ST_Transform(ST_GeomFromText('LINESTRING(123.45 -67.89, 10.11 -12.13)', 4326, 'axis-order=long-lat'), '+proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs')) as geometry;
|
||||
21 geometry
|
||||
21 LINESTRING(13742391.13843 -10374752.862955,1125440.05192 -1351533.85883)
|
||||
SELECT 31, ST_AsText(_ST_Transform(ST_GeomFromText('POLYGON((0 0,1 0,1 1,0 1,0 0))', 4326, 'axis-order=long-lat'), '+proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs')) as geometry;
|
||||
31 geometry
|
||||
31 POLYGON((0 0,111319.490793 0,111319.490793 110579.965222,0 110579.965222,0 0))
|
||||
SELECT 41, ST_AsText(_ST_Transform(ST_GeomFromText('MULTIPOINT(9 9,8 1,1 5)', 4326, 'axis-order=long-lat'), '+proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs')) as geometry;
|
||||
41 geometry
|
||||
41 MULTIPOINT((1001875.417139 999341.310385),(890555.926346 110579.965222),(111319.490793 553583.846816))
|
||||
SELECT 51, ST_AsText(_ST_Transform(ST_GeomFromText('MULTILINESTRING((0 0,5 5,0 0),(0 0,-5 -5,0 0))', 4326, 'axis-order=long-lat'), '+proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs')) as geometry;
|
||||
51 geometry
|
||||
51 MULTILINESTRING((0 0,556597.453966 553583.846816,0 0),(0 0,-556597.453966 -553583.846816,0 0))
|
||||
SELECT 61, ST_AsText(_ST_Transform(ST_GeomFromText('MULTIPOLYGON(((0 0, 3 0, 3 3, 0 3, 0 0)))', 4326, 'axis-order=long-lat'), '+proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs')) as geometry;
|
||||
61 geometry
|
||||
61 MULTIPOLYGON(((0 0,333958.47238 0,333958.47238 331876.534213,0 331876.534213,0 0)))
|
||||
SELECT 71, ST_AsText(_ST_Transform(ST_GeomFromText('GEOMETRYCOLLECTION(Point(9 9),LINESTRING(1 5,0 0),POLYGON((2 2,2 8,8 8,8 2,2 2)))', 4326, 'axis-order=long-lat'), '+proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs')) as geometry;
|
||||
71 geometry
|
||||
71 GEOMETRYCOLLECTION(POINT(1001875.417139 999341.310385),LINESTRING(111319.490793 553583.846816,0 0),POLYGON((222638.981587 221194.077168,890555.926346 221194.077168,890555.926346 887521.12664,222638.981587 887521.12664,222638.981587 221194.077168)))
|
||||
SELECT 12, ST_AsText(_ST_Transform(ST_GeomFromText('POINT(123.45 -67.89)', 4326, 'axis-order=long-lat'),'+proj=utm +zone=1 +ellps=WGS84 +datum=WGS84 +units=m +no_defs')) as geometry;
|
||||
12 geometry
|
||||
12 POINT(-1652422.866845 -8699725.08078)
|
||||
SELECT 22, ST_AsText(_ST_Transform(ST_GeomFromText('LINESTRING(123.45 -67.89, 10.11 -12.13)', 4326, 'axis-order=long-lat'),'+proj=utm +zone=1 +ellps=WGS84 +datum=WGS84 +units=m +no_defs')) as geometry;
|
||||
22 geometry
|
||||
22 LINESTRING(-1652422.866845 -8699725.08078,-275443.590341 -18644852.383437)
|
||||
SELECT 32, ST_AsText(_ST_Transform(ST_GeomFromText('POLYGON((0 0,1 0,1 1,0 1,0 0))', 4326, 'axis-order=long-lat'),'+proj=utm +zone=1 +ellps=WGS84 +datum=WGS84 +units=m +no_defs')) as geometry;
|
||||
32 geometry
|
||||
32 POLYGON((833978.556919 19995929.886042,722595.439676 19995929.886042,722561.736479 19885331.913518,833927.937096 19885247.048283,833978.556919 19995929.886042))
|
||||
SELECT 42, ST_AsText(_ST_Transform(ST_GeomFromText('MULTIPOINT(9 9,8 1,1 5)', 4326, 'axis-order=long-lat'),'+proj=utm +zone=1 +ellps=WGS84 +datum=WGS84 +units=m +no_defs')) as geometry;
|
||||
42 geometry
|
||||
42 MULTIPOINT((-160640.923181 18995651.600153),(-57002.405491 19884974.744862),(721753.345935 19442928.16415))
|
||||
SELECT 52, ST_AsText(_ST_Transform(ST_GeomFromText('MULTILINESTRING((0 0,5 5,0 0),(0 0,-5 -5,0 0))', 4326, 'axis-order=long-lat'),'+proj=utm +zone=1 +ellps=WGS84 +datum=WGS84 +units=m +no_defs')) as geometry;
|
||||
52 geometry
|
||||
52 MULTILINESTRING((833978.556919 19995929.886042,278246.654065 19442928.16415,833978.556919 19995929.886042),(833978.556919 19995929.886042,1389705.452479 -19437825.226475,833978.556919 19995929.886042))
|
||||
SELECT 62, ST_AsText(_ST_Transform(ST_GeomFromText('MULTIPOLYGON(((0 0, 3 0, 3 3, 0 3, 0 0)))', 4326, 'axis-order=long-lat'),'+proj=utm +zone=1 +ellps=WGS84 +datum=WGS84 +units=m +no_defs')) as geometry;
|
||||
62 geometry
|
||||
62 MULTIPOLYGON(((833978.556919 19995929.886042,500000 19995929.886042,500000 19664336.706494,833523.067008 19663879.411294,833978.556919 19995929.886042)))
|
||||
SELECT 72, ST_AsText(_ST_Transform(ST_GeomFromText('GEOMETRYCOLLECTION(Point(9 9),LINESTRING(1 5,0 0),POLYGON((2 2,2 8,8 8,8 2,2 2)))', 4326, 'axis-order=long-lat'),'+proj=utm +zone=1 +ellps=WGS84 +datum=WGS84 +units=m +no_defs')) as geometry;
|
||||
72 geometry
|
||||
72 GEOMETRYCOLLECTION(POINT(-160640.923181 18995651.600153),LINESTRING(721753.345935 19442928.16415,833978.556919 19995929.886042),POLYGON((611213.301271 19774835.019203,-56748.287241 19774019.445903,-51673.937369 19108275.54574,610204.602078 19111498.179551,611213.301271 19774835.019203)))
|
||||
SELECT 13, ST_AsText(_ST_Transform(ST_GeomFromText('POINT(123.45 -67.89)', 4326, 'axis-order=long-lat'), '+proj=laea +lat_0=90 +lon_0=-40 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs')) as geometry;
|
||||
13 geometry
|
||||
13 POINT(3561690.351406 11985646.433911)
|
||||
SELECT 23, ST_AsText(_ST_Transform(ST_GeomFromText('LINESTRING(123.45 -67.89, 10.11 -12.13)', 4326, 'axis-order=long-lat'), '+proj=laea +lat_0=90 +lon_0=-40 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs')) as geometry;
|
||||
23 geometry
|
||||
23 LINESTRING(3561690.351406 11985646.433911,7602041.31784 -6354039.088753)
|
||||
SELECT 33, ST_AsText(_ST_Transform(ST_GeomFromText('POLYGON((0 0,1 0,1 1,0 1,0 0))', 4326, 'axis-order=long-lat'), '+proj=laea +lat_0=90 +lon_0=-40 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs')) as geometry;
|
||||
33 geometry
|
||||
33 POLYGON((5791493.712232 -6902033.438039,5911068.732492 -6799906.722771,5859493.032956 -6740575.667444,5740961.337617 -6841811.299049,5791493.712232 -6902033.438039))
|
||||
SELECT 43, ST_AsText(_ST_Transform(ST_GeomFromText('MULTIPOINT(9 9,8 1,1 5)', 4326, 'axis-order=long-lat'), '+proj=laea +lat_0=90 +lon_0=-40 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs')) as geometry;
|
||||
43 geometry
|
||||
43 MULTIPOINT((6247955.345263 -5431264.720105),(6637286.791194 -5976239.869956),(5648801.408332 -6498202.67881))
|
||||
SELECT 53, ST_AsText(_ST_Transform(ST_GeomFromText('MULTILINESTRING((0 0,5 5,0 0),(0 0,-5 -5,0 0))', 4326, 'axis-order=long-lat'), '+proj=laea +lat_0=90 +lon_0=-40 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs')) as geometry;
|
||||
53 geometry
|
||||
53 MULTILINESTRING((5791493.712232 -6902033.438039,6088332.916557 -6088332.916557,5791493.712232 -6902033.438039),(5791493.712232 -6902033.438039,5387447.310643 -7694072.138123,5791493.712232 -6902033.438039))
|
||||
SELECT 63, ST_AsText(_ST_Transform(ST_GeomFromText('MULTIPOLYGON(((0 0, 3 0, 3 3, 0 3, 0 0)))', 4326, 'axis-order=long-lat'), '+proj=laea +lat_0=90 +lon_0=-40 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs')) as geometry;
|
||||
63 geometry
|
||||
63 MULTIPOLYGON(((5791493.712232 -6902033.438039,6144781.191381 -6589471.079585,5982560.179523 -6415510.34236,5638599.420165 -6719821.116181,5791493.712232 -6902033.438039)))
|
||||
SELECT 73, ST_AsText(_ST_Transform(ST_GeomFromText('GEOMETRYCOLLECTION(Point(9 9),LINESTRING(1 5,0 0),POLYGON((2 2,2 8,8 8,8 2,2 2)))', 4326, 'axis-order=long-lat'), '+proj=laea +lat_0=90 +lon_0=-40 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs')) as geometry;
|
||||
73 geometry
|
||||
73 GEOMETRYCOLLECTION(POINT(6247955.345263 -5431264.720105),LINESTRING(5648801.408332 -6498202.67881,5791493.712232 -6902033.438039),POLYGON((5923185.211117 -6578363.623117,6578363.623117 -5923185.211117,6214530.365044 -5595588.274098,5595588.274098 -6214530.365044,5923185.211117 -6578363.623117)))
|
||||
SELECT 14, ST_AsText(_ST_Transform(ST_GeomFromText('POINT(123.45 -67.89)', 4326, 'axis-order=long-lat'), '+proj=stere +lat_0=90 +lat_ts=71 +lon_0=0 +k=1 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs')) as geometry;
|
||||
14 geometry
|
||||
14 POINT(52488480.820413 34675533.995782)
|
||||
SELECT 24, ST_AsText(_ST_Transform(ST_GeomFromText('LINESTRING(123.45 -67.89, 10.11 -12.13)', 4326, 'axis-order=long-lat'), '+proj=stere +lat_0=90 +lat_ts=71 +lon_0=0 +k=1 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs')) as geometry;
|
||||
24 geometry
|
||||
24 LINESTRING(52488480.820413 34675533.995782,2683355.649025 -15049058.878326)
|
||||
SELECT 34, ST_AsText(_ST_Transform(ST_GeomFromText('POLYGON((0 0,1 0,1 1,0 1,0 0))', 4326, 'axis-order=long-lat'), '+proj=stere +lat_0=90 +lat_ts=71 +lon_0=0 +k=1 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs')) as geometry;
|
||||
34 geometry
|
||||
34 POLYGON((0 -12367396.21846,215840.825375 -12365512.604113,212130.970841 -12152975.180149,0 -12154826.419086,0 -12367396.21846))
|
||||
SELECT 44, ST_AsText(_ST_Transform(ST_GeomFromText('MULTIPOINT(9 9,8 1,1 5)', 4326, 'axis-order=long-lat'), '+proj=stere +lat_0=90 +lat_ts=71 +lon_0=0 +k=1 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs')) as geometry;
|
||||
44 geometry
|
||||
44 MULTIPOINT((1654110.233385 -10443640.991474),(1691624.884376 -12036536.483917),(197897.108989 -11337517.780792))
|
||||
SELECT 54, ST_AsText(_ST_Transform(ST_GeomFromText('MULTILINESTRING((0 0,5 5,0 0),(0 0,-5 -5,0 0))', 4326, 'axis-order=long-lat'), '+proj=stere +lat_0=90 +lat_ts=71 +lon_0=0 +k=1 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs')) as geometry;
|
||||
54 geometry
|
||||
54 MULTILINESTRING((0 -12367396.21846,988280.302977 -11296095.552813,0 -12367396.21846),(0 -12367396.21846,-1175623.953394 -13437443.275675,0 -12367396.21846))
|
||||
SELECT 64, ST_AsText(_ST_Transform(ST_GeomFromText('MULTIPOLYGON(((0 0, 3 0, 3 3, 0 3, 0 0)))', 4326, 'axis-order=long-lat'), '+proj=stere +lat_0=90 +lat_ts=71 +lon_0=0 +k=1 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs')) as geometry;
|
||||
64 geometry
|
||||
64 MULTIPOLYGON(((0 -12367396.21846,647259.507328 -12350447.131766,614441.575303 -11724243.684983,0 -11740333.403883,0 -12367396.21846)))
|
||||
SELECT 74, ST_AsText(_ST_Transform(ST_GeomFromText('GEOMETRYCOLLECTION(Point(9 9),LINESTRING(1 5,0 0),POLYGON((2 2,2 8,8 8,8 2,2 2)))', 4326, 'axis-order=long-lat'), '+proj=stere +lat_0=90 +lat_ts=71 +lon_0=0 +k=1 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs')) as geometry;
|
||||
74 geometry
|
||||
74 GEOMETRYCOLLECTION(POINT(1654110.233385 -10443640.991474),LINESTRING(197897.108989 -11337517.780792,0 -12367396.21846),POLYGON((416904.023461 -11938569.2105,1662540.472787 -11829590.142309,1497618.762952 -10656111.201581,375547.722359 -10754279.697304,416904.023461 -11938569.2105)))
|
||||
SELECT 15, ST_AsText(_ST_Transform(ST_GeomFromText('POINT(123.45 -67.89)', 4326, 'axis-order=long-lat'), '+proj=utm +zone=1 +south +ellps=WGS84 +datum=WGS84 +units=m +no_defs')) as geometry;
|
||||
15 geometry
|
||||
15 POINT(-1652422.866845 1300274.91922)
|
||||
SELECT 25, ST_AsText(_ST_Transform(ST_GeomFromText('LINESTRING(123.45 -67.89, 10.11 -12.13)', 4326, 'axis-order=long-lat'), '+proj=utm +zone=1 +south +ellps=WGS84 +datum=WGS84 +units=m +no_defs')) as geometry;
|
||||
25 geometry
|
||||
25 LINESTRING(-1652422.866845 1300274.91922,-275443.590341 -8644852.383437)
|
||||
SELECT 35, ST_AsText(_ST_Transform(ST_GeomFromText('POLYGON((0 0,1 0,1 1,0 1,0 0))', 4326, 'axis-order=long-lat'), '+proj=utm +zone=1 +south +ellps=WGS84 +datum=WGS84 +units=m +no_defs')) as geometry;
|
||||
35 geometry
|
||||
35 POLYGON((833978.556919 29995929.886042,722595.439676 29995929.886042,722561.736479 29885331.913518,833927.937096 29885247.048283,833978.556919 29995929.886042))
|
||||
SELECT 45, ST_AsText(_ST_Transform(ST_GeomFromText('MULTIPOINT(9 9,8 1,1 5)', 4326, 'axis-order=long-lat'), '+proj=utm +zone=1 +south +ellps=WGS84 +datum=WGS84 +units=m +no_defs')) as geometry;
|
||||
45 geometry
|
||||
45 MULTIPOINT((-160640.923181 28995651.600153),(-57002.405491 29884974.744862),(721753.345935 29442928.16415))
|
||||
SELECT 55, ST_AsText(_ST_Transform(ST_GeomFromText('MULTILINESTRING((0 0,5 5,0 0),(0 0,-5 -5,0 0))', 4326, 'axis-order=long-lat'), '+proj=utm +zone=1 +south +ellps=WGS84 +datum=WGS84 +units=m +no_defs')) as geometry;
|
||||
55 geometry
|
||||
55 MULTILINESTRING((833978.556919 29995929.886042,278246.654065 29442928.16415,833978.556919 29995929.886042),(833978.556919 29995929.886042,1389705.452479 -9437825.226475,833978.556919 29995929.886042))
|
||||
SELECT 65, ST_AsText(_ST_Transform(ST_GeomFromText('MULTIPOLYGON(((0 0, 3 0, 3 3, 0 3, 0 0)))', 4326, 'axis-order=long-lat'), '+proj=utm +zone=1 +south +ellps=WGS84 +datum=WGS84 +units=m +no_defs')) as geometry;
|
||||
65 geometry
|
||||
65 MULTIPOLYGON(((833978.556919 29995929.886042,500000 29995929.886042,500000 29664336.706494,833523.067008 29663879.411294,833978.556919 29995929.886042)))
|
||||
SELECT 75, ST_AsText(_ST_Transform(ST_GeomFromText('GEOMETRYCOLLECTION(Point(9 9),LINESTRING(1 5,0 0),POLYGON((2 2,2 8,8 8,8 2,2 2)))', 4326, 'axis-order=long-lat'), '+proj=utm +zone=1 +south +ellps=WGS84 +datum=WGS84 +units=m +no_defs')) as geometry;
|
||||
75 geometry
|
||||
75 GEOMETRYCOLLECTION(POINT(-160640.923181 28995651.600153),LINESTRING(721753.345935 29442928.16415,833978.556919 29995929.886042),POLYGON((611213.301271 29774835.019203,-56748.287241 29774019.445903,-51673.937369 29108275.54574,610204.602078 29111498.179551,611213.301271 29774835.019203)))
|
||||
SELECT 16, ST_AsText(_ST_Transform(ST_GeomFromText('POINT(123.45 -67.89)', 4326, 'axis-order=long-lat'), '+proj=laea +lat_0=-90 +lon_0=0 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs')) as geometry;
|
||||
16 geometry
|
||||
16 POINT(2046764.276971 -1352156.571463)
|
||||
SELECT 26, ST_AsText(_ST_Transform(ST_GeomFromText('LINESTRING(123.45 -67.89, 10.11 -12.13)', 4326, 'axis-order=long-lat'), '+proj=laea +lat_0=-90 +lon_0=0 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs')) as geometry;
|
||||
26 geometry
|
||||
26 LINESTRING(2046764.276971 -1352156.571463,1406436.139337 7887713.384986)
|
||||
SELECT 36, ST_AsText(_ST_Transform(ST_GeomFromText('POLYGON((0 0,1 0,1 1,0 1,0 0))', 4326, 'axis-order=long-lat'), '+proj=laea +lat_0=-90 +lon_0=0 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs')) as geometry;
|
||||
36 geometry
|
||||
36 POLYGON((0 9009964.761231,157245.566999 9008592.499957,158605.709728 9086515.024711,0 9087899.155771,0 9009964.761231))
|
||||
SELECT 46, ST_AsText(_ST_Transform(ST_GeomFromText('MULTIPOINT(9 9,8 1,1 5)', 4326, 'axis-order=long-lat'), '+proj=laea +lat_0=-90 +lon_0=0 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs')) as geometry;
|
||||
46 geometry
|
||||
46 MULTIPOINT((1515262.597952 9566991.522953),(1264791.106721 8999456.345903),(163925.702253 9391297.192387))
|
||||
SELECT 56, ST_AsText(_ST_Transform(ST_GeomFromText('MULTILINESTRING((0 0,5 5,0 0),(0 0,-5 -5,0 0))', 4326, 'axis-order=long-lat'), '+proj=laea +lat_0=-90 +lon_0=0 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs')) as geometry;
|
||||
56 geometry
|
||||
56 MULTILINESTRING((0 9009964.761231,818630.163505 9356985.585486,0 9009964.761231),(0 9009964.761231,-750428.636177 8577438.560997,0 9009964.761231))
|
||||
SELECT 66, ST_AsText(_ST_Transform(ST_GeomFromText('MULTIPOLYGON(((0 0, 3 0, 3 3, 0 3, 0 0)))', 4326, 'axis-order=long-lat'), '+proj=laea +lat_0=-90 +lon_0=0 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs')) as geometry;
|
||||
66 geometry
|
||||
66 MULTIPOLYGON(((0 9009964.761231,471545.121494 8997616.917664,483673.523523 9229040.614568,0 9241706.05152,0 9009964.761231)))
|
||||
SELECT 76, ST_AsText(_ST_Transform(ST_GeomFromText('GEOMETRYCOLLECTION(Point(9 9),LINESTRING(1 5,0 0),POLYGON((2 2,2 8,8 8,8 2,2 2)))', 4326, 'axis-order=long-lat'), '+proj=laea +lat_0=-90 +lon_0=0 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs')) as geometry;
|
||||
76 geometry
|
||||
76 GEOMETRYCOLLECTION(POINT(1515262.597952 9566991.522953),LINESTRING(163925.702253 9391297.192387,0 9009964.761231),POLYGON((319859.05456 9159564.901202,1275542.076514 9075953.470857,1338002.507297 9520382.528893,335521.834099 9608088.223202,319859.05456 9159564.901202)))
|
||||
############################################################################
|
||||
# customized test for geographical srs -> projected srs -> geographical srs
|
||||
############################################################################
|
||||
SELECT ST_AsText(_ST_Transform(_ST_Transform(ST_GeomFromText('POINT(1 2)', 4326, 'axis-order=long-lat'), 3857), 4326));
|
||||
ST_AsText(_ST_Transform(_ST_Transform(ST_GeomFromText('POINT(1 2)', 4326, 'axis-order=long-lat'), 3857), 4326))
|
||||
POINT(2 1)
|
||||
SELECT ST_AsText(_ST_Transform(_ST_Transform(ST_GeomFromText('POINT(1 2)', 4326, 'axis-order=long-lat'), 3873), 4326));
|
||||
ST_AsText(_ST_Transform(_ST_Transform(ST_GeomFromText('POINT(1 2)', 4326, 'axis-order=long-lat'), 3873), 4326))
|
||||
POINT(2 1)
|
||||
SELECT ST_AsText(_ST_Transform(_ST_Transform(ST_GeomFromText('POINT(1 2)', 4326, 'axis-order=long-lat'), 3874), 4326));
|
||||
ST_AsText(_ST_Transform(_ST_Transform(ST_GeomFromText('POINT(1 2)', 4326, 'axis-order=long-lat'), 3874), 4326))
|
||||
POINT(2 1)
|
||||
SELECT ST_AsText(_ST_Transform(_ST_Transform(ST_GeomFromText('POINT(1 2)', 4326, 'axis-order=long-lat'), 3875), 4326));
|
||||
ST_AsText(_ST_Transform(_ST_Transform(ST_GeomFromText('POINT(1 2)', 4326, 'axis-order=long-lat'), 3875), 4326))
|
||||
POINT(2 1)
|
||||
SELECT ST_AsText(_ST_Transform(_ST_Transform(ST_GeomFromText('POINT(1 2)', 4326, 'axis-order=long-lat'), 3876), 4326));
|
||||
ST_AsText(_ST_Transform(_ST_Transform(ST_GeomFromText('POINT(1 2)', 4326, 'axis-order=long-lat'), 3876), 4326))
|
||||
POINT(2 1)
|
||||
SELECT ST_AsText(_ST_Transform(_ST_Transform(ST_GeomFromText('POINT(1 2)', 4326, 'axis-order=long-lat'), 3877), 4326));
|
||||
ST_AsText(_ST_Transform(_ST_Transform(ST_GeomFromText('POINT(1 2)', 4326, 'axis-order=long-lat'), 3877), 4326))
|
||||
POINT(2 1)
|
||||
SELECT ST_AsText(_ST_Transform(_ST_Transform(ST_GeomFromText('POINT(1 2)', 4326, 'axis-order=long-lat'), 3878), 4326));
|
||||
ST_AsText(_ST_Transform(_ST_Transform(ST_GeomFromText('POINT(1 2)', 4326, 'axis-order=long-lat'), 3878), 4326))
|
||||
POINT(2 1)
|
||||
SELECT ST_AsText(_ST_Transform(_ST_Transform(ST_GeomFromText('POINT(1 2)', 4326, 'axis-order=long-lat'), 3879), 4326));
|
||||
ST_AsText(_ST_Transform(_ST_Transform(ST_GeomFromText('POINT(1 2)', 4326, 'axis-order=long-lat'), 3879), 4326))
|
||||
POINT(2 1)
|
||||
SELECT ST_AsText(_ST_Transform(_ST_Transform(ST_GeomFromText('POINT(1 2)', 4326, 'axis-order=long-lat'), 3880), 4326));
|
||||
ST_AsText(_ST_Transform(_ST_Transform(ST_GeomFromText('POINT(1 2)', 4326, 'axis-order=long-lat'), 3880), 4326))
|
||||
POINT(2 1)
|
||||
SELECT ST_AsText(st_transform(ST_GeomFromText('POINT(15 20)'),0));
|
||||
ST_AsText(st_transform(ST_GeomFromText('POINT(15 20)'),0))
|
||||
POINT(15 20)
|
||||
select ST_AsText(st_transform(ST_GeomFromText('POINT(15 20)',26918),26918));
|
||||
ST_AsText(st_transform(ST_GeomFromText('POINT(15 20)',26918),26918))
|
||||
POINT(15 20)
|
||||
select ST_AsText(st_transform(ST_GeomFromText('POINT(15 20)',4326),4326));
|
||||
ST_AsText(st_transform(ST_GeomFromText('POINT(15 20)',4326),4326))
|
||||
POINT(15 20)
|
||||
# bugfix:
|
||||
SELECT _ST_ASEWKT(_ST_TRANSFORM(ST_GEOMFROMTEXT('POINT(1 1)'),0));
|
||||
ERROR 22S00: Transformation to SRID 0 is not supported.
|
||||
# bugfix:
|
||||
SELECT _ST_ASEWKT(_ST_TRANSFORM(ST_GEOMFROMTEXT('POINT(-16197654 16197654 )',26918),4326));
|
||||
ERROR 42000: Out of range
|
||||
# bugfix:
|
||||
SELECT _ST_ASEWKT(_ST_TRANSFORM(ST_GEOMFROMTEXT('POINT(90 180)',26918),'+proj=gnom +ellps=WGS84 +lat_0=80 +lon_0=-150 +no_defs',4326.4326));
|
||||
ERROR 22023: Invalid GIS data provided to function _st_transform.
|
||||
SELECT _ST_ASEWKT(_ST_TRANSFORM(ST_GEOMFROMTEXT('POINT(180 90)',26918),4326.4326));
|
||||
ERROR 22023: Invalid GIS data provided to function _st_transform.
|
||||
select st_transform(ST_GeomFromText('POINT(15 20)',4326),-4326);
|
||||
ERROR 22003: SRID value is out of range in 'st_transform'
|
||||
SELECT _ST_ASEWKT(_ST_TRANSFORM(ST_GEOMFROMTEXT('POINT(180 90)',26918),False));
|
||||
ERROR 22000: Invalid data type for the operation
|
||||
@ -0,0 +1,238 @@
|
||||
# ----------------------------------------------------------------------
|
||||
# Test of GEOMETRY ST_X Function.
|
||||
# ----------------------------------------------------------------------
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('POINT(0 0)'));
|
||||
ST_X(ST_GEOMFROMTEXT('POINT(0 0)'))
|
||||
0
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('POINT(1.1111 -1.1111)'));
|
||||
ST_X(ST_GEOMFROMTEXT('POINT(1.1111 -1.1111)'))
|
||||
1.1111
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('POINT(1e308 -1e308)'));
|
||||
ST_X(ST_GEOMFROMTEXT('POINT(1e308 -1e308)'))
|
||||
1e308
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('POINT(0 0)'));
|
||||
ST_Y(ST_GEOMFROMTEXT('POINT(0 0)'))
|
||||
0
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('POINT(1.1111 -1.1111)'));
|
||||
ST_Y(ST_GEOMFROMTEXT('POINT(1.1111 -1.1111)'))
|
||||
-1.1111
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('POINT(1e308 -1e308)'));
|
||||
ST_Y(ST_GEOMFROMTEXT('POINT(1e308 -1e308)'))
|
||||
-1e308
|
||||
drop table if exists geo;
|
||||
CREATE TABLE geo (
|
||||
id INT PRIMARY KEY AUTO_INCREMENT,
|
||||
type_name TEXT,
|
||||
geo_value GEOMETRY
|
||||
);
|
||||
INSERT INTO geo (type_name,geo_value) VALUES
|
||||
('P1', ST_GeomFromText("POINT(1 3)")),
|
||||
('P2', ST_GeomFromText("POINT(-100 +2e6)")),
|
||||
('P3', ST_GeomFromText("POINT(23.45 67.910)")),
|
||||
('P4', ST_GeomFromText("POINT(1111 2222)"));
|
||||
SELECT ST_X(geo_value) FROM geo ORDER BY id;
|
||||
ST_X(geo_value)
|
||||
1
|
||||
-100
|
||||
23.45
|
||||
1111
|
||||
SELECT ST_ASTEXT(ST_X(geo_value, 2012.2102)) FROM geo ORDER BY id;
|
||||
ST_ASTEXT(ST_X(geo_value, 2012.2102))
|
||||
POINT(2012.2102 3)
|
||||
POINT(2012.2102 2000000)
|
||||
POINT(2012.2102 67.91)
|
||||
POINT(2012.2102 2222)
|
||||
SELECT ST_Y(geo_value) FROM geo ORDER BY id;
|
||||
ST_Y(geo_value)
|
||||
3
|
||||
2000000
|
||||
67.91
|
||||
2222
|
||||
SELECT ST_ASTEXT(ST_Y(geo_value, 2102.2012)) FROM geo ORDER BY id;
|
||||
ST_ASTEXT(ST_Y(geo_value, 2102.2012))
|
||||
POINT(1 2102.2012)
|
||||
POINT(-100 2102.2012)
|
||||
POINT(23.45 2102.2012)
|
||||
POINT(1111 2102.2012)
|
||||
truncate table geo;
|
||||
drop table geo;
|
||||
SELECT ST_X(POINT(pow(2, 2048), 4), 5);
|
||||
ERROR 22003: value is out of range
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('LINESTRING(0 0, 1 1)'), 5);
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type LINESTRING in st_x.
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('MULTIPOINT(10 40, 40 30, 20 20, 30 10)'), 1024);
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type MULTIPOINT in st_y.
|
||||
SELECT ST_X(ST_GEOMFROMTEXT("MULTILINESTRING((10 10, 20 20, 10 40), (40 40, 30 30, 40 20, 30 10))"), 1024);
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type MULTILINESTRING in st_x.
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('POLYGON((0 0,2 2,0 2,0 0))'), -1024);
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type POLYGON in st_x.
|
||||
SELECT ST_X(ST_GEOMFROMTEXT("MULTIPOLYGON(((40 40, 20 45, 45 30, 40 40)), ((20 35, 10 30, 10 10, 30 5, 45 20, 20 35)))"), -1024);
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type MULTIPOLYGON in st_x.
|
||||
SELECT ST_X(ST_GEOMFROMTEXT("GEOMETRYCOLLECTION(
|
||||
POINT(4 6),
|
||||
LINESTRING(4 6,7 10),
|
||||
POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10)),
|
||||
MULTIPOINT (10 40, 40 30, 20 20, 30 10),
|
||||
MULTILINESTRING ((10 10, 20 20, 10 40), (40 40, 30 30, 40 20, 30 10)),
|
||||
MULTIPOLYGON (((30 20, 45 40, 10 40, 30 20)),
|
||||
((15 5, 40 10, 10 20, 5 10, 15 5))))"),
|
||||
1024);
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type GEOMETRYCOLLECTION in st_x.
|
||||
# NULL as one of the parameters must result in NULL return value.
|
||||
SELECT ST_X(NULL);
|
||||
ST_X(NULL)
|
||||
NULL
|
||||
SELECT ST_X(NULL, NULL);
|
||||
ST_X(NULL, NULL)
|
||||
NULL
|
||||
SELECT ST_X(NULL, 1);
|
||||
ST_X(NULL, 1)
|
||||
NULL
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('POINT(0 0)', 4326), NULL);
|
||||
ST_X(ST_GEOMFROMTEXT('POINT(0 0)', 4326), NULL)
|
||||
NULL
|
||||
# Invalid data is not allowed.
|
||||
#todo@dazhi: string -> geometry
|
||||
# New value must be within the allowed range.
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('POINT(0 0)', 4326), -90.000000001);
|
||||
ERROR 22S03: Latitude -90.000000 is out of range in function st_x. It must be within [-90.000000, 90.000000].
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('POINT(0 0)', 4326), 90.000000001);
|
||||
ERROR 22S03: Latitude 90.000000 is out of range in function st_x. It must be within [-90.000000, 90.000000].
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('POINT(0 0)', 7035), -180.000000001);
|
||||
ERROR 22S02: Longitude -180.000000 is out of range in function st_x. It must be within (-180.000000, 180.000000].
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('POINT(0 0)', 7035), 180.000000001);
|
||||
ERROR 22S02: Longitude 180.000000 is out of range in function st_x. It must be within (-180.000000, 180.000000].
|
||||
# First parameter must be a point.
|
||||
# Cartesian SRID 0
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('LINESTRING(0 0, 1 1)', 0));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type LINESTRING in st_x.
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('POLYGON((0 0, 0 1, 1 1, 0 0))', 0));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type POLYGON in st_x.
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('MULTIPOINT((0 0))', 0));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type MULTIPOINT in st_x.
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('MULTIPOINT((0 0), (1 1))', 0));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type MULTIPOINT in st_x.
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('MULTILINESTRING((0 0, 1 1))', 0));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type MULTILINESTRING in st_x.
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0, 0 1, 1 1, 0 0)))', 0));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type MULTIPOLYGON in st_x.
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(0 0))', 0));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type GEOMETRYCOLLECTION in st_x.
|
||||
# Projected
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('LINESTRING(0 0, 1 1)', 3857));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type LINESTRING in st_x.
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('POLYGON((0 0, 0 1, 1 1, 0 0))', 3857));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type POLYGON in st_x.
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('MULTIPOINT((0 0))', 3857));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type MULTIPOINT in st_x.
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('MULTIPOINT((0 0), (1 1))', 3857));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type MULTIPOINT in st_x.
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('MULTILINESTRING((0 0, 1 1))', 3857));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type MULTILINESTRING in st_x.
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0, 0 1, 1 1, 0 0)))', 3857));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type MULTIPOLYGON in st_x.
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(0 0))', 3857));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type GEOMETRYCOLLECTION in st_x.
|
||||
# Geographic
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('LINESTRING(0 0, 1 1)', 4326));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type LINESTRING in st_x.
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('POLYGON((0 0, 0 1, 1 1, 0 0))', 4326));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type POLYGON in st_x.
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('MULTIPOINT((0 0))', 4326));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type MULTIPOINT in st_x.
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('MULTIPOINT((0 0), (1 1))', 4326));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type MULTIPOINT in st_x.
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('MULTILINESTRING((0 0, 1 1))', 4326));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type MULTILINESTRING in st_x.
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0, 0 1, 1 1, 0 0)))', 4326));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type MULTIPOLYGON in st_x.
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(0 0))', 4326));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type GEOMETRYCOLLECTION in st_x.
|
||||
# Invalied geometry
|
||||
SELECT ST_X(ST_GeomFromText('LINESTRING(0 0, 1 1)'), 5);
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type LINESTRING in st_x.
|
||||
SELECT ST_Y(ST_GeomFromText('LINESTRING(0 0, 1 1)'), 5);
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type LINESTRING in st_y.
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('POLYGON((0 0,2 2,0 2,0 0))'), -1024);
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type POLYGON in st_x.
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('POLYGON((0 0,2 2,0 2,0 0))'), -1024);
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type POLYGON in st_y.
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('MULTIPOINT(10 40, 40 30, 20 20, 30 10)'), 1024);
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type MULTIPOINT in st_x.
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('MULTIPOINT(10 40, 40 30, 20 20, 30 10)'), 1024);
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type MULTIPOINT in st_y.
|
||||
SELECT ST_X(ST_GEOMFROMTEXT("MULTILINESTRING((10 10, 20 20, 10 40),"
|
||||
"(40 40, 30 30, 40 20, 30 10))"), 1024);
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type MULTILINESTRING in st_x.
|
||||
# Get or set the X coordinate of SRID 0.
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('POINT(1 0)', 0));
|
||||
ST_X(ST_GEOMFROMTEXT('POINT(1 0)', 0))
|
||||
1
|
||||
# Get or set the X coordinate of a projected SRS.
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('POINT(1 0)', 3857));
|
||||
ST_X(ST_GEOMFROMTEXT('POINT(1 0)', 3857))
|
||||
1
|
||||
# Get or set the X coordinate (latitude) of a point in a lat-long SRS.
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('POINT(1 0)', 4326));
|
||||
ST_X(ST_GEOMFROMTEXT('POINT(1 0)', 4326))
|
||||
1
|
||||
# Get or set the X coordinate (longitude) of a point in a long-lat SRS.
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('POINT(1 0)', 7035));
|
||||
ST_X(ST_GEOMFROMTEXT('POINT(1 0)', 7035))
|
||||
1
|
||||
SELECT 'X1', ST_X(ST_GEOMFROMTEXT('POINT (0 0)'));
|
||||
X1 ST_X(ST_GEOMFROMTEXT('POINT (0 0)'))
|
||||
X1 0
|
||||
SELECT 'X2', ST_X(ST_GEOMFROMTEXT('POINT (1 2)'));
|
||||
X2 ST_X(ST_GEOMFROMTEXT('POINT (1 2)'))
|
||||
X2 1
|
||||
SELECT 'X3', ST_X(ST_GEOMFROMTEXT('POINT (6 7)'));
|
||||
X3 ST_X(ST_GEOMFROMTEXT('POINT (6 7)'))
|
||||
X3 6
|
||||
SELECT 'X4', ST_X(ST_GEOMFROMTEXT('POINT (10 11)'));
|
||||
X4 ST_X(ST_GEOMFROMTEXT('POINT (10 11)'))
|
||||
X4 10
|
||||
SELECT 'X5', ST_X(ST_GEOMFROMTEXT('MULTIPOINT ((0 0), (1 1))'));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type MULTIPOINT in st_x.
|
||||
SELECT 'X6', ST_X(ST_GEOMFROMTEXT('LINESTRING (0 0, 1 1)'));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type LINESTRING in st_x.
|
||||
SELECT 'X7', ST_X(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION (POINT(0 0))'));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type GEOMETRYCOLLECTION in st_x.
|
||||
SELECT 'X8', ST_X(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION (POINT(0 1), LINESTRING(0 0, 1 1))'));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type GEOMETRYCOLLECTION in st_x.
|
||||
# Test unusual input
|
||||
SET @A = NULL;
|
||||
SELECT ST_ASTEXT(ST_LATITUDE(ST_GEOMFROMTEXT('POINT(90 -90)',4326), @A));
|
||||
ST_ASTEXT(ST_LATITUDE(ST_GEOMFROMTEXT('POINT(90 -90)',4326), @A))
|
||||
NULL
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(180 -180)',4269,'axis-order=long-lat'),NULL);
|
||||
ERROR 22S03: Latitude -180.000000 is out of range in function st_geomfromtext. It must be within [-90.000000, 90.000000].
|
||||
SELECT ST_ASTEXT(ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(90 -90)',4120), ' '));
|
||||
ST_ASTEXT(ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(90 -90)',4120), ' '))
|
||||
POINT(90 0)
|
||||
SELECT ST_ASTEXT(ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(90 -90)',4120), 'invalid input'));
|
||||
ST_ASTEXT(ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(90 -90)',4120), 'invalid input'))
|
||||
POINT(90 0)
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'invalid input'
|
||||
#
|
||||
# Test precision
|
||||
select st_latitude(st_geomfromtext('point(1e-16 1e-16)', 4326));
|
||||
st_latitude(st_geomfromtext('point(1e-16 1e-16)', 4326))
|
||||
1e-16
|
||||
#
|
||||
# Test wkb type
|
||||
select st_x(x'E6100000010000000041CF2402F51C54C0845661A4703A4940');
|
||||
ERROR 22023: Invalid GIS data provided to function st_x.
|
||||
select st_y(x'E6100000010800000041CF2402F51C54C0845661A4703A4940');
|
||||
ERROR 22023: Invalid GIS data provided to function st_y.
|
||||
#
|
||||
# Test unusual input
|
||||
select st_x(1.1);
|
||||
ERROR 22023: Invalid GIS data provided to function st_x.
|
||||
select st_y(10.2);
|
||||
ERROR SR001: There's no spatial reference system with SRID 841887793.
|
||||
select st_x(102342);
|
||||
ERROR SR001: There's no spatial reference system with SRID 858927153.
|
||||
select st_y('sdfwefqwe');
|
||||
ERROR SR001: There's no spatial reference system with SRID 2003199091.
|
||||
@ -0,0 +1,120 @@
|
||||
# ----------------------------------------------------------------------
|
||||
# Test of GEOMETRY ST_Y
|
||||
# ----------------------------------------------------------------------
|
||||
# NULL as one of the parameters must result in NULL return value.
|
||||
SELECT ST_Y(NULL);
|
||||
ST_Y(NULL)
|
||||
NULL
|
||||
SELECT ST_Y(NULL, NULL);
|
||||
ST_Y(NULL, NULL)
|
||||
NULL
|
||||
SELECT ST_Y(NULL, 1);
|
||||
ST_Y(NULL, 1)
|
||||
NULL
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('POINT(0 0)', 4326), NULL);
|
||||
ST_Y(ST_GEOMFROMTEXT('POINT(0 0)', 4326), NULL)
|
||||
NULL
|
||||
# Invalid data is not allowed. todo@dazhi
|
||||
# New value must be within the allowed range.
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('POINT(0 0)', 4326), -180.000000001);
|
||||
ERROR 22S02: Longitude -180.000000 is out of range in function st_y. It must be within (-180.000000, 180.000000].
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('POINT(0 0)', 4326), 180.000000001);
|
||||
ERROR 22S02: Longitude 180.000000 is out of range in function st_y. It must be within (-180.000000, 180.000000].
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('POINT(0 0)', 7035), -90.000000001);
|
||||
ERROR 22S03: Latitude -90.000000 is out of range in function st_y. It must be within [-90.000000, 90.000000].
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('POINT(0 0)', 7035), 90.000000001);
|
||||
ERROR 22S03: Latitude 90.000000 is out of range in function st_y. It must be within [-90.000000, 90.000000].
|
||||
# First parameter must be a point.
|
||||
# Cartesian SRID 0
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('LINESTRING(0 0, 1 1)', 0));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type LINESTRING in st_y.
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('POLYGON((0 0, 0 1, 1 1, 0 0))', 0));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type POLYGON in st_y.
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('MULTIPOINT((0 0))', 0));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type MULTIPOINT in st_y.
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('MULTIPOINT((0 0), (1 1))', 0));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type MULTIPOINT in st_y.
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('MULTILINESTRING((0 0, 1 1))', 0));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type MULTILINESTRING in st_y.
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0, 0 1, 1 1, 0 0)))', 0));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type MULTIPOLYGON in st_y.
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(0 0))', 0));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type GEOMETRYCOLLECTION in st_y.
|
||||
# Projected
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('LINESTRING(0 0, 1 1)', 3857));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type LINESTRING in st_y.
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('POLYGON((0 0, 0 1, 1 1, 0 0))', 3857));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type POLYGON in st_y.
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('MULTIPOINT((0 0))', 3857));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type MULTIPOINT in st_y.
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('MULTIPOINT((0 0), (1 1))', 3857));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type MULTIPOINT in st_y.
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('MULTILINESTRING((0 0, 1 1))', 3857));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type MULTILINESTRING in st_y.
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0, 0 1, 1 1, 0 0)))', 3857));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type MULTIPOLYGON in st_y.
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(0 0))', 3857));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type GEOMETRYCOLLECTION in st_y.
|
||||
# Geographic
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('LINESTRING(0 0, 1 1)', 4326));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type LINESTRING in st_y.
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('POLYGON((0 0, 0 1, 1 1, 0 0))', 4326));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type POLYGON in st_y.
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('MULTIPOINT((0 0))', 4326));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type MULTIPOINT in st_y.
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('MULTIPOINT((0 0), (1 1))', 4326));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type MULTIPOINT in st_y.
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('MULTILINESTRING((0 0, 1 1))', 4326));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type MULTILINESTRING in st_y.
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0, 0 1, 1 1, 0 0)))', 4326));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type MULTIPOLYGON in st_y.
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(0 0))', 4326));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type GEOMETRYCOLLECTION in st_y.
|
||||
# Get or set the Y coordinate of SRID 0.
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('POINT(0 1)', 0));
|
||||
ST_Y(ST_GEOMFROMTEXT('POINT(0 1)', 0))
|
||||
1
|
||||
SELECT ST_ASTEXT(ST_Y(ST_GEOMFROMTEXT('POINT(0 0)', 0), 1));
|
||||
ST_ASTEXT(ST_Y(ST_GEOMFROMTEXT('POINT(0 0)', 0), 1))
|
||||
POINT(0 1)
|
||||
# Get or set the Y coordinate of a projected SRS.
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('POINT(0 1)', 3857));
|
||||
ST_Y(ST_GEOMFROMTEXT('POINT(0 1)', 3857))
|
||||
1
|
||||
SELECT ST_ASTEXT(ST_Y(ST_GEOMFROMTEXT('POINT(0 0)', 3857), 1));
|
||||
ST_ASTEXT(ST_Y(ST_GEOMFROMTEXT('POINT(0 0)', 3857), 1))
|
||||
POINT(0 1)
|
||||
# Get or set the Y coordinate (longitude) of a point in a lat-long SRS.
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('POINT(0 1)', 4326));
|
||||
ST_Y(ST_GEOMFROMTEXT('POINT(0 1)', 4326))
|
||||
1
|
||||
SELECT ST_ASTEXT(ST_Y(ST_GEOMFROMTEXT('POINT(0 0)', 4326), 1));
|
||||
ST_ASTEXT(ST_Y(ST_GEOMFROMTEXT('POINT(0 0)', 4326), 1))
|
||||
POINT(0 1)
|
||||
# Get or set the Y coordinate (latitude) of a point in a long-lat SRS.
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('POINT(0 1)', 7035));
|
||||
ST_Y(ST_GEOMFROMTEXT('POINT(0 1)', 7035))
|
||||
1
|
||||
SELECT ST_ASTEXT(ST_Y(ST_GEOMFROMTEXT('POINT(0 0)', 7035), 1));
|
||||
ST_ASTEXT(ST_Y(ST_GEOMFROMTEXT('POINT(0 0)', 7035), 1))
|
||||
POINT(0 1)
|
||||
SELECT 'Y1', ST_Y(ST_GEOMFROMTEXT('POINT (0 0)'));
|
||||
Y1 ST_Y(ST_GEOMFROMTEXT('POINT (0 0)'))
|
||||
Y1 0
|
||||
SELECT 'Y2', ST_Y(ST_GEOMFROMTEXT('POINT (1 2)'));
|
||||
Y2 ST_Y(ST_GEOMFROMTEXT('POINT (1 2)'))
|
||||
Y2 2
|
||||
SELECT 'Y3', ST_Y(ST_GEOMFROMTEXT('POINT (6 7)'));
|
||||
Y3 ST_Y(ST_GEOMFROMTEXT('POINT (6 7)'))
|
||||
Y3 7
|
||||
SELECT 'Y4', ST_Y(ST_GEOMFROMTEXT('POINT (10 11)'));
|
||||
Y4 ST_Y(ST_GEOMFROMTEXT('POINT (10 11)'))
|
||||
Y4 11
|
||||
SELECT 'Y5', ST_Y(ST_GEOMFROMTEXT('MULTIPOINT ((0 0), (1 1))'));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type MULTIPOINT in st_y.
|
||||
SELECT 'Y6', ST_Y(ST_GEOMFROMTEXT('LINESTRING (0 0, 1 1)'));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type LINESTRING in st_y.
|
||||
SELECT 'Y7', ST_Y(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION (POINT(0 0))'));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type GEOMETRYCOLLECTION in st_y.
|
||||
SELECT 'Y8', ST_Y(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION (POINT(0 1), LINESTRING(0 0, 1 1))'));
|
||||
ERROR 22S01: POINT value is a geometry of unexpected type GEOMETRYCOLLECTION in st_y.
|
||||
@ -0,0 +1,10 @@
|
||||
#owner: ht353245
|
||||
#owner group: shenzhen
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--echo # Test of GEOMETRY __ALL_TENANT_SPATIAL_REFERENCE_SYSTEMS.
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--source mysql_test/test_suite/geometry/t/import_default_srs_data_mysql.inc
|
||||
|
||||
|
||||
|
||||
SELECT SRS_NAME, SRS_ID, ORGANIZATION, ORGANIZATION_COORDSYS_ID, DEFINITION, DESCRIPTION FROM oceanbase.__all_spatial_reference_systems ORDER BY SRS_ID;
|
||||
@ -0,0 +1,41 @@
|
||||
#owner: ht353245
|
||||
#owner group: shenzhen
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--echo # Create spatial index test of GEOMETRY spatial index.
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--source mysql_test/test_suite/geometry/t/import_default_srs_data_mysql.inc
|
||||
|
||||
|
||||
# Check spatial index functionality on compress table with Primary key
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS tab;
|
||||
--enable_warnings
|
||||
CREATE TABLE tab(c1 int NOT NULL PRIMARY KEY,c2 GEOMETRY NOT NULL SRID 0,
|
||||
c3 GEOMETRY NOT NULL SRID 0,c4 GEOMETRY NOT NULL SRID 0,c5 GEOMETRY NOT NULL SRID 0);
|
||||
|
||||
# Check spatial index functionality with Create Index clause options
|
||||
CREATE SPATIAL INDEX idx1 on tab(c2);
|
||||
--error 1221
|
||||
CREATE SPATIAL INDEX idx2 on tab(c3 ASC) COMMENT 'wl6968';
|
||||
--error 1221
|
||||
CREATE SPATIAL INDEX idx2 on tab(c3 DESC) COMMENT 'wl6968';
|
||||
CREATE SPATIAL INDEX idx3 on tab(c4);
|
||||
--error 1221
|
||||
CREATE SPATIAL INDEX idx4 on tab(c5 DESC) COMMENT 'Spatial index on Geometry type column';
|
||||
|
||||
# Check index type
|
||||
SHOW INDEXES FROM tab;
|
||||
|
||||
# Populate some spatial data
|
||||
INSERT INTO tab(c1,c2,c3,c4,c5)
|
||||
VALUES(1,ST_GeomFromText('POINT(10 10)'),ST_GeomFromText('LINESTRING(5 5,20 20,30 30)'),
|
||||
ST_GeomFromText('POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))'),
|
||||
ST_GeomFromText('POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))'));
|
||||
|
||||
INSERT INTO tab(c1,c2,c3,c4,c5)
|
||||
VALUES(3,ST_GeomFromText('POINT(4 4)'),ST_GeomFromText('LINESTRING(130 130,140 140,150 150)'),
|
||||
ST_GeomFromText('POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'),
|
||||
ST_GeomFromText('POLYGON((4 -2,5 -4,6 -5,7 -4,7 2,4 -2))'));
|
||||
|
||||
# Cleanup
|
||||
DROP TABLE tab;
|
||||
@ -0,0 +1,359 @@
|
||||
#owner: ht353245
|
||||
#owner group: shenzhen
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--echo # Base test of geometry ddl.
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--source mysql_test/test_suite/geometry/t/import_default_srs_data_mysql.inc
|
||||
|
||||
|
||||
sleep 1;
|
||||
set @g = point(1, 1);
|
||||
select length(@g);
|
||||
|
||||
connection conn_admin;
|
||||
sleep 1;
|
||||
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists geo_table, tt1, T_GEO, tab, FF01, gis_point_plancache;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE geo_table(
|
||||
k int primary key,
|
||||
geom geometry NOT NULL,
|
||||
SPATIAL INDEX (geom)
|
||||
);
|
||||
INSERT INTO geo_table VALUES
|
||||
(1, ST_GeomFromText('POINT(1.0 1.0)')),
|
||||
(2, ST_GeomFromText('LINESTRING(1.0 1.0, 2.0 2.0)')),
|
||||
(3, ST_GeomFromText('POINT(3.0 3.0)')),
|
||||
(4, ST_GeomFromText('LINESTRING(4.0 4.0, 5.0 5.0)')),
|
||||
(5, ST_GeomFromText('LINESTRING(40.0 40.0, 41.0 41.0)')),
|
||||
(6, ST_GeomFromText('POLYGON((1.0 1.0, 5.0 1.0, 5.0 5.0, 1.0 5.0, 1.0 1.0))'));
|
||||
SELECT k FROM geo_table WHERE ST_Intersects(ST_GeomFromText('POINT(3.0 3.0)'), geom) ORDER BY k;
|
||||
drop table geo_table;
|
||||
|
||||
CREATE TABLE geo_table(
|
||||
k int primary key,
|
||||
geom geometry NOT NULL srid 4326,
|
||||
SPATIAL INDEX (geom) local
|
||||
);
|
||||
INSERT INTO geo_table VALUES (1, ST_GeomFromText('POINT(1.0 1.0)', 4326));
|
||||
--error 3643
|
||||
SELECT k FROM geo_table WHERE ST_Intersects(ST_GeomFromText('POINT(1.0 1.0)', 0), geom) ORDER BY k;
|
||||
drop table geo_table;
|
||||
|
||||
# fix check constraint
|
||||
#
|
||||
create table tt1(g GEOMETRY check(g=ST_GeomFromText('point(10 20)')));
|
||||
--error 3819
|
||||
insert into tt1 values(ST_GeomFromText('point(10 20)',26918));
|
||||
--error 3819
|
||||
insert into tt1 values(st_geomfromwkb(x'01040000000300000001010000000000000000c067400000000000805b4001010000000000000000c06240000000000080514001010000000000000000c06c400000000000805140'));
|
||||
insert into tt1 values(ST_GeomFromText('point(10 20)'));
|
||||
drop table tt1;
|
||||
|
||||
# fix groupby, orderby
|
||||
#
|
||||
create table T_GEO (GID int auto_increment primary key, geo_c geometrycollection,geo geometry);
|
||||
select * from T_GEO group by geo;
|
||||
select * from T_GEO order by geo_c;
|
||||
drop table T_GEO;
|
||||
|
||||
CREATE TABLE tab(c1 int NOT NULL PRIMARY KEY,c2 POINT NOT NULL SRID 0,
|
||||
c3 LINESTRING NOT NULL SRID 0,c4 POLYGON NOT NULL SRID 0,c5 GEOMETRY NOT NULL SRID 0)
|
||||
ENGINE=InnoDB;
|
||||
|
||||
INSERT INTO tab(c1,c2,c3,c4,c5)
|
||||
VALUES(1,ST_GeomFromText('POINT(10 10)'),ST_GeomFromText('LINESTRING(5 5,20 20,30 30)'),
|
||||
ST_GeomFromText('POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))'),
|
||||
ST_GeomFromText('POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))'));
|
||||
|
||||
|
||||
INSERT INTO tab(c1,c2,c3,c4,c5)
|
||||
VALUES(2,ST_GeomFromText('POINT(20 20)'),ST_GeomFromText('LINESTRING(20 20,30 30,40 40)'),
|
||||
ST_GeomFromText('POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50))'),
|
||||
ST_GeomFromText('POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50))'));
|
||||
|
||||
INSERT INTO tab(c1,c2,c3,c4,c5)
|
||||
VALUES(3,ST_GeomFromText('POINT(4 4)'),ST_GeomFromText('LINESTRING(130 130,140 140,150 150)'),
|
||||
ST_GeomFromText('POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'),
|
||||
ST_GeomFromText('POLYGON((4 -2,5 -4,6 -5,7 -4,7 2,4 -2))'));
|
||||
|
||||
INSERT INTO tab(c1,c2,c3,c4,c5)
|
||||
VALUES(4,ST_GeomFromText('POINT(50 50)'),ST_GeomFromText('LINESTRING(200 200,300 300,400 400)'),
|
||||
ST_GeomFromText('POLYGON((300 300,400 400,500 500,300 500,300 400,300 300))'),
|
||||
ST_GeomFromText('POLYGON((300 300,400 400,500 500,300 500,300 400,300 300))'));
|
||||
|
||||
INSERT INTO tab(c1,c2,c3,c4,c5)
|
||||
VALUES(5,ST_GeomFromText('POINT(3 3)'),ST_GeomFromText('LINESTRING(400 400,500 500,600 700)'),
|
||||
ST_GeomFromText('POLYGON((1010 1010,1020 1020,1030 1030,1040 1030,1020 1010,1010 1010))'),
|
||||
ST_GeomFromText('POLYGON((1010 1010,1020 1020,1030 1030,1040 1030,1020 1010,1010 1010))'));
|
||||
|
||||
INSERT INTO tab(c1,c2,c3,c4,c5)
|
||||
VALUES(6,ST_GeomFromText('POINT(3 3)'),ST_GeomFromText('LINESTRING(40 40,50 50,60 70)'),
|
||||
ST_GeomFromText('POLYGON((2010 2010,2020 2020,2030 2030,2040 2030,2020 2010,2010 2010))'),
|
||||
ST_GeomFromText('POLYGON((2010 2010,2020 2020,2030 2030,2040 2030,2020 2010,2010 2010))'));
|
||||
|
||||
INSERT INTO tab(c1,c2,c3,c4,c5)
|
||||
VALUES(7,ST_GeomFromText('POINT(60 70)'),ST_GeomFromText('LINESTRING(40 40,50 50,60 70)'),
|
||||
ST_GeomFromText('POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))'),
|
||||
ST_GeomFromText('POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))'));
|
||||
|
||||
INSERT INTO tab(c1,c2,c3,c4,c5)
|
||||
VALUES(8,ST_GeomFromText('POINT(0 0)'),ST_GeomFromText('LINESTRING(40 40,50 50,60 70)'),
|
||||
ST_GeomFromText('POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))'),
|
||||
ST_GeomFromText('POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))'));
|
||||
|
||||
|
||||
INSERT INTO tab(c1,c2,c3,c4,c5)
|
||||
VALUES(9,ST_GeomFromText('POINT(120 120)'),ST_GeomFromText('LINESTRING(100 100,110 110,120 120)'),
|
||||
ST_GeomFromText('POLYGON((4010 4010,4020 4020,4030 4030,4040 4030,4020 4010,4010 4010))'),
|
||||
ST_GeomFromText('POLYGON((4010 4010,4020 4020,4030 4030,4040 4030,4020 4010,4010 4010))'));
|
||||
|
||||
|
||||
INSERT INTO tab(c1,c2,c3,c4,c5)
|
||||
VALUES(10,ST_GeomFromText('POINT(160 160)'),ST_GeomFromText('LINESTRING(140 140,150 150,160 160)'),
|
||||
ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'),
|
||||
ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'));
|
||||
|
||||
SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab ORDER BY c1;
|
||||
SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab ORDER BY c2;
|
||||
SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab ORDER BY c3;
|
||||
SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab ORDER BY c4;
|
||||
SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab ORDER BY c5;
|
||||
|
||||
SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab GROUP BY c1;
|
||||
SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab GROUP BY c2;
|
||||
SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab GROUP BY c3;
|
||||
SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab GROUP BY c4;
|
||||
SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab GROUP BY c5;
|
||||
|
||||
SET sql_mode = 'ONLY_FULL_GROUP_BY';
|
||||
--error 1055
|
||||
SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab GROUP BY c2;
|
||||
SET sql_mode = ' ';
|
||||
|
||||
drop table tab;
|
||||
|
||||
# fix sub query
|
||||
#
|
||||
CREATE TABLE FF01 (A INT,B GEOMETRY);
|
||||
INSERT INTO FF01 VALUES (1,NULL);
|
||||
INSERT INTO FF01 VALUES (2,POINT(1,2));
|
||||
INSERT INTO FF01 VALUES (3,POINT(-1,-2));
|
||||
SELECT ST_ASTEXT(B) FROM FF01 WHERE B = SOME (SELECT B FROM FF01 WHERE A=1);
|
||||
SELECT ST_ASTEXT(B) FROM FF01 WHERE B = SOME (SELECT A FROM FF01 WHERE B=POINT(1,2));
|
||||
SELECT ST_ASTEXT(B) FROM FF01 WHERE B IN (SELECT B FROM FF01 WHERE B=POINT(1,2));
|
||||
--error 1210
|
||||
SELECT ST_ASTEXT(B) FROM FF01 WHERE B LIKE (SELECT B FROM FF01 WHERE B=POINT(1,2));
|
||||
SELECT ST_ASTEXT(B) FROM FF01 WHERE B NOT IN (SELECT B FROM FF01 WHERE B=POINT(1,2));
|
||||
SELECT ST_ASTEXT(B) FROM FF01 WHERE B = ANY (SELECT A FROM FF01 WHERE B=POINT(1,2));
|
||||
SELECT ST_ASTEXT(B) FROM FF01 WHERE B = ALL (SELECT A FROM FF01 WHERE B=POINT(1,2));
|
||||
|
||||
drop table FF01;
|
||||
|
||||
create table FF01 (gid int auto_increment primary key, geo geometry SRID 4326,geo_c GEOMETRYCOLLECTION SRID 26918,poi point SRID 4326,lin linestring SRID 26918,pol polygon SRID 4326,M_POI MULTIPOINT SRID 26918,M_LIN MULTILINESTRING SRID 4326 ,M_POL MULTIPOLYGON SRID 26918);
|
||||
|
||||
SELECT ST_ASTEXT(POL) FROM FF01 WHERE (GEO,GEO_C) = (SELECT GEO,GEO_C FROM FF01 WHERE GID=1);
|
||||
|
||||
drop table FF01;
|
||||
|
||||
create table FF01 (gid int auto_increment primary key, M_POI MULTIPOINT SRID 26918);
|
||||
create table FF02 (gid int auto_increment primary key, geo geometry SRID 4326);
|
||||
SELECT ST_ASTEXT(M_POI) FROM FF01 WHERE M_POI <=> (SELECT M_POI FROM FF02 WHERE GID=1);
|
||||
drop table FF01;
|
||||
drop table FF02;
|
||||
|
||||
# fix
|
||||
#
|
||||
|
||||
# 1. cases should share same plancache
|
||||
alter system flush plan cache;
|
||||
|
||||
create table gis_point_plancache (x double, y double, poi geometry);
|
||||
|
||||
insert into gis_point_plancache (x,y,poi) values (88.9200873939389,-70.01650134265074,st_srid(point(88.9200873939389,-70.01650134265074),4326)),(-131.96607164968344,70.74339201768984,st_srid(point(-131.96607164968344,70.74339201768984),4326));
|
||||
|
||||
insert into gis_point_plancache (x,y,poi) values (66.70676602312597,68.49638658511424,st_srid(point(66.70676602312597,68.49638658511424),4326)),(38.2111204280196,-84.97214528175294,st_srid(point(38.2111204280196,-84.97214528175294),4326));
|
||||
|
||||
insert into gis_point_plancache (x,y,poi) values (-135.24378902766549,-45.111689570279204,st_srid(point(-135.24378902766549,-45.111689570279204),4326)),(54.43574907318134,11.87557381602113,st_srid(point(54.43574907318134,11.87557381602113),4326));
|
||||
|
||||
insert into gis_point_plancache (x,y,poi) values (-51.28971091880538,-16.112290993511024,st_srid(point(-51.28971091880538,-16.112290993511024),4326)),(26.793719900045886,38.22676013634444,st_srid(point(26.793719900045886,38.22676013634444),4326));
|
||||
|
||||
insert into gis_point_plancache (x,y,poi) values (1.1, 1.2, st_srid(linestring(point(1.1, 1.2), point(1.2, 1.3)), 4326));
|
||||
|
||||
insert into gis_point_plancache (x,y,poi) values (1.111, 1.211, st_srid(linestring(point(1.111, 1.211), point(1.211, 1.311)), 4326));
|
||||
|
||||
insert into gis_point_plancache (x,y,poi) values (1.111111, 1.211111, st_srid(linestring(point(1.111111, 1.211111), point(1.211111, 1.311111)), 4326));
|
||||
|
||||
select x,y,st_astext(poi) from gis_point_plancache;
|
||||
|
||||
select executions, hit_count, substring(query_sql, 1, 100) as sql_text from oceanbase.GV$OB_PLAN_CACHE_PLAN_STAT where query_sql like '%x,y,poi%' order by plan_size desc limit 10;
|
||||
|
||||
drop table gis_point_plancache;
|
||||
|
||||
select json_array(1.1, 1.1, 1.1);
|
||||
|
||||
select json_array(1.1111, 1.1, 1.1);
|
||||
|
||||
select json_array(1.111111111, 1.1, 1.1);
|
||||
|
||||
# 2. cases should not share same plancache
|
||||
select st_astext(point(cast(1.11 as double), 1.1)) as plancache_not_share;
|
||||
|
||||
select st_astext(point(cast(1.1111 as double), 1.1111)) as plancache_not_share;
|
||||
|
||||
select cast(1.11 as double), st_astext(point(1.1, 1.1)) as plancache_not_share;
|
||||
|
||||
select cast(1.11111 as double), st_astext(point(1.1, 1.1111)) as plancache_not_share;
|
||||
|
||||
select executions, hit_count, substring(query_sql, 1, 100) as sql_text from oceanbase.GV$OB_PLAN_CACHE_PLAN_STAT where query_sql like '%plancache_not_share%' and query_sql not like '%OB_PLAN_CACHE_PLAN_STAT%' order by plan_size desc limit 10;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists tt2;
|
||||
--enable_warnings
|
||||
# add geometry compare in old engine (in order to use check constraint)
|
||||
# bugfix:
|
||||
create table tt2(g GEOMETRY);
|
||||
insert into tt2 values(ST_GeomFromText('LINESTRING(0 0, 10 10, 20 25, 50 60)'));
|
||||
--error 3819
|
||||
ALTER TABLE tt2 ADD CONSTRAINT qq CHECK(g=ST_GeomFromText('point(10 20)'));
|
||||
ALTER TABLE tt2 ADD CONSTRAINT qq CHECK(g=ST_GeomFromText('LINESTRING(0 0, 10 10, 20 25, 50 60)'));
|
||||
drop table tt2;
|
||||
#
|
||||
SELECT ST_CONTAINS(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(LINESTRING(2 0,2 0))'),ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(2 0))')) A;
|
||||
|
||||
SELECT ST_CONTAINS(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(LINESTRING(2 0,2 0))', 4326),ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(2 0))', 4326)) A;
|
||||
|
||||
--error 3037
|
||||
SELECT ST_CONTAINS(ST_GEOMETRYFROMTEXT('POLYGON((2 0,0 0,0 0,2 0))'),ST_GEOMETRYFROMTEXT('GEOMETRYCOLLECTION(MULTIPOLYGON(((0 0,1 1,1 0,0 1,0 0))))'));
|
||||
|
||||
#
|
||||
--error 1690
|
||||
SELECT ST_CONTAINS(
|
||||
ST_GEOMFROMTEXT('MULTIPOLYGON(((0 1e+19,0 0,0 0,0 1e+19)))'),
|
||||
ST_GEOMFROMTEXT('POLYGON((0 0,0 0,0 0,0 0))'));
|
||||
|
||||
|
||||
SELECT ST_CONTAINS(
|
||||
ST_GEOMFROMTEXT('MULTIPOLYGON(((0 9.22e+18,0 0,0 0,0 9.22e+18)))'),
|
||||
ST_GEOMFROMTEXT('POLYGON((0 0,0 0,0 0,0 0))'));
|
||||
|
||||
|
||||
SELECT ST_CONTAINS(
|
||||
ST_GEOMFROMTEXT('MULTIPOLYGON(((0 -9.22e+18,0 0,0 0,0 -9.22e+18)))'),
|
||||
ST_GEOMFROMTEXT('POLYGON((0 0,0 0,0 0,0 0))'));
|
||||
|
||||
#
|
||||
create table tt1(id int,p point);
|
||||
--error 1235
|
||||
alter table tt1 change p p polygon;
|
||||
desc tt1;
|
||||
drop table tt1;
|
||||
|
||||
#
|
||||
create table tt2(a blob);
|
||||
insert into tt2 values('E6100000010100000000000000000034400000000000002440');
|
||||
--error 3548
|
||||
select cast(a as point) from tt2;
|
||||
drop table tt2;
|
||||
|
||||
#
|
||||
--error 3037
|
||||
select hex(st_aswkb(x'E61000000108000000000000000e0066C00000000000A06640'));
|
||||
--error 3037
|
||||
select hex(st_asbinary(x'E61000000108000000000000000e0066C00000000000A06640'));
|
||||
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists tt1,t1;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE tt1 (
|
||||
id INT NOT NULL ,
|
||||
g GEOMETRY not null srid 4236,
|
||||
p point not null srid 0,
|
||||
l LINESTRING not null srid 26918,
|
||||
po POLYGON not null srid 4236,
|
||||
mu MULTIPOINT not null,
|
||||
ml MULTILINESTRING not null srid 0,
|
||||
mp MULTIPOLYGON not null srid 26918,
|
||||
ge GEOMETRYCOLLECTION not null srid 4236
|
||||
);
|
||||
CREATE INDEX idx02 ON tt1(mu);
|
||||
CREATE INDEX idx03 ON tt1(ml);
|
||||
CREATE INDEX idx05 ON tt1(ge);
|
||||
|
||||
insert into tt1 values(1,ST_GeomFromText('POINT(15 20)',4236),ST_GeomFromText('POINT(15 20)',0),ST_GeomFromText('LINESTRING(0 0, 10 10, 20 25, 50 60)',26918),ST_GeomFromText('POLYGON((0 1,10 0,9 10,0 10,0 1),(5 5,7 5,8 7,5 7, 5 5))',4236),ST_GeomFromText('MULTIPOINT(0 1, -20 25, 60 -60)'),
|
||||
ST_GeomFromText('MULTILINESTRING((11 10, 20 -20), (-15 20, 30 15))',0),ST_GeomFromText('MULTIPOLYGON(((0 0,10 0,10 11,0 10,0 0)),((-5 -6,7 5,7 7,5 7, -5 -6)))',26918),
|
||||
ST_GeomFromText('GEOMETRYCOLLECTION(POINT(11 10), POINT(30 -30), LINESTRING(-15 15, -20 20))',4236));
|
||||
|
||||
insert into tt1 values(1,ST_GeomFromText('POINT(15 20)',4236),ST_GeomFromText('POINT(15 20)',0),ST_GeomFromText('LINESTRING(0 0, 10 10, 20 25, 50 60)',26918),ST_GeomFromText('POLYGON((0 1,10 0,9 10,0 10,0 1),(5 5,7 5,8 7,5 7, 5 5))',4236),ST_GeomFromText('MULTIPOINT(0 1, -20 25, 60 -60)'),
|
||||
ST_GeomFromText('MULTILINESTRING((11 10, 20 -20), (-15 20, 30 15))',0),ST_GeomFromText('MULTIPOLYGON(((0 0,10 0,10 11,0 10,0 0)),((-5 -6,7 5,7 7,5 7, -5 -6)))',26918),
|
||||
ST_GeomFromText('GEOMETRYCOLLECTION(POINT(11 10), POINT(30 -30), LINESTRING(-15 15, -20 20))',4236));
|
||||
|
||||
insert into tt1 values(2,ST_GeomFromText('POINT(15 20)',4236),ST_GeomFromText('POINT(15 20)',0),ST_GeomFromText('LINESTRING(0 0, 10 10, 20 25, 50 60)',26918),ST_GeomFromText('POLYGON((0 1,10 0,9 10,0 10,0 1),(5 5,7 5,8 7,5 7, 5 5))',4236),ST_GeomFromText('MULTIPOINT(0 1, -20 25, 60 -60)'),
|
||||
ST_GeomFromText('MULTILINESTRING((11 10, 20 -20), (-15 20, 30 15))',0),ST_GeomFromText('MULTIPOLYGON(((0 0,10 0,10 11,0 10,0 0)),((-5 -6,7 5,7 7,5 7, -5 -6)))',26918),
|
||||
ST_GeomFromText('GEOMETRYCOLLECTION(POINT(11 10), POINT(30 -30), LINESTRING(-15 15, -20 20))',4236));
|
||||
|
||||
insert into tt1 values(2,ST_GeomFromText('POINT(15 20)',4236),ST_GeomFromText('POINT(15 20)',0),ST_GeomFromText('LINESTRING(0 0, 10 10, 20 25, 50 60)',26918),ST_GeomFromText('POLYGON((0 1,10 0,9 10,0 10,0 1),(5 5,7 5,8 7,5 7, 5 5))',4236),ST_GeomFromText('MULTIPOINT(0 1, -20 25, 60 -60)'),
|
||||
ST_GeomFromText('MULTILINESTRING((11 10, 20 -20), (-15 20, 30 15))',0),ST_GeomFromText('MULTIPOLYGON(((1 1,10 0,10 11,0 10,1 1)),((-5 -6,7 5,7 7,5 7, -5 -6)))',26918),
|
||||
ST_GeomFromText('GEOMETRYCOLLECTION(POINT(11 10), POINT(30 -30), LINESTRING(-15 15, -20 20))',4236));
|
||||
|
||||
insert into tt1 values(1,ST_GeomFromText('POINT(15 20)',4236),ST_GeomFromText('POINT(15 20)',0),ST_GeomFromText('LINESTRING(0 0, 10 10, 20 25, 50 60)',26918),ST_GeomFromText('POLYGON((0 1,10 0,9 10,0 10,0 1),(5 5,7 5,8 7,5 7, 5 5))',4236),ST_GeomFromText('MULTIPOINT(0 1, -20 25, 60 -60)'),
|
||||
ST_GeomFromText('MULTILINESTRING((11 10, 20 -20), (-15 20, 30 15))',0),ST_GeomFromText('MULTIPOLYGON(((0 0,10 0,10 11,0 10,0 0)),((5 6,7 5,7 7,5 7, 5 6)))',26918),
|
||||
ST_GeomFromText('GEOMETRYCOLLECTION(POINT(11 10), POINT(30 -30), LINESTRING(-15 15, -20 20))',4236));
|
||||
|
||||
insert into tt1 values(1,ST_GeomFromText('POINT(15 20)',4236),ST_GeomFromText('POINT(15 20)',0),ST_GeomFromText('LINESTRING(0 0, 10 10, 20 25, 50 60)',26918),ST_GeomFromText('POLYGON((0 1,10 0,9 10,0 10,0 1),(5 5,7 5,8 7,5 7, 5 5))',4236),ST_GeomFromText('MULTIPOINT(0 1, -20 25, 60 -60)'),
|
||||
ST_GeomFromText('MULTILINESTRING((11 10, 20 -20), (-15 20, 30 15))',0),ST_GeomFromText('MULTIPOLYGON(((0 0,10 0,10 11,0 10,0 0)),((-5 -6,7 5,7 7,5 7, -5 -6)))',26918),
|
||||
ST_GeomFromText('GEOMETRYCOLLECTION(POINT(11 10), POINT(30 -30), LINESTRING(-15 15, -20 20))',4236));
|
||||
|
||||
explain select id from tt1 where ST_Intersects(ge,ST_GeomFromText('POINT(15 20)',4236));
|
||||
drop table tt1;
|
||||
|
||||
create table t1 (a geometry not null, spatial index(a)) row_format=dynamic;
|
||||
--error 1048
|
||||
INSERT IGNORE INTO t1 VALUES (NULL);
|
||||
drop table t1;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t;
|
||||
--enable_warnings
|
||||
create table t1(g geometry NOT NULL SRID 3294);
|
||||
create index idx on t1 (g);
|
||||
INSERT INTO t1 (g) VALUES
|
||||
(ST_GeomFromText('POINT(0 0)', 3294)),
|
||||
(ST_GeomFromText('POINT(1 1)', 3294)),
|
||||
(ST_GeomFromText('POINT(2 2)', 3294)),
|
||||
(ST_GeomFromText('POINT(3 3)', 3294)),
|
||||
(ST_GeomFromText('POINT(4 4)', 3294)),
|
||||
(ST_GeomFromText('POINT(5 5.5)', 3294)),
|
||||
(ST_GeomFromText('POINT(6 6)', 3294)),
|
||||
(ST_GeomFromText('POINT(7 7)', 3294)),
|
||||
(ST_GeomFromText('LINESTRING(0 0, 3 3)',3294));
|
||||
|
||||
explain select st_astext(a.g), st_astext(b.g) from t1 a join t1 b where _st_covers(a.g, b.g);
|
||||
explain select st_astext(a.g), st_astext(b.g) from t1 a join t1 b where st_contains(a.g, b.g);
|
||||
explain select st_astext(a.g), st_astext(b.g) from t1 a join t1 b where st_within(a.g, b.g);
|
||||
explain select st_astext(a.g), st_astext(b.g) from t1 a join t1 b where _st_dwithin(a.g, b.g, 0.1);
|
||||
|
||||
select st_astext(a.g), st_astext(b.g) from t1 a join t1 b where _st_covers(a.g, b.g);
|
||||
select st_astext(a.g), st_astext(b.g) from t1 a join t1 b where st_contains(a.g, b.g);
|
||||
select st_astext(a.g), st_astext(b.g) from t1 a join t1 b where st_within(a.g, b.g);
|
||||
select st_astext(a.g), st_astext(b.g) from t1 a join t1 b where _st_dwithin(a.g, b.g, 0.1);
|
||||
|
||||
# bugfix:
|
||||
select st_astext(g) from t1 where st_within(ST_GeomFromText('POINT(2.5 2.5)', 3294),st_buffer(g, 0));
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists FF01;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE FF01 (A INT,B GEOMETRY);
|
||||
INSERT INTO FF01 VALUES (1,NULL);
|
||||
INSERT INTO FF01 VALUES (2,POINT(1,2));
|
||||
INSERT INTO FF01 VALUES (3,POINT(-1,-2));
|
||||
SELECT ST_ASTEXT(B) FROM FF01 WHERE B NOT IN (SELECT /*+no_unnest*/B FROM FF01 WHERE B=POINT(1,2));
|
||||
drop table FF01;
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,279 @@
|
||||
#owner: ht353245
|
||||
#owner group: shenzhen
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--echo # Test of GEOMETRY filter.
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--source mysql_test/test_suite/geometry/t/import_default_srs_data_mysql.inc
|
||||
|
||||
##
|
||||
## Basic Relational compare test
|
||||
##
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists matrix;
|
||||
--enable_warnings
|
||||
|
||||
#--real_sleep 1
|
||||
create table matrix (TinyIntType tinyint(1),SmallIntType smallint(2),MediumIntType mediumint(3),Int32Type int(4),IntType bigint(5),UTinyIntType tinyint(1) unsigned,USmallIntType smallint(2) unsigned,UMediumIntType mediumint(3) unsigned,UInt32Type int(4) unsigned,UInt64Type bigint(5) unsigned,FloatType float,DoubleType double,UFloatType float unsigned,UDoubleType double unsigned,NumberType decimal(8,2),UNumberType decimal(8,2) unsigned,DateTimeType datetime,TimestampType timestamp,DateType date,TimeType time,YearType year,VarcharType varchar(9),CharType char(10),VarbinaryType varbinary(11),BinaryType binary(12),ExtendType int(13),TinyTextType TINYTEXT, TextType TEXT,MediumTextType MEDIUMTEXT, LongTextType LONGTEXT CHARSET utf8, BitType BIT(63),EnumType ENUM('a', 'b', 'c') default 'a',SetType SET('a', 'b', 'c') default 'b',JsonType json, GeometryType geometry);
|
||||
#--real_sleep 1
|
||||
|
||||
insert into matrix values (-1, -2, -3, -4, -5, 1, 2, 3, 4, 5, -1.1, -1.2, 1.1, 1.2, -1.3, 1.3, '2014-01-01 12:12:12', '2014-01-01 12:12:12', '2014-01-01', '12:12:12', 2014, 'varchar', 'char', 'varbinary', 'binary', 0,'tinytext','text','mediumtext','longtext',b'01010101010101','a','c','"jsonstring"', ST_GeomFromText('POINT(1 1)'));
|
||||
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = TinyIntType;
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = SmallIntType;
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = MediumIntType;
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = Int32Type;
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = IntType;
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = UTinyIntType;
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = USmallIntType;
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = UMediumIntType;
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = UInt32Type;
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = UInt64Type;
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = FloatType;
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = DoubleType;
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = UFloatType;
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = UDoubleType;
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = NumberType;
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = UNumberType;
|
||||
--error 1210
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = DateTimeType;
|
||||
--error 1210
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = TimestampType;
|
||||
--error 1210
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = DateType;
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = TimeType;
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = YearType;
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = VarcharType;
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = CharType;
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = VarbinaryType;
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = BinaryType;
|
||||
select st_astext(GeometryType) from matrix where ST_GeomFromText('POINT(1 1)') = ExtendType;
|
||||
--error 1210
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = TinyTextType;
|
||||
--error 1210
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = TextType;
|
||||
--error 1210
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = MediumTextType;
|
||||
--error 1210
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = LongTextType;
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = BitType;
|
||||
--error 1210
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = EnumType;
|
||||
--error 1210
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = SetType;
|
||||
--error 1235
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') = JsonType;
|
||||
select st_astext(GeometryType) from matrix where ST_GeomFromText('POINT(1 1)') = GeometryType;
|
||||
|
||||
--error 1210
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') > TinyIntType;
|
||||
--error 1210
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') < SmallIntType;
|
||||
--error 1210
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') > MediumIntType;
|
||||
--error 1210
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') < Int32Type;
|
||||
--error 1210
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') > IntType;
|
||||
--error 1210
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') < UTinyIntType;
|
||||
--error 1210
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') > USmallIntType;
|
||||
--error 1210
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') <= UMediumIntType;
|
||||
--error 1210
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') >= UInt32Type;
|
||||
--error 1210
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') <= UInt64Type;
|
||||
--error 1210
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') >= FloatType;
|
||||
--error 1210
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') <= DoubleType;
|
||||
--error 1210
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') >= UFloatType;
|
||||
--error 1210
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') <= UDoubleType;
|
||||
--error 1210
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') >= NumberType;
|
||||
--error 1210
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') <= UNumberType;
|
||||
--error 1210
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') > DateTimeType;
|
||||
--error 1210
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') < TimestampType;
|
||||
--error 1210
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') > DateType;
|
||||
--error 1210
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') < TimeType;
|
||||
--error 1210
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') >= YearType;
|
||||
--error 1210
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') < VarcharType;
|
||||
--error 1210
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') >= CharType;
|
||||
--error 1210
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') < VarbinaryType;
|
||||
--error 1210
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') >= BinaryType;
|
||||
--error 1210
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') <= ExtendType;
|
||||
--error 1210
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') > TinyTextType;
|
||||
--error 1210
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') <= TextType;
|
||||
--error 1210
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') > MediumTextType;
|
||||
--error 1210
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') <= LongTextType;
|
||||
--error 1210
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') > BitType;
|
||||
--error 1210
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') <= EnumType;
|
||||
--error 1210
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') > SetType;
|
||||
--error 1210
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') < JsonType;
|
||||
--error 1210
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') > GeometryType;
|
||||
|
||||
|
||||
##
|
||||
## Calculation test
|
||||
##
|
||||
--error 1210
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') | IntType;
|
||||
--error 1210
|
||||
select * from matrix where ST_GeomFromText('POINT(1 1)') | GeometryType;
|
||||
--error 1210
|
||||
select * from matrix where ~GeometryType;
|
||||
--error 1210
|
||||
select * from matrix where GeometryType^IntType;
|
||||
--error 1210
|
||||
select * from matrix where GeometryType&IntType;
|
||||
--error 1210
|
||||
select * from matrix where GeometryType>>1;
|
||||
--error 1210
|
||||
select * from matrix where GeometryType<<1;
|
||||
--error 1210
|
||||
select * from matrix where GeometryType like 'a';
|
||||
--error 1210
|
||||
select * from matrix where GeometryType between ST_GeomFromText('POINT(1 1)') and ST_GeomFromText('POINT(2 2)');
|
||||
--error 1210
|
||||
select MIN(GeometryType) from matrix;
|
||||
--error 1210
|
||||
select MAX(GeometryType) from matrix;
|
||||
--error 1210
|
||||
select LEAST(st_geomfromtext('POINT(0 0)'), st_geomfromtext('POINT(1 1)'));
|
||||
--error 1210
|
||||
select GREATEST(st_geomfromtext('POINT(0 0)'), st_geomfromtext('POINT(1 1)'));
|
||||
--error 5083
|
||||
select st_geomfromtext('POINT(0 0)') + st_geomfromtext('POINT(1 1)');
|
||||
--error 5083
|
||||
select st_geomfromtext('POINT(0 0)') - st_geomfromtext('POINT(1 1)');
|
||||
--error 5083
|
||||
select st_geomfromtext('POINT(0 0)') * st_geomfromtext('POINT(1 1)');
|
||||
--error 5083
|
||||
select st_geomfromtext('POINT(0 0)') / st_geomfromtext('POINT(1 1)');
|
||||
--error 5083
|
||||
select st_geomfromtext('POINT(0 0)') DIV st_geomfromtext('POINT(1 1)');
|
||||
--error 5083
|
||||
select st_geomfromtext('POINT(0 0)') % st_geomfromtext('POINT(1 1)');
|
||||
--error 1210
|
||||
SELECT EXP(st_geomfromtext('POINT(1 1)'));
|
||||
--error 1210
|
||||
SELECT lOG2(st_geomfromtext('POINT(1 1)'));
|
||||
--error 1210
|
||||
SELECT lOG10(st_geomfromtext('POINT(1 1)'));
|
||||
--error 1210
|
||||
SELECT LN(st_geomfromtext('POINT(1 1)'));
|
||||
--error 1210
|
||||
SELECT lOG(3, st_geomfromtext('POINT(1 1)'));
|
||||
--error 1210
|
||||
SELECT POW(3, st_geomfromtext('POINT(1 1)'));
|
||||
--error 1210
|
||||
SELECT POW(3, GeometryType) from matrix;
|
||||
--error 1210
|
||||
SELECT sqrt(st_geomfromtext('POINT(1 1)'));
|
||||
--error 1210
|
||||
SELECT acos(st_geomfromtext('POINT(1 1)'));
|
||||
--error 1210
|
||||
SELECT asin(st_geomfromtext('POINT(1 1)'));
|
||||
--error 1210
|
||||
SELECT atan(st_geomfromtext('POINT(1 1)'));
|
||||
--error 1210
|
||||
SELECT cos(st_geomfromtext('POINT(1 1)'));
|
||||
--error 1210
|
||||
SELECT sin(st_geomfromtext('POINT(1 1)'));
|
||||
--error 1210
|
||||
SELECT tan(st_geomfromtext('POINT(1 1)'));
|
||||
--error 1210
|
||||
SELECT cot(st_geomfromtext('POINT(1 1)'));
|
||||
--error 1210
|
||||
SELECT round(st_geomfromtext('POINT(1 1)'));
|
||||
--error 1210
|
||||
SELECT round(st_geomfromtext('POINT(1 1)'), 1);
|
||||
--error 1210
|
||||
SELECT round(st_geomfromtext('POINT(1 1)'), -1);
|
||||
--error 1210
|
||||
SELECT truncate(st_geomfromtext('POINT(1 1)'),1);
|
||||
--error 1210
|
||||
SELECT truncate(GeometryType ,1) from matrix;
|
||||
--error 1210
|
||||
SELECT ceiling(st_geomfromtext('POINT(1 1)'));
|
||||
--error 1210
|
||||
SELECT ceiling(GeometryType) from matrix;
|
||||
--error 1210
|
||||
SELECT abs(GeometryType) from matrix;
|
||||
--error 1210
|
||||
SELECT abs(st_geomfromtext('POINT(1 1)')) from matrix;
|
||||
--error 1210
|
||||
SELECT -GeometryType from matrix;
|
||||
--error 1210
|
||||
SELECT -st_geomfromtext('POINT(1 1)') from matrix;
|
||||
--error 1210
|
||||
SELECT rand(GeometryType) from matrix;
|
||||
--error 1210
|
||||
SELECT rand(st_geomfromtext('POINT(1 1)')) from matrix;
|
||||
--error 1210
|
||||
SELECT sign(GeometryType) from matrix;
|
||||
--error 1210
|
||||
SELECT sign(st_geomfromtext('POINT(1 1)')) from matrix;
|
||||
--error 1210
|
||||
SELECT degrees(GeometryType) from matrix;
|
||||
--error 1210
|
||||
SELECT degrees(st_geomfromtext('POINT(1 1)')) from matrix;
|
||||
--error 1210
|
||||
SELECT radians(GeometryType) from matrix;
|
||||
--error 1210
|
||||
SELECT radians(st_geomfromtext('POINT(1 1)')) from matrix;
|
||||
--error 1210
|
||||
SELECT format(GeometryType, 2) from matrix;
|
||||
--error 1210
|
||||
SELECT format(st_geomfromtext('POINT(1 1)'), 2) from matrix;
|
||||
--error 1210
|
||||
SELECT conv(st_geomfromtext('POINT(1 1)'), 1, 2) from dual;
|
||||
--error 1210
|
||||
SELECT conv(-1, st_geomfromtext('POINT(1 1)'), 2) from dual;
|
||||
--error 1210
|
||||
SELECT conv(-1, 1, st_geomfromtext('POINT(1 1)')) from dual;
|
||||
--error 1210
|
||||
SELECT conv(GeometryType, 1, 1) from matrix;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists FF01;
|
||||
--enable_warnings
|
||||
CREATE TABLE FF01(A INT, B GEOMETRY);
|
||||
INSERT INTO FF01 VALUES (1, NULL);
|
||||
INSERT INTO FF01 VALUES (1, ST_GeomFromText('POINT(0 0)'));
|
||||
SELECT A FROM FF01 WHERE B <=> NULL;
|
||||
--error 1210
|
||||
SELECT A FROM FF01 GROUP BY B HAVING AVG(B) IS NULL;
|
||||
--error 1210
|
||||
SELECT A FROM FF01 GROUP BY B HAVING SUM(B) IS NULL;
|
||||
--error 1210
|
||||
SELECT A FROM FF01 GROUP BY B HAVING STD(B) IS NULL;
|
||||
--error 1210
|
||||
SELECT A FROM FF01 GROUP BY B HAVING STDDEV_POP(B) IS NULL;
|
||||
--error 1210
|
||||
SELECT A FROM FF01 GROUP BY B HAVING VARIANCE(B) IS NULL;
|
||||
DROP TABLE FF01;
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,657 @@
|
||||
#owner: ht353245
|
||||
#owner group: shenzhen
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--echo # Base test of geometry ddl.
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--source mysql_test/test_suite/geometry/t/import_default_srs_data_mysql.inc
|
||||
|
||||
--echo # Create a table with three columns:
|
||||
--echo # 1) Normal POINT column without SRID specification
|
||||
--echo # 2) Normal POINT column with SRID 0
|
||||
--echo # 3) Normal POINT column with SRID 4326
|
||||
--disable_warnings
|
||||
drop table if exists t1,tt1;
|
||||
--enable_warnings
|
||||
CREATE TABLE t1 (no_srid POINT DEFAULT NULL,
|
||||
srid_0 POINT SRID 0 DEFAULT NULL,
|
||||
srid_4326 POINT SRID 4326 DEFAULT NULL);
|
||||
--source mysql_test/include/show_create_table_old_version_replica2.inc
|
||||
show create table t1;
|
||||
|
||||
--echo # Insert some data with correct SRID into these columns
|
||||
INSERT INTO t1 (no_srid, srid_0, srid_4326)
|
||||
VALUES (ST_GeomFromText('POINT(0 0)', 0),
|
||||
ST_GeomFromText('POINT(0 0)', 0),
|
||||
ST_GeomFromText('POINT(0 0)', 4326));
|
||||
|
||||
|
||||
INSERT INTO t1 (no_srid, srid_0, srid_4326)
|
||||
VALUES (ST_GeomFromText('POINT(1 1)', 4326),
|
||||
ST_GeomFromText('POINT(1 1)', 0),
|
||||
ST_GeomFromText('POINT(1 1)', 4326));
|
||||
|
||||
--echo # Insert data with wrong SRID, which should fail.
|
||||
--error 3643
|
||||
INSERT INTO t1 (srid_0) VALUES (ST_GeomFromText('POINT(1 1)', 4326));
|
||||
|
||||
--error 3643
|
||||
INSERT INTO t1 (srid_4326) VALUES (ST_GeomFromText('POINT(1 1)', 0));
|
||||
|
||||
--error 3643
|
||||
INSERT INTO t1 (srid_4326) VALUES (POINT(0, 0));
|
||||
|
||||
--echo # Try to alter the SRID of the columns, which should fail for all columns
|
||||
--echo # now since they already contain data.
|
||||
#目前不支持升级srid
|
||||
--error 1235
|
||||
ALTER TABLE t1 CHANGE COLUMN no_srid no_srid POINT SRID 0 DEFAULT NULL;
|
||||
|
||||
#目前不支持升级srid
|
||||
--error 1235
|
||||
ALTER TABLE t1 CHANGE COLUMN srid_0 srid_0 POINT SRID 4326 DEFAULT NULL;
|
||||
|
||||
#目前不支持升级srid
|
||||
--error 1235
|
||||
ALTER TABLE t1 CHANGE COLUMN srid_4326 srid_4326 POINT SRID 0 DEFAULT NULL;
|
||||
|
||||
--echo # Removing the SRID specification from a column should work just fine.
|
||||
#ALTER TABLE t1 CHANGE COLUMN srid_0 no_srid_2 POINT DEFAULT NULL;
|
||||
|
||||
--echo # Setting the SRID to a non-existing SRID should not work.
|
||||
--error 3548
|
||||
ALTER TABLE t1 CHANGE COLUMN srid_4326 srid_1 POINT SRID 1 DEFAULT NULL;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo # Creating a geometry column with a non-existing SRID should not work
|
||||
--error 3548
|
||||
CREATE TABLE t1 (col1 POINT SRID 1);
|
||||
|
||||
--echo # Try to create a table without the SRID property, insert data with
|
||||
--echo # different SRIDs and then add the SRID property (which should not work).
|
||||
CREATE TABLE t1 (col1 POINT);
|
||||
--source mysql_test/include/show_create_table_old_version_replica2.inc
|
||||
show create table t1;
|
||||
|
||||
INSERT INTO t1 VALUES (ST_GeomFromText('POINT(1 1)', 4326)),
|
||||
(ST_GeomFromText('POINT(2 2)', 0)),
|
||||
(ST_GeomFromText('POINT(3 3)', 4326)),
|
||||
(ST_GeomFromText('POINT(4 4)', 0)),
|
||||
(ST_GeomFromText('POINT(5 5)', 4326)),
|
||||
(ST_GeomFromText('POINT(6 6)', 0));
|
||||
|
||||
#目前不支持升级srid
|
||||
--error 1235
|
||||
ALTER TABLE t1 CHANGE COLUMN col1 col1 POINT SRID 4326;
|
||||
|
||||
#DELETE FROM t1 WHERE ST_SRID(col1) = 0;
|
||||
|
||||
#目前不支持升级srid
|
||||
--error 1235
|
||||
ALTER TABLE t1 CHANGE COLUMN col1 col1 POINT SRID 4326;
|
||||
DROP TABLE t1;
|
||||
|
||||
if (0) { #ST_SRID 未支持
|
||||
--echo # The SRID property on a generated column should work
|
||||
CREATE TABLE t1 (col1 POINT SRID 4326,
|
||||
col2 POINT AS (ST_SRID(col1, 0)) SRID 0);
|
||||
--source mysql_test/include/show_create_table_old_version_replica2.inc
|
||||
show create table t1;
|
||||
INSERT INTO t1 (col1) VALUES (ST_GeomFromText('POINT(1 1)', 4326));
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo # However, if the SRID property on the generated column doesn't match
|
||||
--echo # the SRID of the data, it should fail.
|
||||
CREATE TABLE t1 (col1 POINT SRID 4326,
|
||||
col2 POINT AS (ST_SRID(col1, 0)) SRID 2000);
|
||||
--source mysql_test/include/show_create_table_old_version_replica2.inc
|
||||
show create table t1;
|
||||
--error 3643
|
||||
INSERT INTO t1 (col1) VALUES (ST_GeomFromText('POINT(1 1)', 4326));
|
||||
DROP TABLE t1;
|
||||
}
|
||||
--echo # Creating a column with SRID property on a MyISAM table should only
|
||||
--echo # be supported if the SRID represents a cartesian coordinate system.
|
||||
--disable_warnings
|
||||
drop table if exists t1, t2;
|
||||
--enable_warnings
|
||||
CREATE TABLE t1 (col1 POINT SRID 0) ENGINE = MyISAM;
|
||||
--source mysql_test/include/show_create_table_old_version_replica2.inc
|
||||
show create table t1;
|
||||
CREATE TABLE t2 (col1 POINT SRID 2000) ENGINE = MyISAM;
|
||||
--source mysql_test/include/show_create_table_old_version_replica2.inc
|
||||
show create table t1;
|
||||
|
||||
#--error ER_CHECK_NOT_IMPLEMENTED
|
||||
#CREATE TABLE t3 (col1 POINT SRID 4326) ENGINE = MyISAM;
|
||||
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
--echo # It should not be possible to use the SRID property with any other types
|
||||
--echo # than geometric types.
|
||||
|
||||
--error 1221
|
||||
CREATE TABLE t1 (col1 DOUBLE SRID 0);
|
||||
|
||||
--error 1221
|
||||
CREATE TABLE t1 (col1 BLOB SRID 0);
|
||||
|
||||
--error 1221
|
||||
CREATE TABLE t1 (col1 VARCHAR(255) SRID 0);
|
||||
|
||||
|
||||
--echo # Check that any indexes on SRID-less columns are ignored by the
|
||||
--echo # optimizer
|
||||
CREATE TABLE t1 (col1 POINT NOT NULL, SPATIAL INDEX (col1));
|
||||
--source mysql_test/include/show_create_table_old_version_replica2.inc
|
||||
show create table t1;
|
||||
INSERT INTO t1 VALUES (POINT(0, 0)), (POINT(0.5, 0.5)), (POINT(1, 1));
|
||||
|
||||
--echo # The following query plan should NOT use the index on "col1", since
|
||||
--echo # the column does not have the SRID property defined.
|
||||
SELECT ST_ASTEXT(col1) FROM t1;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo # Check that we print error message for misuse of SRID with non-geometric
|
||||
--echo # data type instead of "SRID not found"
|
||||
--error 1221
|
||||
CREATE TABLE t1 (a INTEGER SRID 1);
|
||||
|
||||
CREATE TABLE t1 (a INTEGER);
|
||||
--error 1221
|
||||
ALTER TABLE t1 MODIFY COLUMN a INTEGER SRID 1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # Bug#26594499 WL#8592:ALTER TABLE ADD SPATIAL INDEX RETURNS CANNOT GET
|
||||
--echo # GEOMETRY OBJECT ERROR
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (
|
||||
g1 geometry NOT NULL,
|
||||
g3 geometry SRID 2000 NOT NULL,
|
||||
g4 geometry SRID 4326 NOT NULL
|
||||
);
|
||||
--source mysql_test/include/show_create_table_old_version_replica2.inc
|
||||
show create table t1;
|
||||
|
||||
INSERT INTO t1 VALUES (ST_GeomFromText('POINT(0 0)'),
|
||||
ST_GeomFromText('POINT(0 0)', 2000), ST_GeomFromText('POINT(0 0)', 4326));
|
||||
|
||||
ALTER TABLE t1 add spatial index idx1(g4);
|
||||
ALTER TABLE t1 add spatial index idx3(g3);
|
||||
DROP TABLE t1;
|
||||
|
||||
--error 1690
|
||||
CREATE TABLE t1 (col1 POINT SRID 4294967296);
|
||||
|
||||
--echo #
|
||||
--echo # Check that adding, modifying and removing spatial indexes works well
|
||||
--echo # with SRID columns
|
||||
--echo #
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
CREATE TABLE t1 (col_no_srid POINT NOT NULL,
|
||||
col_srid_0 POINT SRID 0 NOT NULL,
|
||||
col_srid_4326 POINT SRID 4326 NOT NULL);
|
||||
--source mysql_test/include/show_create_table_old_version_replica2.inc
|
||||
show create table t1;
|
||||
|
||||
INSERT INTO t1 VALUES (
|
||||
ST_GeomFromText("POINT(0 0)", 0),
|
||||
ST_GeomFromText("POINT(0 0)", 0),
|
||||
ST_GeomFromText("POINT(0 0)", 4326));
|
||||
|
||||
|
||||
INSERT INTO t1 VALUES (
|
||||
ST_GeomFromText("POINT(1 1)", 4326),
|
||||
ST_GeomFromText("POINT(1 1)", 0),
|
||||
ST_GeomFromText("POINT(1 1)", 4326));
|
||||
|
||||
|
||||
ALTER TABLE t1 ADD SPATIAL INDEX idx1 (col_no_srid);
|
||||
ALTER TABLE t1 ADD SPATIAL INDEX idx2 (col_srid_0);
|
||||
ALTER TABLE t1 ADD SPATIAL INDEX idx3 (col_srid_4326);
|
||||
|
||||
ALTER TABLE t1 DROP INDEX idx2;
|
||||
ALTER TABLE t1 DROP INDEX idx3;
|
||||
ALTER TABLE t1 DROP INDEX idx1;
|
||||
|
||||
CREATE SPATIAL INDEX idx1 ON t1 (col_srid_4326);
|
||||
CREATE SPATIAL INDEX idx2 ON t1 (col_no_srid);
|
||||
CREATE SPATIAL INDEX idx3 ON t1 (col_srid_0);
|
||||
|
||||
DROP INDEX idx1 ON t1;
|
||||
DROP INDEX idx2 ON t1;
|
||||
DROP INDEX idx3 ON t1;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (col_no_srid POINT NOT NULL,
|
||||
col_srid_0 POINT SRID 0 NOT NULL,
|
||||
col_srid_4326 POINT SRID 4326 NOT NULL,
|
||||
SPATIAL INDEX idx1 (col_no_srid),
|
||||
SPATIAL INDEX idx2 (col_srid_0),
|
||||
SPATIAL INDEX idx3 (col_srid_4326));
|
||||
--source mysql_test/include/show_create_table_old_version_replica2.inc
|
||||
show create table t1;
|
||||
|
||||
INSERT INTO t1 VALUES (
|
||||
ST_GeomFromText("POINT(0 0)", 0),
|
||||
ST_GeomFromText("POINT(0 0)", 0),
|
||||
ST_GeomFromText("POINT(0 0)", 4326));
|
||||
|
||||
|
||||
INSERT INTO t1 VALUES (
|
||||
ST_GeomFromText("POINT(1 1)", 4326),
|
||||
ST_GeomFromText("POINT(1 1)", 0),
|
||||
ST_GeomFromText("POINT(1 1)", 4326));
|
||||
|
||||
DROP INDEX idx3 ON t1;
|
||||
DROP INDEX idx2 ON t1;
|
||||
DROP INDEX idx1 ON t1;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # Altering the SRID specification should not be allowed if there is a
|
||||
--echo # spatial index on the column.
|
||||
--echo #
|
||||
CREATE TABLE t1 (col1 POINT NOT NULL SRID 4326,
|
||||
SPATIAL INDEX idx1 (col1));
|
||||
--source mysql_test/include/show_create_table_old_version_replica2.inc
|
||||
show create table t1;
|
||||
|
||||
# OB不支持升级srid
|
||||
--error 1235
|
||||
ALTER TABLE t1 CHANGE COLUMN col1 col1 POINT NOT NULL SRID 0;
|
||||
# OB不支持升级srid
|
||||
--error 1235
|
||||
ALTER TABLE t1 CHANGE COLUMN col1 col1 POINT NOT NULL;
|
||||
# OB不支持升级srid
|
||||
--error 1235
|
||||
ALTER TABLE t1 CHANGE COLUMN col1 col1 POINT NOT NULL SRID 0;
|
||||
# OB不支持升级srid
|
||||
--error 1235
|
||||
ALTER TABLE t1 CHANGE COLUMN col1 col1 POINT NOT NULL;
|
||||
# OB不支持升级srid
|
||||
--error 1235
|
||||
ALTER TABLE t1 CHANGE COLUMN col1 col1 POINT NOT NULL SRID 0;
|
||||
# OB不支持升级srid
|
||||
--error 1235
|
||||
ALTER TABLE t1 CHANGE COLUMN col1 col1 POINT NOT NULL;
|
||||
# OB不支持升级srid
|
||||
--error 1235
|
||||
ALTER TABLE t1 CHANGE COLUMN col1 col1 POINT NOT NULL SRID 0;
|
||||
# OB不支持升级srid
|
||||
--error 1235
|
||||
ALTER TABLE t1 CHANGE COLUMN col1 col1 POINT NOT NULL;
|
||||
# OB不支持升级srid
|
||||
--error 1235
|
||||
ALTER TABLE t1 CHANGE COLUMN col1 col2 POINT NOT NULL SRID 0;
|
||||
# OB不支持升级srid
|
||||
--error 1235
|
||||
ALTER TABLE t1 CHANGE COLUMN col1 col2 POINT NOT NULL;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
if (0) { # 不支持升级srid
|
||||
--echo # Test SRID specification in combination with generated columns and
|
||||
--echo # spatial indexes.
|
||||
CREATE TABLE t1 (
|
||||
col_no_srid POINT NOT NULL,
|
||||
col_srid_0 POINT NOT NULL SRID 0,
|
||||
col_srid_4326 POINT NOT NULL SRID 4326);
|
||||
--source mysql_test/include/show_create_table_old_version_replica2.inc
|
||||
show create table t1;
|
||||
|
||||
INSERT INTO t1 (col_no_srid, col_srid_0, col_srid_4326) VALUES (
|
||||
ST_GeomFromText('POINT(0 0)'),
|
||||
ST_GeomFromText('POINT(0 0)', 0),
|
||||
ST_GeomFromText('POINT(0 0)', 4326));
|
||||
|
||||
|
||||
INSERT INTO t1 (col_no_srid, col_srid_0, col_srid_4326) VALUES (
|
||||
ST_GeomFromText('POINT(0 0)', 4326),
|
||||
ST_GeomFromText('POINT(0 0)', 0),
|
||||
ST_GeomFromText('POINT(0 0)', 4326));
|
||||
|
||||
--echo # This should not be allowed since the column contains data with a
|
||||
--echo # different SRID
|
||||
#目前不支持升级srid
|
||||
#ALTER TABLE t1 CHANGE COLUMN col_srid_4326 col_srid_2000 POINT NOT NULL SRID 2000;
|
||||
|
||||
DELETE FROM t1;
|
||||
--echo # Now it should be allowed since there is no data in the table,
|
||||
#目前不支持升级srid
|
||||
#ALTER TABLE t1 CHANGE COLUMN col_srid_4326 col_srid_2000 POINT NOT NULL SRID 2000;
|
||||
|
||||
|
||||
INSERT INTO t1 (col_no_srid, col_srid_0, col_srid_2000) VALUES (
|
||||
ST_GeomFromText('POINT(0 0)'),
|
||||
ST_GeomFromText('POINT(0 0)', 0),
|
||||
ST_GeomFromText('POINT(0 0)', 2000));
|
||||
|
||||
|
||||
INSERT INTO t1 (col_no_srid, col_srid_0, col_srid_2000) VALUES (
|
||||
ST_GeomFromText('POINT(0 0)', 4326),
|
||||
ST_GeomFromText('POINT(0 0)', 0),
|
||||
ST_GeomFromText('POINT(0 0)', 2000));
|
||||
|
||||
--echo # Add an index on "col_srid_2000"
|
||||
CREATE SPATIAL INDEX idx_2000 ON t1 (col_srid_2000);
|
||||
|
||||
|
||||
INSERT INTO t1 (col_no_srid, col_srid_0, col_srid_2000) VALUES (
|
||||
ST_GeomFromText('POINT(0 0)', 4326),
|
||||
ST_GeomFromText('POINT(0 0)', 0),
|
||||
ST_GeomFromText('POINT(0 0)', 2000));
|
||||
|
||||
|
||||
INSERT INTO t1 (col_no_srid, col_srid_0, col_srid_2000) VALUES (
|
||||
ST_GeomFromText('POINT(1 1)', 4326),
|
||||
ST_GeomFromText('POINT(1 1)', 0),
|
||||
ST_GeomFromText('POINT(1 1)', 2000));
|
||||
|
||||
--echo # This should give an error since there is an index on the column.
|
||||
--error 1235
|
||||
ALTER TABLE t1 CHANGE COLUMN col_srid_2000 col_srid_2000 POINT NOT NULL SRID 4326;
|
||||
|
||||
--echo # Remove the index from col_srid_2000
|
||||
DROP INDEX idx_2000 ON t1;
|
||||
|
||||
--echo # This should not be allowed since the column contains data with a
|
||||
--echo # different SRID
|
||||
#目前不支持升级srid
|
||||
#ALTER TABLE t1 CHANGE COLUMN col_srid_2000 col_srid_2000 POINT NOT NULL SRID 4326;
|
||||
|
||||
DELETE FROM t1;
|
||||
|
||||
--echo # Now it should be allowed since there is no data in the table,
|
||||
ALTER TABLE t1 CHANGE COLUMN col_srid_2000 col_srid_2000 POINT NOT NULL SRID 4326;
|
||||
|
||||
--echo # Wrong SRID for col_srid_2000, so should not work
|
||||
--error 3643
|
||||
INSERT INTO t1 (col_no_srid, col_srid_0, col_srid_2000) VALUES (
|
||||
ST_GeomFromText('POINT(1 1)'),
|
||||
ST_GeomFromText('POINT(1 1)', 0),
|
||||
ST_GeomFromText('POINT(1 1)', 2000));
|
||||
|
||||
INSERT INTO t1 (col_no_srid, col_srid_0, col_srid_2000) VALUES (
|
||||
ST_GeomFromText('POINT(1 1)'),
|
||||
ST_GeomFromText('POINT(1 1)', 0),
|
||||
ST_GeomFromText('POINT(1 1)', 4326));
|
||||
|
||||
#目前不支持升级srid
|
||||
#ALTER TABLE t1 CHANGE COLUMN col_srid_2000 col_srid_2000 POINT NOT NULL;
|
||||
|
||||
--echo # This should work just fine, since we have removed the SRID specification
|
||||
--echo # for col_srid_2000
|
||||
|
||||
INSERT INTO t1 (col_no_srid, col_srid_0, col_srid_2000) VALUES (
|
||||
ST_GeomFromText('POINT(1 1)'),
|
||||
ST_GeomFromText('POINT(1 1)', 0),
|
||||
ST_GeomFromText('POINT(1 1)', 2000));
|
||||
|
||||
SELECT * FROM t1;
|
||||
|
||||
CREATE SPATIAL INDEX idx_0 ON t1 (col_srid_0);
|
||||
|
||||
DROP TABLE t1;
|
||||
}
|
||||
--echo #
|
||||
--echo # Bug#26594499 WL#8592: CANNOT GET GEOMETRY OBJECT ERROR
|
||||
--echo #
|
||||
CREATE TABLE t1 (
|
||||
g1 geometry NOT NULL,
|
||||
g3 geometry SRID 2000 NOT NULL,
|
||||
g4 geometry SRID 4326 NOT NULL
|
||||
);
|
||||
--source mysql_test/include/show_create_table_old_version_replica2.inc
|
||||
show create table t1;
|
||||
|
||||
INSERT INTO t1 VALUES (ST_GeomFromText('POINT(0 0)'),
|
||||
ST_GeomFromText('POINT(0 0)', 2000), ST_GeomFromText('POINT(0 0)', 4326));
|
||||
|
||||
ALTER TABLE t1 add spatial index idx1(g4);
|
||||
ALTER TABLE t1 add spatial index idx3(g3);
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Bug#27015964 USELESS SPATIAL INDEX CAN BE CREATED WITHOUT WARNING
|
||||
--echo #
|
||||
--echo # Creating a table with a spatial index on a SRID-less column should
|
||||
--echo # raise a warning.
|
||||
CREATE TABLE t1 (
|
||||
g1 POINT NOT NULL
|
||||
, g2 POINT NOT NULL
|
||||
, g3 POINT NOT NULL SRID 0
|
||||
, SPATIAL INDEX idx1 (g1)
|
||||
, SPATIAL INDEX idx2 (g2)
|
||||
, SPATIAL INDEX idx3 (g3));
|
||||
--source mysql_test/include/show_create_table_old_version_replica2.inc
|
||||
show create table t1;
|
||||
|
||||
DROP INDEX idx1 ON t1;
|
||||
DROP INDEX idx2 ON t1;
|
||||
DROP INDEX idx3 ON t1;
|
||||
|
||||
--echo # Verify that we get the same warning when using CREATE INDEX syntax.
|
||||
CREATE SPATIAL INDEX idx1 ON t1 (g1);
|
||||
CREATE SPATIAL INDEX idx2 ON t1 (g2);
|
||||
CREATE SPATIAL INDEX idx3 ON t1 (g3);
|
||||
|
||||
DROP INDEX idx1 ON t1;
|
||||
DROP INDEX idx2 ON t1;
|
||||
DROP INDEX idx3 ON t1;
|
||||
|
||||
--echo # Verify that we get the same warning when using ALTER TABLE syntax.
|
||||
ALTER TABLE t1 ADD SPATIAL INDEX idx1 (g1);
|
||||
ALTER TABLE t1 ADD SPATIAL INDEX idx2 (g2);
|
||||
ALTER TABLE t1 ADD SPATIAL INDEX idx3 (g3);
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # Bug#27220467 SERVER HANGS WHILE CREATING A NEW SRS WHICH IS USED IN
|
||||
--echo # ANOTHER CLIENT
|
||||
--echo #
|
||||
--echo # Try to create a point column using a SRID that doesn't exist
|
||||
--error 3548
|
||||
CREATE TABLE t1 (col1 POINT SRID 4326, col2 POINT SRID 1000000000);
|
||||
|
||||
--echo # Force the error to happen after all the columns are contextualized.
|
||||
|
||||
--echo # Verify the same behavior for ALTER TABLE as well.
|
||||
CREATE TABLE t1 (col1 INT);
|
||||
|
||||
--error 3548
|
||||
ALTER TABLE t1 ADD COLUMN col2 POINT SRID 1000000000;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
# bugfix:
|
||||
CREATE TABLE t1 (col_no_srid POINT NOT NULL,
|
||||
col_srid_0 POINT SRID 0 NOT NULL,
|
||||
col_srid_4326 POINT SRID 4326 NOT NULL,
|
||||
SPATIAL INDEX idx1 (col_no_srid),
|
||||
SPATIAL INDEX idx2 (col_srid_0),
|
||||
SPATIAL INDEX idx3 (col_srid_4326));
|
||||
--source mysql_test/include/show_create_table_old_version_replica2.inc
|
||||
show create table t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
# bugfix:
|
||||
--error 1064
|
||||
create table tt1(p POINT SRID -1);
|
||||
--error 1064
|
||||
create table tt1(p POINT SRID 'test');
|
||||
--error 1064
|
||||
create table tt1(p POINT SRID 0.7);
|
||||
--error 1064
|
||||
create table tt1(p POINT SRID null);
|
||||
--error 1064
|
||||
create table tt1(p POINT SRID '');
|
||||
create table tt1(p POINT SRID 4294967295);
|
||||
DROP TABLE tt1;
|
||||
|
||||
# bugfix:
|
||||
--error 3728
|
||||
create table tt1(g GEOMETRY primary key);
|
||||
--error 3728
|
||||
create table tt1(g geometry, primary key (g));
|
||||
--error 3728
|
||||
create table tt2(p point unique key);
|
||||
--error 3728
|
||||
create table tt2(p point, unique key (p));
|
||||
create table child(i int primary key, g geometry not null srid 4326);
|
||||
--error 1215
|
||||
create table parent(i int primary key, g geometry not null srid 4326, constraint g1_fk foreign key(g) references child(g));
|
||||
drop table child;
|
||||
|
||||
# bugfix:
|
||||
--disable_warnings
|
||||
drop table if exists T_GEO;
|
||||
drop view if exists V_T_GEO;
|
||||
--enable_warnings
|
||||
create table T_GEO (gid int auto_increment primary key, geometry geometry not null srid 4326);
|
||||
create view V_T_GEO AS SELECT * FROM T_GEO;
|
||||
desc V_T_GEO;
|
||||
drop view V_T_GEO;
|
||||
drop table T_GEO;
|
||||
create table T_GEO (gid int auto_increment primary key, geo geometry ,geo_c GEOMETRYCOLLECTION,poi point,lin linestring ,pol polygon,M_POI MULTIPOINT,M_LIN MULTILINESTRING ,M_POL MULTIPOLYGON );
|
||||
create view V_T_GEO AS SELECT * FROM T_GEO;
|
||||
--error 1416
|
||||
insert into V_T_GEO(POI) VALUES (ST_GEOMFROMTEXT('POLYGON((0 0,1 1,1 0,0 1,0 0)) '));
|
||||
SELECT ST_ASTEXT(poi) FROM V_T_GEO;
|
||||
SELECT ST_ASTEXT(poi) FROM T_GEO;
|
||||
drop view V_T_GEO;
|
||||
DROP TABLE T_GEO;
|
||||
|
||||
# bugfix:
|
||||
# 这个问题单没法兼容在空表的情况下add一个not null的空间列。
|
||||
create table tt4(id int, g GEOMETRY);
|
||||
--error 1138
|
||||
alter table tt4 add g1 GEOMETRY not null;
|
||||
--source mysql_test/include/show_create_table_old_version_replica2.inc
|
||||
show create table tt4;
|
||||
alter table tt4 add g2 GEOMETRY null;
|
||||
--source mysql_test/include/show_create_table_old_version_replica2.inc
|
||||
show create table tt4;
|
||||
insert into tt4(id, g2) values (1, point(1,1));
|
||||
select id,st_astext(g2) from tt4 order by id;
|
||||
drop table tt4;
|
||||
|
||||
# bugfix:
|
||||
--disable_warnings
|
||||
drop table if exists test;
|
||||
--enable_warnings
|
||||
create table test(p point srid 4326);
|
||||
--error 1235
|
||||
alter table test modify p MULTIPOINT;
|
||||
--error 1235
|
||||
alter table test change p p1 MULTIPOINT;
|
||||
--error 1235
|
||||
alter table test modify p POINT SRID 0;
|
||||
--error 1235
|
||||
alter table test change p p1 point srid 0;
|
||||
--error 1235
|
||||
alter table test change p p1 point;
|
||||
alter table test change p p1 point srid 4326;
|
||||
desc test;
|
||||
drop table test;
|
||||
|
||||
# bugfix:
|
||||
create table tt1(id int);
|
||||
insert into tt1 values(1);
|
||||
--error 1138
|
||||
alter table tt1 add g GEOMETRY not null;
|
||||
drop table tt1;
|
||||
create table tt1(id int);
|
||||
--error 1138 #这里不兼容mysql
|
||||
alter table tt1 add g GEOMETRY not null;
|
||||
drop table tt1;
|
||||
create table tt1(id int);
|
||||
alter table tt1 add g GEOMETRY;
|
||||
drop table tt1;
|
||||
create table tt1(id int);
|
||||
insert into tt1 values(1);
|
||||
alter table tt1 add g GEOMETRY;
|
||||
drop table tt1;
|
||||
## 如果需要添加一个not null的geometry列,只能在建表的时候添加
|
||||
create table tt1(id int);
|
||||
# 1. 先添加一个nullable的geometry列
|
||||
alter table tt1 add g GEOMETRY;
|
||||
# 2. 往g列插入一行
|
||||
insert into tt1 values (1, point(0,0));
|
||||
# 3. modify为not null
|
||||
alter table tt1 modify column g geometry not null;
|
||||
drop table tt1;
|
||||
create table tt1(g geometry);
|
||||
alter table tt1 modify column g geometry not null;
|
||||
drop table tt1;
|
||||
create table tt1(g geometry);
|
||||
insert into tt1(g) value (null);
|
||||
--error 1138
|
||||
alter table tt1 modify column g geometry not null;
|
||||
drop table tt1;
|
||||
|
||||
# bugfix:
|
||||
--disable_warnings
|
||||
drop table if exists T_GEO;
|
||||
drop table if exists t;
|
||||
drop view if exists V_T_GEO;
|
||||
--enable_warnings
|
||||
create table T_GEO (poi point);
|
||||
insert into T_GEO values (ST_GEOMFROMTEXT('POINT(0 0)', 4267));
|
||||
create view V_T_GEO AS SELECT * FROM T_GEO;
|
||||
--error 1416
|
||||
REPLACE INTO V_T_GEO(poi) VALUES (ST_GEOMFROMTEXT('POLYGON((0 0,1 1,1 0,0 1,0 0))'));
|
||||
|
||||
# test accuracy
|
||||
insert into T_GEO values (ST_GEOMFROMTEXT('point(0 0)'));
|
||||
create table t as select st_buffer(T_GEO.poi, 1) from T_GEO;
|
||||
drop table t;
|
||||
--disable_warnings
|
||||
drop table if exists T_GEO;
|
||||
drop table if exists t;
|
||||
--enable_warnings
|
||||
create table T_GEO (poly polygon);
|
||||
insert into T_GEO values (ST_GEOMFROMTEXT('polygon((0 0, 0 1, 1 1,0 0))', 4267));
|
||||
create table t as select st_area(T_GEO.poly) from T_GEO;
|
||||
select * from t;
|
||||
drop table T_GEO;
|
||||
drop table t;
|
||||
drop view if exists V_T_GEO;
|
||||
|
||||
# bugfix:
|
||||
create or replace view vv as select st_aswkb(x'00000000010100000000000000000034C00000000000004940') a;
|
||||
desc vv;
|
||||
|
||||
# bugfix:
|
||||
create or replace view vv as select st_geomfromwkb(x'0106000000010000000103000000010000000500000000000000008056400000000000C0564000000000000024400000000000A066C0000000000000244000000000000024400000000000000000000000000000244000000000008056400000000000C05640');
|
||||
desc vv;
|
||||
create or replace view vv as select Point(0,0);
|
||||
desc vv;
|
||||
|
||||
# bugfix :
|
||||
--disable_warnings
|
||||
drop table if exists geometries;
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
CREATE TABLE geometries ( g GEOMETRY, pt POINT, ls LINESTRING, py POLYGON, mpt MULTIPOINT, mls MULTILINESTRING, mpy MULTIPOLYGON, gc GEOMETRYCOLLECTION);
|
||||
SET @c1 = ST_GEOMFROMTEXT('POINT(10 10)');
|
||||
SET @c2 = ST_GEOMFROMTEXT('LINESTRING(10 10,20 20,30 30)');
|
||||
SET @c3 = ST_GEOMFROMTEXT('POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4))');
|
||||
SET @c4 = ST_GEOMFROMTEXT('MULTIPOINT(0 0,5 5,10 10,20 20)');
|
||||
SET @c5 = ST_GEOMFROMTEXT('MULTILINESTRING((1 1,2 2,3 3),(10 10,20 20,30 30))');
|
||||
SET @c6 = ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0)),((5 5,5 10,10 10,10 5,5 5)))');
|
||||
SET @c7 = ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))');
|
||||
INSERT INTO geometries VALUES (@c1, @c1, @c2, @c3, @c4, @c5, @c6, @c7);
|
||||
CREATE TABLE t1 SELECT a FROM (SELECT pt AS a FROM geometries UNION SELECT mls FROM geometries) t;
|
||||
select st_astext(a) from t1;
|
||||
drop table geometries;
|
||||
drop table t1;
|
||||
@ -0,0 +1,427 @@
|
||||
#owner: ht353245
|
||||
#owner group: shenzhen
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--echo # Base test of GEOMETRY dml.
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--source mysql_test/test_suite/geometry/t/import_default_srs_data_mysql.inc
|
||||
alter system set _enable_defensive_check = 1;
|
||||
### 1. Test for spatial index base DML constraint.
|
||||
if (1) {
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS spatial_index_dml_constraint, tt1;
|
||||
--enable_warnings
|
||||
|
||||
## 1.1 Insert row
|
||||
## 1.1.1 GEOMETRY can allow all other type
|
||||
CREATE TABLE spatial_index_dml_constraint (i INT, g GEOMETRY NOT NULL SRID 4326, PRIMARY KEY (i));
|
||||
SET @v1=ST_GEOMFROMTEXT('POINT(0 0)', 4326);
|
||||
SET @v2=ST_GEOMFROMTEXT('LINESTRING(0 0,10 10)', 4326);
|
||||
SET @v3=ST_GEOMFROMTEXT('POLYGON((0 0, 0 8, 8 8, 8 10, -10 10, -10 0, 0 0))', 4326);
|
||||
SET @v4=ST_GEOMFROMTEXT('MULTIPOINT(1 1, 11 11, 11 21, 21 21)', 4326);
|
||||
SET @v5=ST_GEOMFROMTEXT('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))', 4326);
|
||||
SET @v6=ST_GEOMFROMTEXT('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))', 4326);
|
||||
SET @v7=ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(9 9),LINESTRING(1 5,0 0),POLYGON((2 2,2 8,8 8,8 2,2 2)))', 4326);
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (1, @v1);
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (2, @v2);
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (3, @v3);
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (4, @v4);
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (5, @v5);
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (6, @v6);
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (7, @v7);
|
||||
DROP TABLE spatial_index_dml_constraint;
|
||||
## 1.1.2 POINT can only allow POINT
|
||||
CREATE TABLE spatial_index_dml_constraint (i INT, g POINT NOT NULL SRID 4326, PRIMARY KEY (i));
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (1, @v1);
|
||||
--error 1416
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (2, @v2);
|
||||
--error 1416
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (3, @v3);
|
||||
--error 1416
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (4, @v4);
|
||||
--error 1416
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (5, @v5);
|
||||
--error 1416
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (6, @v6);
|
||||
--error 1416
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (7, @v7);
|
||||
DROP TABLE spatial_index_dml_constraint;
|
||||
## 1.1.3 LINESTRING can only allow LINESTRING
|
||||
CREATE TABLE spatial_index_dml_constraint (i INT, g LINESTRING NOT NULL SRID 4326, PRIMARY KEY (i));
|
||||
--error 1416
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (1, @v1);
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (2, @v2);
|
||||
--error 1416
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (3, @v3);
|
||||
--error 1416
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (4, @v4);
|
||||
--error 1416
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (5, @v5);
|
||||
--error 1416
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (6, @v6);
|
||||
--error 1416
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (7, @v7);
|
||||
DROP TABLE spatial_index_dml_constraint;
|
||||
## 1.1.4 POLYGON can only allow POLYGON
|
||||
CREATE TABLE spatial_index_dml_constraint (i INT, g POLYGON NOT NULL SRID 4326, PRIMARY KEY (i));
|
||||
--error 1416
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (1, @v1);
|
||||
--error 1416
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (2, @v2);
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (3, @v3);
|
||||
--error 1416
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (4, @v4);
|
||||
--error 1416
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (5, @v5);
|
||||
--error 1416
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (6, @v6);
|
||||
--error 1416
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (7, @v7);
|
||||
DROP TABLE spatial_index_dml_constraint;
|
||||
## 1.1.5 MULTIPOINT can only allow MULTIPOINT
|
||||
CREATE TABLE spatial_index_dml_constraint (i INT, g MULTIPOINT NOT NULL SRID 4326, PRIMARY KEY (i));
|
||||
--error 1416
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (1, @v1);
|
||||
--error 1416
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (2, @v2);
|
||||
--error 1416
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (3, @v3);
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (4, @v4);
|
||||
--error 1416
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (5, @v5);
|
||||
--error 1416
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (6, @v6);
|
||||
--error 1416
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (7, @v7);
|
||||
DROP TABLE spatial_index_dml_constraint;
|
||||
## 1.1.6 MULTILINESTRING can only allow MULTILINESTRING
|
||||
CREATE TABLE spatial_index_dml_constraint (i INT, g MULTILINESTRING NOT NULL SRID 4326, PRIMARY KEY (i));
|
||||
--error 1416
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (1, @v1);
|
||||
--error 1416
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (2, @v2);
|
||||
--error 1416
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (3, @v3);
|
||||
--error 1416
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (4, @v4);
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (5, @v5);
|
||||
--error 1416
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (6, @v6);
|
||||
--error 1416
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (7, @v7);
|
||||
DROP TABLE spatial_index_dml_constraint;
|
||||
## 1.1.7 MULTIPOLYGON can only allow MULTIPOLYGON
|
||||
CREATE TABLE spatial_index_dml_constraint (i INT, g MULTIPOLYGON NOT NULL SRID 4326, PRIMARY KEY (i));
|
||||
--error 1416
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (1, @v1);
|
||||
--error 1416
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (2, @v2);
|
||||
--error 1416
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (3, @v3);
|
||||
--error 1416
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (4, @v4);
|
||||
--error 1416
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (5, @v5);
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (6, @v6);
|
||||
--error 1416
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (7, @v7);
|
||||
DROP TABLE spatial_index_dml_constraint;
|
||||
## 1.1.7 GEOMETRYCOLLECTION can allow MULTIPOINT,MULTILINESTRING,MULTIPOLYGON,GEOMETRYCOLLECTION
|
||||
CREATE TABLE spatial_index_dml_constraint (i INT, g GEOMETRYCOLLECTION NOT NULL SRID 4326, PRIMARY KEY (i));
|
||||
--error 1416
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (1, @v1);
|
||||
--error 1416
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (2, @v2);
|
||||
--error 1416
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (3, @v3);
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (4, @v4);
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (5, @v5);
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (6, @v6);
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (7, @v7);
|
||||
DROP TABLE spatial_index_dml_constraint;
|
||||
|
||||
## 1.2 Update row
|
||||
## 1.2.1 GEOMETRY can allow all other type
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS spatial_index_dml_constraint;
|
||||
--enable_warnings
|
||||
CREATE TABLE spatial_index_dml_constraint (i int, g GEOMETRY NOT NULL SRID 4326, PRIMARY KEY (i));
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (1, @v1);
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (2, @v2);
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (3, @v3);
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (4, @v4);
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (5, @v5);
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (6, @v6);
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (7, @v7);
|
||||
UPDATE spatial_index_dml_constraint SET g=@v1 WHERE i = 1;
|
||||
UPDATE spatial_index_dml_constraint SET g=@v2 WHERE i = 1;
|
||||
UPDATE spatial_index_dml_constraint SET g=@v3 WHERE i = 1;
|
||||
UPDATE spatial_index_dml_constraint SET g=@v4 WHERE i = 1;
|
||||
UPDATE spatial_index_dml_constraint SET g=@v5 WHERE i = 1;
|
||||
UPDATE spatial_index_dml_constraint SET g=@v6 WHERE i = 1;
|
||||
UPDATE spatial_index_dml_constraint SET g=@v7 WHERE i = 1;
|
||||
DROP TABLE spatial_index_dml_constraint;
|
||||
## 1.2.2 POINT can only allow POINT
|
||||
CREATE TABLE spatial_index_dml_constraint (i int, g POINT NOT NULL SRID 4326, PRIMARY KEY (i));
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (1, @v1);
|
||||
UPDATE spatial_index_dml_constraint SET g=@v1 WHERE i = 1;
|
||||
--error 1416
|
||||
UPDATE spatial_index_dml_constraint SET g=@v2 WHERE i = 1;
|
||||
--error 1416
|
||||
UPDATE spatial_index_dml_constraint SET g=@v3 WHERE i = 1;
|
||||
--error 1416
|
||||
UPDATE spatial_index_dml_constraint SET g=@v4 WHERE i = 1;
|
||||
--error 1416
|
||||
UPDATE spatial_index_dml_constraint SET g=@v5 WHERE i = 1;
|
||||
--error 1416
|
||||
UPDATE spatial_index_dml_constraint SET g=@v6 WHERE i = 1;
|
||||
--error 1416
|
||||
UPDATE spatial_index_dml_constraint SET g=@v7 WHERE i = 1;
|
||||
DROP TABLE spatial_index_dml_constraint;
|
||||
## 1.2.3 LINESTRING can only allow LINESTRING
|
||||
CREATE TABLE spatial_index_dml_constraint (i int, g LINESTRING NOT NULL SRID 4326, PRIMARY KEY (i));
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (1, @v2);
|
||||
--error 1416
|
||||
UPDATE spatial_index_dml_constraint SET g=@v1 WHERE i = 1;
|
||||
UPDATE spatial_index_dml_constraint SET g=@v2 WHERE i = 1;
|
||||
--error 1416
|
||||
UPDATE spatial_index_dml_constraint SET g=@v3 WHERE i = 1;
|
||||
--error 1416
|
||||
UPDATE spatial_index_dml_constraint SET g=@v4 WHERE i = 1;
|
||||
--error 1416
|
||||
UPDATE spatial_index_dml_constraint SET g=@v5 WHERE i = 1;
|
||||
--error 1416
|
||||
UPDATE spatial_index_dml_constraint SET g=@v6 WHERE i = 1;
|
||||
--error 1416
|
||||
UPDATE spatial_index_dml_constraint SET g=@v7 WHERE i = 1;
|
||||
DROP TABLE spatial_index_dml_constraint;
|
||||
## 1.2.4 POLYGON can only allow POLYGON
|
||||
CREATE TABLE spatial_index_dml_constraint (i int, g POLYGON NOT NULL SRID 4326, PRIMARY KEY (i));
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (1, @v3);
|
||||
--error 1416
|
||||
UPDATE spatial_index_dml_constraint SET g=@v1 WHERE i = 1;
|
||||
--error 1416
|
||||
UPDATE spatial_index_dml_constraint SET g=@v2 WHERE i = 1;
|
||||
UPDATE spatial_index_dml_constraint SET g=@v3 WHERE i = 1;
|
||||
--error 1416
|
||||
UPDATE spatial_index_dml_constraint SET g=@v4 WHERE i = 1;
|
||||
--error 1416
|
||||
UPDATE spatial_index_dml_constraint SET g=@v5 WHERE i = 1;
|
||||
--error 1416
|
||||
UPDATE spatial_index_dml_constraint SET g=@v6 WHERE i = 1;
|
||||
--error 1416
|
||||
UPDATE spatial_index_dml_constraint SET g=@v7 WHERE i = 1;
|
||||
DROP TABLE spatial_index_dml_constraint;
|
||||
## 1.2.5 MULTIPOINT can only allow MULTIPOINT
|
||||
CREATE TABLE spatial_index_dml_constraint (i int, g MULTIPOINT NOT NULL SRID 4326, PRIMARY KEY (i));
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (1, @v4);
|
||||
--error 1416
|
||||
UPDATE spatial_index_dml_constraint SET g=@v1 WHERE i = 1;
|
||||
--error 1416
|
||||
UPDATE spatial_index_dml_constraint SET g=@v2 WHERE i = 1;
|
||||
--error 1416
|
||||
UPDATE spatial_index_dml_constraint SET g=@v3 WHERE i = 1;
|
||||
UPDATE spatial_index_dml_constraint SET g=@v4 WHERE i = 1;
|
||||
--error 1416
|
||||
UPDATE spatial_index_dml_constraint SET g=@v5 WHERE i = 1;
|
||||
--error 1416
|
||||
UPDATE spatial_index_dml_constraint SET g=@v6 WHERE i = 1;
|
||||
--error 1416
|
||||
UPDATE spatial_index_dml_constraint SET g=@v7 WHERE i = 1;
|
||||
DROP TABLE spatial_index_dml_constraint;
|
||||
## 1.2.6 MULTILINESTRING can only allow MULTILINESTRING
|
||||
CREATE TABLE spatial_index_dml_constraint (i int, g MULTILINESTRING NOT NULL SRID 4326, PRIMARY KEY (i));
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (1, @v5);
|
||||
--error 1416
|
||||
UPDATE spatial_index_dml_constraint SET g=@v1 WHERE i = 1;
|
||||
--error 1416
|
||||
UPDATE spatial_index_dml_constraint SET g=@v2 WHERE i = 1;
|
||||
--error 1416
|
||||
UPDATE spatial_index_dml_constraint SET g=@v3 WHERE i = 1;
|
||||
--error 1416
|
||||
UPDATE spatial_index_dml_constraint SET g=@v4 WHERE i = 1;
|
||||
UPDATE spatial_index_dml_constraint SET g=@v5 WHERE i = 1;
|
||||
--error 1416
|
||||
UPDATE spatial_index_dml_constraint SET g=@v6 WHERE i = 1;
|
||||
--error 1416
|
||||
UPDATE spatial_index_dml_constraint SET g=@v7 WHERE i = 1;
|
||||
DROP TABLE spatial_index_dml_constraint;
|
||||
## 1.2.7 MULTIPOLYGON can only allow MULTIPOLYGON
|
||||
CREATE TABLE spatial_index_dml_constraint (i int, g MULTIPOLYGON NOT NULL SRID 4326, PRIMARY KEY (i));
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (1, @v6);
|
||||
--error 1416
|
||||
UPDATE spatial_index_dml_constraint SET g=@v1 WHERE i = 1;
|
||||
--error 1416
|
||||
UPDATE spatial_index_dml_constraint SET g=@v2 WHERE i = 1;
|
||||
--error 1416
|
||||
UPDATE spatial_index_dml_constraint SET g=@v3 WHERE i = 1;
|
||||
--error 1416
|
||||
UPDATE spatial_index_dml_constraint SET g=@v4 WHERE i = 1;
|
||||
--error 1416
|
||||
UPDATE spatial_index_dml_constraint SET g=@v5 WHERE i = 1;
|
||||
UPDATE spatial_index_dml_constraint SET g=@v6 WHERE i = 1;
|
||||
--error 1416
|
||||
UPDATE spatial_index_dml_constraint SET g=@v7 WHERE i = 1;
|
||||
DROP TABLE spatial_index_dml_constraint;
|
||||
## 1.1.7 GEOMETRYCOLLECTION can allow MULTIPOINT,MULTILINESTRING,MULTIPOLYGON,GEOMETRYCOLLECTION
|
||||
CREATE TABLE spatial_index_dml_constraint (i int, g GEOMETRYCOLLECTION NOT NULL SRID 4326, PRIMARY KEY (i));
|
||||
INSERT INTO spatial_index_dml_constraint VALUES (1, @v7);
|
||||
--error 1416
|
||||
UPDATE spatial_index_dml_constraint SET g=@v1 WHERE i = 1;
|
||||
--error 1416
|
||||
UPDATE spatial_index_dml_constraint SET g=@v2 WHERE i = 1;
|
||||
--error 1416
|
||||
UPDATE spatial_index_dml_constraint SET g=@v3 WHERE i = 1;
|
||||
UPDATE spatial_index_dml_constraint SET g=@v4 WHERE i = 1;
|
||||
UPDATE spatial_index_dml_constraint SET g=@v5 WHERE i = 1;
|
||||
UPDATE spatial_index_dml_constraint SET g=@v6 WHERE i = 1;
|
||||
UPDATE spatial_index_dml_constraint SET g=@v7 WHERE i = 1;
|
||||
DROP TABLE spatial_index_dml_constraint;
|
||||
}
|
||||
|
||||
# bugfix:
|
||||
CREATE TABLE t(p POINT);
|
||||
--error 1416
|
||||
INSERT INTO t VALUES(1);
|
||||
DROP TABLE t;
|
||||
|
||||
# bugfix:
|
||||
create table T_GEO (gid int auto_increment primary key,geo geometry );
|
||||
replace into T_GEO VALUES (1,st_geomfromtext('point(90 90)'));
|
||||
select st_astext(geo) from T_GEO;
|
||||
replace into T_GEO VALUES (1,st_geomfromtext('point(80 80)'));
|
||||
select st_astext(geo) from T_GEO;
|
||||
replace into T_GEO VALUES (1,st_geomfromtext('point(80 80)'));
|
||||
select st_astext(geo) from T_GEO;
|
||||
drop table T_GEO;
|
||||
|
||||
# bugfix:
|
||||
create table T_GEO (gid int auto_increment primary key,g point srid 4326);
|
||||
--error 3643
|
||||
replace into T_GEO VALUES (1,st_geomfromtext('point(90 90)', 0));
|
||||
--error 1416
|
||||
replace into T_GEO VALUES (1,st_geomfromtext('LINESTRING(90 90, 1 1)', 0));
|
||||
replace into T_GEO VALUES (1,st_geomfromtext('point(90 90)', 4326));
|
||||
select st_astext(g) from T_GEO;
|
||||
drop table T_GEO;
|
||||
create table T_GEO (gid int auto_increment primary key,g point);
|
||||
replace into T_GEO VALUES (1,st_geomfromtext('point(90 90)', 0));
|
||||
replace into T_GEO VALUES (2,st_geomfromtext('point(90 90)', 4326));
|
||||
--error 1416
|
||||
replace into T_GEO VALUES (3,st_geomfromtext('LINESTRING(90 90, 1 1)', 0));
|
||||
select st_astext(g) from T_GEO;
|
||||
drop table T_GEO;
|
||||
|
||||
# budfix:
|
||||
create table T_GEO (gid int auto_increment primary key, geo geometry ,geo_c GEOMETRYCOLLECTION,poi point,lin linestring ,pol polygon,M_POI MULTIPOINT,M_LIN MULTILINESTRING ,M_POL MULTIPOLYGON);
|
||||
REPLACE INTO T_GEO(geo) VALUES ( st_geomfromtext('point(90 90)'));
|
||||
select st_astext(geo) from T_GEO;
|
||||
drop table T_GEO;
|
||||
|
||||
# bugfix:
|
||||
create table T_GEO (gid int auto_increment primary key, geo geometry ,geo_c GEOMETRYCOLLECTION,poi point,lin linestring ,pol polygon,M_POI MULTIPOINT,M_LIN MULTILINESTRING ,M_POL MULTIPOLYGON );
|
||||
INSERT INTO T_GEO VALUES (1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
||||
--error 1416
|
||||
UPDATE T_GEO SET GEO=0;
|
||||
drop table T_GEO;
|
||||
|
||||
# bugfix :
|
||||
create table tt1(id int , g geometry not null srid 4236 , spatial index(g));
|
||||
insert into tt1(g) values(st_geomfromtext('POINT(0 0)', 4236));
|
||||
--error 3548
|
||||
select id ,st_astext(g) from tt1 where ST_Intersects(ST_GeomFromText('point(10 20)',426),g);
|
||||
drop table tt1;
|
||||
|
||||
# bugfix :
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS gis_line;
|
||||
--enable_warnings
|
||||
CREATE TABLE `gis_line` (`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`num` bigint(18) DEFAULT NULL,
|
||||
`lin` linestring NOT NULL /*!80003 SRID 4326 */,
|
||||
PRIMARY KEY (`id`), SPATIAL KEY `lin_index` (`lin`) BLOCK_SIZE 16384 LOCAL );
|
||||
insert into gis_line values(1,0, st_geomfromtext('LINESTRING(1 1, 2 2)', 4326));
|
||||
--error 3037
|
||||
select /*+index (gis_line lin_index)*/ * from gis_line where _st_covers(lin, ST_GeomFromText('point(15.830728278409012 10.534231407596138,,,,)', 4326));
|
||||
select /*+index (gis_line lin_index)*/ st_astext(lin) from gis_line where _st_covers(lin, ST_GeomFromText('point(1 1)', 4326));
|
||||
drop table gis_line;
|
||||
|
||||
# bugfix :
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS gis_point;
|
||||
--enable_warnings
|
||||
CREATE TABLE `gis_point` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `x` decimal(19,16) DEFAULT NULL, `y` decimal(19,16) DEFAULT NULL, `poi` point NOT NULL /*!80003 SRID 4326 */, PRIMARY KEY (`id`), KEY `xy_index` (`x`, `y`) BLOCK_SIZE 16384 LOCAL, SPATIAL KEY `poi_index` (`poi`) BLOCK_SIZE 16384 LOCAL ) AUTO_INCREMENT = 1196000001 DEFAULT CHARSET = utf8mb4 ROW_FORMAT = DYNAMIC COMPRESSION = 'zstd_1.3.8' REPLICA_NUM = 3 BLOCK_SIZE = 16384 USE_BLOOM_FILTER = FALSE TABLET_SIZE = 134217728 PCTFREE = 0;
|
||||
select concat((select st_astext(poi) from gis_point order by id desc limit 1),(select st_astext(poi) from gis_point order by id desc limit 1)) ;
|
||||
drop table gis_point;
|
||||
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS spatial_index;
|
||||
--enable_warnings
|
||||
CREATE TABLE spatial_index (i INT, g GEOMETRY NOT NULL SRID 4326, PRIMARY KEY (i), SPATIAL KEY (g));
|
||||
INSERT INTO spatial_index VALUES (1, ST_GEOMFROMTEXT('POLYGON((1 1, 1 8, 8 8, 8 10, -10 10, -10 1, 1 1))', 4326));
|
||||
INSERT INTO spatial_index VALUES (2, ST_GEOMFROMTEXT('LINESTRING(0 0,1 1)', 4326));
|
||||
select i, st_astext(g) from spatial_index where ST_Intersects(g, ST_GEOMFROMTEXT('POINT(1 1)', 4326));
|
||||
update spatial_index set g=ST_GEOMFROMTEXT('POINT(2 2)', 4326) where i=1;
|
||||
select i, st_astext(g) from spatial_index where ST_Intersects(g, ST_GEOMFROMTEXT('POINT(2 2)', 4326));
|
||||
|
||||
# bugfix :
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t3;
|
||||
--enable_warnings
|
||||
create table t3(id int, g1 geometry not null srid 2284);
|
||||
create spatial index spidx3 on t3(g1);
|
||||
insert into t3 values(13, ST_GeomFromText('GEOMETRYCOLLECTION EMPTY', 2284));
|
||||
#select /*+index(t3 spidx3)*/ st_astext(g1) from t3 where g1=ST_GeomFromText('GEOMETRYCOLLECTION EMPTY', 2284);
|
||||
select /*+index(t3 spidx3)*/ st_astext(g1) from t3 where _st_covers(ST_GeomFromText('GEOMETRYCOLLECTION EMPTY', 2284), g1);
|
||||
select /*+index(t3 spidx3)*/ st_astext(g1) from t3 where st_intersects(ST_GeomFromText('GEOMETRYCOLLECTION EMPTY', 2284), g1);
|
||||
select /*+index(t3 spidx3)*/ st_astext(g1) from t3 where st_within(ST_GeomFromText('GEOMETRYCOLLECTION EMPTY', 2284), g1);
|
||||
select /*+index(t3 spidx3)*/ st_astext(g1) from t3 where st_contains(ST_GeomFromText('GEOMETRYCOLLECTION EMPTY', 2284), g1);
|
||||
select /*+index(t3 spidx3)*/ st_astext(g1) from t3 where st_intersects(ST_GeomFromText('POINT(1 1)', 2284), g1);
|
||||
select /*+index(t3 spidx3)*/ st_astext(g1) from t3 where _st_covers(ST_GeomFromText('POINT(1 1)', 2284), g1);
|
||||
select /*+index(t3 spidx3)*/ st_astext(g1) from t3 where st_within(ST_GeomFromText('POINT(1 1)', 2284), g1);
|
||||
select /*+index(t3 spidx3)*/ st_astext(g1) from t3 where st_contains(ST_GeomFromText('POINT(1 1)', 2284), g1);
|
||||
select /*+index(t3 spidx3)*/ st_astext(g1) from t3 where st_intersects(g1, ST_GeomFromText('POINT(1 1)', 2284));
|
||||
select /*+index(t3 spidx3)*/ st_astext(g1) from t3 where _st_covers(g1, ST_GeomFromText('POINT(1 1)', 2284));
|
||||
select /*+index(t3 spidx3)*/ st_astext(g1) from t3 where st_within(g1, ST_GeomFromText('POINT(1 1)', 2284));
|
||||
select /*+index(t3 spidx3)*/ st_astext(g1) from t3 where st_contains(g1, ST_GeomFromText('POINT(1 1)', 2284));
|
||||
select /*+index(t3 spidx3)*/ st_astext(g1) from t3 where _st_dwithin(ST_GeomFromText('GEOMETRYCOLLECTION EMPTY', 2284), g1, 0.1);
|
||||
drop table t3;
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t_geo, cities;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE `cities` (
|
||||
`CityId` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Name` longtext DEFAULT NULL,
|
||||
`Location` geometry DEFAULT NULL,
|
||||
PRIMARY KEY (`CityId`)
|
||||
);
|
||||
|
||||
insert into cities(Name,Location) values("Berlin", 0xE61000000101000000CEC4742156CF2A407558E1968F424A40),
|
||||
("Seattle", 0xE61000000101000000387DE2A540955EC02383DC4598CD4740),
|
||||
("Warsaw", 0xE6100000010100000013109370210335408A56EE05661D4A40),
|
||||
("Shenzhen", 0xE61000000102000000020000000000000000002E400000000000002E4000000000000034400000000000003440),
|
||||
("Guangzhou", 0xE610000001030000000100000007000000000000000000F03F000000000000F03F0000000000002040000000000000F03F0000000000002040000000000000204000000000000024400000000000002040000000000000244000000000000024C0000000000000F03F00000000000024C0000000000000F03F000000000000F03F),
|
||||
("Emptycollection", 0xE6100000010700000000000000);
|
||||
select st_astext(cast(0xE61000000101000000CEC4742156CF2A407558E1968F424A40 as point));
|
||||
select Location from cities;
|
||||
select hex(Location) from cities;
|
||||
select st_astext(Location) from cities;
|
||||
drop table cities;
|
||||
|
||||
# bugfix :
|
||||
CREATE TABLE `t_geo` (
|
||||
`geo` geometry NOT NULL,
|
||||
SPATIAL KEY `SP_GEO` (`geo`) BLOCK_SIZE 16384 LOCAL
|
||||
) DEFAULT CHARSET = utf8mb4 ROW_FORMAT = DYNAMIC COMPRESSION = 'zstd_1.3.8' REPLICA_NUM = 1 BLOCK_SIZE = 16384 USE_BLOOM_FILTER = FALSE TABLET_SIZE = 134217728 PCTFREE = 0;
|
||||
|
||||
insert into t_geo values(st_geomfromtext('POINT(1.2345678987654322e24 -1.2345678998765433e25)'));
|
||||
insert into t_geo values(st_geomfromtext('GEOMETRYCOLLECTION(MULTIPOINT((2 -1),(11831.743318109031 -63273.949623278015),(0 -1)))'));
|
||||
insert into t_geo values(st_geomfromtext('GEOMETRYCOLLECTION EMPTY'));
|
||||
select st_astext(geo) from t_geo;
|
||||
UPDATE T_GEO SET GEO=ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(10 10), POINT(30 30), LINESTRING(15 15, 20 20))');
|
||||
select st_astext(geo) from t_geo;
|
||||
alter system set _enable_defensive_check = 0;
|
||||
|
||||
drop table t_geo;
|
||||
@ -0,0 +1,490 @@
|
||||
#owner: ht353245
|
||||
#owner group: shenzhen
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--echo # Test of GEOMETRY filter.
|
||||
--echo # ----------------------------------------------------------------------
|
||||
|
||||
##
|
||||
## Basic test for st_intersects
|
||||
##
|
||||
|
||||
--source mysql_test/test_suite/geometry/t/import_default_srs_data_mysql.inc
|
||||
|
||||
SET @point_0_0 = ST_GeomFromText('POINT(0 0)');
|
||||
SET @point_1_1 = ST_GeomFromText('POINT(1 1)');
|
||||
SET @point_2_2 = ST_GeomFromText('POINT(2 2)');
|
||||
SET @point_3_3 = ST_GeomFromText('POINT(3 3)');
|
||||
SET @point_4_4 = ST_GeomFromText('POINT(4 4)');
|
||||
SET @point_5_5 = ST_GeomFromText('POINT(5 5)');
|
||||
SET @line = ST_GeomFromText('LINESTRING(0 0,1 1)');
|
||||
SET @polygon = ST_GeomFromText('POLYGON((0 0, 10 0, 10 5, 0 5, 0 0))');
|
||||
SET @multi_point = ST_GeomFromText('MULTIPOINT((0 0), (1 1))');
|
||||
SET @multi_line = ST_GeomFromText('MULTILINESTRING((0 0, 1 1), (4 4, 5 5))');
|
||||
SET @multi_polygon = ST_GeomFromText('MULTIPOLYGON (((0 0, 2 0, 2 2, 0 2, 0 0)), ((2.5 2.5, 6 2.5, 6 6, 2.5 6, 2.5 2.5), (3.5 3, 4.5 3, 4.5 4.5, 3.5 4.5, 3.5 3)))');
|
||||
SET @colloction = ST_GeomFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(2 2,3 3))');
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t;
|
||||
--enable_warnings
|
||||
|
||||
#--real_sleep 1
|
||||
create table t(g geometry NOT NULL srid 0);
|
||||
#--real_sleep 1
|
||||
|
||||
create index idx on t (g);
|
||||
INSERT INTO t (g) VALUES
|
||||
(ST_GeomFromText('POINT(0 0)')),
|
||||
(ST_GeomFromText('POINT(1 1)')),
|
||||
(ST_GeomFromText('POINT(2 2)')),
|
||||
(ST_GeomFromText('POINT(3 3)')),
|
||||
(ST_GeomFromText('POINT(4 4)')),
|
||||
(ST_GeomFromText('POINT(5 5.5)')),
|
||||
(ST_GeomFromText('POINT(6 6)')),
|
||||
(ST_GeomFromText('POINT(7 7)'));
|
||||
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(0 0)'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(ST_GeomFromText('POINT(0 0)'), g);
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(1 1)'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(2 2)'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(3 3)'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(4 4)'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(5 5)'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('LINESTRING(0 0,1 1)'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POLYGON((0 0, 10 0, 10 5, 0 5, 0 0))'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('MULTIPOINT((0 0), (1 1))'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('MULTILINESTRING((0 0, 1 1), (4 4, 5 5))'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('MULTIPOLYGON (((0 0, 2 0, 2 2, 0 2, 0 0)), ((2.5 2.5, 6 2.5, 6 6, 2.5 6, 2.5 2.5), (3.5 3, 4.5 3, 4.5 4.5, 3.5 4.5, 3.5 3)))'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(2 2,3 3))'));
|
||||
|
||||
explain EXTENDED_NOADDR select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(0 0)'));
|
||||
explain EXTENDED_NOADDR select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(1 1)'));
|
||||
explain EXTENDED_NOADDR select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('LINESTRING(0 0,1 1)'));
|
||||
explain EXTENDED_NOADDR select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POLYGON((0 0, 10 0, 10 5, 0 5, 0 0))'));
|
||||
explain EXTENDED_NOADDR select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('MULTIPOINT((0 0), (1 1))'));
|
||||
explain EXTENDED_NOADDR select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('MULTILINESTRING((0 0, 1 1), (4 4, 5 5))'));
|
||||
explain EXTENDED_NOADDR select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('MULTIPOLYGON (((0 0, 2 0, 2 2, 0 2, 0 0)), ((2.5 2.5, 6 2.5, 6 6, 2.5 6, 2.5 2.5), (3.5 3, 4.5 3, 4.5 4.5, 3.5 4.5, 3.5 3)))'));
|
||||
explain EXTENDED_NOADDR select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(2 2,3 3))'));
|
||||
|
||||
SET @line = ST_GeomFromText('LINESTRING(3 3,5 5)');
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('LINESTRING(3 3,5 5)'));
|
||||
SET @line = ST_GeomFromText('LINESTRING(0 0,1 1)');
|
||||
|
||||
##
|
||||
## Combination test
|
||||
##
|
||||
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(0 0)')) or st_intersects(g, ST_GeomFromText('POINT(1 1)'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(0 0)')) and st_intersects(g, ST_GeomFromText('POINT(1 1)'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(0 0)')) or st_intersects(g, ST_GeomFromText('POINT(1 1)')) or st_intersects(g, ST_GeomFromText('POINT(2 2)')) or st_intersects(g, ST_GeomFromText('POINT(3 3)')) or st_intersects(g, ST_GeomFromText('POINT(4 4)'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(0 0)')) and st_intersects(g, ST_GeomFromText('LINESTRING(0 0,1 1)'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(1 1)')) or st_intersects(g, ST_GeomFromText('LINESTRING(0 0,1 1)'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POLYGON((0 0, 10 0, 10 5, 0 5, 0 0))')) and st_intersects(g, ST_GeomFromText('LINESTRING(0 0,1 1)'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POLYGON((0 0, 10 0, 10 5, 0 5, 0 0))')) or st_intersects(g, ST_GeomFromText('LINESTRING(0 0,1 1)'));
|
||||
#select /*+index(t idx)*/ st_astext(g) from t where 1=1;
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(0 0)')) or st_intersects(g, ST_GeomFromText('POINT(1 1)')) or 1=1;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(0 0)')) or st_intersects(g, ST_GeomFromText('POINT(1 1)')) or 1=1;
|
||||
set @@ob_enable_plan_cache = 1;
|
||||
|
||||
explain EXTENDED_NOADDR select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(0 0)')) or st_intersects(g, ST_GeomFromText('POINT(1 1)'));
|
||||
explain EXTENDED_NOADDR select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(0 0)')) and st_intersects(g, ST_GeomFromText('POINT(1 1)'));
|
||||
|
||||
##
|
||||
## Test Srid = 3825
|
||||
##
|
||||
--disable_warnings
|
||||
drop table if exists t;
|
||||
--enable_warnings
|
||||
create table t(g geometry NOT NULL SRID 3825);
|
||||
create index idx on t (g);
|
||||
INSERT INTO t (g) VALUES
|
||||
(ST_GeomFromText('POINT(150000 2100000)', 3825)),
|
||||
(ST_GeomFromText('POINT(150001 2100001)', 3825)),
|
||||
(ST_GeomFromText('POINT(150002 2100002)', 3825)),
|
||||
(ST_GeomFromText('POINT(150003 2100003)', 3825)),
|
||||
(ST_GeomFromText('POINT(150004 2100004)', 3825)),
|
||||
(ST_GeomFromText('POINT(150005 2100005.5)', 3825)),
|
||||
(ST_GeomFromText('POINT(150006 2100006)', 3825)),
|
||||
(ST_GeomFromText('POINT(150007 2100007)', 3825));
|
||||
|
||||
SET @point_0_0_3825 = ST_GeomFromText('POINT(150000 2100000)', 3825);
|
||||
SET @point_1_1_3825 = ST_GeomFromText('POINT(150001 2100001)', 3825);
|
||||
SET @point_2_2_3825 = ST_GeomFromText('POINT(150002 2100002)', 3825);
|
||||
SET @point_3_3_3825 = ST_GeomFromText('POINT(150003 2100003)', 3825);
|
||||
SET @point_4_4_3825 = ST_GeomFromText('POINT(150004 2100004)', 3825);
|
||||
SET @point_5_5_3825 = ST_GeomFromText('POINT(150005 2100005)', 3825);
|
||||
SET @line_3825 = ST_GeomFromText('LINESTRING(150000 2100000,150001 2100001)', 3825);
|
||||
SET @polygon_3825 = ST_GeomFromText('POLYGON((150000 2100000, 150010 2100000, 150010 2100005, 150000 2100005, 150000 2100000))', 3825);
|
||||
SET @multi_point_3825 = ST_GeomFromText('MULTIPOINT((150000 2100000), (150001 2100001))', 3825);
|
||||
SET @multi_line_3825 = ST_GeomFromText('MULTILINESTRING((150000 2100000, 150001 2100001), (150004 2100004, 150005 2100005))', 3825);
|
||||
SET @multi_polygon_3825 = ST_GeomFromText('MULTIPOLYGON (((150000 2100000, 150002 2100000, 150002 2100002, 150000 2100002, 150000 2100000)), ((150002.5 2100002.5, 150006 2100002.5, 150006 2100006, 150002.5 2100006, 150002.5 2100002.5), (150003.5 2100003, 150004.5 2100003, 150004.5 2100004.5, 150003.5 2100004.5, 150003.5 2100003)))', 3825);
|
||||
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(150000 2100000)', 3825));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(150001 2100001)', 3825));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(150002 2100002)', 3825));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(150003 2100003)', 3825));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(150004 2100004)', 3825));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(150005 2100005)', 3825));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('LINESTRING(150000 2100000,150001 2100001)', 3825));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POLYGON((150000 2100000, 150010 2100000, 150010 2100005, 150000 2100005, 150000 2100000))', 3825));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('MULTIPOINT((150000 2100000), (150001 2100001))', 3825));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('MULTILINESTRING((150000 2100000, 150001 2100001), (150004 2100004, 150005 2100005))', 3825));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('MULTIPOLYGON (((150000 2100000, 150002 2100000, 150002 2100002, 150000 2100002, 150000 2100000)), ((150002.5 2100002.5, 150006 2100002.5, 150006 2100006, 150002.5 2100006, 150002.5 2100002.5), (150003.5 2100003, 150004.5 2100003, 150004.5 2100004.5, 150003.5 2100004.5, 150003.5 2100003)))', 3825));
|
||||
|
||||
# illegal point
|
||||
# {minX_ = 144483.7169890964, maxX_ = 355516.28301090357, minY_ = 2060800.9721256399, maxY_ = 2727380.2976675923}
|
||||
INSERT INTO t (g) VALUES
|
||||
(ST_GeomFromText('POINT(355517 2727381)', 3825));
|
||||
SET @exceed_point = ST_GeomFromText('POINT(355517 2727381)', 3825);
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(355517 2727381)', 3825));
|
||||
|
||||
##
|
||||
## Test Srid = 4326
|
||||
##
|
||||
--disable_warnings
|
||||
drop table if exists t;
|
||||
--enable_warnings
|
||||
create table t(g geometry NOT NULL SRID 4326);
|
||||
create index idx on t (g);
|
||||
INSERT INTO t (g) VALUES
|
||||
(ST_GeomFromText('POINT(0 0)', 4326)),
|
||||
(ST_GeomFromText('POINT(1 1)', 4326)),
|
||||
(ST_GeomFromText('POINT(2 2)', 4326)),
|
||||
(ST_GeomFromText('POINT(3 3)', 4326)),
|
||||
(ST_GeomFromText('POINT(4 4)', 4326)),
|
||||
(ST_GeomFromText('POINT(5 5.5)', 4326)),
|
||||
(ST_GeomFromText('POINT(6 6)', 4326)),
|
||||
(ST_GeomFromText('POINT(7 7)', 4326));
|
||||
|
||||
SET @point_0_0_4326 = ST_GeomFromText('POINT(0 0)', 4326);
|
||||
SET @point_1_1_4326 = ST_GeomFromText('POINT(1 1)', 4326);
|
||||
SET @point_2_2_4326 = ST_GeomFromText('POINT(2 2)', 4326);
|
||||
SET @point_3_3_4326 = ST_GeomFromText('POINT(3 3)', 4326);
|
||||
SET @point_4_4_4326 = ST_GeomFromText('POINT(4 4)', 4326);
|
||||
SET @point_5_5_4326 = ST_GeomFromText('POINT(5 5)', 4326);
|
||||
SET @line_4326 = ST_GeomFromText('LINESTRING(0 0,1 1)', 4326);
|
||||
SET @polygon_4326 = ST_GeomFromText('POLYGON((0 0, 10 0, 10 5, 0 5, 0 0))', 4326);
|
||||
SET @multi_point_4326 = ST_GeomFromText('MULTIPOINT((0 0), (1 1))', 4326);
|
||||
SET @multi_line_4326 = ST_GeomFromText('MULTILINESTRING((0 0, 1 1), (4 4, 5 5))', 4326);
|
||||
SET @multi_polygon_4326 = ST_GeomFromText('MULTIPOLYGON (((0 0, 2 0, 2 2, 0 2, 0 0)), ((2.5 2.5, 6 2.5, 6 6, 2.5 6, 2.5 2.5), (3.5 3, 4.5 3, 4.5 4.5, 3.5 4.5, 3.5 3)))', 4326);
|
||||
SET @colloction_4326 = ST_GeomFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(2 2,3 3))', 4326);
|
||||
|
||||
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(0 0)', 4326));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(1 1)', 4326));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(2 2)', 4326));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(3 3)', 4326));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(4 4)', 4326));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(5 5)', 4326));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('LINESTRING(0 0,1 1)', 4326));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POLYGON((0 0, 10 0, 10 5, 0 5, 0 0))', 4326));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('MULTIPOINT((0 0), (1 1))', 4326));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('MULTILINESTRING((0 0, 1 1), (4 4, 5 5))', 4326));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('MULTIPOLYGON (((0 0, 2 0, 2 2, 0 2, 0 0)), ((2.5 2.5, 6 2.5, 6 6, 2.5 6, 2.5 2.5), (3.5 3, 4.5 3, 4.5 4.5, 3.5 4.5, 3.5 3)))', 4326));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(2 2,3 3))', 4326));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(ST_GeomFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(2 2,3 3))', 4326), g);
|
||||
|
||||
|
||||
##
|
||||
## Srid constrain test
|
||||
##
|
||||
SET @point_0_0 = ST_GeomFromText('POINT(0 0)');
|
||||
--error 3643
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(0 0)'));
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t;
|
||||
--enable_warnings
|
||||
#--real_sleep 1
|
||||
create table t(g geometry NOT NULL);
|
||||
#--real_sleep 1
|
||||
create index idx on t (g);
|
||||
|
||||
INSERT INTO t(g) VALUES (ST_GeomFromText('POINT(0 0)'));
|
||||
|
||||
--error ER_GIS_DIFFERENT_SRIDS
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(0 0)', 4326));
|
||||
|
||||
drop table t;
|
||||
|
||||
##
|
||||
## inverted_filter_geospatial from cockroachdb
|
||||
##
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists geo_table;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE geo_table(
|
||||
k int primary key,
|
||||
geom geometry SRID 0 NOT NULL,
|
||||
SPATIAL INDEX (geom)
|
||||
);
|
||||
|
||||
INSERT INTO geo_table VALUES
|
||||
(1, ST_GeomFromText('POINT(1.0 1.0)')),
|
||||
(2, ST_GeomFromText('LINESTRING(1.0 1.0, 2.0 2.0)')),
|
||||
(3, ST_GeomFromText('POINT(3.0 3.0)')),
|
||||
(4, ST_GeomFromText('LINESTRING(4.0 4.0, 5.0 5.0)')),
|
||||
(5, ST_GeomFromText('LINESTRING(40.0 40.0, 41.0 41.0)')),
|
||||
(6, ST_GeomFromText('POLYGON((1.0 1.0, 5.0 1.0, 5.0 5.0, 1.0 5.0, 1.0 1.0))'));
|
||||
|
||||
SELECT k FROM geo_table WHERE ST_Intersects(ST_GeomFromText('POINT(3.0 3.0)'), geom) ORDER BY k;
|
||||
SELECT k FROM geo_table WHERE ST_Intersects(ST_GeomFromText('POINT(4.5 4.5)'), geom) ORDER BY k;
|
||||
SELECT k FROM geo_table WHERE ST_Intersects(ST_GeomFromText('POINT(2.5 2.5)'), geom) ORDER BY k;
|
||||
SELECT /*+index(geo_table geom)*/ k FROM geo_table WHERE ST_Intersects(ST_GeomFromText('POINT(2.5 2.5)'), geom) ORDER BY k;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists geo_table2;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE geo_table2(
|
||||
k int,
|
||||
geom geometry SRID 0 NOT NULL,
|
||||
k_plus_one int,
|
||||
PRIMARY KEY (k, k_plus_one),
|
||||
SPATIAL INDEX (geom)
|
||||
);
|
||||
|
||||
INSERT INTO geo_table2 VALUES
|
||||
(1, ST_GeomFromText('LINESTRING(1.0 1.0, 2.0 2.0)'), 2),
|
||||
(2, ST_GeomFromText('POLYGON((1.0 1.0, 5.0 1.0, 5.0 5.0, 1.0 5.0, 1.0 1.0))'), 3);
|
||||
SELECT k FROM geo_table2 WHERE ST_Intersects(ST_GeomFromText('POINT(3.0 3.0)'), geom);
|
||||
SELECT /*+index(geo_table2 geom)*/ k FROM geo_table2 WHERE ST_Intersects(ST_GeomFromText('POINT(3.0 3.0)'), geom);
|
||||
explain EXTENDED_NOADDR SELECT /*+index(geo_table2 geom)*/ k FROM geo_table2 WHERE ST_Intersects(ST_GeomFromText('POINT(3.0 3.0)'), geom);
|
||||
SELECT k, k_plus_one FROM geo_table2 WHERE ST_Intersects(ST_GeomFromText('POINT(3.0 3.0)'), geom);
|
||||
SELECT /*+index(geo_table2 geom)*/ k, k_plus_one FROM geo_table2 WHERE ST_Intersects(ST_GeomFromText('POINT(3.0 3.0)'), geom);
|
||||
explain EXTENDED_NOADDR SELECT /*+index(geo_table2 geom)*/ k, k_plus_one FROM geo_table2 WHERE ST_Intersects(ST_GeomFromText('POINT(3.0 3.0)'), geom);
|
||||
|
||||
|
||||
##
|
||||
## inverted_index_geospatial from cockroachdb
|
||||
##
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists geo_table;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE geo_table(
|
||||
k int primary key,
|
||||
geom geometry SRID 26918 NOT NULL,
|
||||
SPATIAL INDEX (geom)
|
||||
);
|
||||
|
||||
INSERT INTO geo_table VALUES
|
||||
(1, ST_GeomFromText('POINT(400001 4000001)', 26918)),
|
||||
(2, ST_GeomFromText('LINESTRING(400001 4000001, 400002 4000002)', 26918)),
|
||||
(3, ST_GeomFromText('POINT(400003 4000003)', 26918)),
|
||||
(4, ST_GeomFromText('LINESTRING(400004 4000004, 400005 4000005)', 26918)),
|
||||
(5, ST_GeomFromText('LINESTRING(400040 4000040, 400041 4000041)', 26918)),
|
||||
(6, ST_GeomFromText('POLYGON((400001 4000001, 400005 4000001, 400005 4000005, 400001 4000005, 400001 4000001))', 26918));
|
||||
|
||||
SELECT k FROM geo_table WHERE ST_Intersects(ST_GeomFromText('POINT(400003 4000003)', 26918), geom) ORDER BY k;
|
||||
SELECT /*+index(geo_table geom)*/ k FROM geo_table WHERE ST_Intersects(ST_GeomFromText('POINT(400003 4000003)', 26918), geom) ORDER BY k;
|
||||
explain EXTENDED_NOADDR SELECT /*+index(geo_table geom)*/ k FROM geo_table WHERE ST_Intersects(ST_GeomFromText('POINT(400003 4000003)', 26918), geom) ORDER BY k;
|
||||
|
||||
##
|
||||
## Test for covered_by
|
||||
##
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t;
|
||||
--enable_warnings
|
||||
|
||||
#--real_sleep 1
|
||||
create table t(g geometry NOT NULL srid 0);
|
||||
#--real_sleep 1
|
||||
|
||||
create index idx on t (g);
|
||||
INSERT INTO t (g) VALUES
|
||||
(ST_GeomFromText('POINT(0 0)')),
|
||||
(ST_GeomFromText('POINT(1 1)')),
|
||||
(ST_GeomFromText('POINT(2 2)')),
|
||||
(ST_GeomFromText('POINT(3 3)')),
|
||||
(ST_GeomFromText('POINT(4 4)')),
|
||||
(ST_GeomFromText('POINT(5 5.5)')),
|
||||
(ST_GeomFromText('POINT(6 6)')),
|
||||
(ST_GeomFromText('POINT(7 7)')),
|
||||
(ST_GeomFromText('LINESTRING(0 0,1 1)')),
|
||||
(ST_GeomFromText('POLYGON((0 0, 10 0, 10 5, 0 5, 0 0))')),
|
||||
(ST_GeomFromText('MULTIPOINT((0 0), (1 1))')),
|
||||
(ST_GeomFromText('MULTILINESTRING((0 0, 1 1), (4 4, 5 5))')),
|
||||
(ST_GeomFromText('MULTIPOLYGON (((0 0, 2 0, 2 2, 0 2, 0 0)), ((2.5 2.5, 6 2.5, 6 6, 2.5 6, 2.5 2.5), (3.5 3, 4.5 3, 4.5 4.5, 3.5 4.5, 3.5 3)))')),
|
||||
(ST_GeomFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(2 2,3 3))'));
|
||||
|
||||
select st_astext(g) from t where _st_covers(g, ST_GeomFromText('POINT(0 0)'));
|
||||
select st_astext(g) from t where _st_covers(ST_GeomFromText('POINT(0 0)'), g);
|
||||
select st_astext(g) from t where _st_covers(g, ST_GeomFromText('POINT(1 1)'));
|
||||
select st_astext(g) from t where _st_covers(g, ST_GeomFromText('POINT(2 2)'));
|
||||
select st_astext(g) from t where _st_covers(g, ST_GeomFromText('POINT(3 3)'));
|
||||
select st_astext(g) from t where _st_covers(g, ST_GeomFromText('POINT(4 4)'));
|
||||
select st_astext(g) from t where _st_covers(g, ST_GeomFromText('POINT(5 5)'));
|
||||
select st_astext(g) from t where _st_covers(g, ST_GeomFromText('LINESTRING(0 0,1 1)'));
|
||||
select st_astext(g) from t where _st_covers(g, ST_GeomFromText('POLYGON((0 0, 10 0, 10 5, 0 5, 0 0))'));
|
||||
select st_astext(g) from t where _st_covers(g, ST_GeomFromText('MULTIPOINT((0 0), (1 1))'));
|
||||
select st_astext(g) from t where _st_covers(g, ST_GeomFromText('MULTILINESTRING((0 0, 1 1), (4 4, 5 5))'));
|
||||
select st_astext(g) from t where _st_covers(g, ST_GeomFromText('MULTIPOLYGON (((0 0, 2 0, 2 2, 0 2, 0 0)), ((2.5 2.5, 6 2.5, 6 6, 2.5 6, 2.5 2.5), (3.5 3, 4.5 3, 4.5 4.5, 3.5 4.5, 3.5 3)))'));
|
||||
select st_astext(g) from t where _st_covers(g, ST_GeomFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(2 2,3 3))'));
|
||||
|
||||
|
||||
select /*+index(t idx)*/ st_astext(g) from t where _st_covers(g, ST_GeomFromText('POINT(0 0)'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where _st_covers(ST_GeomFromText('POINT(0 0)'), g);
|
||||
select /*+index(t idx)*/ st_astext(g) from t where _st_covers(g, ST_GeomFromText('POINT(1 1)'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where _st_covers(g, ST_GeomFromText('POINT(2 2)'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where _st_covers(g, ST_GeomFromText('POINT(3 3)'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where _st_covers(g, ST_GeomFromText('POINT(4 4)'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where _st_covers(g, ST_GeomFromText('POINT(5 5)'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where _st_covers(g, ST_GeomFromText('LINESTRING(0 0,1 1)'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where _st_covers(g, ST_GeomFromText('POLYGON((0 0, 10 0, 10 5, 0 5, 0 0))'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where _st_covers(g, ST_GeomFromText('MULTIPOINT((0 0), (1 1))'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where _st_covers(g, ST_GeomFromText('MULTILINESTRING((0 0, 1 1), (4 4, 5 5))'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where _st_covers(g, ST_GeomFromText('MULTIPOLYGON (((0 0, 2 0, 2 2, 0 2, 0 0)), ((2.5 2.5, 6 2.5, 6 6, 2.5 6, 2.5 2.5), (3.5 3, 4.5 3, 4.5 4.5, 3.5 4.5, 3.5 3)))'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where _st_covers(g, ST_GeomFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(2 2,3 3))'));
|
||||
|
||||
explain EXTENDED_NOADDR select /*+index(t idx)*/ st_astext(g) from t where _st_covers(g, ST_GeomFromText('POINT(0 0)'));
|
||||
explain EXTENDED_NOADDR select /*+index(t idx)*/ st_astext(g) from t where _st_covers(g, ST_GeomFromText('POINT(1 1)'));
|
||||
explain EXTENDED_NOADDR select /*+index(t idx)*/ st_astext(g) from t where _st_covers(g, ST_GeomFromText('LINESTRING(0 0,1 1)'));
|
||||
explain EXTENDED_NOADDR select /*+index(t idx)*/ st_astext(g) from t where _st_covers(g, ST_GeomFromText('POLYGON((0 0, 10 0, 10 5, 0 5, 0 0))'));
|
||||
explain EXTENDED_NOADDR select /*+index(t idx)*/ st_astext(g) from t where _st_covers(g, ST_GeomFromText('MULTIPOINT((0 0), (1 1))'));
|
||||
explain EXTENDED_NOADDR select /*+index(t idx)*/ st_astext(g) from t where _st_covers(g, ST_GeomFromText('MULTILINESTRING((0 0, 1 1), (4 4, 5 5))'));
|
||||
explain EXTENDED_NOADDR select /*+index(t idx)*/ st_astext(g) from t where _st_covers(g, ST_GeomFromText('MULTIPOLYGON (((0 0, 2 0, 2 2, 0 2, 0 0)), ((2.5 2.5, 6 2.5, 6 6, 2.5 6, 2.5 2.5), (3.5 3, 4.5 3, 4.5 4.5, 3.5 4.5, 3.5 3)))'));
|
||||
explain EXTENDED_NOADDR select /*+index(t idx)*/ st_astext(g) from t where _st_covers(g, ST_GeomFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(2 2,3 3))'));
|
||||
|
||||
select /*+index(t idx)*/ st_astext(g) from t where ST_Within(g, ST_GeomFromText('POINT(0 0)'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where ST_Within(ST_GeomFromText('POINT(0 0)'), g);
|
||||
select /*+index(t idx)*/ st_astext(g) from t where ST_Within(g, ST_GeomFromText('POINT(1 1)'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where ST_Within(g, ST_GeomFromText('POINT(2 2)'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where ST_Within(g, ST_GeomFromText('POINT(3 3)'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where ST_Within(g, ST_GeomFromText('POINT(4 4)'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where ST_Within(g, ST_GeomFromText('POINT(5 5)'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where ST_Within(g, ST_GeomFromText('LINESTRING(0 0,1 1)'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where ST_Within(g, ST_GeomFromText('POLYGON((0 0, 10 0, 10 5, 0 5, 0 0))'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where ST_Within(g, ST_GeomFromText('MULTIPOINT((0 0), (1 1))'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where ST_Within(g, ST_GeomFromText('MULTILINESTRING((0 0, 1 1), (4 4, 5 5))'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where ST_Within(g, ST_GeomFromText('MULTIPOLYGON (((0 0, 2 0, 2 2, 0 2, 0 0)), ((2.5 2.5, 6 2.5, 6 6, 2.5 6, 2.5 2.5), (3.5 3, 4.5 3, 4.5 4.5, 3.5 4.5, 3.5 3)))'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where ST_Within(g, ST_GeomFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(2 2,3 3))'));
|
||||
|
||||
select /*+index(t idx)*/ st_astext(g) from t where ST_Contains(g, ST_GeomFromText('POINT(0 0)'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where ST_Contains(ST_GeomFromText('POINT(0 0)'), g);
|
||||
select /*+index(t idx)*/ st_astext(g) from t where ST_Contains(g, ST_GeomFromText('POINT(1 1)'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where ST_Contains(g, ST_GeomFromText('POINT(2 2)'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where ST_Contains(g, ST_GeomFromText('POINT(3 3)'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where ST_Contains(g, ST_GeomFromText('POINT(4 4)'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where ST_Contains(g, ST_GeomFromText('POINT(5 5)'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where ST_Contains(g, ST_GeomFromText('LINESTRING(0 0,1 1)'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where ST_Contains(g, ST_GeomFromText('POLYGON((0 0, 10 0, 10 5, 0 5, 0 0))'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where ST_Contains(g, ST_GeomFromText('MULTIPOINT((0 0), (1 1))'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where ST_Contains(g, ST_GeomFromText('MULTILINESTRING((0 0, 1 1), (4 4, 5 5))'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where ST_Contains(g, ST_GeomFromText('MULTIPOLYGON (((0 0, 2 0, 2 2, 0 2, 0 0)), ((2.5 2.5, 6 2.5, 6 6, 2.5 6, 2.5 2.5), (3.5 3, 4.5 3, 4.5 4.5, 3.5 4.5, 3.5 3)))'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where ST_Contains(g, ST_GeomFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(2 2,3 3))'));
|
||||
|
||||
explain EXTENDED_NOADDR select /*+index(t idx)*/ st_astext(g) from t where ST_Within(g, ST_GeomFromText('POINT(0 0)'));
|
||||
explain EXTENDED_NOADDR select /*+index(t idx)*/ st_astext(g) from t where ST_Within(g, ST_GeomFromText('POINT(1 1)'));
|
||||
explain EXTENDED_NOADDR select /*+index(t idx)*/ st_astext(g) from t where ST_Within(g, ST_GeomFromText('LINESTRING(0 0,1 1)'));
|
||||
explain EXTENDED_NOADDR select /*+index(t idx)*/ st_astext(g) from t where ST_Within(g, ST_GeomFromText('POLYGON((0 0, 10 0, 10 5, 0 5, 0 0))'));
|
||||
explain EXTENDED_NOADDR select /*+index(t idx)*/ st_astext(g) from t where ST_Within(g, ST_GeomFromText('MULTIPOINT((0 0), (1 1))'));
|
||||
explain EXTENDED_NOADDR select /*+index(t idx)*/ st_astext(g) from t where ST_Within(g, ST_GeomFromText('MULTILINESTRING((0 0, 1 1), (4 4, 5 5))'));
|
||||
explain EXTENDED_NOADDR select /*+index(t idx)*/ st_astext(g) from t where ST_Within(g, ST_GeomFromText('MULTIPOLYGON (((0 0, 2 0, 2 2, 0 2, 0 0)), ((2.5 2.5, 6 2.5, 6 6, 2.5 6, 2.5 2.5), (3.5 3, 4.5 3, 4.5 4.5, 3.5 4.5, 3.5 3)))'));
|
||||
explain EXTENDED_NOADDR select /*+index(t idx)*/ st_astext(g) from t where ST_Within(g, ST_GeomFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(2 2,3 3))'));
|
||||
|
||||
explain EXTENDED_NOADDR select /*+index(t idx)*/ st_astext(g) from t where ST_Contains(g, ST_GeomFromText('POINT(0 0)'));
|
||||
explain EXTENDED_NOADDR select /*+index(t idx)*/ st_astext(g) from t where ST_Contains(g, ST_GeomFromText('POINT(1 1)'));
|
||||
explain EXTENDED_NOADDR select /*+index(t idx)*/ st_astext(g) from t where ST_Contains(g, ST_GeomFromText('LINESTRING(0 0,1 1)'));
|
||||
explain EXTENDED_NOADDR select /*+index(t idx)*/ st_astext(g) from t where ST_Contains(g, ST_GeomFromText('POLYGON((0 0, 10 0, 10 5, 0 5, 0 0))'));
|
||||
explain EXTENDED_NOADDR select /*+index(t idx)*/ st_astext(g) from t where ST_Contains(g, ST_GeomFromText('MULTIPOINT((0 0), (1 1))'));
|
||||
explain EXTENDED_NOADDR select /*+index(t idx)*/ st_astext(g) from t where ST_Contains(g, ST_GeomFromText('MULTILINESTRING((0 0, 1 1), (4 4, 5 5))'));
|
||||
explain EXTENDED_NOADDR select /*+index(t idx)*/ st_astext(g) from t where ST_Contains(g, ST_GeomFromText('MULTIPOLYGON (((0 0, 2 0, 2 2, 0 2, 0 0)), ((2.5 2.5, 6 2.5, 6 6, 2.5 6, 2.5 2.5), (3.5 3, 4.5 3, 4.5 4.5, 3.5 4.5, 3.5 3)))'));
|
||||
explain EXTENDED_NOADDR select /*+index(t idx)*/ st_astext(g) from t where ST_Contains(g, ST_GeomFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(2 2,3 3))'));
|
||||
|
||||
drop table geo_table;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists tt1;
|
||||
--enable_warnings
|
||||
CREATE TABLE tt1 (id int ,g GEOMETRY not null srid 4236);
|
||||
ALTER TABLE tt1 ADD spatial INDEX idx(g) local;
|
||||
insert into tt1 values(2,ST_GeomFromText('LINESTRING(0 0, 10 10, 20 25, 50 60)',4236));
|
||||
select id ,st_astext(g) from tt1 where ST_Intersects(g,g);
|
||||
|
||||
drop table tt1;
|
||||
|
||||
##
|
||||
## Test for invalid data
|
||||
##
|
||||
--disable_warnings
|
||||
drop table if exists t;
|
||||
--enable_warnings
|
||||
create table t(g geometry NOT NULL SRID 3825);
|
||||
create index idx on t (g);
|
||||
SET @illegal_point = ST_GeomFromText('POINT(600000 3000000)', 3825);
|
||||
SET @illegal_line = ST_GeomFromText('LINESTRING(550000 2600000,600000 3000000)', 3825);
|
||||
SET @legal_polygon = ST_GeomFromText('POLYGON((500000 2500000, 550000 2500000, 550000 2600000, 500000 2600000, 500000 2500000))', 3825);
|
||||
SET @illegal_polygon = ST_GeomFromText('POLYGON((500000 2500000, 590000 2500000, 590000 2800000, 500000 2800000, 500000 2500000))', 3825);
|
||||
SET @illegal_mtp = ST_GeomFromText('MULTIPOINT((550000 2600000),(600000 3100000))', 3825);
|
||||
SET @illegal_mtl = ST_GeomFromText('MULTILINESTRING((550000 2600000,600000 3000000), (530000 2500000,560000 2500000))', 3825);
|
||||
SET @illegal_multi_mpy = ST_GeomFromText('MULTIPOLYGON(((500000 2500000, 550000 2500000, 550000 2600000, 500000 2600000, 500000 2500000)), ((500000 2500000, 590000 2500000, 590000 2800000, 500000 2800000, 500000 2500000)))', 3825);
|
||||
SET @illegal_colloction = ST_GeomFromText('GEOMETRYCOLLECTION(POINT(600000 3000000), LINESTRING(530000 2500000,560000 2500000))', 3825);
|
||||
|
||||
INSERT INTO t (g) VALUES (ST_GeomFromText('POINT(600000 3000000)', 3825));
|
||||
INSERT INTO t (g) VALUES (ST_GeomFromText('LINESTRING(550000 2600000,600000 3000000)', 3825));
|
||||
INSERT INTO t (g) VALUES (ST_GeomFromText('POLYGON((500000 2500000, 600000 2500000, 600000 3000000, 500000 3000000, 500000 2500000))', 3825));
|
||||
INSERT INTO t (g) VALUES (ST_GeomFromText('MULTIPOINT((550000 2600000),(600000 3100000))', 3825));
|
||||
INSERT INTO t (g) VALUES (ST_GeomFromText('MULTILINESTRING((550000 2600000,600000 3000000), (530000 2500000,560000 2500000))', 3825));
|
||||
INSERT INTO t (g) VALUES (ST_GeomFromText('MULTIPOLYGON(((500000 2500000, 550000 2500000, 550000 2600000, 500000 2600000, 500000 2500000)), ((500000 2500000, 590000 2500000, 590000 2800000, 500000 2800000, 500000 2500000)))', 3825));
|
||||
INSERT INTO t (g) VALUES (ST_GeomFromText('GEOMETRYCOLLECTION(POINT(600000 3000000), LINESTRING(530000 2500000,560000 2500000))', 3825));
|
||||
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(600000 3000000)', 3825));
|
||||
explain EXTENDED_NOADDR select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(600000 3000000)', 3825));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('LINESTRING(550000 2600000,600000 3000000)', 3825));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POLYGON((500000 2500000, 550000 2500000, 550000 2600000, 500000 2600000, 500000 2500000))', 3825));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POLYGON((500000 2500000, 590000 2500000, 590000 2800000, 500000 2800000, 500000 2500000))', 3825));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('MULTIPOINT((550000 2600000),(600000 3100000))', 3825));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('MULTIPOLYGON(((500000 2500000, 550000 2500000, 550000 2600000, 500000 2600000, 500000 2500000)), ((500000 2500000, 590000 2500000, 590000 2800000, 500000 2800000, 500000 2500000)))', 3825));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('MULTILINESTRING((550000 2600000,600000 3000000), (530000 2500000,560000 2500000))', 3825));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('GEOMETRYCOLLECTION(POINT(600000 3000000), LINESTRING(530000 2500000,560000 2500000))', 3825));
|
||||
drop table t;
|
||||
|
||||
# bugfix:
|
||||
--disable_warnings
|
||||
drop table if exists geo_t1;
|
||||
--enable_warnings
|
||||
CREATE TABLE geo_t1 (
|
||||
id INT,
|
||||
g GEOMETRY NOT NULL SRID 4326,
|
||||
SPATIAL INDEX g_idx (g)
|
||||
);
|
||||
INSERT INTO geo_t1 (id, g) VALUES
|
||||
(1, ST_GeomFromText('LINESTRING(0 10.00001, 10 10.00001)', 4326, 'axis-order=long-lat')),
|
||||
(2, ST_GeomFromText('LINESTRING(0 9.99999, 10 9.99999)', 4326, 'axis-order=long-lat')),
|
||||
(3, ST_GeomFromText('POLYGON((5 5.00001, 6 5.00001, 6 10, 5 10, 5 5.00001))', 4326, 'axis-order=long-lat')),
|
||||
(4, ST_GeomFromText('POINT(5 5.00001)', 4326, 'axis-order=long-lat')),
|
||||
(5, ST_GeomFromText('MULTILINESTRING((0 9.99999, 10 9.99999))', 4326, 'axis-order=long-lat')),
|
||||
(6, ST_GeomFromText('MULTIPOLYGON(((5 5.00001, 6 5.00001, 6 10, 5 10, 5 5.00001)))', 4326, 'axis-order=long-lat')),
|
||||
(7, ST_GeomFromText('MULTIPOINT((5 5.00001))', 4326, 'axis-order=long-lat')),
|
||||
(8, ST_GeomFromText('GEOMETRYCOLLECTION(MULTIPOLYGON(((5 5.00001, 6 5.00001, 6 10, 5 10, 5 5.00001))))', 4326, 'axis-order=long-lat'));
|
||||
|
||||
select id, st_astext(g) from geo_t1 IGNORE INDEX(g_idx) where st_intersects(g, ST_GeomFromText('LINESTRING(-5 10, 5 10)', 4326, 'axis-order=long-lat'));
|
||||
select id, st_astext(g) from geo_t1 FORCE INDEX(g_idx) where st_intersects(g, ST_GeomFromText('LINESTRING(-5 10, 5 10)', 4326, 'axis-order=long-lat'));
|
||||
|
||||
select id, st_astext(g) from geo_t1 IGNORE INDEX(g_idx) where st_contains(g, ST_GeomFromText('LINESTRING(-5 10, 5 10)', 4326, 'axis-order=long-lat'));
|
||||
select id, st_astext(g) from geo_t1 FORCE INDEX(g_idx) where st_contains(g, ST_GeomFromText('LINESTRING(-5 10, 5 10)', 4326, 'axis-order=long-lat'));
|
||||
|
||||
select id, st_astext(g) from geo_t1 IGNORE INDEX(g_idx) where st_within(g, ST_GeomFromText('LINESTRING(-5 10, 5 10)', 4326, 'axis-order=long-lat'));
|
||||
select id, st_astext(g) from geo_t1 FORCE INDEX(g_idx) where st_within(g, ST_GeomFromText('LINESTRING(-5 10, 5 10)', 4326, 'axis-order=long-lat'));
|
||||
|
||||
select id, st_astext(g) from geo_t1 IGNORE INDEX(g_idx) where _st_covers(g, ST_GeomFromText('LINESTRING(-5 10, 5 10)', 4326, 'axis-order=long-lat'));
|
||||
select id, st_astext(g) from geo_t1 FORCE INDEX(g_idx) where _st_covers(g, ST_GeomFromText('LINESTRING(-5 10, 5 10)', 4326, 'axis-order=long-lat'));
|
||||
|
||||
select id, st_astext(g) from geo_t1 IGNORE INDEX(g_idx) where st_intersects(g, ST_GeomFromText('POLYGON((0 0, 10 0, 10 5, 0 5, 0 0))', 4326, 'axis-order=long-lat'));
|
||||
select id, st_astext(g) from geo_t1 FORCE INDEX(g_idx) where st_intersects(g, ST_GeomFromText('POLYGON((0 0, 10 0, 10 5, 0 5, 0 0))', 4326, 'axis-order=long-lat'));
|
||||
|
||||
select id, st_astext(g) from geo_t1 IGNORE INDEX(g_idx) where st_contains(ST_GeomFromText('POLYGON((0 0, 10 0, 10 5, 0 5, 0 0))', 4326, 'axis-order=long-lat'), g);
|
||||
select id, st_astext(g) from geo_t1 FORCE INDEX(g_idx) where st_contains(ST_GeomFromText('POLYGON((0 0, 10 0, 10 5, 0 5, 0 0))', 4326, 'axis-order=long-lat'), g);
|
||||
|
||||
select id, st_astext(g) from geo_t1 IGNORE INDEX(g_idx) where st_within(g, ST_GeomFromText('POLYGON((0 0, 10 0, 10 5, 0 5, 0 0))', 4326, 'axis-order=long-lat'));
|
||||
select id, st_astext(g) from geo_t1 FORCE INDEX(g_idx) where st_within(g, ST_GeomFromText('POLYGON((0 0, 10 0, 10 5, 0 5, 0 0))', 4326, 'axis-order=long-lat'));
|
||||
|
||||
select id, st_astext(g) from geo_t1 IGNORE INDEX(g_idx) where _st_covers(ST_GeomFromText('POLYGON((0 0, 10 0, 10 5, 0 5, 0 0))', 4326, 'axis-order=long-lat'), g);
|
||||
select id, st_astext(g) from geo_t1 FORCE INDEX(g_idx) where _st_covers(ST_GeomFromText('POLYGON((0 0, 10 0, 10 5, 0 5, 0 0))', 4326, 'axis-order=long-lat'), g);
|
||||
|
||||
drop table geo_t1;
|
||||
@ -0,0 +1,185 @@
|
||||
#owner: ht353245
|
||||
#owner group: shenzhen
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--echo # Base test of GEOMETRY function.
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--source mysql_test/test_suite/geometry/t/import_default_srs_data_mysql.inc
|
||||
|
||||
|
||||
### 1. Test for POINT
|
||||
if (1) {
|
||||
--error 1064
|
||||
SELECT ST_ASTEXT(POINT(1));
|
||||
--error 1064
|
||||
SELECT ST_ASTEXT(POINT(1,1,1));
|
||||
|
||||
SELECT ST_ASTEXT(POINT(1, 1));
|
||||
SELECT ST_ASTEXT(POINT('1', '1'));
|
||||
SELECT ST_ASTEXT(POINT('a', 'a'));
|
||||
SELECT ST_ASTEXT(POINT(' ', ' '));
|
||||
SELECT ST_ASTEXT(POINT(12345, ''));
|
||||
SELECT ST_ASTEXT(POINT(NULL, NULL));
|
||||
SELECT ST_ASTEXT(POINT(1, NULL));
|
||||
SELECT ST_ASTEXT(POINT(NULL, 1));
|
||||
SELECT ST_ASTEXT(POINT('NULL', 1));
|
||||
}
|
||||
|
||||
### 2. Test for LINESTRING
|
||||
if (1) {
|
||||
--error 1367
|
||||
SELECT ST_ASTEXT(LINESTRING(1));
|
||||
--error 1367
|
||||
SELECT ST_ASTEXT(LINESTRING(1,1,1));
|
||||
--error 1367
|
||||
SELECT ST_ASTEXT(LINESTRING('1', '1'));
|
||||
--error 1367
|
||||
SELECT ST_ASTEXT(LINESTRING(NULL, NULL));
|
||||
--error 1367
|
||||
SELECT ST_ASTEXT(LINESTRING('NULL', 'NULL'));
|
||||
--error 3037
|
||||
SELECT ST_ASTEXT(LINESTRING(POINT(0,0)));
|
||||
--error 1210
|
||||
SELECT ST_ASTEXT(LINESTRING(LINESTRING(POINT(0,0),POINT(1,0))));
|
||||
|
||||
SELECT ST_ASTEXT(LINESTRING(POINT(0,0),POINT(1,0)));
|
||||
SELECT ST_ASTEXT(LINESTRING(POINT(0,0),POINT(1,0),POINT(0,0)));
|
||||
SELECT ST_ASTEXT(LINESTRING(POINT(0,0),POINT(1,0),POINT(1,1), POINT(0,0)));
|
||||
}
|
||||
|
||||
### 3. Test for MULTIPOINT
|
||||
if (1) {
|
||||
--error 1367
|
||||
SELECT ST_ASTEXT(MULTIPOINT(1));
|
||||
--error 1367
|
||||
SELECT ST_ASTEXT(MULTIPOINT(1,1,1));
|
||||
--error 1367
|
||||
SELECT ST_ASTEXT(MULTIPOINT('1', '1'));
|
||||
--error 1367
|
||||
SELECT ST_ASTEXT(MULTIPOINT(NULL, NULL));
|
||||
--error 1367
|
||||
SELECT ST_ASTEXT(MULTIPOINT('NULL', 'NULL'));
|
||||
--error 1210
|
||||
SELECT ST_ASTEXT(MULTIPOINT(LINESTRING(POINT(0,0),POINT(1,0))));
|
||||
|
||||
SELECT ST_ASTEXT(MULTIPOINT(POINT(0,0)));
|
||||
SELECT ST_ASTEXT(MULTIPOINT(POINT(0,0),POINT(1,1)));
|
||||
}
|
||||
|
||||
### 4. Test for MULTILINESTRING
|
||||
if (1) {
|
||||
--error 1367
|
||||
SELECT ST_ASTEXT(MULTILINESTRING(1));
|
||||
--error 1367
|
||||
SELECT ST_ASTEXT(MULTILINESTRING(1,1,1));
|
||||
--error 1367
|
||||
SELECT ST_ASTEXT(MULTILINESTRING('1', '1'));
|
||||
--error 1367
|
||||
SELECT ST_ASTEXT(MULTILINESTRING(NULL, NULL));
|
||||
--error 1367
|
||||
SELECT ST_ASTEXT(MULTILINESTRING('NULL', 'NULL'));
|
||||
--error 1210
|
||||
SELECT ST_ASTEXT(MULTILINESTRING(POINT(0,0)));
|
||||
--error 1210
|
||||
SELECT ST_ASTEXT(MULTILINESTRING(LINESTRING(POINT(0,0),POINT(1,0)),LINESTRING(POINT(0,0),POINT(1,0)),POINT(1,1)));
|
||||
|
||||
SELECT ST_ASTEXT(MULTILINESTRING(LINESTRING(POINT(0,0),POINT(1,0))));
|
||||
SELECT ST_ASTEXT(MULTILINESTRING(LINESTRING(POINT(0,0),POINT(1,0)),LINESTRING(POINT(0,0),POINT(1,0))));
|
||||
}
|
||||
|
||||
### 5. Test for POLYGON
|
||||
if (1) {
|
||||
--error 1367
|
||||
SELECT ST_ASTEXT(POLYGON(1));
|
||||
--error 1367
|
||||
SELECT ST_ASTEXT(POLYGON(1,1,1));
|
||||
--error 1367
|
||||
SELECT ST_ASTEXT(POLYGON('1', '1'));
|
||||
--error 1367
|
||||
SELECT ST_ASTEXT(POLYGON(NULL, NULL));
|
||||
--error 1367
|
||||
SELECT ST_ASTEXT(POLYGON('NULL', 'NULL'));
|
||||
--error 1210
|
||||
SELECT ST_ASTEXT(POLYGON(POINT(0,0)));
|
||||
--error 3037
|
||||
SELECT ST_ASTEXT(POLYGON(LINESTRING(POINT(0,0),POINT(1,0)),LINESTRING(POINT(0,0),POINT(1,0)),POINT(1,1)));
|
||||
--error 3037
|
||||
SELECT ST_ASTEXT(POLYGON(LINESTRING(POINT(0,0),POINT(1,0))));
|
||||
--error 3037
|
||||
SELECT ST_ASTEXT(POLYGON(LINESTRING(POINT(0,0),POINT(1,0)),LINESTRING(POINT(0,0),POINT(1,0))));
|
||||
--error 1210
|
||||
SELECT ST_ASTEXT(POLYGON(LINESTRING(POINT(0,0),POINT(1,0),POINT(1,1),POINT(0,1),POINT(0,0)), POINT(1,1)));
|
||||
|
||||
SELECT ST_ASTEXT(POLYGON(LINESTRING(POINT(0,0),POINT(1,0),POINT(1,1),POINT(0,1),POINT(0,0))));
|
||||
}
|
||||
|
||||
### 5. Test for MULTIPOLYGON
|
||||
if (1) {
|
||||
--error 1367
|
||||
SELECT ST_ASTEXT(MULTIPOLYGON(1));
|
||||
--error 1367
|
||||
SELECT ST_ASTEXT(MULTIPOLYGON(1,1,1));
|
||||
--error 1367
|
||||
SELECT ST_ASTEXT(MULTIPOLYGON('1', '1'));
|
||||
--error 1367
|
||||
SELECT ST_ASTEXT(MULTIPOLYGON(NULL, NULL));
|
||||
--error 1367
|
||||
SELECT ST_ASTEXT(MULTIPOLYGON('NULL', 'NULL'));
|
||||
--error 1210
|
||||
SELECT ST_ASTEXT(MULTIPOLYGON(POINT(0,0)));
|
||||
--error 1210
|
||||
SELECT ST_ASTEXT(MULTIPOLYGON(LINESTRING(POINT(0,0),POINT(1,0)),LINESTRING(POINT(0,0),POINT(1,0))));
|
||||
--error 1210
|
||||
SELECT ST_ASTEXT(MULTIPOLYGON(LINESTRING(POINT(0,0),POINT(1,0)),LINESTRING(POINT(0,0),POINT(1,0))));
|
||||
--error 1210
|
||||
SELECT ST_ASTEXT(MULTIPOLYGON(POLYGON(LINESTRING(POINT(0,0),POINT(1,0),POINT(1,1),POINT(0,1),POINT(0,0))), POINT(1,1)));
|
||||
|
||||
SELECT ST_ASTEXT(MULTIPOLYGON(POLYGON(LINESTRING(POINT(0,0),POINT(1,0),POINT(1,1),POINT(0,1),POINT(0,0)))));
|
||||
SELECT ST_ASTEXT(MULTIPOLYGON(POLYGON(LINESTRING(POINT(0,0),POINT(1,0),POINT(1,1),POINT(0,1),POINT(0,0))),
|
||||
POLYGON(LINESTRING(POINT(0,0),POINT(1,0),POINT(1,1),POINT(0,1),POINT(0,0)))));
|
||||
}
|
||||
|
||||
### 5. Test for GEOMETRYCOLLECTION
|
||||
if (1) {
|
||||
--error 1367
|
||||
SELECT ST_ASTEXT(GEOMETRYCOLLECTION(1));
|
||||
--error 1367
|
||||
SELECT ST_ASTEXT(GEOMETRYCOLLECTION(1,1,1));
|
||||
--error 1367
|
||||
SELECT ST_ASTEXT(GEOMETRYCOLLECTION('1', '1'));
|
||||
--error 1367
|
||||
SELECT ST_ASTEXT(GEOMETRYCOLLECTION(NULL, NULL));
|
||||
--error 1367
|
||||
SELECT ST_ASTEXT(GEOMETRYCOLLECTION('NULL', 'NULL'));
|
||||
|
||||
SELECT ST_ASTEXT(GEOMETRYCOLLECTION());
|
||||
SELECT ST_ASTEXT(GEOMETRYCOLLECTION(POINT(0,0)));
|
||||
SELECT ST_ASTEXT(GEOMETRYCOLLECTION(LINESTRING(POINT(0,0),POINT(1,0)),LINESTRING(POINT(0,0),POINT(1,0))));
|
||||
SELECT ST_ASTEXT(GEOMETRYCOLLECTION(POLYGON(LINESTRING(POINT(0,0),POINT(1,0),POINT(1,1),POINT(0,1),POINT(0,0)))));
|
||||
SELECT ST_ASTEXT(GEOMETRYCOLLECTION(MULTIPOINT(POINT(0,0),POINT(1,1))));
|
||||
SELECT ST_ASTEXT(GEOMETRYCOLLECTION(MULTILINESTRING(LINESTRING(POINT(0,0),POINT(1,0)),LINESTRING(POINT(0,0),POINT(1,0)))));
|
||||
SELECT ST_ASTEXT(GEOMETRYCOLLECTION(MULTIPOLYGON(POLYGON(LINESTRING(POINT(0,0),POINT(1,0),POINT(1,1),POINT(0,1),POINT(0,0))),
|
||||
POLYGON(LINESTRING(POINT(0,0),POINT(1,0),POINT(1,1),POINT(0,1),POINT(0,0))))));
|
||||
}
|
||||
|
||||
### 5. Test for GEOMCOLLECTION
|
||||
if (1) {
|
||||
--error 1367
|
||||
SELECT ST_ASTEXT(GEOMCOLLECTION(1));
|
||||
--error 1367
|
||||
SELECT ST_ASTEXT(GEOMCOLLECTION(1,1,1));
|
||||
--error 1367
|
||||
SELECT ST_ASTEXT(GEOMCOLLECTION('1', '1'));
|
||||
--error 1367
|
||||
SELECT ST_ASTEXT(GEOMCOLLECTION(NULL, NULL));
|
||||
--error 1367
|
||||
SELECT ST_ASTEXT(GEOMCOLLECTION('NULL', 'NULL'));
|
||||
|
||||
SELECT ST_ASTEXT(GEOMCOLLECTION());
|
||||
SELECT ST_ASTEXT(GEOMCOLLECTION(POINT(0,0)));
|
||||
SELECT ST_ASTEXT(GEOMCOLLECTION(LINESTRING(POINT(0,0),POINT(1,0)),LINESTRING(POINT(0,0),POINT(1,0))));
|
||||
SELECT ST_ASTEXT(GEOMCOLLECTION(POLYGON(LINESTRING(POINT(0,0),POINT(1,0),POINT(1,1),POINT(0,1),POINT(0,0)))));
|
||||
SELECT ST_ASTEXT(GEOMCOLLECTION(MULTIPOINT(POINT(0,0),POINT(1,1))));
|
||||
SELECT ST_ASTEXT(GEOMCOLLECTION(MULTILINESTRING(LINESTRING(POINT(0,0),POINT(1,0)),LINESTRING(POINT(0,0),POINT(1,0)))));
|
||||
SELECT ST_ASTEXT(GEOMCOLLECTION(MULTIPOLYGON(POLYGON(LINESTRING(POINT(0,0),POINT(1,0),POINT(1,1),POINT(0,1),POINT(0,0))),
|
||||
POLYGON(LINESTRING(POINT(0,0),POINT(1,0),POINT(1,1),POINT(0,1),POINT(0,0))))));
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,110 @@
|
||||
#owner: ht353245
|
||||
#owner group: shenzhen
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--echo # Base test of GEOMETRY spatial index.
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--source mysql_test/test_suite/geometry/t/import_default_srs_data_mysql.inc
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1 (x INTEGER,
|
||||
y INTEGER,
|
||||
g POINT GENERATED ALWAYS AS (POINT(x, y)) NOT NULL SRID 0);
|
||||
SHOW COLUMNS FROM t1;
|
||||
INSERT INTO t1(x,y) VALUES (0, 0);
|
||||
INSERT INTO t1(x,y) VALUES (0.1, 0.1);
|
||||
SELECT x,y,st_astext(g) FROM t1 ORDER BY x;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (x INTEGER,
|
||||
y INTEGER,
|
||||
g POINT GENERATED ALWAYS AS (POINT(x, y)) NOT NULL SRID 4326);
|
||||
SHOW COLUMNS FROM t1;
|
||||
--error 3643
|
||||
INSERT INTO t1(x,y) VALUES (0, 0);
|
||||
--error 3643
|
||||
INSERT INTO t1(x,y) VALUES (0.1, 0.1);
|
||||
SELECT x,y,st_astext(g) FROM t1 ORDER BY x;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (x INTEGER,
|
||||
y INTEGER,
|
||||
g POINT GENERATED ALWAYS AS (ST_GEOMFROMTEXT('POINT(1 1)', 4326)) STORED NOT NULL SRID 4326);
|
||||
SHOW COLUMNS FROM t1;
|
||||
INSERT INTO t1(x,y) VALUES (0, 0);
|
||||
INSERT INTO t1(x,y) VALUES (0.1, 0.1);
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (x INTEGER,
|
||||
y INTEGER,
|
||||
g POINT GENERATED ALWAYS AS (ST_GEOMFROMTEXT('POINT(1 1)', 0)) STORED NOT NULL SRID 4326);
|
||||
SHOW COLUMNS FROM t1;
|
||||
--error 3643
|
||||
INSERT INTO t1(x,y) VALUES (0, 0);
|
||||
--error 3643
|
||||
INSERT INTO t1(x,y) VALUES (0.1, 0.1);
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (g GEOMETRY NOT NULL SRID 4326,
|
||||
i INT GENERATED ALWAYS AS (ST_INTERSECTS(ST_GEOMFROMTEXT('POINT(0 0)', 4326), g)));
|
||||
SHOW COLUMNS FROM t1;
|
||||
INSERT INTO t1(g) VALUES (ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0)))', 4326));
|
||||
SELECT i,st_astext(g) FROM t1 ORDER BY i;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (g GEOMETRY NOT NULL SRID 4326,
|
||||
i INT GENERATED ALWAYS AS (ST_INTERSECTS(ST_GEOMFROMTEXT('POINT(0 0)', 4326), g)));
|
||||
SHOW COLUMNS FROM t1;
|
||||
INSERT INTO t1(g) VALUES (ST_GEOMFROMTEXT('MULTIPOLYGON(((1 1,10 0,10 10,0 10,1 1)))', 4326));
|
||||
SELECT i,st_astext(g) FROM t1 ORDER BY i;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (g GEOMETRY NOT NULL SRID 4326,
|
||||
i INT GENERATED ALWAYS AS (ST_INTERSECTS(g, ST_GEOMFROMTEXT('POINT(0 0)', 4326))));
|
||||
SHOW COLUMNS FROM t1;
|
||||
INSERT INTO t1(g) VALUES (ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0)))', 4326));
|
||||
SELECT i,st_astext(g) FROM t1 ORDER BY i;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (g GEOMETRY NOT NULL SRID 4326,
|
||||
i INT GENERATED ALWAYS AS (ST_INTERSECTS(g, ST_GEOMFROMTEXT('POINT(0 0)', 4326))));
|
||||
SHOW COLUMNS FROM t1;
|
||||
INSERT INTO t1(g) VALUES (ST_GEOMFROMTEXT('MULTIPOLYGON(((1 1,10 0,10 10,0 10,1 1)))', 4326));
|
||||
SELECT i,st_astext(g) FROM t1 ORDER BY i;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (g GEOMETRY NOT NULL SRID 4326,
|
||||
i INT GENERATED ALWAYS AS (ST_INTERSECTS(ST_GEOMFROMTEXT('POINT(0 0)', 4326), g)) STORED);
|
||||
SHOW COLUMNS FROM t1;
|
||||
INSERT INTO t1(g) VALUES (ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0)))', 4326));
|
||||
SELECT i,st_astext(g) FROM t1 ORDER BY i;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (g GEOMETRY NOT NULL SRID 4326,
|
||||
i INT GENERATED ALWAYS AS (ST_INTERSECTS(ST_GEOMFROMTEXT('POINT(0 0)', 4326), g)) STORED);
|
||||
SHOW COLUMNS FROM t1;
|
||||
INSERT INTO t1(g) VALUES (ST_GEOMFROMTEXT('MULTIPOLYGON(((1 1,10 0,10 10,0 10,1 1)))', 4326));
|
||||
SELECT i,st_astext(g) FROM t1 ORDER BY i;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (g GEOMETRY NOT NULL SRID 4326,
|
||||
i INT GENERATED ALWAYS AS (ST_INTERSECTS(g, ST_GEOMFROMTEXT('POINT(0 0)', 4326))) STORED);
|
||||
SHOW COLUMNS FROM t1;
|
||||
INSERT INTO t1(g) VALUES (ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0)))', 4326));
|
||||
SELECT i,st_astext(g) FROM t1 ORDER BY i;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (g GEOMETRY NOT NULL SRID 4326,
|
||||
i INT GENERATED ALWAYS AS (ST_INTERSECTS(g, ST_GEOMFROMTEXT('POINT(0 0)', 4326))) STORED);
|
||||
SHOW COLUMNS FROM t1;
|
||||
INSERT INTO t1(g) VALUES (ST_GEOMFROMTEXT('MULTIPOLYGON(((1 1,10 0,10 10,0 10,1 1)))', 4326));
|
||||
SELECT i,st_astext(g) FROM t1 ORDER BY i;
|
||||
DROP TABLE t1;
|
||||
|
||||
# bugfix:
|
||||
CREATE TABLE t1(id INT, p POLYGON GENERATED ALWAYS AS (ST_GeomFromText('POINT(15 20)',0)) STORED);
|
||||
--error 1416
|
||||
INSERT INTO t1(id) VALUES (1);
|
||||
DROP TABLE t1;
|
||||
@ -0,0 +1,454 @@
|
||||
#owner: ht353245
|
||||
#owner group: shenzhen
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--echo # Base test of GEOMETRY spatial index.
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--source mysql_test/test_suite/geometry/t/import_default_srs_data_mysql.inc
|
||||
|
||||
############################################################################################
|
||||
# Creating the spatial objects #
|
||||
############################################################################################
|
||||
|
||||
let $k=5;
|
||||
--echo #Creating the spatial Geometry object
|
||||
USE test;
|
||||
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS gis_line_with_spatial_index, gis_polygon_with_spatial_index, gis_multipoint_with_spatial_index, gis_multiline_with_spatial_index,
|
||||
gis_point_with_spatial_index, gis_geometrycollection_with_spatial_index, gis_linestring_and_int_with_spatial_index;
|
||||
--enable_warnings
|
||||
|
||||
############################################################################################
|
||||
# POINT: Check indexes for spatial data on same table with spatial index
|
||||
############################################################################################
|
||||
|
||||
CREATE TABLE gis_point_with_spatial_index (fid INTEGER NOT NULL PRIMARY KEY, g POINT
|
||||
NOT NULL SRID 0,spatial index (g) );
|
||||
|
||||
let $i=$k;
|
||||
while ($i)
|
||||
{
|
||||
--eval INSERT INTO gis_point_with_spatial_index VALUES ($i,ST_GEOMFROMTEXT('POINT(100 10)'))
|
||||
dec $i;
|
||||
}
|
||||
|
||||
select count(g) from gis_point_with_spatial_index where ST_AsText(g) like "%100 10%";
|
||||
select ST_AsText(g) from gis_point_with_spatial_index where ST_AsText(g) like "%100 10%";
|
||||
|
||||
DROP TABLE gis_point_with_spatial_index;
|
||||
|
||||
############################################################################################
|
||||
# LINESTRING: Check indexes for spatial data on same table with spatial index
|
||||
############################################################################################
|
||||
|
||||
CREATE TABLE gis_line_with_spatial_index (fid INTEGER NOT NULL PRIMARY KEY, g LINESTRING
|
||||
NOT NULL SRID 0, spatial index (g) );
|
||||
|
||||
let $i=$k;
|
||||
while ($i)
|
||||
{
|
||||
--eval INSERT INTO gis_line_with_spatial_index VALUES ($i,ST_GeomFromText('LINESTRING(100 10,10 100)'))
|
||||
dec $i;
|
||||
}
|
||||
|
||||
select count(g) from gis_line_with_spatial_index where ST_AsText(g) like "%100 10%";
|
||||
select ST_AsText(g) from gis_line_with_spatial_index where ST_AsText(g) like "%100 10%";
|
||||
|
||||
DROP TABLE gis_line_with_spatial_index;
|
||||
|
||||
############################################################################################
|
||||
# POLYGON: Check indexes for spatial data on same table with spatial index
|
||||
############################################################################################
|
||||
|
||||
CREATE TABLE gis_polygon_with_spatial_index (fid INTEGER NOT NULL PRIMARY KEY, g POLYGON
|
||||
NOT NULL SRID 0, spatial index (g) );
|
||||
|
||||
let $i=$k;
|
||||
while ($i)
|
||||
{
|
||||
--eval INSERT INTO gis_polygon_with_spatial_index VALUES ($i,ST_GEOMFROMTEXT('POLYGON((10 10,20 10,20 20,10 20,10 10))'))
|
||||
dec $i;
|
||||
}
|
||||
|
||||
select count(g) from gis_polygon_with_spatial_index where ST_AsText(g) like "%10 10%";
|
||||
select ST_AsText(g) from gis_polygon_with_spatial_index where ST_AsText(g) like "%10 10%";
|
||||
|
||||
DROP TABLE gis_polygon_with_spatial_index;
|
||||
|
||||
############################################################################################
|
||||
# MULTIPOINT: Check indexes for spatial data on same table with spatial index
|
||||
############################################################################################
|
||||
|
||||
CREATE TABLE gis_multipoint_with_spatial_index (fid INTEGER NOT NULL PRIMARY KEY, g MULTIPOINT
|
||||
NOT NULL SRID 0, spatial index (g) );
|
||||
|
||||
let $i=$k;
|
||||
while ($i)
|
||||
{
|
||||
--eval INSERT INTO gis_multipoint_with_spatial_index VALUES ($i,ST_GEOMFROMTEXT('MULTIPOINT(0 0,10 10,10 20,20 20)'))
|
||||
dec $i;
|
||||
}
|
||||
|
||||
select count(g) from gis_multipoint_with_spatial_index where ST_AsText(g) like "%10 10%";
|
||||
select ST_AsText(g) from gis_multipoint_with_spatial_index where ST_AsText(g) like "%10 10%";
|
||||
|
||||
DROP TABLE gis_multipoint_with_spatial_index;
|
||||
|
||||
############################################################################################
|
||||
# MULTILINE: Check indexes for spatial data on same table with spatial index
|
||||
############################################################################################
|
||||
|
||||
CREATE TABLE gis_multiline_with_spatial_index (fid INTEGER NOT NULL PRIMARY KEY, g MULTILINESTRING
|
||||
NOT NULL SRID 0, spatial index (g) );
|
||||
|
||||
let $i=$k;
|
||||
while ($i)
|
||||
{
|
||||
--eval INSERT INTO gis_multiline_with_spatial_index VALUES ($i,ST_GEOMFROMTEXT('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))'))
|
||||
dec $i;
|
||||
}
|
||||
|
||||
select count(g) from gis_multiline_with_spatial_index where ST_AsText(g) like "%10 0%";
|
||||
select ST_AsText(g) from gis_multiline_with_spatial_index where ST_AsText(g) like "%10 0%";
|
||||
|
||||
DROP TABLE gis_multiline_with_spatial_index;
|
||||
|
||||
############################################################################################
|
||||
# MULTIPOLYGON: Check indexes for spatial data on same table with spatial index
|
||||
############################################################################################
|
||||
|
||||
CREATE TABLE gis_multipolygon_with_spatial_index (fid INTEGER NOT NULL PRIMARY KEY, g MULTIPOLYGON
|
||||
NOT NULL SRID 0, spatial index (g) );
|
||||
|
||||
let $i=$k;
|
||||
while ($i)
|
||||
{
|
||||
--eval INSERT INTO gis_multipolygon_with_spatial_index VALUES ($i,ST_GEOMFROMTEXT('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))'))
|
||||
dec $i;
|
||||
}
|
||||
|
||||
select count(g) from gis_multipolygon_with_spatial_index where ST_AsText(g) like "%10 10%";
|
||||
select ST_AsText(g) from gis_multipolygon_with_spatial_index where ST_AsText(g) like "%10 10%";
|
||||
select count(g) from gis_multipolygon_with_spatial_index where ST_AsText(g) like "%84 0%";
|
||||
select ST_AsText(g) from gis_multipolygon_with_spatial_index where ST_AsText(g) like "%84 0%";
|
||||
|
||||
DROP TABLE gis_multipolygon_with_spatial_index;
|
||||
|
||||
############################################################################################
|
||||
# GEOMETRY COLLECTION: Check indexes for spatial data on same table with spatial index
|
||||
############################################################################################
|
||||
|
||||
CREATE TABLE gis_geometrycollection_with_spatial_index (fid INTEGER NOT NULL PRIMARY KEY, g GEOMETRYCOLLECTION
|
||||
NOT NULL SRID 0, spatial index (g) );
|
||||
|
||||
let $i=$k;
|
||||
while ($i)
|
||||
{
|
||||
--eval INSERT INTO gis_geometrycollection_with_spatial_index VALUES ($i,ST_GeomFromText('GEOMETRYCOLLECTION(POINT(10 10), LINESTRING(10 10,20 20))'))
|
||||
dec $i;
|
||||
}
|
||||
|
||||
select count(g) from gis_geometrycollection_with_spatial_index where ST_AsText(g) like "%10 10%";
|
||||
select ST_AsText(g) from gis_geometrycollection_with_spatial_index where ST_AsText(g) like "%10 10%";
|
||||
|
||||
DROP TABLE gis_geometrycollection_with_spatial_index;
|
||||
|
||||
############################################################################################
|
||||
# GEOMETRY COLLECTION: Check indexes for spatial data on same table with spatial index
|
||||
############################################################################################
|
||||
|
||||
CREATE TABLE gis_geometry_with_spatial_index (fid INTEGER NOT NULL PRIMARY KEY, g GEOMETRY
|
||||
NOT NULL SRID 0, spatial index (g) );
|
||||
|
||||
let $i=$k;
|
||||
while ($i)
|
||||
{
|
||||
--eval INSERT INTO gis_geometry_with_spatial_index VALUES ($i,ST_GeomFromText('GEOMETRYCOLLECTION(POINT(10 10), LINESTRING(10 10,20 20))'))
|
||||
dec $i;
|
||||
}
|
||||
|
||||
select count(g) from gis_geometry_with_spatial_index where ST_AsText(g) like "%10 10%";
|
||||
select ST_AsText(g) from gis_geometry_with_spatial_index where ST_AsText(g) like "%10 10%";
|
||||
|
||||
DROP TABLE gis_geometry_with_spatial_index;
|
||||
|
||||
############################################################################################
|
||||
# Check indexes for spatial data and normal data on same table with spatial index
|
||||
############################################################################################
|
||||
# Create some data for point table
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS gis_point_and_int_with_spatial_index;
|
||||
--enable_warnings
|
||||
CREATE TABLE gis_point_and_int_with_spatial_index (fid INTEGER NOT NULL PRIMARY KEY, g POINT
|
||||
NOT NULL SRID 0,spatial index (g) );
|
||||
|
||||
let $i=$k;
|
||||
while ($i)
|
||||
{
|
||||
--eval INSERT INTO gis_point_and_int_with_spatial_index VALUES ($i,ST_GEOMFROMTEXT('POINT(100 10)'))
|
||||
dec $i;
|
||||
}
|
||||
|
||||
select count(g) from gis_point_and_int_with_spatial_index where ST_AsText(g) like "%100 10%";
|
||||
select ST_AsText(g) from gis_point_and_int_with_spatial_index where ST_AsText(g) like "%100 10%";
|
||||
|
||||
DROP TABLE gis_point_and_int_with_spatial_index;
|
||||
|
||||
############################################################################################
|
||||
# Check indexes for spatial data and normal data on same table with spatial index
|
||||
############################################################################################
|
||||
CREATE TABLE gis_point_and_int_with_spatial_index (fid INTEGER NOT NULL PRIMARY KEY, g POINT
|
||||
NOT NULL SRID 0, a int, spatial index (g) );
|
||||
# Inserting the values specific to the spatial objects #
|
||||
--echo #INSERT valid entries to Point class
|
||||
INSERT INTO gis_point_and_int_with_spatial_index VALUES
|
||||
(101, ST_GEOMFROMTEXT('POINT(10 10)'),1),
|
||||
(102, ST_GEOMFROMTEXT('POINT(10 20)'),21),
|
||||
(103, ST_GEOMFROMTEXT('POINT(100 20)'),3),
|
||||
(104, ST_GEOMFROMTEXT('POINT(100 20)'),3);
|
||||
|
||||
#check the index was created properly
|
||||
SELECT COUNT(g) FROM gis_point_and_int_with_spatial_index WHERE ST_AsText(g) LIKE "%point%";
|
||||
#the count should be 4
|
||||
|
||||
#drop the index
|
||||
ALTER TABLE gis_point_and_int_with_spatial_index DROP INDEX g;
|
||||
CREATE SPATIAL INDEX g ON gis_point_and_int_with_spatial_index (g);
|
||||
#check the index was created properly
|
||||
SELECT COUNT(g) FROM gis_point_and_int_with_spatial_index WHERE ST_AsText(g) LIKE "%point%";
|
||||
#the count should be 4
|
||||
|
||||
#drop the spatial index
|
||||
ALTER TABLE gis_point_and_int_with_spatial_index DROP INDEX g;
|
||||
#create index on non-indexed non-spatial data
|
||||
CREATE INDEX a ON gis_point_and_int_with_spatial_index (a) ;
|
||||
#check for data consistency
|
||||
select count(g) from gis_point_and_int_with_spatial_index where a like "%3%";
|
||||
select ST_AsText(g) from gis_point_and_int_with_spatial_index where a like "%3%";
|
||||
|
||||
DROP TABLE gis_point_and_int_with_spatial_index;
|
||||
|
||||
############################################################################################
|
||||
#POINT: Check indexes for spatial data and normal data on same table with spatial index
|
||||
############################################################################################
|
||||
CREATE TABLE gis_point_and_int_with_spatial_index (fid INTEGER NOT NULL PRIMARY KEY, g POINT
|
||||
NOT NULL SRID 0, a int, index (a) );
|
||||
# Inserting the values specific to the spatial objects #
|
||||
--echo #INSERT valid entries to Point class
|
||||
INSERT INTO gis_point_and_int_with_spatial_index VALUES
|
||||
(101, ST_GEOMFROMTEXT('POINT(10 10)'),1),
|
||||
(102, ST_GEOMFROMTEXT('POINT(10 20)'),21),
|
||||
(103, ST_GEOMFROMTEXT('POINT(100 20)'),3),
|
||||
(104, ST_GEOMFROMTEXT('POINT(101 20)'),3);
|
||||
|
||||
#check the index was created properly
|
||||
select count(g) from gis_point_and_int_with_spatial_index where a like "%3%";
|
||||
#the count should be 2
|
||||
SELECT COUNT(a) FROM gis_point_and_int_with_spatial_index WHERE a LIKE "%3%";
|
||||
#the count should be 2
|
||||
|
||||
#drop the non spatial index and recreate the spatial index
|
||||
ALTER TABLE gis_point_and_int_with_spatial_index DROP INDEX a;
|
||||
CREATE SPATIAL INDEX g ON gis_point_and_int_with_spatial_index (g);
|
||||
|
||||
#check the index was created properly
|
||||
SELECT COUNT(g) FROM gis_point_and_int_with_spatial_index WHERE ST_AsText(g) LIKE "%point%";
|
||||
#the count should be 2
|
||||
SELECT COUNT(a) FROM gis_point_and_int_with_spatial_index WHERE ST_AsText(g) LIKE "%point%";
|
||||
#the count should be 2
|
||||
|
||||
#create a spatial index on a non existing column
|
||||
#CREATE SPATIAL INDEX g ON gis_point_and_int_with_spatial_index (b);
|
||||
|
||||
DROP TABLE gis_point_and_int_with_spatial_index ;
|
||||
|
||||
############################################################################################
|
||||
#LINESTRING: Check indexes for spatial data and normal data on same table with spatial index
|
||||
############################################################################################
|
||||
CREATE TABLE gis_linestring_and_int_with_spatial_index (fid INTEGER NOT NULL PRIMARY KEY, g LINESTRING
|
||||
NOT NULL SRID 0, a int, spatial index (g) );
|
||||
# Inserting the values specific to the spatial objects #
|
||||
--echo #INSERT valid entries to Point class
|
||||
INSERT INTO gis_linestring_and_int_with_spatial_index VALUES
|
||||
(201,ST_GEOMFROMTEXT('LINESTRING(0 0,0 10,10 0)'),1),
|
||||
(202,ST_GEOMFROMTEXT('LINESTRING(1 1,1 10,10 20)'),2),
|
||||
(203,ST_GEOMFROMTEXT('LINESTRING(1 1,1 10,10 20)'),2);
|
||||
#check the index was created properly
|
||||
select count(g) from gis_linestring_and_int_with_spatial_index where ST_AsText(g) like "%0%";
|
||||
select count(a) from gis_linestring_and_int_with_spatial_index where ST_AsText(g) like "%0%";
|
||||
select count(a) from gis_linestring_and_int_with_spatial_index where ST_AsText(g) like "%10 10%";
|
||||
|
||||
#drop the spatial index
|
||||
ALTER TABLE gis_linestring_and_int_with_spatial_index DROP INDEX g;
|
||||
#create index on non-indexed non-spatial data
|
||||
CREATE INDEX a ON gis_linestring_and_int_with_spatial_index (a) ;
|
||||
|
||||
#check the index created on a
|
||||
SELECT COUNT(g) FROM gis_linestring_and_int_with_spatial_index WHERE a LIKE "%2%";
|
||||
|
||||
#drop the index
|
||||
ALTER TABLE gis_linestring_and_int_with_spatial_index DROP INDEX a;
|
||||
#create index on non-indexed spatial data
|
||||
CREATE SPATIAL INDEX g ON gis_linestring_and_int_with_spatial_index (g) ;
|
||||
#check the index created on a
|
||||
SELECT COUNT(g) FROM gis_linestring_and_int_with_spatial_index WHERE ST_AsText(g) LIKE "%2%";
|
||||
|
||||
DROP TABLE gis_linestring_and_int_with_spatial_index ;
|
||||
|
||||
############################################################################################
|
||||
#MULTILINE: Check indexes for spatial data and normal data on same table with spatial index
|
||||
############################################################################################
|
||||
CREATE TABLE gis_multilinestring_and_int_with_spatial_index (fid INTEGER PRIMARY KEY, g MULTILINESTRING
|
||||
NOT NULL SRID 0, a int, spatial index (g) );
|
||||
# Inserting the values specific to the spatial objects #
|
||||
--echo #INSERT valid entries to Point class
|
||||
INSERT INTO gis_multilinestring_and_int_with_spatial_index VALUES
|
||||
(300,ST_GEOMFROMTEXT('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))'),1),
|
||||
(301,ST_GEOMFROMTEXT('MULTILINESTRING((130 48,180 21,10 90),(916 0,516 2373223,816 48))'),1),
|
||||
(302,ST_GEOMFROMTEXT('MULTILINESTRING((180 48,10 25891,160 0),(5416 0,19096 29093,19096 498))'),1);
|
||||
#check the index was created properly
|
||||
select count(g) from gis_multilinestring_and_int_with_spatial_index where ST_AsText(g) like "%48%";
|
||||
select count(a) from gis_multilinestring_and_int_with_spatial_index where ST_AsText(g) like "%48%";
|
||||
|
||||
|
||||
#drop the spatial index
|
||||
ALTER TABLE gis_multilinestring_and_int_with_spatial_index DROP INDEX g;
|
||||
#create index on non-indexed non-spatial data
|
||||
CREATE INDEX a ON gis_multilinestring_and_int_with_spatial_index (a) ;
|
||||
|
||||
#check the index created on a
|
||||
SELECT COUNT(g) FROM gis_multilinestring_and_int_with_spatial_index WHERE a LIKE "%2%";
|
||||
|
||||
#drop the index
|
||||
ALTER TABLE gis_multilinestring_and_int_with_spatial_index DROP INDEX a;
|
||||
#create index on non-indexed spatial data
|
||||
CREATE SPATIAL INDEX g ON gis_multilinestring_and_int_with_spatial_index (g) ;
|
||||
#check the index created on a
|
||||
SELECT COUNT(g) FROM gis_multilinestring_and_int_with_spatial_index WHERE ST_AsText(g) LIKE "%48%";
|
||||
|
||||
DROP TABLE gis_multilinestring_and_int_with_spatial_index ;
|
||||
|
||||
############################################################################################
|
||||
#POLYGON: Check indexes for spatial data and normal data on same table with spatial index
|
||||
############################################################################################
|
||||
CREATE TABLE gis_polygon_and_int_with_spatial_index (fid INTEGER PRIMARY KEY, g POLYGON
|
||||
NOT NULL SRID 0, a int, spatial index (g) );
|
||||
# Inserting the values specific to the spatial objects #
|
||||
--echo #INSERT valid entries to Point class
|
||||
INSERT INTO gis_polygon_and_int_with_spatial_index VALUES
|
||||
(300,ST_GEOMFROMTEXT('POLYGON((183670 10,2470 10,20 249380,10 254760,183670 10))'),12),
|
||||
(301,ST_GEOMFROMTEXT('POLYGON((10 10,20 10,20 20,10 20,10 10))'),2),
|
||||
(302,ST_GEOMFROMTEXT('POLYGON((110 10,320 310,2550 8520,1059 2590,110 10))'),2),
|
||||
(303,ST_GEOMFROMTEXT('POLYGON((180 160,55620 5610,240 206560,10 285960,180 160))'),2);
|
||||
#check the index was created properly
|
||||
select count(g) from gis_polygon_and_int_with_spatial_index where ST_AsText(g) like "%10 10%";
|
||||
select count(a) from gis_polygon_and_int_with_spatial_index where ST_AsText(g) like "%10 10%";
|
||||
|
||||
|
||||
#drop the spatial index
|
||||
ALTER TABLE gis_polygon_and_int_with_spatial_index DROP INDEX g;
|
||||
#create index on non-indexed non-spatial data
|
||||
CREATE INDEX a ON gis_polygon_and_int_with_spatial_index (a) ;
|
||||
|
||||
#check the index created on a
|
||||
SELECT COUNT(g) FROM gis_polygon_and_int_with_spatial_index WHERE a LIKE "%2%";
|
||||
|
||||
#drop the index
|
||||
ALTER TABLE gis_polygon_and_int_with_spatial_index DROP INDEX a;
|
||||
#create index on non-indexed spatial data
|
||||
CREATE SPATIAL INDEX g ON gis_polygon_and_int_with_spatial_index (g) ;
|
||||
#check the index created on a
|
||||
SELECT COUNT(g) FROM gis_polygon_and_int_with_spatial_index WHERE ST_AsText(g) LIKE "%48%";
|
||||
|
||||
DROP TABLE gis_polygon_and_int_with_spatial_index ;
|
||||
|
||||
############################################################################################
|
||||
#MULTIPOLYGON: Check indexes for spatial data and normal data on same table with spatial index
|
||||
############################################################################################
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS gis_multipolygon_and_int_with_spatial_index;
|
||||
--enable_warnings
|
||||
CREATE TABLE gis_multipolygon_and_int_with_spatial_index (fid INTEGER PRIMARY KEY, g multiPOLYGON
|
||||
NOT NULL SRID 0, a int, spatial index (g) );
|
||||
# Inserting the values specific to the spatial objects #
|
||||
--echo #INSERT valid entries to Point class
|
||||
INSERT INTO gis_multipolygon_and_int_with_spatial_index VALUES
|
||||
(1,ST_GEOMFROMTEXT('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))'),1),
|
||||
(2,ST_GEOMFROMTEXT('MULTIPOLYGON(((28 26,28 0,864 0,8984 42,28 26),(2 18,66 348345723,73 9,48 6,2 18)),((519 18,67 18,348345767 13,59 13,519 18)))'),1),
|
||||
(5,ST_GEOMFROMTEXT('MULTIPOLYGON(((254397348 26,28 0,84 0,84 42,254397348 26),(52 18,634834576 23,73 9,48 34834576,52 18)),((59 18,67 18,67 13,59 13,59 18)))'),1),
|
||||
(9,ST_GEOMFROMTEXT('MULTIPOLYGON(((28 26,28 0,84 0,834834574 42,28 26),(52 18,348345766 23,73 9,434834578 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))'),1);
|
||||
#check the index was created properly
|
||||
select count(g) from gis_multipolygon_and_int_with_spatial_index where ST_AsText(g) like "%59 18%";
|
||||
select count(a) from gis_multipolygon_and_int_with_spatial_index where ST_AsText(g) like "%59 18%";
|
||||
|
||||
|
||||
#drop the spatial index
|
||||
ALTER TABLE gis_multipolygon_and_int_with_spatial_index DROP INDEX g;
|
||||
#create index on non-indexed non-spatial data
|
||||
CREATE INDEX a ON gis_multipolygon_and_int_with_spatial_index (a) ;
|
||||
|
||||
#check the index created on a
|
||||
SELECT COUNT(g) FROM gis_multipolygon_and_int_with_spatial_index WHERE a LIKE "%1%";
|
||||
|
||||
#drop the index
|
||||
ALTER TABLE gis_multipolygon_and_int_with_spatial_index DROP INDEX a;
|
||||
#create index on non-indexed spatial data
|
||||
CREATE SPATIAL INDEX g ON gis_multipolygon_and_int_with_spatial_index (g) ;
|
||||
#check the index created on a
|
||||
SELECT COUNT(g) FROM gis_multipolygon_and_int_with_spatial_index WHERE ST_AsText(g) LIKE "%18%";
|
||||
|
||||
|
||||
############################################################################################
|
||||
#Some erors around spatial index
|
||||
############################################################################################
|
||||
DROP TABLE gis_multipolygon_and_int_with_spatial_index ;
|
||||
if (0) { #TODO: @linjing adapt
|
||||
--error 3728 #ER_SPATIAL_UNIQUE_INDEX
|
||||
CREATE TABLE gis_multipolygon_and_int_with_spatial_index (fid INTEGER NOT NULL, g MULTIPOLYGON PRIMARY KEY, a int);
|
||||
|
||||
--error 3728
|
||||
CREATE TABLE gis_multipolygon_and_int_with_spatial_index (fid INTEGER NOT NULL, g MULTIPOLYGON, a int, unique index (g) );
|
||||
|
||||
--error 1252 # ER_SPATIAL_CANT_HAVE_NULL
|
||||
CREATE TABLE gis_multipolygon_and_int_with_spatial_index (fid INTEGER NOT NULL, g MULTIPOLYGON, a int, spatial index (g) );
|
||||
|
||||
--error 1687 #ER_SPATIAL_MUST_HAVE_GEOM_COL
|
||||
CREATE TABLE gis_multipolygon_and_int_with_spatial_index (fid INTEGER NOT NULL, g MULTIPOLYGON, a int, spatial index (fid) );
|
||||
}
|
||||
CREATE TABLE gis_multipolygon_and_int_with_spatial_index (fid INTEGER PRIMARY KEY, g MULTIPOLYGON
|
||||
NOT NULL SRID 0, a int, spatial index (g) );
|
||||
# Inserting the values specific to the spatial objects #
|
||||
--echo #INSERT valid entries to Point class
|
||||
INSERT INTO gis_multipolygon_and_int_with_spatial_index VALUES
|
||||
(1,ST_GEOMFROMTEXT('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))'),1),
|
||||
(2,ST_GEOMFROMTEXT('MULTIPOLYGON(((28 26,28 0,864 0,8984 42,28 26),(2 18,66 348345723,73 9,48 6,2 18)),((519 18,67 18,348345767 13,59 13,519 18)))'),1),
|
||||
(5,ST_GEOMFROMTEXT('MULTIPOLYGON(((254397348 26,28 0,84 0,84 42,254397348 26),(52 18,634834576 23,73 9,48 34834576,52 18)),((59 18,67 18,67 13,59 13,59 18)))'),1),
|
||||
(9,ST_GEOMFROMTEXT('MULTIPOLYGON(((28 26,28 0,84 0,834834574 42,28 26),(52 18,348345766 23,73 9,434834578 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))'),1);
|
||||
#check the index was created properly
|
||||
select count(g) from gis_multipolygon_and_int_with_spatial_index where ST_AsText(g) like "%59 18%";
|
||||
select count(a) from gis_multipolygon_and_int_with_spatial_index where ST_AsText(g) like "%59 18%";
|
||||
|
||||
#drop the spatial index
|
||||
ALTER TABLE gis_multipolygon_and_int_with_spatial_index DROP INDEX g;
|
||||
#create index on non-indexed non-spatial data
|
||||
CREATE INDEX a ON gis_multipolygon_and_int_with_spatial_index (a) ;
|
||||
|
||||
#check the index created on a
|
||||
SELECT COUNT(g) FROM gis_multipolygon_and_int_with_spatial_index WHERE a LIKE "%1%";
|
||||
|
||||
#drop the index
|
||||
ALTER TABLE gis_multipolygon_and_int_with_spatial_index DROP INDEX a;
|
||||
#create index on non-indexed spatial data
|
||||
CREATE INDEX g ON gis_multipolygon_and_int_with_spatial_index (g) ;
|
||||
DROP INDEX g ON gis_multipolygon_and_int_with_spatial_index;
|
||||
#create index on non-indexed spatial data
|
||||
--error 1687
|
||||
CREATE SPATIAL INDEX a ON gis_multipolygon_and_int_with_spatial_index (a) ;
|
||||
#create index on non-indexed spatial data
|
||||
CREATE SPATIAL INDEX g ON gis_multipolygon_and_int_with_spatial_index (g) ;
|
||||
#check the index created on a
|
||||
SELECT COUNT(g) FROM gis_multipolygon_and_int_with_spatial_index WHERE ST_AsText(g) LIKE "%18%";
|
||||
|
||||
DROP TABLE gis_multipolygon_and_int_with_spatial_index ;
|
||||
@ -0,0 +1,546 @@
|
||||
#owner: ht353245
|
||||
#owner group: shenzhen
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--echo # Base test of GEOMETRY spatial index.
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--source mysql_test/test_suite/geometry/t/import_default_srs_data_mysql.inc
|
||||
|
||||
### 6. Test for alter spatial index.
|
||||
if (1) {
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS tab;
|
||||
--enable_warnings
|
||||
CREATE TABLE tab(c1 int NOT NULL,c2 GEOMETRY NOT NULL SRID 0,
|
||||
c3 GEOMETRY NOT NULL SRID 0,c4 GEOMETRY NOT NULL SRID 0,c5 GEOMETRY NOT NULL SRID 0);
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS tab1;
|
||||
--enable_warnings
|
||||
CREATE TABLE tab1(c1 int NOT NULL PRIMARY KEY,c2 GEOMETRY NOT NULL SRID 0,
|
||||
c3 GEOMETRY NOT NULL SRID 0,c4 GEOMETRY NOT NULL SRID 0,c5 GEOMETRY NOT NULL SRID 0);
|
||||
|
||||
INSERT INTO tab1 SELECT * FROM tab;
|
||||
|
||||
INSERT INTO tab(c1,c2,c3,c4,c5)
|
||||
VALUES(1,ST_GeomFromText('POINT(10 10)'),ST_GeomFromText('LINESTRING(5 5,20 20,30 30)'),
|
||||
ST_GeomFromText('POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))'),
|
||||
ST_GeomFromText('POLYGON((30 30,40 40,50 50,30 50,30 40,30 30))'));
|
||||
|
||||
INSERT INTO tab(c1,c2,c3,c4,c5)
|
||||
VALUES(2,ST_GeomFromText('POINT(20 20)'),ST_GeomFromText('LINESTRING(20 20,30 30,40 40)'),
|
||||
ST_GeomFromText('POLYGON((40 50,40 70,50 89,70 89,80 80,70 50,40 50))'),
|
||||
ST_GeomFromText('POLYGON((40 50,40 70,50 89,70 89,80 80,70 50,40 50))'));
|
||||
|
||||
INSERT INTO tab(c1,c2,c3,c4,c5)
|
||||
VALUES(3,ST_GeomFromText('POINT(4 4)'),ST_GeomFromText('LINESTRING(13 13,14 14,15 15)'),
|
||||
ST_GeomFromText('POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'),
|
||||
ST_GeomFromText('POLYGON((4 -2,5 -4,6 -5,7 -4,7 2,4 -2))'));
|
||||
|
||||
ALTER TABLE tab ADD SPATIAL INDEX idx2(c2);
|
||||
|
||||
--error 1221
|
||||
ALTER TABLE tab ADD SPATIAL KEY idx3(c3 DESC);
|
||||
|
||||
--error 1221
|
||||
ALTER TABLE tab ADD SPATIAL KEY idx3(c3 ASC);
|
||||
|
||||
ALTER TABLE tab ADD SPATIAL INDEX idx4(c4) COMMENT 'testing spatial index on Polygon';
|
||||
|
||||
ALTER TABLE tab ADD SPATIAL KEY idx5(c5) COMMENT 'testing spatial index on Geometry';
|
||||
|
||||
drop index idx4 on tab;
|
||||
|
||||
ALTER TABLE tab ADD INDEX idx6(c4) USING BTREE;
|
||||
}
|
||||
|
||||
--echo #
|
||||
--echo # Bug #21087676 FORBID BUILDING NON-SPATIAL INDEX ON GEOMETRY COLUMNS
|
||||
--echo #
|
||||
|
||||
if (0) {#TODO: @linjing adapt
|
||||
--echo # Primary key on geometry column is not allowed.
|
||||
--error 3728
|
||||
CREATE TABLE t1 (g GEOMETRY SRID 0 PRIMARY KEY);
|
||||
--error 3728
|
||||
CREATE TABLE t1 (g GEOMETRY SRID 0 NOT NULL PRIMARY KEY);
|
||||
CREATE TABLE t1 (g GEOMETRY SRID 0);
|
||||
--error 3728
|
||||
ALTER TABLE t1 ADD PRIMARY KEY (g);
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo # Unique index on geometry column is not allowed.
|
||||
--error 3728
|
||||
CREATE TABLE t1 (g GEOMETRY SRID 0 UNIQUE);
|
||||
--error 3728
|
||||
CREATE TABLE t1 (g GEOMETRY SRID 0 NOT NULL UNIQUE);
|
||||
CREATE TABLE t1 (g GEOMETRY SRID 0);
|
||||
--error 3728
|
||||
CREATE UNIQUE INDEX g_idx ON t1(g);
|
||||
--error 3728
|
||||
ALTER TABLE t1 ADD UNIQUE INDEX (g);
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (g GEOMETRY SRID 0 NOT NULL);
|
||||
--error 3728
|
||||
CREATE UNIQUE INDEX g_idx ON t1(g);
|
||||
--error 3728
|
||||
ALTER TABLE t1 ADD UNIQUE INDEX (g);
|
||||
DROP TABLE t1;
|
||||
}
|
||||
|
||||
if (0) { #TODO: @linjing adapt
|
||||
--echo # Prefix index on geometry column is not allowed.
|
||||
--error ER_WRONG_SUB_KEY
|
||||
CREATE TABLE t1 (g GEOMETRY SRID 0, INDEX (g(10)));
|
||||
--error ER_WRONG_SUB_KEY
|
||||
CREATE TABLE t1 (g GEOMETRY SRID 0 NOT NULL, INDEX (g(10)));
|
||||
CREATE TABLE t1 (g GEOMETRY SRID 0);
|
||||
--error ER_WRONG_SUB_KEY
|
||||
CREATE INDEX g_idx ON t1(g(10));
|
||||
--error ER_WRONG_SUB_KEY
|
||||
ALTER TABLE t1 ADD INDEX (g(10));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (g GEOMETRY SRID 0 NOT NULL);
|
||||
--error ER_WRONG_SUB_KEY
|
||||
CREATE INDEX g_idx ON t1(g(10));
|
||||
--error ER_WRONG_SUB_KEY
|
||||
ALTER TABLE t1 ADD INDEX (g(10));
|
||||
DROP TABLE t1;
|
||||
}
|
||||
|
||||
--echo # Multi-column index on geometry column is not allowed.
|
||||
--error ER_TOO_MANY_KEY_PARTS
|
||||
CREATE TABLE t1 (
|
||||
g1 GEOMETRY SRID 0 NOT NULL,
|
||||
g2 GEOMETRY SRID 0 NOT NULL,
|
||||
INDEX (g1, g2)
|
||||
);
|
||||
--error ER_TOO_MANY_KEY_PARTS
|
||||
CREATE TABLE t1 (
|
||||
g1 GEOMETRY SRID 0,
|
||||
g2 GEOMETRY SRID 0,
|
||||
INDEX (g1, g2)
|
||||
);
|
||||
--error ER_TOO_MANY_KEY_PARTS
|
||||
CREATE TABLE t1 (g GEOMETRY SRID 0, a INT, INDEX (g, a));
|
||||
--error ER_TOO_MANY_KEY_PARTS
|
||||
CREATE TABLE t1 (g GEOMETRY SRID 0 NOT NULL, a INT, INDEX (g, a));
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
CREATE TABLE t1 (g1 GEOMETRY SRID 0, g2 GEOMETRY SRID 0, a INT);
|
||||
--error ER_TOO_MANY_KEY_PARTS
|
||||
CREATE INDEX g_idx ON t1(g1, g2);
|
||||
--error ER_TOO_MANY_KEY_PARTS
|
||||
CREATE INDEX g_idx ON t1(g1, a);
|
||||
--error ER_TOO_MANY_KEY_PARTS
|
||||
ALTER TABLE t1 ADD INDEX (g1, g2);
|
||||
--error ER_TOO_MANY_KEY_PARTS
|
||||
ALTER TABLE t1 ADD INDEX (g1, a);
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
g1 GEOMETRY SRID 0 NOT NULL,
|
||||
g2 GEOMETRY SRID 0 NOT NULL,
|
||||
a INT
|
||||
);
|
||||
--error ER_TOO_MANY_KEY_PARTS
|
||||
CREATE INDEX g_idx ON t1(g1, g2);
|
||||
--error ER_TOO_MANY_KEY_PARTS
|
||||
CREATE INDEX g_idx ON t1(g1, a);
|
||||
--error ER_TOO_MANY_KEY_PARTS
|
||||
ALTER TABLE t1 ADD INDEX (g1, g2);
|
||||
--error ER_TOO_MANY_KEY_PARTS
|
||||
ALTER TABLE t1 ADD INDEX (g1, a);
|
||||
DROP TABLE t1;
|
||||
|
||||
if (0) {
|
||||
--echo # Explicit B-tree index on geometry column is not allowed.
|
||||
--error 1252
|
||||
CREATE TABLE t1 (g GEOMETRY SRID 0, INDEX (g) USING BTREE);
|
||||
--error 3729
|
||||
CREATE TABLE t1 (g GEOMETRY SRID 0 NOT NULL, INDEX (g) USING BTREE);
|
||||
CREATE TABLE t1 (g GEOMETRY SRID 0);
|
||||
--error 3729
|
||||
CREATE INDEX g_idx ON t1(g) USING BTREE;
|
||||
--error 3729
|
||||
ALTER TABLE t1 ADD INDEX (g) USING BTREE;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (g GEOMETRY SRID 0 NOT NULL);
|
||||
--error 3729
|
||||
CREATE INDEX g_idx ON t1(g) USING BTREE;
|
||||
--error 3729
|
||||
ALTER TABLE t1 ADD INDEX (g) USING BTREE;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo # Explicit hash index on geometry column is not allowed.
|
||||
--error 3729
|
||||
CREATE TABLE t1 (g GEOMETRY SRID 0, INDEX (g) USING HASH);
|
||||
--error 3729
|
||||
CREATE TABLE t1 (g GEOMETRY SRID 0 NOT NULL, INDEX (g) USING HASH);
|
||||
CREATE TABLE t1 (g GEOMETRY SRID 0);
|
||||
--error 3729
|
||||
CREATE INDEX g_idx ON t1(g) USING HASH;
|
||||
--error 3729
|
||||
ALTER TABLE t1 ADD INDEX (g) USING HASH;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (g GEOMETRY SRID 0 NOT NULL);
|
||||
--error 3729
|
||||
CREATE INDEX g_idx ON t1(g) USING HASH;
|
||||
--error 3729
|
||||
ALTER TABLE t1 ADD INDEX (g) USING HASH;
|
||||
DROP TABLE t1;
|
||||
}
|
||||
|
||||
--echo # Explicit ASC index on geometry column is not allowed.
|
||||
# Without SPATIAL keyword.
|
||||
--error 1221
|
||||
CREATE TABLE t1 (g GEOMETRY SRID 0, INDEX (g ASC));
|
||||
--error 1221
|
||||
CREATE TABLE t1 (g GEOMETRY SRID 0 NOT NULL, INDEX (g ASC));
|
||||
CREATE TABLE t1 (g GEOMETRY SRID 0);
|
||||
--error 1221
|
||||
CREATE INDEX g_idx ON t1(g ASC);
|
||||
--error 1221
|
||||
ALTER TABLE t1 ADD INDEX (g ASC);
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (g GEOMETRY SRID 0 NOT NULL);
|
||||
--error 1221
|
||||
CREATE INDEX g_idx ON t1(g ASC);
|
||||
--error 1221
|
||||
ALTER TABLE t1 ADD INDEX (g ASC);
|
||||
DROP TABLE t1;
|
||||
# With SPATIAL keyword.
|
||||
--error 1221
|
||||
CREATE TABLE t1 (g GEOMETRY SRID 0, SPATIAL INDEX (g ASC));
|
||||
--error 1221
|
||||
CREATE TABLE t1 (g GEOMETRY SRID 0 NOT NULL, SPATIAL INDEX (g ASC));
|
||||
CREATE TABLE t1 (g GEOMETRY SRID 0);
|
||||
--error 1221
|
||||
CREATE SPATIAL INDEX g_idx ON t1(g ASC);
|
||||
--error 1221
|
||||
ALTER TABLE t1 ADD SPATIAL INDEX (g ASC);
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (g GEOMETRY SRID 0 NOT NULL);
|
||||
--error 1221
|
||||
CREATE SPATIAL INDEX g_idx ON t1(g ASC);
|
||||
--error 1221
|
||||
ALTER TABLE t1 ADD SPATIAL INDEX (g ASC);
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo # Explicit DESC index on geometry column is not allowed.
|
||||
# Without SPATIAL keyword.
|
||||
--error 1221
|
||||
CREATE TABLE t1 (g GEOMETRY SRID 0, INDEX (g DESC));
|
||||
--error 1221
|
||||
CREATE TABLE t1 (g GEOMETRY SRID 0 NOT NULL, INDEX (g DESC));
|
||||
CREATE TABLE t1 (g GEOMETRY SRID 0);
|
||||
--error 1221
|
||||
CREATE INDEX g_idx ON t1(g DESC);
|
||||
--error 1221
|
||||
ALTER TABLE t1 ADD INDEX (g DESC);
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (g GEOMETRY SRID 0 NOT NULL);
|
||||
--error 1221
|
||||
CREATE INDEX g_idx ON t1(g DESC);
|
||||
--error 1221
|
||||
ALTER TABLE t1 ADD INDEX (g DESC);
|
||||
DROP TABLE t1;
|
||||
# With SPATIAL keyword.
|
||||
--error 1221
|
||||
CREATE TABLE t1 (g GEOMETRY SRID 0, SPATIAL INDEX (g DESC));
|
||||
--error 1221
|
||||
CREATE TABLE t1 (g GEOMETRY SRID 0 NOT NULL, SPATIAL INDEX (g DESC));
|
||||
CREATE TABLE t1 (g GEOMETRY SRID 0);
|
||||
--error 1221
|
||||
CREATE SPATIAL INDEX g_idx ON t1(g DESC);
|
||||
--error 1221
|
||||
ALTER TABLE t1 ADD SPATIAL INDEX (g DESC);
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (g GEOMETRY SRID 0 NOT NULL);
|
||||
--error 1221
|
||||
CREATE SPATIAL INDEX g_idx ON t1(g DESC);
|
||||
--error 1221
|
||||
ALTER TABLE t1 ADD SPATIAL INDEX (g DESC);
|
||||
DROP TABLE t1;
|
||||
|
||||
if (0) {
|
||||
--echo # Fulltext index on geometry column is not allowed.
|
||||
--error ER_BAD_FT_COLUMN
|
||||
CREATE TABLE t1 (g GEOMETRY SRID 0, FULLTEXT INDEX (g));
|
||||
--error ER_BAD_FT_COLUMN
|
||||
CREATE TABLE t1 (g GEOMETRY SRID 0 NOT NULL, FULLTEXT INDEX (g));
|
||||
CREATE TABLE t1 (g GEOMETRY SRID 0);
|
||||
--error ER_BAD_FT_COLUMN
|
||||
CREATE FULLTEXT INDEX g_idx ON t1(g);
|
||||
--error ER_BAD_FT_COLUMN
|
||||
ALTER TABLE t1 ADD FULLTEXT INDEX (g);
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (g GEOMETRY SRID 0 NOT NULL);
|
||||
--error ER_BAD_FT_COLUMN
|
||||
CREATE FULLTEXT INDEX g_idx ON t1(g);
|
||||
--error ER_BAD_FT_COLUMN
|
||||
ALTER TABLE t1 ADD FULLTEXT INDEX (g);
|
||||
DROP TABLE t1;
|
||||
}
|
||||
|
||||
--echo # Index on nullable geometry column is not allowed.
|
||||
--error 1252
|
||||
CREATE TABLE t1 (g GEOMETRY SRID 0, INDEX (g));
|
||||
CREATE TABLE t1 (g GEOMETRY SRID 0);
|
||||
--error 1252
|
||||
CREATE INDEX g_idx ON t1(g);
|
||||
--error 1252
|
||||
ALTER TABLE t1 ADD INDEX (g);
|
||||
DROP TABLE t1;
|
||||
--error 1252
|
||||
CREATE TABLE t1 (g GEOMETRY SRID 0, SPATIAL INDEX (g));
|
||||
CREATE TABLE t1 (g GEOMETRY SRID 0);
|
||||
--error 1252
|
||||
CREATE SPATIAL INDEX g_idx ON t1(g);
|
||||
--error 1252
|
||||
ALTER TABLE t1 ADD SPATIAL INDEX (g);
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo # Index on non-nullable geometry column is allowed.
|
||||
CREATE TABLE t1 (g GEOMETRY SRID 0 NOT NULL, INDEX (g));
|
||||
#SHOW CREATE TABLE t1;@linjing 需要适配schema printer
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (g GEOMETRY SRID 0 NOT NULL);
|
||||
CREATE INDEX g_idx ON t1(g);
|
||||
#SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (g GEOMETRY SRID 0 NOT NULL, SPATIAL INDEX (g));
|
||||
#SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (g GEOMETRY SRID 0 NOT NULL);
|
||||
CREATE SPATIAL INDEX g_idx ON t1(g);
|
||||
#SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo # Virtual generated geometry columns don't support spatial indexes.
|
||||
CREATE TABLE t1 (x INTEGER,
|
||||
y INTEGER,
|
||||
g POINT GENERATED ALWAYS AS (POINT(x, y)) NOT NULL SRID 0);
|
||||
#--error ER_UNSUPPORTED_ACTION_ON_GENERATED_COLUMN OB目前不支持通过alter来追加PRIMARY KEY(ObAlterTableResolver::resolve_add_primary)
|
||||
#ALTER TABLE t1 ADD PRIMARY KEY (g);
|
||||
--error 3106
|
||||
CREATE INDEX g_idx ON t1(g);
|
||||
--error 3106
|
||||
CREATE INDEX g_idx ON t1(g(25));
|
||||
--error 3106
|
||||
CREATE INDEX g_idx ON t1(g) USING BTREE;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo # Stored generated geometry columns follow the same rules as
|
||||
--echo # non-generated columns.
|
||||
CREATE TABLE t1 (x INTEGER,
|
||||
y INTEGER,
|
||||
g POINT AS (POINT(x, y)) STORED SRID 0 NOT NULL);
|
||||
#--error ER_UNSUPPORTED_ACTION_ON_GENERATED_COLUMN OB目前不支持通过alter来追加PRIMARY KEY(ObAlterTableResolver::resolve_add_primary)
|
||||
#ALTER TABLE t1 ADD PRIMARY KEY (g);
|
||||
--error 3106
|
||||
CREATE INDEX g_idx ON t1(g(25));
|
||||
--error 3106
|
||||
CREATE INDEX g_idx ON t1(g) USING BTREE;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo # Check error code order
|
||||
CREATE TABLE t1 (g GEOMETRY SRID 0, g1 point srid 0, x int, y int,g2 POINT GENERATED ALWAYS AS (POINT(x, y)) SRID 0);
|
||||
##### 1. column num eror code is first order
|
||||
# column num vs generate, num first
|
||||
--error 1070
|
||||
CREATE INDEX g_idx ON t1(g, g2);
|
||||
# column num vs specific order, num first
|
||||
--error 1070
|
||||
CREATE INDEX g_idx ON t1(g asc, g2);
|
||||
# column num vs not null, num first
|
||||
--error 1070
|
||||
CREATE INDEX g_idx ON t1(g, g2);
|
||||
|
||||
##### 2. generate column eror code is the second order
|
||||
# generate vs specific order, generate first
|
||||
--error 3106
|
||||
CREATE INDEX g_idx ON t1(g2 asc);
|
||||
# generate vs not null, generate first
|
||||
--error 3106
|
||||
CREATE INDEX g_idx ON t1(g2);
|
||||
|
||||
##### 3. specific order eror code is the third order
|
||||
# specific order vs not null, specific order first
|
||||
--error 1221
|
||||
CREATE INDEX g_idx ON t1(g asc);
|
||||
|
||||
# bugfix:
|
||||
# 记录一下复现的case,合并后日志中出现'merge error''fail to merge index'证明问题复现
|
||||
#create table if not exists gis (
|
||||
# x decimal(19,16),
|
||||
# y decimal(19,16),
|
||||
# poi geometry not null srid 4326,
|
||||
# index `xy_index` (x, y) local,
|
||||
# index `poi_index` (poi) local
|
||||
# );
|
||||
#insert into gis values (x,y,ST_srid(linestring(point(1,1),point(10,10),point(40,80)),4326));
|
||||
#insert into gis values (x,y,ST_srid(linestring(point(1,1),point(5,5),point(75,75)),4326));
|
||||
#alter system major freeze;
|
||||
#drop table gis;
|
||||
|
||||
# bugfix:
|
||||
# 空间列未指定srid,不走空间索引
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS tt2,t;
|
||||
--enable_warnings
|
||||
CREATE TABLE tt2 (id int, g GEOMETRY not null, spatial INDEX idx (g));
|
||||
explain extended_noaddr select st_astext(g) from tt2 where ST_Intersects(g,ST_GeomFromText('LINESTRING(0 0, 10 10, 20 25, 50 60)'));
|
||||
explain extended_noaddr select /*+index(tt2 idx)*/ st_astext(g) from tt2 where ST_Intersects(g,ST_GeomFromText('LINESTRING(0 0, 10 10, 20 25, 50 60)'));
|
||||
drop table tt2;
|
||||
CREATE TABLE tt2 (id int, g GEOMETRY not null srid 4326, spatial INDEX idx (g));
|
||||
--error 3643
|
||||
explain extended_noaddr select st_astext(g) from tt2 where ST_Intersects(g,ST_GeomFromText('LINESTRING(0 0, 10 10, 20 25, 50 60)'));
|
||||
explain extended_noaddr select st_astext(g) from tt2 where ST_Intersects(g,ST_GeomFromText('LINESTRING(0 0, 10 10, 20 25, 50 60)', 4326));
|
||||
explain extended_noaddr select /*+index(tt2 idx)*/ st_astext(g) from tt2 where ST_Intersects(g,ST_GeomFromText('LINESTRING(0 0, 10 10, 20 25, 50 60)', 4326));
|
||||
insert into tt2 values (1, ST_GeomFromText('LINESTRING(0 0, 10 10, 20 25, 50 60)', 4326));
|
||||
explain extended_noaddr select st_astext(g) from tt2 where ST_Intersects(g,ST_GeomFromText('LINESTRING(0 0, 10 10, 20 25, 50 60)', 4326));
|
||||
explain extended_noaddr select /*+index(tt2 idx)*/ st_astext(g) from tt2 where ST_Intersects(g,ST_GeomFromText('LINESTRING(0 0, 10 10, 20 25, 50 60)', 4326));
|
||||
drop table tt2;
|
||||
|
||||
# bugfix:
|
||||
# 原场景无法在mysql test中测试,这里仅测试相关修改点
|
||||
# 1. 平面坐标系
|
||||
SET @point_0_0 = ST_GeomFromText('POINT(0 0)');
|
||||
SET @point_1_1 = ST_GeomFromText('POINT(1 1)');
|
||||
SET @point_2_2 = ST_GeomFromText('POINT(2 2)');
|
||||
SET @point_3_3 = ST_GeomFromText('POINT(3 3)');
|
||||
SET @point_4_4 = ST_GeomFromText('POINT(4 4)');
|
||||
SET @point_5_5 = ST_GeomFromText('POINT(5 5)');
|
||||
SET @point_314_314 = ST_GeomFromText('POINT(3.1415926 3.1415926)');
|
||||
create table t (g geometry not null srid 0);
|
||||
create index idx on t(g);
|
||||
insert into t (g) values
|
||||
(ST_GeomFromText('POINT(0 0)')),
|
||||
(ST_GeomFromText('POINT(1 1)')),
|
||||
(ST_GeomFromText('POINT(2 2)')),
|
||||
(ST_GeomFromText('POINT(3 3)')),
|
||||
(ST_GeomFromText('POINT(4 4)')),
|
||||
(ST_GeomFromText('POINT(5 5)'));
|
||||
explain select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(0 0)'));
|
||||
explain select /*+index(t idx)*/ st_astext(g) from t where st_intersects(ST_GeomFromText('POINT(0 0)'), g);
|
||||
explain select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(1 1)'));
|
||||
explain select /*+index(t idx)*/ st_astext(g) from t where st_intersects(ST_GeomFromText('POINT(1 1)'), g);
|
||||
explain select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(2 2)'));
|
||||
explain select /*+index(t idx)*/ st_astext(g) from t where st_intersects(ST_GeomFromText('POINT(2 2)'), g);
|
||||
explain select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(3 3)'));
|
||||
explain select /*+index(t idx)*/ st_astext(g) from t where st_intersects(ST_GeomFromText('POINT(3 3)'), g);
|
||||
explain select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(4 4)'));
|
||||
explain select /*+index(t idx)*/ st_astext(g) from t where st_intersects(ST_GeomFromText('POINT(4 4)'), g);
|
||||
explain select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(5 5)'));
|
||||
explain select /*+index(t idx)*/ st_astext(g) from t where st_intersects(ST_GeomFromText('POINT(5 5)'), g);
|
||||
explain select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(3.1415926 3.1415926)'));
|
||||
explain select /*+index(t idx)*/ st_astext(g) from t where st_intersects(ST_GeomFromText('POINT(3.1415926 3.1415926)'), g);
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(ST_GeomFromText('POINT(0 0)'), g);
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(0 0)'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(1 1)'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(ST_GeomFromText('POINT(1 1)'), g);
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(2 2)'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(ST_GeomFromText('POINT(2 2)'), g);
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(3 3)'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(ST_GeomFromText('POINT(3 3)'), g);
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(4 4)'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(ST_GeomFromText('POINT(4 4)'), g);
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(5 5)'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(ST_GeomFromText('POINT(5 5)'), g);
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(3.1415926 3.1415926)'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(ST_GeomFromText('POINT(3.1415926 3.1415926)'), g);
|
||||
drop table t;
|
||||
# 2. 球面坐标系
|
||||
SET @point_0_0 = ST_GeomFromText('POINT(0 0)', 4326);
|
||||
SET @point_1_1 = ST_GeomFromText('POINT(1 1)', 4326);
|
||||
SET @point_2_2 = ST_GeomFromText('POINT(2 2)', 4326);
|
||||
SET @point_3_3 = ST_GeomFromText('POINT(3 3)', 4326);
|
||||
SET @point_4_4 = ST_GeomFromText('POINT(4 4)', 4326);
|
||||
SET @point_5_5 = ST_GeomFromText('POINT(5 5)', 4326);
|
||||
SET @point_314_314 = ST_GeomFromText('POINT(3.1415926 3.1415926)', 4326);
|
||||
create table t (g geometry not null srid 4326);
|
||||
create index idx on t(g);
|
||||
insert into t (g) values
|
||||
(ST_GeomFromText('POINT(0 0)', 4326)),
|
||||
(ST_GeomFromText('POINT(1 1)', 4326)),
|
||||
(ST_GeomFromText('POINT(2 2)', 4326)),
|
||||
(ST_GeomFromText('POINT(3 3)', 4326)),
|
||||
(ST_GeomFromText('POINT(4 4)', 4326)),
|
||||
(ST_GeomFromText('POINT(5 5)', 4326));
|
||||
explain select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(0 0)',4326));
|
||||
explain select /*+index(t idx)*/ st_astext(g) from t where st_intersects(ST_GeomFromText('POINT(0 0)', 4326), g);
|
||||
explain select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(1 1)', 4326));
|
||||
explain select /*+index(t idx)*/ st_astext(g) from t where st_intersects(ST_GeomFromText('POINT(1 1)', 4326), g);
|
||||
explain select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(2 2)', 4326));
|
||||
explain select /*+index(t idx)*/ st_astext(g) from t where st_intersects(ST_GeomFromText('POINT(2 2)', 4326), g);
|
||||
explain select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(3 3)', 4326));
|
||||
explain select /*+index(t idx)*/ st_astext(g) from t where st_intersects(ST_GeomFromText('POINT(3 3)', 4326), g);
|
||||
explain select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(4 4)', 4326));
|
||||
explain select /*+index(t idx)*/ st_astext(g) from t where st_intersects(ST_GeomFromText('POINT(4 4)', 4326), g);
|
||||
explain select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(5 5)', 4326));
|
||||
explain select /*+index(t idx)*/ st_astext(g) from t where st_intersects(ST_GeomFromText('POINT(5 5)', 4326), g);
|
||||
explain select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(3.1415926 3.1415926)', 4326));
|
||||
explain select /*+index(t idx)*/ st_astext(g) from t where st_intersects(ST_GeomFromText('POINT(3.1415926 3.1415926)', 4326), g);
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(ST_GeomFromText('POINT(0 0)',4326), g);
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(0 0)',4326));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(1 1)', 4326));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(ST_GeomFromText('POINT(1 1)', 4326), g);
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(2 2)', 4326));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(ST_GeomFromText('POINT(2 2)', 4326), g);
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(3 3)', 4326));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(ST_GeomFromText('POINT(3 3)', 4326), g);
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(4 4)', 4326));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(ST_GeomFromText('POINT(4 4)', 4326), g);
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(5 5)', 4326));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(ST_GeomFromText('POINT(5 5)', 4326), g);
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(g, ST_GeomFromText('POINT(3.1415926 3.1415926)', 4326));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where st_intersects(ST_GeomFromText('POINT(3.1415926 3.1415926)', 4326), g);
|
||||
drop table t;
|
||||
|
||||
if (1)
|
||||
{
|
||||
create table t (id int auto_increment primary key, g geometry not null srid 4326);
|
||||
--disable_warnings
|
||||
drop procedure if exists insert_test;
|
||||
--enable_warnings
|
||||
delimiter //;
|
||||
create procedure insert_test()
|
||||
begin
|
||||
set @i=0;
|
||||
w:while @i<2000 do
|
||||
INSERT INTO t (g) VALUES (ST_GeomFromText('POINT(5 6)', 4326));
|
||||
set @i=@i+1;
|
||||
end while w;
|
||||
end; //
|
||||
delimiter ;//
|
||||
call insert_test();
|
||||
create index idx on t(g);
|
||||
SELECT /*+index(t idx)*/ count(*) FROM t where st_intersects(g, st_geomfromtext('point(5 6)', 4326));
|
||||
drop table t;
|
||||
}
|
||||
|
||||
alter system set _enable_defensive_check = '2';
|
||||
create table t(g geometry NOT NULL SRID 4326);
|
||||
create index idx on t (g);
|
||||
|
||||
INSERT INTO t (g) VALUES
|
||||
(ST_GeomFromText('POINT(0 0)', 4326, 'axis-order=long-lat')),
|
||||
(ST_GeomFromText('POINT(1 1)', 4326, 'axis-order=long-lat')),
|
||||
(ST_GeomFromText('POINT(1.5 1.5)', 4326, 'axis-order=long-lat')),
|
||||
(ST_GeomFromText('POINT(2 2)', 4326, 'axis-order=long-lat')),
|
||||
(ST_GeomFromText('POINT(2.5 2.5)', 4326, 'axis-order=long-lat')),
|
||||
(ST_GeomFromText('POINT(3 3)', 4326, 'axis-order=long-lat')),
|
||||
(ST_GeomFromText('POINT(3.5 3.5)', 4326, 'axis-order=long-lat')),
|
||||
(ST_GeomFromText('POINT(4 4)', 4326, 'axis-order=long-lat')),
|
||||
(ST_GeomFromText('POINT(5 5.5)', 4326, 'axis-order=long-lat')),
|
||||
(ST_GeomFromText('POINT(6 6)', 4326, 'axis-order=long-lat')),
|
||||
(ST_GeomFromText('POINT(7 7)', 4326, 'axis-order=long-lat')),
|
||||
(ST_GeomFromText('MULTIPOINT(1 1,1 4,4 4,4 0.00009)', 4326, 'axis-order=long-lat')),
|
||||
(ST_GeomFromText('LINESTRING(2 2,5 0,8 2)', 4326, 'axis-order=long-lat')),
|
||||
(ST_GeomFromText('MULTILINESTRING((2 2,2 10,10 10),(10 10,10 2,2 2))', 4326, 'axis-order=long-lat')),
|
||||
(ST_GeomFromText('POLYGON((0 0,0 10,10 10,10 0, 0 0),(4 4,4 6,6 6,6 4,4 4))', 4326, 'axis-order=long-lat')),
|
||||
(ST_GeomFromText('MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4)),((3 3,3 7,7 7,7 3,3 3),(4 4,4 6,6 6,6 4,4 4)))', 4326, 'axis-order=long-lat')),
|
||||
(ST_GeomFromText('GEOMETRYCOLLECTION(POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4)),POLYGON((3 3,3 7,7 7,7 3,3 3),(4 4,4 6,6 6,6 4,4 4)))', 4326, 'axis-order=long-lat'));
|
||||
select /*+index(t idx)*/ st_astext(g) from t where _st_dwithin(g, st_geomfromtext('POINT(1 1)', 4326, 'axis-order=long-lat'), 5);
|
||||
drop table t;
|
||||
alter system set _enable_defensive_check = '1';
|
||||
@ -0,0 +1,243 @@
|
||||
#owner: ht353245
|
||||
#owner group: shenzhen
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--echo # Base test of GEOMETRY spatial index.
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--source mysql_test/test_suite/geometry/t/import_default_srs_data_mysql.inc
|
||||
|
||||
############################################################################################
|
||||
# Base test for spatial index #
|
||||
############################################################################################
|
||||
### 1. Test for spatial index sql syntax
|
||||
if (1) {
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS spatial_index_syntax;
|
||||
--enable_warnings
|
||||
|
||||
## 1.1 Create table with spaital index.
|
||||
# 1.1.1 Basic syntax.
|
||||
CREATE TABLE spatial_index_syntax (g GEOMETRY NOT NULL SRID 4326, INDEX(g) LOCAL);
|
||||
SHOW FIELDS FROM spatial_index_syntax;
|
||||
DROP TABLE IF EXISTS spatial_index_syntax;
|
||||
CREATE TABLE spatial_index_syntax (g GEOMETRY NOT NULL SRID 4326, INDEX(g) GLOBAL);
|
||||
SHOW FIELDS FROM spatial_index_syntax;
|
||||
DROP TABLE IF EXISTS spatial_index_syntax;
|
||||
CREATE TABLE spatial_index_syntax (g GEOMETRY NOT NULL SRID 4326, INDEX(g));
|
||||
SHOW FIELDS FROM spatial_index_syntax;
|
||||
|
||||
# 1.1.2 Test for 'SPATIAL' keyword when create table.
|
||||
DROP TABLE IF EXISTS spatial_index_syntax;
|
||||
CREATE TABLE spatial_index_syntax (g GEOMETRY NOT NULL SRID 4326, SPATIAL INDEX(g) LOCAL);
|
||||
SHOW FIELDS FROM spatial_index_syntax;
|
||||
DROP TABLE IF EXISTS spatial_index_syntax;
|
||||
CREATE TABLE spatial_index_syntax (g GEOMETRY NOT NULL SRID 4326, SPATIAL INDEX(g) GLOBAL);
|
||||
SHOW FIELDS FROM spatial_index_syntax;
|
||||
DROP TABLE IF EXISTS spatial_index_syntax;
|
||||
CREATE TABLE spatial_index_syntax (g GEOMETRY NOT NULL SRID 4326, SPATIAL INDEX(g));
|
||||
SHOW FIELDS FROM spatial_index_syntax;
|
||||
DROP TABLE IF EXISTS spatial_index_syntax;
|
||||
|
||||
## 1.2 Alter table with spaital index.
|
||||
# 1.2.1 Basic syntax.
|
||||
DROP TABLE IF EXISTS spatial_index_syntax;
|
||||
CREATE TABLE spatial_index_syntax (g GEOMETRY NOT NULL SRID 4326);
|
||||
ALTER TABLE spatial_index_syntax ADD INDEX idx(g) LOCAL;
|
||||
SHOW FIELDS FROM spatial_index_syntax;
|
||||
DROP INDEX idx ON spatial_index_syntax;
|
||||
ALTER TABLE spatial_index_syntax ADD INDEX idx(g) GLOBAL;
|
||||
SHOW FIELDS FROM spatial_index_syntax;
|
||||
DROP INDEX idx ON spatial_index_syntax;
|
||||
ALTER TABLE spatial_index_syntax ADD INDEX idx(g);
|
||||
SHOW FIELDS FROM spatial_index_syntax;
|
||||
DROP INDEX idx ON spatial_index_syntax;
|
||||
|
||||
# 1.2.2 Test for 'SPATIAL' keyword when alter table.
|
||||
DROP TABLE IF EXISTS spatial_index_syntax;
|
||||
CREATE TABLE spatial_index_syntax (g GEOMETRY NOT NULL SRID 4326);
|
||||
ALTER TABLE spatial_index_syntax ADD SPATIAL INDEX idx(g) LOCAL;
|
||||
SHOW FIELDS FROM spatial_index_syntax;
|
||||
DROP INDEX idx ON spatial_index_syntax;
|
||||
ALTER TABLE spatial_index_syntax ADD SPATIAL INDEX idx(g) GLOBAL;
|
||||
SHOW FIELDS FROM spatial_index_syntax;
|
||||
DROP INDEX idx ON spatial_index_syntax;
|
||||
ALTER TABLE spatial_index_syntax ADD SPATIAL INDEX idx(g);
|
||||
SHOW FIELDS FROM spatial_index_syntax;
|
||||
DROP INDEX idx ON spatial_index_syntax;
|
||||
|
||||
## 1.3 Create spatial index.
|
||||
# 1.3.1 Basic syntax.
|
||||
DROP TABLE IF EXISTS spatial_index_syntax;
|
||||
CREATE TABLE spatial_index_syntax (g GEOMETRY NOT NULL SRID 4326);
|
||||
CREATE INDEX idx ON spatial_index_syntax (g) LOCAL;
|
||||
SHOW FIELDS FROM spatial_index_syntax;
|
||||
DROP INDEX idx ON spatial_index_syntax;
|
||||
CREATE INDEX idx ON spatial_index_syntax (g) GLOBAL;
|
||||
SHOW FIELDS FROM spatial_index_syntax;
|
||||
DROP INDEX idx ON spatial_index_syntax;
|
||||
CREATE INDEX idx ON spatial_index_syntax (g);
|
||||
SHOW FIELDS FROM spatial_index_syntax;
|
||||
DROP INDEX idx ON spatial_index_syntax;
|
||||
|
||||
# 1.3.2 Test for 'SPATIAL' keyword when create index.
|
||||
DROP TABLE IF EXISTS spatial_index_syntax;
|
||||
CREATE TABLE spatial_index_syntax (g GEOMETRY NOT NULL SRID 4326);
|
||||
CREATE SPATIAL INDEX idx ON spatial_index_syntax (g) LOCAL;
|
||||
SHOW FIELDS FROM spatial_index_syntax;
|
||||
DROP INDEX idx ON spatial_index_syntax;
|
||||
CREATE SPATIAL INDEX idx ON spatial_index_syntax (g) GLOBAL;
|
||||
SHOW FIELDS FROM spatial_index_syntax;
|
||||
DROP INDEX idx ON spatial_index_syntax;
|
||||
CREATE SPATIAL INDEX idx ON spatial_index_syntax (g);
|
||||
SHOW FIELDS FROM spatial_index_syntax;
|
||||
DROP INDEX idx ON spatial_index_syntax;
|
||||
}
|
||||
|
||||
### 2. Test for spatial index constraint
|
||||
if (1) {
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS spatial_index_constraint;
|
||||
--enable_warnings
|
||||
|
||||
## 2.1 A spatial index can only be built on a single spatial column.
|
||||
CREATE TABLE spatial_index_constraint (g1 GEOMETRY NOT NULL SRID 4326, g2 GEOMETRY NOT NULL SRID 4326);
|
||||
--error 1070
|
||||
CREATE INDEX idx ON spatial_index_constraint (g1, g2);
|
||||
DROP TABLE IF EXISTS spatial_index_constraint;
|
||||
CREATE TABLE spatial_index_constraint (i int, g GEOMETRY NOT NULL SRID 4326);
|
||||
--error 1070
|
||||
CREATE INDEX idx ON spatial_index_constraint (i, g);
|
||||
|
||||
## 2.2 Spatial index can only be built on spatial columns.
|
||||
DROP TABLE IF EXISTS spatial_index_constraint;
|
||||
CREATE TABLE spatial_index_constraint (i int, g GEOMETRY NOT NULL SRID 4326);
|
||||
--error 1687
|
||||
CREATE SPATIAL INDEX idx ON spatial_index_constraint (i);
|
||||
|
||||
## 2.3 Spatial columns can only be indexed spatial index.(TODO:adapt error code)
|
||||
DROP TABLE IF EXISTS spatial_index_constraint;
|
||||
CREATE TABLE spatial_index_constraint (i int, g GEOMETRY NOT NULL SRID 4326);
|
||||
--error 3728
|
||||
CREATE UNIQUE INDEX idx ON spatial_index_constraint (g);
|
||||
|
||||
## 2.4 Column of the spatial index must be 'NOT NULL'.(TODO:adapt error code)
|
||||
DROP TABLE IF EXISTS spatial_index_constraint;
|
||||
CREATE TABLE spatial_index_constraint (i int, g GEOMETRY);
|
||||
--error 1252
|
||||
CREATE INDEX idx ON spatial_index_constraint (g);
|
||||
|
||||
## 2.5 Cannot insert the record when srid is different with the colume srid.
|
||||
DROP TABLE IF EXISTS spatial_index_constraint;
|
||||
CREATE TABLE spatial_index_constraint (g GEOMETRY NOT NULL SRID 4326);
|
||||
CREATE INDEX idx ON spatial_index_constraint (g);
|
||||
--error 3643
|
||||
INSERT INTO spatial_index_constraint values (ST_GEOMFROMTEXT('POINT(1 1)', 0));
|
||||
DROP TABLE IF EXISTS spatial_index_constraint;
|
||||
}
|
||||
|
||||
### 3. Test for spatial index base DML.
|
||||
if (1) {
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS spatial_index_dml;
|
||||
--enable_warnings
|
||||
SET @v=ST_GEOMFROMTEXT('POINT(0 0)', 4326);
|
||||
SET @v0=ST_GEOMFROMTEXT('POINT(0 0)', 4326);
|
||||
SET @v1=ST_GEOMFROMTEXT('POINT(1 1)', 4326);
|
||||
## 3.1 Insert row
|
||||
# 3.1.1 one column for rowkey
|
||||
CREATE TABLE spatial_index_dml (i int, g GEOMETRY NOT NULL SRID 4326, PRIMARY KEY (i));
|
||||
CREATE INDEX idx ON spatial_index_dml (g);
|
||||
INSERT INTO spatial_index_dml VALUES (1, ST_GEOMFROMTEXT('POINT(0 0)', 4326));
|
||||
SELECT /*+INDEX(spatial_index_dml idx)*/ st_astext(g) FROM spatial_index_dml WHERE ST_INTERSECTS(g, ST_GEOMFROMTEXT('POINT(0 0)', 4326));
|
||||
DROP TABLE spatial_index_dml;
|
||||
|
||||
# 3.1.2 more than one column for rowkey
|
||||
CREATE TABLE spatial_index_dml (i int, g GEOMETRY NOT NULL SRID 4326, PRIMARY KEY (i));
|
||||
CREATE INDEX idx ON spatial_index_dml (g);
|
||||
INSERT INTO spatial_index_dml VALUES (1, ST_GEOMFROMTEXT('POINT(0 0)', 4326));
|
||||
SELECT /*+INDEX(spatial_index_dml idx)*/ st_astext(g) FROM spatial_index_dml WHERE ST_INTERSECTS(g, ST_GEOMFROMTEXT('POINT(0 0)', 4326));
|
||||
DROP TABLE spatial_index_dml;
|
||||
CREATE TABLE spatial_index_dml (i1 int, i2 int, g GEOMETRY NOT NULL SRID 4326, PRIMARY KEY (i1, i2));
|
||||
CREATE INDEX idx ON spatial_index_dml (g);
|
||||
INSERT INTO spatial_index_dml VALUES (1, 2, ST_GEOMFROMTEXT('POINT(0 0)', 4326));
|
||||
SELECT /*+INDEX(spatial_index_dml idx)*/ st_astext(g) FROM spatial_index_dml WHERE ST_INTERSECTS(g, ST_GEOMFROMTEXT('POINT(0 0)', 4326));
|
||||
DROP TABLE spatial_index_dml;
|
||||
|
||||
## 3.2 Update row
|
||||
# 3.2.1 one column for rowkey
|
||||
DROP TABLE IF EXISTS spatial_index_dml;
|
||||
CREATE TABLE spatial_index_dml (i int, g GEOMETRY NOT NULL SRID 4326, PRIMARY KEY (i));
|
||||
CREATE INDEX idx ON spatial_index_dml (g);
|
||||
INSERT INTO spatial_index_dml VALUES (1, ST_GEOMFROMTEXT('POINT(0 0)', 4326));
|
||||
UPDATE spatial_index_dml SET g=ST_GEOMFROMTEXT('POINT(1 2)', 4326) WHERE ST_INTERSECTS(g, ST_GEOMFROMTEXT('POINT(0 0)', 4326));
|
||||
SELECT /*+INDEX(spatial_index_dml idx)*/ g FROM spatial_index_dml WHERE ST_INTERSECTS(g, ST_GEOMFROMTEXT('POINT(1 1)', 4326));
|
||||
|
||||
# 3.2.2 more than one column for rowkey
|
||||
DROP TABLE IF EXISTS spatial_index_dml;
|
||||
CREATE TABLE spatial_index_dml (i1 int, i2 int, g GEOMETRY NOT NULL SRID 4326, PRIMARY KEY (i1, i2));
|
||||
CREATE INDEX idx ON spatial_index_dml (g);
|
||||
SET @v0=ST_GEOMFROMTEXT('POINT(0 0)', 4326);
|
||||
SET @v1=ST_GEOMFROMTEXT('POINT(1 1)', 4326);
|
||||
INSERT INTO spatial_index_dml VALUES (1, 2, ST_GEOMFROMTEXT('POINT(0 0)', 4326));
|
||||
UPDATE spatial_index_dml SET g=ST_GEOMFROMTEXT('POINT(1 2)', 4326) WHERE ST_INTERSECTS(g, ST_GEOMFROMTEXT('POINT(0 0)', 4326));
|
||||
SELECT /*+INDEX(spatial_index_dml idx)*/ g FROM spatial_index_dml WHERE ST_INTERSECTS(g, ST_GEOMFROMTEXT('POINT(1 1)', 4326));
|
||||
|
||||
## 3.3 Delete row
|
||||
# 3.3.1 one column for rowkey
|
||||
DROP TABLE IF EXISTS spatial_index_dml;
|
||||
CREATE TABLE spatial_index_dml (i int, g GEOMETRY NOT NULL SRID 4326, PRIMARY KEY (i));
|
||||
CREATE INDEX idx ON spatial_index_dml (g);
|
||||
SET @v0=ST_GEOMFROMTEXT('POINT(0 0)', 4326);
|
||||
INSERT INTO spatial_index_dml VALUES (1, ST_GEOMFROMTEXT('POINT(0 0)', 4326));
|
||||
DELETE FROM spatial_index_dml WHERE ST_INTERSECTS(g, ST_GEOMFROMTEXT('POINT(0 0)', 4326));
|
||||
SELECT /*+INDEX(spatial_index_dml idx)*/ g FROM spatial_index_dml WHERE ST_INTERSECTS(g, ST_GEOMFROMTEXT('POINT(0 0)', 4326));
|
||||
|
||||
# 3.3.2 more than one column for rowkey
|
||||
DROP TABLE IF EXISTS spatial_index_dml;
|
||||
CREATE TABLE spatial_index_dml (i1 int, i2 int, g GEOMETRY NOT NULL SRID 4326, PRIMARY KEY (i1, i2));
|
||||
CREATE INDEX idx ON spatial_index_dml (g);
|
||||
SET @v0=ST_GEOMFROMTEXT('POINT(0 0)', 4326);
|
||||
INSERT INTO spatial_index_dml VALUES (1, 2, ST_GEOMFROMTEXT('POINT(0 0)', 4326));
|
||||
DELETE FROM spatial_index_dml WHERE ST_INTERSECTS(g, ST_GEOMFROMTEXT('POINT(0 0)', 4326));
|
||||
SELECT /*+INDEX(spatial_index_dml idx)*/ g FROM spatial_index_dml WHERE ST_INTERSECTS(g, ST_GEOMFROMTEXT('POINT(0 0)', 4326));
|
||||
}
|
||||
|
||||
|
||||
### 4. Test for spatial index base query.
|
||||
if (1) {
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS spatial_index_query;
|
||||
--enable_warnings
|
||||
SET @v=ST_GEOMFROMTEXT('POINT(0 0)', 4326);
|
||||
## 4.1 INTERSECTS
|
||||
# 4.1.1 Point & point
|
||||
CREATE TABLE spatial_index_query (i int, g GEOMETRY NOT NULL SRID 4326, PRIMARY KEY(i));
|
||||
CREATE INDEX idx ON spatial_index_query (g);
|
||||
INSERT INTO spatial_index_query VALUES (0, ST_GEOMFROMTEXT('POINT(0 0)', 4326));
|
||||
INSERT INTO spatial_index_query VALUES (1, ST_GEOMFROMTEXT('POINT(0 0)', 4326));
|
||||
INSERT INTO spatial_index_query VALUES (2, ST_GEOMFROMTEXT('POINT(0 0)', 4326));
|
||||
SELECT /*+INDEX(spatial_index_query idx)*/ st_astext(g) FROM spatial_index_query WHERE ST_INTERSECTS(g, ST_GEOMFROMTEXT('POINT(0 0)', 4326));
|
||||
|
||||
# 4.1.1 Polygon & point
|
||||
DROP TABLE IF EXISTS spatial_index_query;
|
||||
CREATE TABLE spatial_index_query (i int, g GEOMETRY NOT NULL SRID 4326);
|
||||
CREATE INDEX idx ON spatial_index_query (g);
|
||||
SET @v=ST_GEOMFROMTEXT('POINT(1 1)', 4326);
|
||||
INSERT INTO spatial_index_query VALUES (1, ST_GEOMFROMTEXT('POINT(1 1)', 4326));
|
||||
SET @cart_py = ST_GeomFromText('POLYGON((0 0, 10 0, 10 5, 0 5, 0 0))', 4326);
|
||||
SELECT /*+INDEX(spatial_index_query idx)*/ st_astext(g) from spatial_index_query where st_intersects(g, ST_GeomFromText('POLYGON((0 0, 10 0, 10 5, 0 5, 0 0))', 4326));
|
||||
}
|
||||
|
||||
### 5. Test for spatial index rebuild. not supported, to fix later
|
||||
if (1) {
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS spatial_index_rebuild;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE spatial_index_rebuild (i int, g GEOMETRY NOT NULL SRID 4326, PRIMARY KEY(i));
|
||||
SET @v=ST_GEOMFROMTEXT('POINT(0 0)', 4326);
|
||||
INSERT INTO spatial_index_rebuild VALUES (0, ST_GEOMFROMTEXT('POINT(0 0)', 4326));
|
||||
INSERT INTO spatial_index_rebuild VALUES (1, ST_GEOMFROMTEXT('POINT(0 0)', 4326));
|
||||
INSERT INTO spatial_index_rebuild VALUES (2, ST_GEOMFROMTEXT('POINT(0 0)', 4326));
|
||||
CREATE INDEX idx ON spatial_index_rebuild (g);
|
||||
SELECT /*+INDEX(spatial_index_rebuild idx)*/ st_astext(g) FROM spatial_index_rebuild WHERE ST_INTERSECTS(g, ST_GEOMFROMTEXT('POINT(0 0)', 4326));
|
||||
}
|
||||
@ -0,0 +1,120 @@
|
||||
#owner: ht353245
|
||||
#owner group: shenzhen
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--echo # Base test of GEOMETRY spatial index.
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--source mysql_test/test_suite/geometry/t/import_default_srs_data_mysql.inc
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
create table t1(c1 int primary key, g geometry not null srid 0) partition by hash(c1) partitions 2;
|
||||
create spatial index idx on t1 (g) local;
|
||||
insert into t1 (c1, g) values (0, st_geomfromtext('point(1 1)'));
|
||||
explain select /*+index(t1 idx)*/ st_astext(g) from t1 where st_intersects(g, st_geomfromtext('point(1 1)'));
|
||||
select /*+index(t1 idx)*/ st_astext(g) from t1 where st_intersects(g, st_geomfromtext('point(1 1)'));
|
||||
drop table t1;
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
create table t1(c1 int primary key, g geometry not null srid 0) partition by range(c1) ( partition p0 values less than (4),
|
||||
partition p1 values less than (10));
|
||||
create spatial index idx on t1 (g) local;
|
||||
insert into t1 (c1, g) values (0, st_geomfromtext('point(1 1)'));
|
||||
insert into t1 (c1, g) values (1, st_geomfromtext('point(1 1)'));
|
||||
insert into t1 (c1, g) values (2, st_geomfromtext('point(1 1)'));
|
||||
insert into t1 (c1, g) values (3, st_geomfromtext('point(1 1)'));
|
||||
insert into t1 (c1, g) values (4, st_geomfromtext('point(1 1)'));
|
||||
insert into t1 (c1, g) values (5, st_geomfromtext('point(1 1)'));
|
||||
insert into t1 (c1, g) values (6, st_geomfromtext('point(1 1)'));
|
||||
insert into t1 (c1, g) values (7, st_geomfromtext('point(1 1)'));
|
||||
insert into t1 (c1, g) values (8, st_geomfromtext('point(1 1)'));
|
||||
insert into t1 (c1, g) values (9, st_geomfromtext('point(1 1)'));
|
||||
explain select /*+index(t1 idx)*/ st_astext(g) from t1 where st_intersects(g, st_geomfromtext('point(1 1)'));
|
||||
select /*+index(t1 idx)*/ st_astext(g) from t1 where st_intersects(g, st_geomfromtext('point(1 1)'));
|
||||
drop table t1;
|
||||
|
||||
connection default;
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
create table t1(c1 int primary key, g geometry not null srid 0) partition by hash(c1) partitions 2;
|
||||
--error 1235
|
||||
create spatial index idx on t1 (g) global;
|
||||
# 支持分区表本地索引
|
||||
create spatial index idx on t1 (g);
|
||||
drop table t1;
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
--error 1235
|
||||
create table t1(c1 int primary key, g geometry not null srid 0, spatial index(g) global) partition by hash(c1) partitions 2;
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
create table t1(c1 int primary key, g geometry not null srid 0, spatial index(g)) partition by hash(c1) partitions 2;
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
--error 1235
|
||||
create table t1(c1 int primary key, g geometry not null srid 0, index(g) global) partition by hash(c1) partitions 2;
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
create table t1(c1 int primary key, g geometry not null srid 0, index(g)) partition by hash(c1) partitions 2;
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
create table t1(c1 int primary key, g geometry not null srid 0) partition by hash(c1) partitions 2;
|
||||
alter table t1 add spatial index idx(g);
|
||||
show index from t1;
|
||||
drop index idx on t1;
|
||||
--error 1235
|
||||
alter table t1 add spatial index idx(g) global;
|
||||
show index from t1;
|
||||
alter table t1 add spatial index idx(g) local;
|
||||
show index from t1;
|
||||
drop index idx on t1;
|
||||
show index from t1;
|
||||
create index idx on t1(g);
|
||||
show index from t1;
|
||||
--error 1235
|
||||
create index idx on t1(g) global;
|
||||
show index from t1;
|
||||
drop index idx on t1;
|
||||
create index idx on t1(g) local;
|
||||
show index from t1;
|
||||
drop table t1;
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS geo_maxpt_coords_100y, geo_maxpt_coords_100y_2, aoi_string_limit10;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE geo_maxpt_coords_100y (
|
||||
poi_id VARCHAR(128) NOT NULL,
|
||||
pwkt VARCHAR(128) NOT NULL DEFAULT '0',
|
||||
geo_pwkt GEOMETRY NOT NULL srid 0,
|
||||
-- PRIMARY KEY (`id`, k)
|
||||
SPATIAL INDEX(geo_pwkt)
|
||||
) PARTITION BY key(poi_id) PARTITIONS 256;
|
||||
|
||||
|
||||
CREATE TABLE geo_maxpt_coords_100y_2 (
|
||||
poi_id VARCHAR(128) NOT NULL,
|
||||
pwkt VARCHAR(128) NOT NULL DEFAULT '0',
|
||||
geo_pwkt GEOMETRY NOT NULL /*!80003 srid 0 */,
|
||||
SPATIAL INDEX(geo_pwkt)
|
||||
);
|
||||
|
||||
explain select count(*) from geo_maxpt_coords_100y where st_intersects(geo_maxpt_coords_100y.geo_pwkt, st_geomfromtext('polygon((0 0,5 0,5 5,0 5,0 0))', 0));
|
||||
explain select /*+ parallel(1) */ count(*) from geo_maxpt_coords_100y where st_intersects(geo_maxpt_coords_100y.geo_pwkt, st_geomfromtext('polygon((0 0,5 0,5 5,0 5,0 0))', 0));
|
||||
explain select /*+ parallel(3) */ count(*) from geo_maxpt_coords_100y where st_intersects(geo_maxpt_coords_100y.geo_pwkt, st_geomfromtext('polygon((0 0,5 0,5 5,0 5,0 0))', 0));
|
||||
|
||||
explain select count(*) from geo_maxpt_coords_100y_2 where st_intersects(geo_maxpt_coords_100y_2.geo_pwkt, st_geomfromtext('polygon((0 0,5 0,5 5,0 5,0 0))', 0));
|
||||
explain select /*+ parallel(1) */ count(*) from geo_maxpt_coords_100y_2 where st_intersects(geo_maxpt_coords_100y_2.geo_pwkt, st_geomfromtext('polygon((0 0,5 0,5 5,0 5,0 0))', 0));
|
||||
explain select /*+ parallel(3) */ count(*) from geo_maxpt_coords_100y_2 where st_intersects(geo_maxpt_coords_100y_2.geo_pwkt, st_geomfromtext('polygon((0 0,5 0,5 5,0 5,0 0))', 0));
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,608 @@
|
||||
#owner: ht353245
|
||||
#owner group: shenzhen
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--echo # Base test of GEOMETRY tyoe.
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--source mysql_test/test_suite/geometry/t/import_default_srs_data_mysql.inc
|
||||
|
||||
############################################################################################
|
||||
# Creating the spatial objects #
|
||||
############################################################################################
|
||||
|
||||
--echo # Creating the spatial objects
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS gis_point,gis_linestring,gis_polygon,gis_multi_point,
|
||||
gis_multi_linestring,gis_multi_polygon,gis_geometrycollection,gis_geometry;
|
||||
--enable_warnings
|
||||
CREATE TABLE gis_point (fid INTEGER NOT NULL PRIMARY KEY, g POINT);
|
||||
CREATE TABLE gis_linestring (fid INTEGER NOT NULL PRIMARY KEY, g LINESTRING);
|
||||
CREATE TABLE gis_polygon (fid INTEGER NOT NULL PRIMARY KEY, g POLYGON);
|
||||
CREATE TABLE gis_multi_point (fid INTEGER NOT NULL PRIMARY KEY, g MULTIPOINT);
|
||||
CREATE TABLE gis_multi_linestring (fid INTEGER NOT NULL PRIMARY KEY, g MULTILINESTRING);
|
||||
CREATE TABLE gis_multi_polygon (fid INTEGER NOT NULL PRIMARY KEY, g MULTIPOLYGON);
|
||||
CREATE TABLE gis_geometrycollection (fid INTEGER NOT NULL PRIMARY KEY, g GEOMETRYCOLLECTION);
|
||||
CREATE TABLE gis_geometry (fid INTEGER NOT NULL PRIMARY KEY, g GEOMETRY);
|
||||
|
||||
--echo # Displaying the created spatial columns
|
||||
SHOW FIELDS FROM gis_point;
|
||||
SHOW COLUMNS FROM gis_point;
|
||||
SHOW FIELDS FROM gis_linestring;
|
||||
SHOW COLUMNS FROM gis_linestring;
|
||||
SHOW FIELDS FROM gis_polygon;
|
||||
SHOW COLUMNS FROM gis_polygon;
|
||||
SHOW FIELDS FROM gis_multi_point;
|
||||
SHOW COLUMNS FROM gis_multi_point;
|
||||
SHOW FIELDS FROM gis_multi_linestring;
|
||||
SHOW COLUMNS FROM gis_multi_linestring;
|
||||
SHOW FIELDS FROM gis_multi_polygon;
|
||||
SHOW COLUMNS FROM gis_multi_polygon;
|
||||
SHOW FIELDS FROM gis_geometrycollection;
|
||||
SHOW COLUMNS FROM gis_geometrycollection;
|
||||
SHOW FIELDS FROM gis_geometry;
|
||||
SHOW COLUMNS FROM gis_geometry;
|
||||
|
||||
############################################################################################
|
||||
# Inserting the values specific to the spatial objects #
|
||||
############################################################################################
|
||||
|
||||
--echo # Inserting POINT Geometry Values
|
||||
# TODO: @linjing 待完成表达式后打开
|
||||
if (0) {
|
||||
INSERT INTO gis_point VALUES
|
||||
(101, ST_POINTFROMTEXT('POINT(0 0)')),
|
||||
(102, ST_POINTFROMTEXT('POINT(1 0)')),
|
||||
(103, ST_POINTFROMTEXT('POINT(0 1)')),
|
||||
(104, ST_POINTFROMTEXT('POINT(1 1)')),
|
||||
(105, ST_POINTFROMTEXT('POINT(-1 1)'));
|
||||
|
||||
INSERT INTO gis_point VALUES
|
||||
(106, ST_POINTFROMTEXT('POINT(0 0)')),
|
||||
(107, ST_POINTFROMTEXT('POINT(10 0)')),
|
||||
(108, ST_POINTFROMTEXT('POINT(0 10)')),
|
||||
(109, ST_POINTFROMTEXT('POINT(-10 0)')),
|
||||
(110, ST_POINTFROMTEXT('POINT(0 -10)'));
|
||||
|
||||
INSERT INTO gis_point VALUES
|
||||
(111, ST_POINTFROMWKB(ST_ASWKB(ST_POINTFROMTEXT('POINT(1 1)')))),
|
||||
(112, ST_POINTFROMWKB(ST_ASWKB(ST_POINTFROMTEXT('POINT(1e308 1e308)')))),
|
||||
(113, ST_POINTFROMWKB(ST_ASWKB(ST_POINTFROMTEXT('POINT(1e308 -1e308)')))),
|
||||
(114, ST_POINTFROMWKB(ST_ASWKB(ST_POINTFROMTEXT('POINT(-1e308 1e308)')))),
|
||||
(115, ST_POINTFROMWKB(ST_ASWKB(ST_POINTFROMTEXT('POINT(-1e308 -1e308)'))));
|
||||
|
||||
--echo # Inserting LINESTRING Geometry Values
|
||||
INSERT INTO gis_linestring VALUES
|
||||
(201, ST_LINEFROMTEXT('LINESTRING(0 0,5 5)')),
|
||||
(202, ST_LINEFROMTEXT('LINESTRING(0 0,2 2,4 4)')),
|
||||
(203, ST_LINEFROMTEXT('LINESTRING(0 0,5 5,10 10)'));
|
||||
|
||||
INSERT INTO gis_linestring VALUES
|
||||
(204, ST_LINESTRINGFROMTEXT('LINESTRING(10 10,5 5)')),
|
||||
(205, ST_LINESTRINGFROMTEXT('LINESTRING(0 0,12 12,24 24)')),
|
||||
(206, ST_LINESTRINGFROMTEXT('LINESTRING(0 0,50 50,100 100)'));
|
||||
|
||||
INSERT INTO gis_linestring VALUES
|
||||
(207, ST_LINEFROMWKB(ST_ASWKB(LINESTRING(POINT(0,0), POINT(5,5))))),
|
||||
(208, ST_LINEFROMWKB(ST_ASWKB(LINESTRING(POINT(0,0), POINT(-5,-5), POINT(-10,10))))),
|
||||
(209, ST_LINEFROMWKB(ST_ASWKB(LINESTRING(POINT(0,0), POINT(2,2), POINT(4,4), POINT(6,6), POINT(8,8)))));
|
||||
|
||||
INSERT INTO gis_linestring VALUES
|
||||
(210, ST_LINESTRINGFROMWKB(ST_ASWKB(LINESTRING(POINT(0,0), POINT(5,5))))),
|
||||
(211, ST_LINESTRINGFROMWKB(ST_ASWKB(LINESTRING(POINT(0,0), POINT(-50,-50), POINT(10,-10))))),
|
||||
(212, ST_LINESTRINGFROMWKB(ST_ASWKB(LINESTRING(POINT(0,0), POINT(1e308,1e308), POINT(1e308,-1e308)))));
|
||||
|
||||
INSERT INTO gis_linestring VALUES
|
||||
(213, ST_LINEFROMWKB(ST_ASWKB(ST_LINEFROMTEXT('LINESTRING(1e308 1e308,1e308 -1e308)')))),
|
||||
(214, ST_LINEFROMWKB(ST_ASWKB(ST_LINEFROMTEXT('LINESTRING(1 1,2 2,3 3,4 4,5 5,6 6,7 7,8 8,9 9)')))),
|
||||
(215, ST_LINESTRINGFROMWKB(ST_ASWKB(ST_LINESTRINGFROMTEXT('LINESTRING(10 10,10 -10,-10 -10,-10 10,10 10)'))));
|
||||
|
||||
--echo # Inserting POLYGON Geometry Values
|
||||
INSERT INTO gis_polygon VALUES
|
||||
(301, ST_POLYFROMTEXT('POLYGON((0 0,0 5,5 5, 0 0))')),
|
||||
(302, ST_POLYFROMTEXT('POLYGON((0 0,0 5,5 5,5 0,0 0))')),
|
||||
(303, ST_POLYFROMTEXT('POLYGON((0 0,0 10,10 10,10 0,0 0))'));
|
||||
|
||||
INSERT INTO gis_polygon VALUES
|
||||
(304, ST_POLYGONFROMTEXT('POLYGON((0 0,0 50,50 50,50 0,0 0))')),
|
||||
(305, ST_POLYGONFROMTEXT('POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4))')),
|
||||
(306, ST_POLYGONFROMTEXT('POLYGON((0 0,0 10,10 10,10 0,0 0),(2 2,2 4,4 4,4 2,2 2),(6 6,6 8,8 8,8 6,6 6))'));
|
||||
|
||||
INSERT INTO gis_polygon VALUES
|
||||
(307, ST_POLYFROMWKB(ST_ASWKB(POLYGON(LINESTRING(POINT(0,0), POINT(0,5), POINT(5,5), POINT(0,0)))))),
|
||||
(308, ST_POLYFROMWKB(ST_ASWKB(POLYGON(LINESTRING(POINT(0,0), POINT(0,15), POINT(15,15), POINT(15,0), POINT(0,0)))))),
|
||||
(309, ST_POLYFROMWKB(ST_ASWKB(POLYGON(LINESTRING(POINT(0,0), POINT(0,10), POINT(10,10), POINT(10,0), POINT(0,0)),
|
||||
LINESTRING(POINT(4,4), POINT(4,6), POINT(6,6), POINT(6,4), POINT(4,4))))));
|
||||
|
||||
INSERT INTO gis_polygon VALUES
|
||||
(310, ST_POLYGONFROMWKB(ST_ASWKB(POLYGON(LINESTRING(POINT(0,0), POINT(0,5), POINT(5,5), POINT(0,0)))))),
|
||||
(311, ST_POLYGONFROMWKB(ST_ASWKB(POLYGON(LINESTRING(POINT(10,10), POINT(10,15), POINT(15,15), POINT(15,10), POINT(10,10)))))),
|
||||
(312, ST_POLYGONFROMWKB(ST_ASWKB(POLYGON(LINESTRING(POINT(10,10), POINT(10,20), POINT(20,20), POINT(20,10), POINT(10,10)),
|
||||
LINESTRING(POINT(14,14), POINT(14,16), POINT(16,16), POINT(16,14), POINT(14,14))))));
|
||||
|
||||
INSERT INTO gis_polygon VALUES
|
||||
(313, ST_POLYFROMWKB(ST_ASWKB(ST_POLYFROMTEXT('POLYGON((0 0,0 10,10 10,10 0,5 5,0 0))')))),
|
||||
(314, ST_POLYFROMWKB(ST_ASWKB(ST_POLYGONFROMTEXT('POLYGON((10 0,10 10,0 10,-10 10,-10 0,-10 -10,0 10,10 -10,10 0))')))),
|
||||
(315, ST_POLYGONFROMWKB(ST_ASWKB(ST_POLYGONFROMTEXT('POLYGON((0 0,0 10,10 10,10 0,0 0),(2 2,2 4,4 4,4 2,2 2),(6 6,6 8,8 8,8 6,6 6))'))));
|
||||
|
||||
--echo # Inserting MULTIPOINT Geometry Values
|
||||
INSERT INTO gis_multi_point VALUES
|
||||
(401, ST_MPOINTFROMTEXT('MULTIPOINT(0 0)')),
|
||||
(402, ST_MPOINTFROMTEXT('MULTIPOINT(0 0,2 2,4 4)')),
|
||||
(403, ST_MPOINTFROMTEXT('MULTIPOINT(0 0,5 5,10 10)'));
|
||||
|
||||
INSERT INTO gis_multi_point VALUES
|
||||
(404, ST_MULTIPOINTFROMTEXT('MULTIPOINT(0 0,100 100)')),
|
||||
(405, ST_MULTIPOINTFROMTEXT('MULTIPOINT(0 0,1e308 1e308)')),
|
||||
(406, ST_MULTIPOINTFROMTEXT('MULTIPOINT(1e308 1e308,1e308 -1e308,-1e308 1e308,-1e308 -1e308)'));
|
||||
|
||||
INSERT INTO gis_multi_point VALUES
|
||||
(407, ST_MPOINTFROMWKB(ST_ASWKB(MULTIPOINT(POINT(0,0))))),
|
||||
(408, ST_MPOINTFROMWKB(ST_ASWKB(MULTIPOINT(POINT(0,0), POINT(10,10))))),
|
||||
(409, ST_MPOINTFROMWKB(ST_ASWKB(MULTIPOINT(POINT(0,0), POINT(2,2), POINT(4,4), POINT(6,6)))));
|
||||
|
||||
INSERT INTO gis_multi_point VALUES
|
||||
(410, ST_MULTIPOINTFROMWKB(ST_ASWKB(MULTIPOINT(POINT(0,0))))),
|
||||
(411, ST_MULTIPOINTFROMWKB(ST_ASWKB(MULTIPOINT(POINT(0,0), POINT(1e308,1e308))))),
|
||||
(412, ST_MULTIPOINTFROMWKB(ST_ASWKB(MULTIPOINT(POINT(1e308,1e308), POINT(-1e308,1e308), POINT(1e308,-1e308), POINT(-1e308,-1e308)))));
|
||||
|
||||
INSERT INTO gis_multi_point VALUES
|
||||
(413, ST_MPOINTFROMWKB(ST_ASWKB(ST_MPOINTFROMTEXT('MULTIPOINT(0 0)')))),
|
||||
(414, ST_MPOINTFROMWKB(ST_ASWKB(ST_MPOINTFROMTEXT('MULTIPOINT(0 0,1e308 1e308,-1e308 -1e308)')))),
|
||||
(415, ST_MPOINTFROMWKB(ST_ASWKB(ST_MPOINTFROMTEXT('MULTIPOINT(1e308 1e308,1e308 -1e308,-1e308 1e308,-1e308 -1e308,1e308 1e308)'))));
|
||||
|
||||
--echo # Inserting MULTILINESTRING Geometry Values
|
||||
INSERT INTO gis_multi_linestring VALUES
|
||||
(501, ST_MLINEFROMTEXT('MULTILINESTRING((0 0,2 2))')),
|
||||
(502, ST_MLINEFROMTEXT('MULTILINESTRING((0 0,2 2,4 4))')),
|
||||
(503, ST_MLINEFROMTEXT('MULTILINESTRING((0 0,2 2,4 4),(6 6,8 8,10 10))'));
|
||||
|
||||
INSERT INTO gis_multi_linestring VALUES
|
||||
(504, ST_MULTILINESTRINGFROMTEXT('MULTILINESTRING((0 0,100 100,-100 -100))')),
|
||||
(505, ST_MULTILINESTRINGFROMTEXT('MULTILINESTRING((1e308 1e308,-1e308 -1e308))')),
|
||||
(506, ST_MULTILINESTRINGFROMTEXT('MULTILINESTRING((1e308 1e308,-1e308 -1e308),(1e308 -1e308,-1e308 1e308))'));
|
||||
|
||||
INSERT INTO gis_multi_linestring VALUES
|
||||
(507, ST_MLINEFROMWKB(ST_ASWKB(MULTILINESTRING(LINESTRING(POINT(0,0), POINT(2,2)))))),
|
||||
(508, ST_MLINEFROMWKB(ST_ASWKB(MULTILINESTRING(LINESTRING(POINT(0,0), POINT(12,12), POINT(24,24)))))),
|
||||
(509, ST_MLINEFROMWKB(ST_ASWKB(MULTILINESTRING(LINESTRING(POINT(0,0), POINT(2,2), POINT(4,4)),
|
||||
LINESTRING(POINT(6,6), POINT(8,8), POINT(10,10))))));
|
||||
|
||||
INSERT INTO gis_multi_linestring VALUES
|
||||
(510, ST_MULTILINESTRINGFROMWKB(ST_ASWKB(MULTILINESTRING(LINESTRING(POINT(0,0), POINT(2,2), POINT(4,4)))))),
|
||||
(511, ST_MULTILINESTRINGFROMWKB(ST_ASWKB(MULTILINESTRING(LINESTRING(POINT(0,0), POINT(1,1), POINT(2,2)))))),
|
||||
(512, ST_MULTILINESTRINGFROMWKB(ST_ASWKB(MULTILINESTRING(LINESTRING(POINT(0,0), POINT(12,12), POINT(24,24)),
|
||||
LINESTRING(POINT(36,36), POINT(48,48), POINT(50,50))))));
|
||||
|
||||
INSERT INTO gis_multi_linestring VALUES
|
||||
(513, ST_MLINEFROMWKB(ST_ASWKB(ST_MLINEFROMTEXT('MULTILINESTRING((0 0,10 10),(0 10,10 0))')))),
|
||||
(514, ST_MLINEFROMWKB(ST_ASWKB(ST_MULTILINESTRINGFROMTEXT('MULTILINESTRING((0 0,10 10,-10 10,0 0),(0 0,-10 -10,10 -10,0 0))')))),
|
||||
(515, ST_MULTILINESTRINGFROMWKB(ST_ASWKB(ST_MULTILINESTRINGFROMTEXT('MULTILINESTRING((0 0,0 100),(0 0,100 0),(0 0,0 -100),(0 0,-100 0))'))));
|
||||
|
||||
--echo # Inserting MULTIPOLGYON Geometry Values
|
||||
INSERT INTO gis_multi_polygon VALUES
|
||||
(601, ST_MPOLYFROMTEXT('MULTIPOLYGON(((0 0,0 5,5 5,0 0)))')),
|
||||
(602, ST_MPOLYFROMTEXT('MULTIPOLYGON(((0 0,0 5,5 5,0 0)),((5 5,5 10,10 10,5 5)))')),
|
||||
(603, ST_MPOLYFROMTEXT('MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4)))'));
|
||||
|
||||
INSERT INTO gis_multi_polygon VALUES
|
||||
(604, ST_MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((0 0,0 5,5 5, 0 0)))')),
|
||||
(605, ST_MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4, 4 4)),((0 0,0 -2,-2 -2, 0 0)))')),
|
||||
(606, ST_MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((0 0,5 5,-5 5,0 0)),((0 0,-5 -5,5 -5,0 0)))'));
|
||||
|
||||
INSERT INTO gis_multi_polygon VALUES
|
||||
(607, ST_MPOLYFROMWKB(ST_ASWKB(MULTIPOLYGON(POLYGON(LINESTRING(POINT(0,0), POINT(5,0), POINT(5,5), POINT(0,5), POINT(0,0))))))),
|
||||
(608, ST_MPOLYFROMWKB(ST_ASWKB(MULTIPOLYGON(POLYGON(LINESTRING(POINT(0,0), POINT(10,0), POINT(10,10), POINT(0,10), POINT(0,0)),
|
||||
LINESTRING(POINT(4,4), POINT(4,6), POINT(6,6), POINT(6,4), POINT(4,4))))))),
|
||||
(609, ST_MPOLYFROMWKB(ST_ASWKB(MULTIPOLYGON(POLYGON(LINESTRING(POINT(0,0), POINT(5,0), POINT(5,5), POINT(0,5), POINT(0,0))),
|
||||
POLYGON(LINESTRING(POINT(0,0), POINT(-5,0), POINT(-5,-5), POINT(0,-5), POINT(0,0)))))));
|
||||
|
||||
INSERT INTO gis_multi_polygon VALUES
|
||||
(610, ST_MULTIPOLYGONFROMWKB(ST_ASWKB(MULTIPOLYGON(POLYGON(LINESTRING(POINT(0,0), POINT(-5,0), POINT(-5,-5), POINT(0,-5), POINT(0,0))))))),
|
||||
(611, ST_MULTIPOLYGONFROMWKB(ST_ASWKB(MULTIPOLYGON(POLYGON(LINESTRING(POINT(10,10), POINT(20,10), POINT(20,20), POINT(10,20), POINT(10,10)),
|
||||
LINESTRING(POINT(14,14), POINT(14,16), POINT(16,16), POINT(16,14), POINT(14,14))))))),
|
||||
(612, ST_MULTIPOLYGONFROMWKB(ST_ASWKB(MULTIPOLYGON(POLYGON(LINESTRING(POINT(0,0), POINT(0,10), POINT(10,10), POINT(10,0), POINT(0,0)),
|
||||
LINESTRING(POINT(4,4), POINT(4,6), POINT(6,6), POINT(6,4), POINT(4,4))),
|
||||
POLYGON(LINESTRING(POINT(0,0), POINT(-5,0), POINT(-5,-5), POINT(0,-5), POINT(0,0)))))));
|
||||
|
||||
INSERT INTO gis_multi_polygon VALUES
|
||||
(613, ST_MPOLYFROMWKB(ST_ASWKB(ST_MPOLYFROMTEXT('MULTIPOLYGON(((0 0,5 5,5 -5,0 0)),((0 0,-5 5,-5 -5,0 0)))')))),
|
||||
(614, ST_MPOLYFROMWKB(ST_ASWKB(ST_MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((0 0,10 10,-10 10,0 0)),((0 0,-10 -10,10 -10,0 0)))')))),
|
||||
(615, ST_MULTIPOLYGONFROMWKB(ST_ASWKB(ST_MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((0 0,5 5,10 0,5 -5,0 0)))'))));
|
||||
|
||||
--echo # Inserting GEOMETRYCOLLECTION Geometry Values
|
||||
INSERT INTO gis_geometrycollection VALUES
|
||||
(701, ST_GEOMCOLLFROMTEXT('GEOMETRYCOLLECTION(POINT(0 0))')),
|
||||
(702, ST_GEOMCOLLFROMTEXT('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')),
|
||||
(703, ST_GEOMCOLLFROMTEXT('GEOMETRYCOLLECTION(POINT(5 5), POLYGON((0 0,0 10,10 10,10 0,0 0)))'));
|
||||
|
||||
INSERT INTO gis_geometrycollection VALUES
|
||||
(704, ST_GEOMETRYCOLLECTIONFROMTEXT('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')),
|
||||
(705, ST_GEOMETRYCOLLECTIONFROMTEXT('GEOMETRYCOLLECTION(POINT(0 0),'
|
||||
'LINESTRING(0 0,10 10),'
|
||||
'POLYGON((0 0,0 10,10 10,10 0, 0 0)))')),
|
||||
(706, ST_GEOMETRYCOLLECTIONFROMTEXT('GEOMETRYCOLLECTION(MULTIPOINT(0 0,5 5,10 10),'
|
||||
'MULTILINESTRING((0 0,10 10),(0 10,10 0)),'
|
||||
'MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)),'
|
||||
'((0 0,-10 0,-10 -10,0 -10,0 0))))'));
|
||||
|
||||
INSERT INTO gis_geometrycollection VALUES
|
||||
(707, ST_GEOMCOLLFROMWKB(ST_ASWKB(GEOMETRYCOLLECTION(POINT(0,0))))),
|
||||
(708, ST_GEOMCOLLFROMWKB(ST_ASWKB(GEOMETRYCOLLECTION(POINT(0,0),
|
||||
LINESTRING(POINT(0,0), POINT(2,2), POINT(4,4), POINT(6,6), POINT(8,8)),
|
||||
POLYGON(LINESTRING(POINT(0,0), POINT(0,10), POINT(10,10), POINT(10,0), POINT(0,0)),
|
||||
LINESTRING(POINT(4,4), POINT(4,6), POINT(6,6), POINT(6,4), POINT(4,4))))))),
|
||||
(709, ST_GEOMCOLLFROMWKB(ST_ASWKB(GEOMETRYCOLLECTION(MULTIPOINT(POINT(0,0), POINT(5,5), POINT(10,10)),
|
||||
MULTILINESTRING(LINESTRING(POINT(0,0), POINT(2,2), POINT(4,4), POINT(6,6), POINT(8,8)),
|
||||
LINESTRING(POINT(10,10), POINT(5,5), POINT(0,10))),
|
||||
MULTIPOLYGON(POLYGON(LINESTRING(POINT(0,0), POINT(0,10), POINT(10,10), POINT(10,0), POINT(0,0)),
|
||||
LINESTRING(POINT(4,4), POINT(4,6), POINT(6,6), POINT(6,4), POINT(4,4))),
|
||||
POLYGON(LINESTRING(POINT(0,0), POINT(-10,0), POINT(-10,-10), POINT(0,0))))))));
|
||||
|
||||
INSERT INTO gis_geometrycollection VALUES
|
||||
(710, ST_GEOMETRYCOLLECTIONFROMWKB(ST_ASWKB(GEOMETRYCOLLECTION(POINT(0,0),
|
||||
LINESTRING(POINT(0,0), POINT(100,100)))))),
|
||||
(711, ST_GEOMETRYCOLLECTIONFROMWKB(ST_ASWKB(GEOMETRYCOLLECTION(POINT(10,10),
|
||||
LINESTRING(POINT(10,10), POINT(12,12), POINT(14,14), POINT(16,16), POINT(18,18)),
|
||||
POLYGON(LINESTRING(POINT(0,0), POINT(0,10), POINT(10,10), POINT(10,0), POINT(0,0)),
|
||||
LINESTRING(POINT(4,4), POINT(4,6), POINT(6,6), POINT(6,4), POINT(4,4))))))),
|
||||
(712, ST_GEOMETRYCOLLECTIONFROMWKB(ST_ASWKB(GEOMETRYCOLLECTION(MULTIPOINT(POINT(10,10), POINT(15,15), POINT(20,20)),
|
||||
MULTILINESTRING(LINESTRING(POINT(0,0), POINT(2,2), POINT(4,4), POINT(6,6), POINT(8,8)),
|
||||
LINESTRING(POINT(10,10), POINT(5,5), POINT(0,10))),
|
||||
MULTIPOLYGON(POLYGON(LINESTRING(POINT(0,0), POINT(0,10), POINT(10,10), POINT(10,0), POINT(0,0)),
|
||||
LINESTRING(POINT(4,4), POINT(4,6), POINT(6,6), POINT(6,4), POINT(4,4))),
|
||||
POLYGON(LINESTRING(POINT(0,0), POINT(-10,0), POINT(-10,-10), POINT(0,0))))))));
|
||||
|
||||
INSERT INTO gis_geometrycollection VALUES
|
||||
(713, ST_GEOMCOLLFROMWKB(ST_ASWKB(ST_GEOMCOLLFROMTEXT('GEOMETRYCOLLECTION('
|
||||
'POINT(0 0),'
|
||||
'LINESTRING(0 0,10 10),'
|
||||
'POLYGON((0 0,0 10,10 10,10 0, 0 0)),'
|
||||
'MULTIPOINT(0 0,2 2,4 4,6 6,8 8,10 10),'
|
||||
'MULTILINESTRING((0 0,10 10),(0 10,10 0)),'
|
||||
'MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0)),((5 5,5 10,10 10,10 5,5 5))))')))),
|
||||
(714, ST_GEOMCOLLFROMWKB(ST_ASWKB(ST_GEOMCOLLFROMTEXT('GEOMETRYCOLLECTION('
|
||||
'GEOMETRYCOLLECTION('
|
||||
'POINT(0 0)),'
|
||||
'GEOMETRYCOLLECTION('
|
||||
'LINESTRING(0 0,10 10)),'
|
||||
'GEOMETRYCOLLECTION('
|
||||
'POLYGON((0 0,0 10,10 10,10 0, 0 0))),'
|
||||
'GEOMETRYCOLLECTION('
|
||||
'MULTIPOINT(0 0,2 2,4 4,6 6,8 8,10 10)),'
|
||||
'GEOMETRYCOLLECTION('
|
||||
'MULTILINESTRING((0 0,10 10),(0 10,10 0))),'
|
||||
'GEOMETRYCOLLECTION('
|
||||
'MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0)),((5 5,5 10,10 10,10 5,5 5)))))')))),
|
||||
(715, ST_GEOMCOLLFROMWKB(ST_ASWKB(ST_GEOMCOLLFROMTEXT('GEOMETRYCOLLECTION('
|
||||
'GEOMETRYCOLLECTION(),'
|
||||
'POINT(0 0),'
|
||||
'GEOMETRYCOLLECTION('
|
||||
'LINESTRING(0 0,10 10),'
|
||||
'GEOMETRYCOLLECTION('
|
||||
'GEOMETRYCOLLECTION())),'
|
||||
'GEOMETRYCOLLECTION(),'
|
||||
'GEOMETRYCOLLECTION('
|
||||
'GEOMETRYCOLLECTION()),'
|
||||
'POLYGON((0 0,0 10,10 10,10 0, 0 0)),'
|
||||
'MULTIPOINT(0 0,2 2,4 4,6 6,8 8,10 10),'
|
||||
'MULTILINESTRING((0 0,10 10),(0 10,10 0)),'
|
||||
'MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0)),((5 5,5 10,10 10,10 5,5 5))))'))));
|
||||
|
||||
--echo # Inserting all kinds of spatial value to the GEOMETRY class
|
||||
INSERT INTO gis_geometry VALUES
|
||||
(901, ST_GEOMFROMWKB(ST_ASWKB(POINT(0,0)))),
|
||||
(902, ST_GEOMETRYFROMWKB(ST_ASWKB(POINT(1e308,-1e308))));
|
||||
|
||||
INSERT INTO gis_geometry VALUES
|
||||
(903, ST_GEOMFROMWKB(ST_ASWKB(LINESTRING(POINT(0,0), POINT(5,5), POINT(10,10))))),
|
||||
(904, ST_GEOMETRYFROMWKB(ST_ASWKB(LINESTRING(POINT(10,0), POINT(0,10), POINT(-10,0), POINT(0,-10)))));
|
||||
|
||||
INSERT INTO gis_geometry VALUES
|
||||
(905, ST_GEOMFROMWKB(ST_ASWKB(POLYGON(LINESTRING(POINT(0,0), POINT(0,5), POINT(5,5), POINT(5,0), POINT(0,0)))))),
|
||||
(906, ST_GEOMETRYFROMWKB(ST_ASWKB(POLYGON(LINESTRING(POINT(0,0), POINT(0,10), POINT(10,10), POINT(10,0), POINT(0,0)),
|
||||
LINESTRING(POINT(4,4), POINT(4,6), POINT(6,6), POINT(6,4), POINT(4,4))))));
|
||||
|
||||
INSERT INTO gis_geometry VALUES
|
||||
(907, ST_GEOMFROMTEXT('MULTIPOINT(0 0,2 2,4 4,6 6,8 8,10 10)')),
|
||||
(908, ST_GEOMETRYFROMTEXT('MULTIPOINT(1e308 1e308, -1e308 1e308, 1e308 -1e308, -1e308 -1e308)'));
|
||||
|
||||
INSERT INTO gis_geometry VALUES
|
||||
(909, ST_GEOMFROMTEXT('MULTILINESTRING((0 0,10 10),(0 0,-10 -10))')),
|
||||
(910, ST_GEOMETRYFROMTEXT('MULTILINESTRING((0 0,10 0),(0 0,0 10),(0 0,-10 0),(0 0,0 -10))'));
|
||||
|
||||
INSERT INTO gis_geometry VALUES
|
||||
(911, ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0)))')),
|
||||
(912, ST_GEOMETRYFROMTEXT('MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0)),((5 5,5 10,1 10,10 5,5 5)))'));
|
||||
|
||||
INSERT INTO gis_geometry VALUES
|
||||
(913, ST_GEOMFROMTEXT('GEOMETRYCOLLECTION('
|
||||
'POINT(0 0),'
|
||||
'LINESTRING(0 0,5 5,10 10),'
|
||||
'POLYGON((0 0,0 10,10 10,10 0,0 0)))')),
|
||||
(924, ST_GEOMFROMTEXT('GEOMETRYCOLLECTION('
|
||||
'MULTIPOINT(0 0,2 2,4 4),'
|
||||
'MULTILINESTRING((0 0,5 5,0 0),(0 0,-5 -5,0 0)),'
|
||||
'MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0)),((5 5,5 10,10 10,10 5,5 5))))')),
|
||||
(915, ST_GEOMETRYFROMTEXT('GEOMETRYCOLLECTION('
|
||||
'POINT(0 0),'
|
||||
'LINESTRING(0 0,5 5,10 10),'
|
||||
'POLYGON((0 0,0 10,10 10,10 0,0 0)),'
|
||||
'MULTIPOINT(0 0,2 2,4 4),'
|
||||
'MULTILINESTRING((0 0,5 5,0 0),(0 0,-5 -5,0 0)),'
|
||||
'MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0)),((5 5,5 10,10 10,10 5,5 5))))'));
|
||||
}
|
||||
############################################################################################
|
||||
# Inserting the spatial values of all kinds to the parent class #
|
||||
############################################################################################
|
||||
|
||||
--echo # Check the parent class hierarchy by inserting all values to the GEOMETRY parent class.
|
||||
INSERT INTO gis_geometry SELECT * FROM gis_point;
|
||||
|
||||
INSERT INTO gis_geometry SELECT * FROM gis_linestring;
|
||||
|
||||
INSERT INTO gis_geometry SELECT * FROM gis_polygon;
|
||||
|
||||
INSERT INTO gis_geometry SELECT * FROM gis_multi_point;
|
||||
|
||||
INSERT INTO gis_geometry SELECT * FROM gis_multi_linestring;
|
||||
|
||||
INSERT INTO gis_geometry SELECT * FROM gis_multi_polygon;
|
||||
|
||||
INSERT INTO gis_geometry SELECT * FROM gis_geometrycollection;
|
||||
|
||||
--echo # Checking the integrity of the above insert statements
|
||||
SELECT COUNT(g) FROM gis_geometry;
|
||||
# TODO: @linjing 待完成表达式后打开
|
||||
if (0) {
|
||||
SELECT COUNT(ST_ASTEXT(g)) FROM gis_geometry;
|
||||
|
||||
SELECT COUNT(DISTINCT(g)) FROM gis_geometry;
|
||||
|
||||
SELECT COUNT(DISTINCT(ST_ASTEXT(g))) FROM gis_geometry;
|
||||
}
|
||||
--echo # Displaying the created spatial columns
|
||||
SHOW FIELDS FROM gis_point;
|
||||
|
||||
SHOW FIELDS FROM gis_linestring;
|
||||
|
||||
SHOW FIELDS FROM gis_polygon;
|
||||
|
||||
SHOW FIELDS FROM gis_multi_point;
|
||||
|
||||
SHOW FIELDS FROM gis_multi_linestring;
|
||||
|
||||
SHOW FIELDS FROM gis_multi_polygon;
|
||||
|
||||
SHOW FIELDS FROM gis_geometrycollection;
|
||||
|
||||
SHOW FIELDS FROM gis_geometry;
|
||||
|
||||
############################################################################################
|
||||
# Analyzing the spatial objets #
|
||||
############################################################################################
|
||||
|
||||
--echo # Analyzing the spatial objets
|
||||
# TODO: @linjing 报语法错误
|
||||
if (0) {
|
||||
ANALYZE TABLE gis_point;
|
||||
|
||||
ANALYZE TABLE gis_linestring;
|
||||
|
||||
ANALYZE TABLE gis_polygon;
|
||||
|
||||
ANALYZE TABLE gis_multi_point;
|
||||
|
||||
ANALYZE TABLE gis_multi_linestring;
|
||||
|
||||
ANALYZE TABLE gis_multi_polygon;
|
||||
|
||||
ANALYZE TABLE gis_geometrycollection;
|
||||
|
||||
ANALYZE TABLE gis_geometry;
|
||||
}
|
||||
############################################################################################
|
||||
# DDL Functionality on the GIS geometry types #
|
||||
############################################################################################
|
||||
|
||||
--echo # Check DDL functionality on GIS datatypes
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS tab;
|
||||
--enable_warnings
|
||||
CREATE TABLE tab(c1 POINT, c2 LINESTRING, c3 POLYGON, c4 MULTIPOINT,
|
||||
c5 MULTILINESTRING, c6 MULTIPOLYGON, c7 GEOMETRYCOLLECTION, c8 GEOMETRY);
|
||||
|
||||
--disable_warnings
|
||||
SELECT sc.COLUMN_NAME, sc.ORDINAL_POSITION, sc.DATA_TYPE, sc.COLUMN_TYPE
|
||||
FROM information_schema.columns sc INNER JOIN information_schema.tables st
|
||||
ON sc.TABLE_NAME=st.TABLE_NAME WHERE st.TABLE_NAME='tab' ORDER BY sc.COLUMN_NAME;
|
||||
--enable_warnings
|
||||
|
||||
############################################################################################
|
||||
# Using Variables to assign spatial values #
|
||||
############################################################################################
|
||||
|
||||
SET @c1 = ST_GEOMFROMTEXT('POINT(10 10)');
|
||||
SET @c2 = ST_GEOMFROMTEXT('LINESTRING(10 10,20 20,30 30)');
|
||||
SET @c3 = ST_GEOMFROMTEXT('POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4))');
|
||||
SET @c4 = ST_GEOMFROMTEXT('MULTIPOINT(0 0,5 5,10 10,20 20)');
|
||||
SET @c5 = ST_GEOMFROMTEXT('MULTILINESTRING((1 1,2 2,3 3),(10 10,20 20,30 30))');
|
||||
SET @c6 = ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0)),((5 5,5 10,10 10,10 5,5 5)))');
|
||||
SET @c7 = ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))');
|
||||
SET @c8 = ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(1 1), LINESTRING(2 2, 3 3))');
|
||||
|
||||
--echo # Insert the spatial values
|
||||
INSERT INTO tab VALUES (@c1, @c2, @c3, @c4, @c5, @c6, @c7, @c8);
|
||||
|
||||
--echo # Check the above inserted values
|
||||
SELECT ST_ASTEXT(c1), ST_ASTEXT(c2), ST_ASTEXT(c3), ST_ASTEXT(c4), ST_ASTEXT(c5), ST_ASTEXT(c6), ST_ASTEXT(c7), ST_ASTEXT(c8) FROM tab;
|
||||
|
||||
--echo # Cleanup the table
|
||||
TRUNCATE TABLE tab;
|
||||
|
||||
############################################################################################
|
||||
# Checking the triggers to work with the Geometry class hierarchy #
|
||||
############################################################################################
|
||||
|
||||
--echo # Create another table same as tab
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS tab2;
|
||||
--enable_warnings
|
||||
CREATE TABLE tab2 AS SELECT * FROM tab;
|
||||
|
||||
--echo # Check the table definition
|
||||
--replace_regex /REPLICA_NUM = [0-9]*/REPLICA_NUM = 1/g
|
||||
SHOW CREATE TABLE tab2;
|
||||
|
||||
--echo # Create a tigger and populate the values into tab2
|
||||
DELIMITER |;
|
||||
CREATE TRIGGER geom_trigger AFTER INSERT ON tab
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
INSERT INTO tab2 VALUES (@c1, @c2, @c3, @c4, @c5, @c6, @c7, @c8);
|
||||
END|
|
||||
DELIMITER ;|
|
||||
|
||||
SET @c1 = ST_GEOMFROMTEXT('POINT(10 10)');
|
||||
SET @c2 = ST_GEOMFROMTEXT('LINESTRING(10 10,20 20,30 30)');
|
||||
SET @c3 = ST_GEOMFROMTEXT('POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4))');
|
||||
SET @c4 = ST_GEOMFROMTEXT('MULTIPOINT(0 0,5 5,10 10,20 20)');
|
||||
SET @c5 = ST_GEOMFROMTEXT('MULTILINESTRING((1 1,2 2,3 3),(10 10,20 20,30 30))');
|
||||
SET @c6 = ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0)),((5 5,5 10,10 10,10 5,5 5)))');
|
||||
SET @c7 = ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))');
|
||||
SET @c8 = ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(1 1), LINESTRING(2 2, 3 3))');
|
||||
|
||||
# trigger is not supported when user is system tenant
|
||||
--echo # Insert the spatial values
|
||||
#INSERT INTO tab VALUES(@c1, @c2, @c3, @c4, @c5, @c6, @c7, @c8);
|
||||
|
||||
--echo # Check the values whether populated
|
||||
# TODO: @linjing 完成表达式后放开
|
||||
if (0) {
|
||||
SELECT ST_ASTEXT(c1) FROM tab2;
|
||||
SELECT ST_ASTEXT(c2) FROM tab2;
|
||||
SELECT ST_ASTEXT(c3) FROM tab2;
|
||||
SELECT ST_ASTEXT(c4) FROM tab2;
|
||||
SELECT ST_ASTEXT(c5) FROM tab2;
|
||||
SELECT ST_ASTEXT(c6) FROM tab2;
|
||||
SELECT ST_ASTEXT(c7) FROM tab2;
|
||||
SELECT ST_ASTEXT(c8) From tab2;
|
||||
}
|
||||
--echo # Cleaning up the trigger
|
||||
DROP TRIGGER geom_trigger;
|
||||
|
||||
# TODO: @linjing 完成表达式后放开
|
||||
if (0) {
|
||||
|
||||
############################################################################################
|
||||
# Checking the join with the geometry data #
|
||||
############################################################################################
|
||||
|
||||
--echo # Check self join
|
||||
SELECT ST_ASTEXT(tableX.c1), ST_ASTEXT(tableX.c4), ST_ASTEXT(tableX.c3)
|
||||
FROM tab AS tableX, tab2 AS tableY
|
||||
WHERE tableX.c1 = tableY.c1 AND tableX.c3 = tableY.c3 AND tableX.c4 = tableY.c4 AND
|
||||
tableX.c5 = tableY.c5 AND tableX.c7 = tableY.c7 AND tableX.c8 = tableY.c8;
|
||||
|
||||
--echo # Check equi join
|
||||
SELECT ST_ASTEXT(tableX.c3), ST_ASTEXT(tableY.c3) FROM tab AS tableX, tab2 AS tableY WHERE tableX.c3 = tableY.c3;
|
||||
|
||||
############################################################################################
|
||||
# Checking the other DML operations on the geometry classes #
|
||||
############################################################################################
|
||||
|
||||
--echo # Check DELETE stmt with WHERE clause and a constant predicate
|
||||
DELETE FROM tab
|
||||
WHERE c8 = ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(1 1), LINESTRING(2 2, 3 3))');
|
||||
|
||||
--echo # Check the data
|
||||
SELECT COUNT(*) FROM tab;
|
||||
|
||||
--echo # Check UPDATE stmt with WHERE clause and a constant predicate
|
||||
SET @c8 = ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(10 10), LINESTRING(20 20, 30 30))');
|
||||
|
||||
UPDATE tab2 SET c8 = @c8
|
||||
WHERE c3 = ST_GEOMFROMTEXT('POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4))');
|
||||
|
||||
--echo # Check the column should be modified to LINESTRING(10 10,20 20,30 30)
|
||||
SELECT ST_ASTEXT(c8) FROM tab2;
|
||||
|
||||
############################################################################################
|
||||
# Checking spatial index with geometry data #
|
||||
############################################################################################
|
||||
|
||||
--echo # Creating a table with spatial index column
|
||||
CREATE TABLE geom_index (fid INTEGER NOT NULL PRIMARY KEY, g GEOMETRY NOT NULL SRID 0, SPATIAL INDEX(g));
|
||||
|
||||
--echo # Inserting geometry values
|
||||
INSERT INTO geom_index SELECT * FROM gis_geometry;
|
||||
|
||||
--echo # Check column datatypes
|
||||
--replace_regex /REPLICA_NUM = [0-9]*/REPLICA_NUM = 1/g
|
||||
SHOW CREATE TABLE geom_index;
|
||||
|
||||
SET @polygon = ST_GEOMFROMTEXT('POLYGON((0 0,0 10,10 10,10 0,0 0))');
|
||||
|
||||
--echo # Sptail index query
|
||||
SELECT fid, ST_ASTEXT(g) FROM geom_index WHERE MBRCONTAINS(@polygon, g) ORDER BY fid;
|
||||
|
||||
############################################################################################
|
||||
# Checking the commit and rollback #
|
||||
############################################################################################
|
||||
|
||||
SELECT COUNT(*) FROM gis_geometry;
|
||||
|
||||
--echo # Check start transaction commit & Rollback
|
||||
START TRANSACTION;
|
||||
DELETE FROM gis_geometry;
|
||||
ROLLBACK;
|
||||
|
||||
SELECT COUNT(*) FROM gis_geometry;
|
||||
|
||||
START TRANSACTION;
|
||||
DELETE FROM gis_geometry;
|
||||
COMMIT;
|
||||
|
||||
SELECT COUNT(*) FROM gis_geometry;
|
||||
|
||||
############################################################################################
|
||||
# Check that the new aliases introduced in WL#8055 exists andworks as expected. #
|
||||
############################################################################################
|
||||
|
||||
SET @geometrycollection_text = "GEOMETRYCOLLECTION(GEOMETRYCOLLECTION())";
|
||||
SET @multilinestring_text = "MULTILINESTRING((10 10, 11 11), (9 9, 10 10))";
|
||||
SET @multipoint_text = "MULTIPOINT(10 10, 11 11)";
|
||||
SET @multipolygon_text = "MULTIPOLYGON(((40 40, 20 45, 45 30, 40 40)),
|
||||
((20 35, 10 30, 10 10, 30 5, 45 20, 20 35),
|
||||
(30 20, 20 15, 20 25, 30 20)))";
|
||||
|
||||
SELECT ST_ASTEXT(ST_GEOMCOLLFROMTXT(@geometrycollection_text));
|
||||
|
||||
SELECT ST_ASTEXT(ST_MLINEFROMTEXT(@multilinestring_text));
|
||||
SELECT ST_ASTEXT(ST_MLINEFROMWKB(ST_ASWKB(ST_GEOMFROMTEXT(@multilinestring_text))));
|
||||
|
||||
SELECT ST_ASTEXT(ST_MPOINTFROMTEXT(@multipoint_text));
|
||||
SELECT ST_ASTEXT(ST_MPOINTFROMWKB(ST_ASWKB(ST_GEOMFROMTEXT(@multipoint_text))));
|
||||
|
||||
SELECT ST_ASTEXT(ST_MPOLYFROMTEXT(@multipolygon_text));
|
||||
SELECT ST_ASTEXT(ST_MPOLYFROMWKB(ST_ASWKB(ST_GEOMFROMTEXT(@multipolygon_text))));
|
||||
|
||||
SELECT ST_ASTEXT(ST_MULTILINESTRINGFROMTEXT(@multilinestring_text));
|
||||
SELECT ST_ASTEXT(ST_MULTILINESTRINGFROMWKB(ST_ASWKB(ST_GEOMFROMTEXT(@multilinestring_text))));
|
||||
|
||||
SELECT ST_ASTEXT(ST_MULTIPOINTFROMTEXT(@multipoint_text));
|
||||
SELECT ST_ASTEXT(ST_MULTIPOINTFROMWKB(ST_ASWKB(ST_GEOMFROMTEXT(@multipoint_text))));
|
||||
|
||||
SELECT ST_ASTEXT(ST_MULTIPOLYGONFROMTEXT(@multipolygon_text));
|
||||
SELECT ST_ASTEXT(ST_MULTIPOLYGONFROMWKB(ST_ASWKB(ST_GEOMFROMTEXT(@multipolygon_text))));
|
||||
}
|
||||
--echo # Final cleanup
|
||||
DROP TABLE gis_point;
|
||||
DROP TABLE gis_linestring;
|
||||
DROP TABLE gis_polygon;
|
||||
DROP TABLE gis_multi_point;
|
||||
DROP TABLE gis_multi_linestring;
|
||||
DROP TABLE gis_multi_polygon;
|
||||
DROP TABLE gis_geometrycollection;
|
||||
DROP TABLE gis_geometry;
|
||||
DROP TABLE tab;
|
||||
DROP TABLE tab2;
|
||||
|
||||
@ -0,0 +1,92 @@
|
||||
#owner: ht353245
|
||||
#owner group: shenzhen
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--echo # Test of GEOMETRY NLJ JOIN.
|
||||
--echo # ----------------------------------------------------------------------
|
||||
#fix srs only support sys tenant currently
|
||||
#connect (conn_admin, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
--source mysql_test/test_suite/geometry/t/import_default_srs_data_mysql.inc
|
||||
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists tgnoindex1, tgnoindex2, tgeom1, tgeom2, ptgeom1, ptgeom2;
|
||||
--enable_warnings
|
||||
|
||||
create table tgnoindex1(g1 geometry not null srid 4326);
|
||||
create table tgnoindex2(g2 geometry not null srid 4326);
|
||||
|
||||
insert into tgnoindex1 values(ST_GeomFromText('POLYGON((0 0, 5 0, 5 5, 0 5, 0 0))', 4326));
|
||||
insert into tgnoindex1 values(ST_GeomFromText('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))', 4326));
|
||||
insert into tgnoindex1 values(ST_GeomFromText('POLYGON((0 0, 15 0, 15 15, 0 15, 0 0))', 4326));
|
||||
|
||||
insert into tgnoindex2 values(ST_GEOMFROMTEXT('POINT(6 6)', 4326));
|
||||
insert into tgnoindex2 values(ST_GEOMFROMTEXT('POINT(6 6)', 4326));
|
||||
insert into tgnoindex2 values(ST_GEOMFROMTEXT('POINT(6 6)', 4326));
|
||||
insert into tgnoindex2 values(ST_GEOMFROMTEXT('POINT(6 6)', 4326));
|
||||
insert into tgnoindex2 values(ST_GEOMFROMTEXT('POINT(6 6)', 4326));
|
||||
insert into tgnoindex2 values(ST_GEOMFROMTEXT('POINT(12 12)', 4326));
|
||||
insert into tgnoindex2 values(ST_GEOMFROMTEXT('POINT(12 12)', 4326));
|
||||
insert into tgnoindex2 values(ST_GEOMFROMTEXT('POINT(12 12)', 4326));
|
||||
insert into tgnoindex2 values(ST_GEOMFROMTEXT('POINT(12 12)', 4326));
|
||||
insert into tgnoindex2 values(ST_GEOMFROMTEXT('POINT(12 12)', 4326));
|
||||
|
||||
select st_astext(tgnoindex1.g1),st_astext(tgnoindex2.g2) from tgnoindex1, tgnoindex2 where st_intersects(tgnoindex1.g1, tgnoindex2.g2);
|
||||
|
||||
explain extended_noaddr select * from tgnoindex1, tgnoindex2 where st_intersects(tgnoindex1.g1, tgnoindex2.g2);
|
||||
--enable_result_log
|
||||
--replace_regex /Plan signature: [0-9]*/Plan signature/
|
||||
|
||||
|
||||
create table tgeom1(g1 geometry not null srid 4326);
|
||||
create index gidx1 on tgeom1(g1);
|
||||
create table tgeom2(g2 geometry not null srid 4326);
|
||||
create index gidx2 on tgeom2(g2);
|
||||
|
||||
insert into tgeom1 values(ST_GeomFromText('POLYGON((0 0, 5 0, 5 5, 0 5, 0 0))', 4326));
|
||||
insert into tgeom1 values(ST_GeomFromText('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))', 4326));
|
||||
insert into tgeom1 values(ST_GeomFromText('POLYGON((0 0, 15 0, 15 15, 0 15, 0 0))', 4326));
|
||||
|
||||
insert into tgeom2 values(ST_GEOMFROMTEXT('POINT(6 6)', 4326));
|
||||
insert into tgeom2 values(ST_GEOMFROMTEXT('POINT(6 6)', 4326));
|
||||
insert into tgeom2 values(ST_GEOMFROMTEXT('POINT(6 6)', 4326));
|
||||
insert into tgeom2 values(ST_GEOMFROMTEXT('POINT(6 6)', 4326));
|
||||
insert into tgeom2 values(ST_GEOMFROMTEXT('POINT(6 6)', 4326));
|
||||
insert into tgeom2 values(ST_GEOMFROMTEXT('POINT(12 12)', 4326));
|
||||
insert into tgeom2 values(ST_GEOMFROMTEXT('POINT(12 12)', 4326));
|
||||
insert into tgeom2 values(ST_GEOMFROMTEXT('POINT(12 12)', 4326));
|
||||
insert into tgeom2 values(ST_GEOMFROMTEXT('POINT(12 12)', 4326));
|
||||
insert into tgeom2 values(ST_GEOMFROMTEXT('POINT(12 12)', 4326));
|
||||
|
||||
select st_astext(tgeom1.g1),st_astext(tgeom2.g2) from tgeom1, tgeom2 where st_intersects(tgeom1.g1, tgeom2.g2);
|
||||
|
||||
explain extended_noaddr select * from tgeom1, tgeom2 where st_intersects(tgeom1.g1, tgeom2.g2);
|
||||
--replace_regex /Plan signature: [0-9]*/Plan signature/
|
||||
|
||||
|
||||
create table ptgeom1(c1 int, g1 geometry not null srid 4326) partition by hash(c1) partitions 3;
|
||||
create index pgidx1 on ptgeom1(g1) local;
|
||||
create table ptgeom2(c2 int, g2 geometry not null srid 4326) partition by hash(c2) partitions 3;
|
||||
create index pgidx2 on ptgeom2(g2) local;
|
||||
|
||||
insert into ptgeom1 values(1, ST_GeomFromText('POLYGON((0 0, 5 0, 5 5, 0 5, 0 0))', 4326));
|
||||
insert into ptgeom1 values(2, ST_GeomFromText('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))', 4326));
|
||||
insert into ptgeom1 values(3, ST_GeomFromText('POLYGON((0 0, 15 0, 15 15, 0 15, 0 0))', 4326));
|
||||
|
||||
insert into ptgeom2 values(1, ST_GEOMFROMTEXT('POINT(6 6)', 4326));
|
||||
insert into ptgeom2 values(2, ST_GEOMFROMTEXT('POINT(6 6)', 4326));
|
||||
insert into ptgeom2 values(3, ST_GEOMFROMTEXT('POINT(6 6)', 4326));
|
||||
insert into ptgeom2 values(4, ST_GEOMFROMTEXT('POINT(6 6)', 4326));
|
||||
insert into ptgeom2 values(5, ST_GEOMFROMTEXT('POINT(6 6)', 4326));
|
||||
insert into ptgeom2 values(6, ST_GEOMFROMTEXT('POINT(12 12)', 4326));
|
||||
insert into ptgeom2 values(7, ST_GEOMFROMTEXT('POINT(12 12)', 4326));
|
||||
insert into ptgeom2 values(8, ST_GEOMFROMTEXT('POINT(12 12)', 4326));
|
||||
insert into ptgeom2 values(9, ST_GEOMFROMTEXT('POINT(12 12)', 4326));
|
||||
insert into ptgeom2 values(10, ST_GEOMFROMTEXT('POINT(12 12)', 4326));
|
||||
|
||||
select st_astext(ptgeom1.g1),st_astext(ptgeom2.g2) from ptgeom1, ptgeom2 where st_intersects(ptgeom1.g1, ptgeom2.g2) order by c1,c2;
|
||||
|
||||
explain extended_noaddr select * from ptgeom1, ptgeom2 where st_intersects(ptgeom1.g1, ptgeom2.g2);
|
||||
--replace_regex /Plan signature: [0-9]*/Plan signature/
|
||||
|
||||
drop table tgnoindex1, tgnoindex2, tgeom1, tgeom2, ptgeom1, ptgeom2;
|
||||
|
||||
360
tools/deploy/mysql_test/test_suite/geometry/t/st_area_mysql.test
Normal file
360
tools/deploy/mysql_test/test_suite/geometry/t/st_area_mysql.test
Normal file
@ -0,0 +1,360 @@
|
||||
#owner: ht353245
|
||||
#owner group: shenzhen
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--echo # Test of GEOMETRY ST_Area.
|
||||
--echo # ----------------------------------------------------------------------
|
||||
#fix srs only support sys tenant currently
|
||||
#connect (conn_admin, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
--source mysql_test/test_suite/geometry/t/import_default_srs_data_mysql.inc
|
||||
|
||||
|
||||
# Test errors
|
||||
--error ER_GIS_INVALID_DATA
|
||||
SELECT ST_AREA('');
|
||||
|
||||
--error 3516
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('POINT(0 0)'));
|
||||
--error 3516
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('MULTIPOINT(0 0)'));
|
||||
--error 3516
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('LINESTRING(0 0, 1 0)'));
|
||||
--error 3516
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('MULTILINESTRING((0 0, 1 0))'));
|
||||
--error 3516
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION()'));
|
||||
|
||||
# Test error due to numeric overflow.
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('POLYGON((0 0, 0 1e308, 1e308 1e308, 0 0))'));
|
||||
|
||||
# Cartesian
|
||||
SELECT
|
||||
ROUND(
|
||||
ST_AREA(ST_GEOMFROMTEXT('POLYGON((0 0, 1 0, 1 1, 0 0))', 0)),
|
||||
2
|
||||
) AS area;
|
||||
SELECT
|
||||
ROUND(
|
||||
ST_AREA(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0, 1 0, 1 1, 0 0)))', 0)),
|
||||
2
|
||||
) AS area;
|
||||
|
||||
# mysql is 6154785747.34
|
||||
# Geographic
|
||||
SELECT
|
||||
ROUND(
|
||||
ST_AREA(ST_GEOMFROMTEXT('POLYGON((0 0, 0 1, 1 1, 0 0))', 4326)),
|
||||
2
|
||||
) AS area;
|
||||
SELECT
|
||||
ROUND(
|
||||
ST_AREA(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0, 0 1, 1 1, 0 0)))', 4326)),
|
||||
2
|
||||
) AS area;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists gis_geometrycollection;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE gis_geometrycollection (fid INTEGER NOT NULL PRIMARY KEY, g GEOMETRY);
|
||||
|
||||
SET @star_elem_vertical= 'POLYGON((5 0,15 25,25 0,15 5,5 0))';
|
||||
SET @star_elem_horizontal= 'POLYGON((25 0,0 15,30 15,22 10,25 0))';
|
||||
SET @star_center= 'POINT(15 10)';
|
||||
SET @star_top= 'POINT(15 25)';
|
||||
SET @star_bottom_left= 'POINT(5 0)';
|
||||
SET @star_bottom_right= 'POINT(25 0)';
|
||||
SET @star_bottom_points= 'MULTIPOINT(5 0,25 0)';
|
||||
SET @star_all_points= 'MULTIPOINT(5 0,25 0,15 10,15 25)';
|
||||
SET @star_line_horizontal= 'LINESTRING(10 15,20 15)';
|
||||
SET @star_line_vertical= 'LINESTRING(15 5,15 25)';
|
||||
SET @star_top_to_center= 'LINESTRING(15 25,15 10)';
|
||||
SET @star_lines_near_horizontal= 'MULTILINESTRING((25 0,0 15,15 30,0 5))';
|
||||
SET @star_lines_near_vertical= 'MULTILINESTRING((0 5,15 25,0 25))';
|
||||
SET @star= 'POLYGON((5 0,7 10,0 15,10 15,15 25,20 15,30 15,22 10,25 0,15 5,5 0))';
|
||||
SET @star_elem_vertical_val= '((5 0,15 25,25 0,15 5,5 0))';
|
||||
SET @star_elem_horizontal_val= '((25 0,0 15,30 15,22 10,25 0))';
|
||||
SET @star_of_elems='MULTIPOLYGON(((5 0,15 25,25 0,15 5,5 0)),((25 0,0 15,30 15,22 10,25 0)))';
|
||||
SET @star_collection_elems='GEOMETRYCOLLECTION(MULTIPOLYGON(((5 0,15 25,25 0,15 5,5 0)),((25 0,0 15,30 15,22 10,25 0))),POLYGON((5 0,7 10,0 15,10 15,15 25,20 15,30 15,22 10,25 0,15 5,5 0)),LINESTRING(15 25,15 10),MULTIPOINT(5 0,25 0),POINT(15 25))';
|
||||
SET @star_collection_multilinestr='GEOMETRYCOLLECTION(MULTIPOLYGON(((5 0,15 25,25 0,15 5,5 0)),((25 0,0 15,30 15,22 10,25 0))),POLYGON((5 0,7 10,0 15,10 15,15 25,20 15,30 15,22 10,25 0,15 5,5 0)),MULTILINESTRING((25 0,0 15,15 30,0 5)),LINESTRING(15 25,15 10),MULTIPOINT(5 0,25 0),POINT(15 25))';
|
||||
|
||||
--disable_warnings
|
||||
INSERT INTO gis_geometrycollection VALUES
|
||||
(100,ST_GEOMFROMTEXT(@star)),
|
||||
(101,ST_GEOMFROMTEXT(@star_elem_vertical)),
|
||||
(102,ST_GEOMFROMTEXT(@star_elem_horizontal)),
|
||||
(103,ST_GEOMFROMTEXT(@star_of_elems)),
|
||||
(104,ST_GEOMFROMTEXT(@star_top)),
|
||||
(105,ST_GEOMFROMTEXT(@star_center)),
|
||||
(106,ST_GEOMFROMTEXT(@star_bottom_left)),
|
||||
(107,ST_GEOMFROMTEXT(@star_bottom_right)),
|
||||
(108,ST_GEOMFROMTEXT(@star_bottom_points)),
|
||||
(109,ST_GEOMFROMTEXT(@star_all_points)),
|
||||
(110,ST_GEOMFROMTEXT(@star_line_horizontal)),
|
||||
(111,ST_GEOMFROMTEXT(@star_line_vertical)),
|
||||
(112,ST_GEOMFROMTEXT(@star_top_to_center)),
|
||||
(113,ST_GEOMFROMTEXT(@star_lines_near_horizontal)),
|
||||
(114,ST_GEOMFROMTEXT(@star_lines_near_vertical)),
|
||||
(115,ST_GEOMFROMTEXT(@star_collection_elems)),
|
||||
(116,ST_GEOMFROMTEXT(@star_collection_multilinestr)),
|
||||
(200,ST_GEOMFROMTEXT('POLYGON((0 0,6 7,8 8,3 9,0 0),(3 6,4 6,4 7,3 6))')),
|
||||
(201,ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0)), ((2 2,4 5,6 2,2 2)))'));
|
||||
--enable_warnings
|
||||
|
||||
--echo #test ST_AREA POLYGON
|
||||
#SELECT count(ST_ASTEXT(g) != 'NULL') FROM gis_geometrycollection;
|
||||
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT(@star));
|
||||
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT(@star_elem_vertical));
|
||||
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('POLYGON((0 0,0 5,5 5, 0 0))'));
|
||||
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('POLYGON((0 0,0 10,10 10,10 0,0 0))'));
|
||||
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('POLYGON((0 0,0 10,10 10,10 0,0 0,-10 0,-10 -10,0 -10, 0 0))'));
|
||||
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4))'));
|
||||
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('POLYGON((0 0,0 10,10 10,10 0,0 0),(0 0,0 10,10 10,10 0,0 0))'));
|
||||
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('POLYGON((4 4,4 6,6 6,6 4,4 4),(0 0,0 10,10 10,10 0,0 0))'));
|
||||
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('POLYGON((4 4,4 6,6 6,6 4,4 4),(8 8,8 10,10 10,10 8,8 8))'));
|
||||
|
||||
SELECT ST_AREA(g) FROM gis_geometrycollection WHERE fid=100;
|
||||
|
||||
# from func_math.test
|
||||
SELECT CRC32(ST_Area(g)) FROM gis_geometrycollection WHERE fid=200;
|
||||
SELECT CRC32(ST_Area(g)) FROM gis_geometrycollection WHERE fid=201;
|
||||
|
||||
--echo #test ST_AREA MULTIPOLYGON
|
||||
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT(@star_of_elems));
|
||||
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,0 5,5 5, 0 0)))'));
|
||||
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 10,10 0,0 0, 0 10)),((0 0,10 10,10 0, 0 0)))'));
|
||||
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,0 10,10 10, 0 0)),((10 10,10 15,15 15,10 10)))'));
|
||||
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)),((4 4,4 6,6 6,6 4, 4 4)))'));
|
||||
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,0 10,10 10,10 0, 0 0),(4 4,4 6,6 6,6 4, 4 4)))'));
|
||||
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(0 0,0 10,10 10,10 0,0 0)))'));
|
||||
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('MULTIPOLYGON(((4 4,4 6,6 6,6 4,4 4),(0 0,0 10,10 10,10 0,0 0)))'));
|
||||
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('MULTIPOLYGON(((4 4,4 6,6 6,6 4,4 4),(8 8,8 10,10 10,10 8,8 8)))'));
|
||||
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('MULTIPOLYGON(((10 10,10 0,5 10,10 10)),((0 10,0 20,5 10,0 10)))'));
|
||||
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(0 0,0 10,10 10,10 0,0 0)),((0 0,0 10,10 10,10 0,0 0)))'));
|
||||
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(0 0,0 10,10 10,10 0,0 0)),((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6, 4 4)))'));
|
||||
|
||||
SELECT ST_AREA(g) FROM gis_geometrycollection WHERE fid=103;
|
||||
|
||||
--echo #test with invalid srid
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT(@star_center,-1024));
|
||||
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT(@star_all_points,-1));
|
||||
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT(@star_of_elems,4294967296));
|
||||
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT(@star_collection_elems,4294967295000));
|
||||
|
||||
#wrong error code from st_geomfromtext
|
||||
--echo #test ST_AREA with invalid input
|
||||
|
||||
--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
||||
SELECT ST_AREA();
|
||||
SELECT ST_AREA(NULL);
|
||||
|
||||
--error ER_GIS_INVALID_DATA
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('POINT()'));
|
||||
--error ER_GIS_INVALID_DATA
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('LINESTRING()'));
|
||||
--error ER_GIS_INVALID_DATA
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('POLYGON(())'));
|
||||
--error ER_GIS_INVALID_DATA
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('MULTIPOINT()'));
|
||||
--error ER_GIS_INVALID_DATA
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('MULTILINESTRING(())'));
|
||||
--error ER_GIS_INVALID_DATA
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('MULTIPOLYGON((()))'));
|
||||
--error ER_GIS_INVALID_DATA
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('POINT(a 0)'));
|
||||
--error ER_GIS_INVALID_DATA
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('POINT(! 0)'));
|
||||
--error ER_PARSE_ERROR
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('POINT('!' 0)'));
|
||||
--error ER_GIS_INVALID_DATA
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('POINT(12,34 0)'));
|
||||
--error ER_GIS_INVALID_DATA
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('LINESTRING(a 0,10 10)'));
|
||||
--error ER_GIS_INVALID_DATA
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('LINESTRING(0 0,! 10)'));
|
||||
--error ER_PARSE_ERROR
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('LINESTRING('!' 0,10 10)'));
|
||||
--error ER_GIS_INVALID_DATA
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('LINESTRING(12,34 0,10 10)'));
|
||||
--error ER_GIS_INVALID_DATA
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('POLYGON((a 0,10 10,10 0,0 0))'));
|
||||
--error ER_GIS_INVALID_DATA
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('POLYGON((0 0,! 10,10 0,0 0))'));
|
||||
--error ER_PARSE_ERROR
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('POLYGON(('!' 0,10 10,10 0,0 0))'));
|
||||
--error ER_GIS_INVALID_DATA
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('POLYGON((12,34 0,10 10,10 0,0 0))'));
|
||||
--error ER_GIS_INVALID_DATA
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('POLYGON((0 0))'));
|
||||
|
||||
--error ER_GIS_INVALID_DATA
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('POLYGON((0 0,5 5))'));
|
||||
|
||||
--error ER_GIS_INVALID_DATA
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('POLYGON((0 0,5 5,10 10))'));
|
||||
|
||||
--error ER_GIS_INVALID_DATA
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('POLYGON((0 0,0 5,10 10),(0 0))'));
|
||||
|
||||
--error ER_GIS_INVALID_DATA
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,5 5,10 10)),((10 10)))'));
|
||||
|
||||
--error ER_GIS_INVALID_DATA
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,5 5,10 10)),((10 10))'));
|
||||
|
||||
--echo #test ST_AREA out of range
|
||||
--echo # Assume SRID 10 is not defined.
|
||||
# need varchar to wkb cast?
|
||||
--error 3548
|
||||
SELECT ST_AREA(x'0A000000010100000000000000000000000000000000000000');
|
||||
|
||||
--echo # MYSQL Bug#28301552 ASSERTION FAILED: STD::ISFINITE(*RESULT)
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
SELECT ST_Area(
|
||||
POLYGON(
|
||||
LINESTRING(
|
||||
POINT(4.271317e+307,-18656),
|
||||
POINT(-29177,-15475),
|
||||
POINT(8554,3430),
|
||||
POINT(4.271317e+307,-18656)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
SELECT ST_Area(POLYGON(
|
||||
LINESTRING(
|
||||
POINT(3006,-15963),
|
||||
POINT(-17919,-15105),
|
||||
POINT(9.466488e+307,1.280303e+308),
|
||||
POINT(3006,-15963)
|
||||
)
|
||||
)
|
||||
);
|
||||
truncate table gis_geometrycollection;
|
||||
drop table gis_geometrycollection;
|
||||
|
||||
--echo #other tests
|
||||
|
||||
# need subtypes
|
||||
#--disable_warnings
|
||||
#drop table if exists gis_polygon, gis_multi_polygon;
|
||||
#--enable_warnings
|
||||
|
||||
#CREATE TABLE gis_polygon (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g POLYGON);
|
||||
#CREATE TABLE gis_multi_polygon (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g MULTIPOLYGON);
|
||||
#INSERT INTO gis_polygon VALUES
|
||||
# (108, ST_PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')),
|
||||
# (109, ST_PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')),
|
||||
# (110, ST_PolyFromWKB(St_AsWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0))))));
|
||||
|
||||
#INSERT INTO gis_multi_polygon VALUES
|
||||
# (117, ST_MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
|
||||
# (118, ST_MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
|
||||
# (119, ST_MPolyFromWKB(St_AsWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3)))))));
|
||||
|
||||
#SELECT fid, ST_Area(g) FROM gis_polygon ORDER by fid;
|
||||
#SELECT fid, ST_Area(g) FROM gis_multi_polygon ORDER by fid;
|
||||
|
||||
#drop table gis_polygon, gis_multi_polygon;
|
||||
|
||||
--echo #error codes
|
||||
--error ER_GIS_INVALID_DATA
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT('POLYGON((0 0,5 5, 0 0))'));
|
||||
|
||||
SET @star_of_elems='MULTIPOLYGON(((5 0,15 25,25 0,15 5,5 0)),((25 0,0 15,30 15,22 10,25 0)))';
|
||||
SELECT ST_AREA(ST_GEOMFROMTEXT(@star_of_elems));
|
||||
|
||||
#tests with st_buffer
|
||||
#fix need st_buffer!
|
||||
#SET @buf = ST_BUFFER(ST_GEOMFROMTEXT(@star_of_elems), 1);
|
||||
#--replace_numeric_round 12
|
||||
#SELECT ST_AREA(@buf);
|
||||
|
||||
#SELECT ST_AREA(ST_BUFFER(ST_GEOMFROMTEXT('LINESTRING(0 0,0 1)'), 1)) > 0;
|
||||
#SELECT ST_AREA(ST_BUFFER(ST_GEOMFROMTEXT('LINESTRING(1 1,1 1)'), 1)) > 0;
|
||||
|
||||
#--error ER_GIS_INVALID_DATA
|
||||
#SELECT ST_AREA(ST_BUFFER(ST_GEOMFROMTEXT('POLYGON(1 1,1 1,1 1,1 1)'), 1)) > 0;
|
||||
|
||||
#SELECT ST_AREA(ST_BUFFER(ST_GEOMFROMTEXT('POLYGON((0 0, 0 8, 8 8, 8 10, -10 10, -10 0, 0 0))'), 1)) > 0;
|
||||
#SELECT ST_AREA(ST_BUFFER(ST_GEOMFROMTEXT('POLYGON((0 0,10 10,0 8,0 0))'), 1)) > 0;
|
||||
#SELECT ST_AREA(ST_BUFFER(ST_GEOMFROMTEXT('POLYGON((1 1,10 10,0 8,1 1))'), 1)) > 0;
|
||||
#SELECT ST_AREA(ST_BUFFER(ST_GEOMFROMTEXT('POLYGON((2 2,2 8,8 8,8 2,2 2))'), 1)) > 0;
|
||||
#SELECT ST_AREA(ST_BUFFER(ST_GEOMFROMTEXT('POLYGON((2 2,8 2,8 8,2 8,2 2))'), 1)) > 0;
|
||||
|
||||
#from gis-precise.test
|
||||
#self intersection polygons
|
||||
#Result 450
|
||||
Select ST_Area(ST_GEOMFROMTEXT('POLYGON((0 0, 30 30, 30 0, 0 5, 0 0, 30 5, 30 0, 0 10, 0 0, 30 10, 30 0, 0 0))')) as Result;
|
||||
#Result 0
|
||||
Select ST_Area(ST_GEOMFROMTEXT('POLYGON((1 1, 10 1, 1 0, 10 0, 1 -1, 10 -1, 7 2, 7 -2, 4 2, 4 -2, 1 1))')) as Result;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists tbl_polygon;
|
||||
--enable_warnings
|
||||
create table tbl_polygon(id varchar(32), geom GEOMETRY);
|
||||
insert into tbl_polygon (id, geom) values ('POLY1',ST_GeomFromText('POLYGON((0 0,0 10,10 10,10 0,0 0))'));
|
||||
insert into tbl_polygon (id, geom) values ('POLY2',ST_GeomFromText('POLYGON((0 0,0 -10,10 -10,10 0,0 0))'));
|
||||
|
||||
select 100, st_area(t.geom) from tbl_polygon t where t.id like 'POLY%';
|
||||
drop table tbl_polygon;
|
||||
|
||||
#from gis.test
|
||||
--disable_warnings
|
||||
drop table if exists ponds, named_places;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE ponds (
|
||||
fid INTEGER NOT NULL PRIMARY KEY,
|
||||
name VARCHAR(64),
|
||||
type VARCHAR(64),
|
||||
shores GEOMETRY);
|
||||
|
||||
INSERT INTO ponds VALUES(120, NULL, 'Stock Pond', ST_GEOMFROMTEXT(
|
||||
'MULTIPOLYGON( ( ( 24 44, 22 42, 24 40, 24 44) ), ( ( 26 44, 26 40, 28 42, 26 44) ) )', 0));
|
||||
|
||||
SELECT ST_Area(shores)
|
||||
FROM ponds
|
||||
WHERE fid = 120;
|
||||
|
||||
CREATE TABLE named_places (
|
||||
fid INTEGER NOT NULL PRIMARY KEY,
|
||||
name VARCHAR(64),
|
||||
boundary GEOMETRY);
|
||||
|
||||
INSERT INTO named_places VALUES(117, 'Ashton', ST_GEOMFROMTEXT('POLYGON( ( 62 48, 84 48, 84 30, 56 30, 56 34, 62 48) )', 0));
|
||||
|
||||
INSERT INTO named_places VALUES(118, 'Goose Island', ST_GEOMFROMTEXT('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )', 0));
|
||||
|
||||
SELECT ST_Area(boundary) FROM named_places WHERE name = 'Goose Island';
|
||||
|
||||
drop table ponds, named_places;
|
||||
@ -0,0 +1,326 @@
|
||||
#owner: ht353245
|
||||
#owner group: shenzhen
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--echo # Test of ST_AsText/ST_ASWKT/_st_asewkt.
|
||||
--echo # ----------------------------------------------------------------------
|
||||
|
||||
##
|
||||
## Basic test
|
||||
##
|
||||
--source mysql_test/test_suite/geometry/t/import_default_srs_data_mysql.inc
|
||||
|
||||
SET @wkt_pt = 'POINT(0 0)';
|
||||
SET @wkt_ln = 'LINESTRING(0 0,2 2,4 4,6 6,8 8, 10 10)';
|
||||
SET @wkt_py = 'POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4))';
|
||||
SET @wkt_mpt = 'MULTIPOINT(0 0,2 2,4 4,6 6)';
|
||||
SET @wkt_mln = 'MULTILINESTRING((0 0,2 2,4 4),(6 6,8 8,10 10))';
|
||||
SET @wkt_mpy = 'MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4)),'
|
||||
'((10 10,10 12,12 12,12 10,10 10)))';
|
||||
SET @wkt_gc = 'GEOMETRYCOLLECTION('
|
||||
'POINT(0 0),'
|
||||
'LINESTRING(0 0,10 10),'
|
||||
'POLYGON((0 0,0 10,10 10,10 0, 0 0)),'
|
||||
'MULTIPOINT(0 0,2 2,4 4,6 6,8 8,10 10),'
|
||||
'MULTILINESTRING((0 0,10 10),(0 10,10 0)),'
|
||||
'MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0)),((5 5,5 10,10 10,10 5,5 5))))';
|
||||
SELECT ST_AsText(ST_GeomFromText(@wkt_pt));
|
||||
SELECT ST_AsText(ST_GeomFromText(@wkt_ln));
|
||||
SELECT ST_AsText(ST_GeomFromText(@wkt_py));
|
||||
SELECT ST_AsText(ST_GeomFromText(@wkt_mpt));
|
||||
SELECT ST_AsText(ST_GeomFromText(@wkt_mln));
|
||||
SELECT ST_AsText(ST_GeomFromText(@wkt_mpy));
|
||||
SELECT ST_AsText(ST_GeomFromText(@wkt_gc));
|
||||
|
||||
|
||||
##
|
||||
## Empty GEOMETRYCOLLECTION
|
||||
##
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION EMPTY'));
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION()'));
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION()', 4326));
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMTEXT(' GEOMETRYCOLLECTION EMPTY '));
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMTEXT(
|
||||
'GEOMETRYCOLLECTION(
|
||||
GEOMETRYCOLLECTION(
|
||||
GEOMETRYCOLLECTION EMPTY,
|
||||
GEOMETRYCOLLECTION ()
|
||||
)
|
||||
)'
|
||||
));
|
||||
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMTEXT(
|
||||
'GEOMETRYCOLLECTION(
|
||||
GEOMETRYCOLLECTION(
|
||||
GEOMETRYCOLLECTION ()
|
||||
)
|
||||
)'
|
||||
));
|
||||
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMTEXT(
|
||||
'GEOMETRYCOLLECTION(
|
||||
GEOMETRYCOLLECTION(
|
||||
MULTIPOINT((0 0), (1 1)),
|
||||
GEOMETRYCOLLECTION ()
|
||||
)
|
||||
)'
|
||||
));
|
||||
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMTEXT(
|
||||
'GEOMETRYCOLLECTION(
|
||||
GEOMETRYCOLLECTION(
|
||||
MULTIPOINT((0 0), (1 1)),
|
||||
GEOMETRYCOLLECTION ()
|
||||
),
|
||||
GEOMETRYCOLLECTION(
|
||||
MULTIPOINT((0 0), (1 1)),
|
||||
GEOMETRYCOLLECTION ()
|
||||
)
|
||||
)'
|
||||
));
|
||||
|
||||
##
|
||||
## Values with long lat ordering
|
||||
##
|
||||
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(3 5),
|
||||
POLYGON((0 0,10 0,10 10,0 10,0 0)),
|
||||
MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(4 4,4 6,6 6,6 4, 4 4)),
|
||||
((0 0,-2 -2,0 -2, 0 0))))', 4326,'axis-order=long-lat'));
|
||||
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(3 5),
|
||||
POLYGON((0 0,0 10,10 10,10 0,0 0)),
|
||||
MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6, 4 4)),
|
||||
((0 0,-2 -2,-2 0, 0 0))))', 4326,'axis-order=lat-long'));
|
||||
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(3 5),
|
||||
POLYGON((0 0,0 10,10 10,10 0,0 0)),
|
||||
MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6, 4 4)),
|
||||
((0 0,-2 -2,-2 0, 0 0))))', 4326,'axis-order=srid-defined'));
|
||||
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(3 5),
|
||||
POLYGON((0 0,10 0,10 10,0 10,0 0)),
|
||||
MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(4 4,4 6,6 6,6 4, 4 4)),
|
||||
((0 0,-2 -2,0 -2, 0 0))))', 4326,'axis-order=srid-defined'));
|
||||
|
||||
##
|
||||
## Values from table
|
||||
##
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t;
|
||||
--enable_warnings
|
||||
create table t(g geometry NOT NULL);
|
||||
INSERT INTO t (g) VALUES
|
||||
(ST_GeomFromText('POINT(0 0)')),
|
||||
(ST_GeomFromText('POINT(1 1)')),
|
||||
(ST_GeomFromText('POINT(2 2)')),
|
||||
(ST_GeomFromText('POINT(3 3)')),
|
||||
(ST_GeomFromText('POINT(4 4)')),
|
||||
(ST_GeomFromText('POINT(5 5)')),
|
||||
(ST_GeomFromText('POINT(6 6)')),
|
||||
(ST_GeomFromText('POINT(7 7)'));
|
||||
SELECT ST_ASTEXT(g) FROM t;
|
||||
drop table t;
|
||||
|
||||
|
||||
##
|
||||
## Values from wkb
|
||||
##
|
||||
select ST_ASTEXT(x'00000000010100000000000000000000000000000000000000');
|
||||
select ST_ASTEXT(x'00000000010500000002000000010200000003000000000000000000000000000000000000000000000000000040000000000000004000000000000010400000000000001040010200000003000000000000000000184000000000000018400000000000002040000000000000204000000000000024400000000000002440');
|
||||
|
||||
##
|
||||
## Alias Func testing
|
||||
##
|
||||
select ST_ASWKT(x'00000000010100000000000000000000000000000000000000');
|
||||
select ST_ASWKT(x'00000000010500000002000000010200000003000000000000000000000000000000000000000000000000000040000000000000004000000000000010400000000000001040010200000003000000000000000000184000000000000018400000000000002040000000000000204000000000000024400000000000002440');
|
||||
--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
||||
SELECT ST_ASWKT();
|
||||
|
||||
##
|
||||
## Empty/Error testing
|
||||
##
|
||||
|
||||
SELECT ST_ASTEXT(NULL);
|
||||
SELECT ST_AsText(ST_GeomFromText(@wkt_pt), NULL);
|
||||
--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
||||
SELECT ST_ASTEXT();
|
||||
--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
||||
SELECT ST_ASTEXT(ST_GeomFromText(@wkt_pt),ST_GeomFromText(@wkt_pt),'axis-order=srid-defin');
|
||||
|
||||
##
|
||||
## axis-order testing
|
||||
##
|
||||
select ST_ASTEXT(ST_GeomFromText('POINT(1 2)',4326), 'axis-order=lat-long');
|
||||
select ST_ASTEXT(ST_GeomFromText('POINT(1 2)',4326), 'axis-order=long-lat');
|
||||
|
||||
#TODO: 错误码适配
|
||||
#--error ER_DUPLICATE_OPTION_KEY
|
||||
#SELECT ST_ASTEXT(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),
|
||||
# (4 4,6 4,6 6,4 6, 4 4)),((0 0,-2 -2,-2 0, 0 0)))', 3825,
|
||||
# 'axis-order=srid-defined, axis-order=lat-long'));
|
||||
#SELECT ST_ASTEXT(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),
|
||||
# (4 4,6 4,6 6,4 6, 4 4)),((0 0,-2 -2,-2 0, 0 0)))', 3825,
|
||||
# 'axis-order=srid-defin'));
|
||||
|
||||
#TODO: invalid wkb recognize
|
||||
#select ST_ASTEXT(x'0000000001010000000000000000000000000000');
|
||||
|
||||
##
|
||||
## Bugs: repeated testcase
|
||||
##
|
||||
set @p=st_geomfromtext('point(10 -10)', 4326);
|
||||
select st_astext(@p);
|
||||
select st_astext(@p);
|
||||
select st_astext(@p);
|
||||
|
||||
##
|
||||
## Testcase from postgis
|
||||
##
|
||||
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('POINT(0 0)'));
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('MULTIPOINT(0 0, 2 0)'));
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('MULTIPOINT((0 0), (2 0))'));
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('LINESTRING(0 0, 1 1)'));
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('MULTILINESTRING((0 0, 2 0))'));
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('MULTILINESTRING((0 0, 2 0), (1 1, 2 2))'));
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('POLYGON((0 0,1 0,1 1,0 1,0 0))'));
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('POLYGON((0 0,10 0,10 10,0 10,0 0),(2 2,2 5,5 5,5 2,2 2))'));
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(2 2,2 5,5 5,5 2,2 2)))'));
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION EMPTY'));
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(2 2,2 5,5 5,5 2,2 2))),POINT(0 0),MULTILINESTRING((0 0, 2 0),(1 1, 2 2)))'));
|
||||
|
||||
SELECT _st_asewkt(ST_GEOMFROMTEXT('POINT(0 0)', 4326));
|
||||
SELECT _st_asewkt(ST_GEOMFROMTEXT('MULTIPOINT(0 0, 2 0)', 4326));
|
||||
SELECT _st_asewkt(ST_GEOMFROMTEXT('MULTIPOINT((0 0), (2 0))', 4326));
|
||||
SELECT _st_asewkt(ST_GEOMFROMTEXT('LINESTRING(0 0, 1 1)', 4326));
|
||||
SELECT _st_asewkt(ST_GEOMFROMTEXT('MULTILINESTRING((0 0, 2 0))', 4326));
|
||||
SELECT _st_asewkt(ST_GEOMFROMTEXT('MULTILINESTRING((0 0, 2 0), (1 1, 2 2))', 4326));
|
||||
SELECT _st_asewkt(ST_GEOMFROMTEXT('POLYGON((0 0,1 0,1 1,0 1,0 0))', 4326));
|
||||
SELECT _st_asewkt(ST_GEOMFROMTEXT('POLYGON((0 0,10 0,10 10,0 10,0 0),(2 2,2 5,5 5,5 2,2 2))', 4326));
|
||||
SELECT _st_asewkt(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(2 2,2 5,5 5,5 2,2 2)))', 4326));
|
||||
SELECT _st_asewkt(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION EMPTY', 4326));
|
||||
SELECT _st_asewkt(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(2 2,2 5,5 5,5 2,2 2))),POINT(0 0),MULTILINESTRING((0 0, 2 0),(1 1, 2 2)))', 4326));
|
||||
SELECT _st_asewkt(ST_GEOMFROMTEXT('POINT(25.416666666666666666666666668 -25.416666666666666666666666668)'), 3);
|
||||
SELECT _st_asewkt(_ST_GeomFromEWKT('SRID=4269;point(0.1234567898765432123456789 -0.12345678998765432123456789)'));
|
||||
SELECT _st_asewkt(_ST_GeomFromEWKT('SRID=4269;POLYGON((0 0.000035379323451,0.000006466490655 0.000008682268431,0.000026970365057 0.000024413715792,0.000151654188725 0.000034529750537,0.00006579467362 -0.00010449622015,-0.000025454219399 -0.000110606436693,-0.000062701646319 -0.000019388332115,0 0.000035379323451)) '),20) t;
|
||||
SELECT _st_asewkt(_ST_GeomFromEWKT('SRID=4269;POLYGON((0.123456789876543212345678987654321 0.123456789876543212345678987654321, 0.123456789876543212345678987654321 0.123456789876543212345678987654321,
|
||||
0.123456789876543212345678987654321 0.123456789876543212345678987654321,
|
||||
0.123456789876543212345678987654321 0.123456789876543212345678987654321)) '),31) t;
|
||||
--error 3064
|
||||
SELECT _st_asewkt(_ST_GeomFromEWKT('SRID=4269;POLYGON((0 0.000035379323451,0.000006466490655 0.000008682268431,0.000026970365057 0.000024413715792,0.000151654188725 0.000034529750537,0.00006579467362 -0.00010449622015,-0.000025454219399 -0.000110606436693,-0.000062701646319 -0.000019388332115,0 0.000035379323451)) '),15.5) t;
|
||||
|
||||
#
|
||||
# POINT(2.093e-320 5.332997387e-315)
|
||||
select _st_asewkt(_st_geomfromewkb(x'01010000008C10000000000000008056400000000000806640'));
|
||||
# POINT(1.32993e-319 5.33817804e-315)
|
||||
select _st_asewkt(_st_geomfromewkb(x'01010000002669000000000000008066400000000000805640'));
|
||||
# all zeros
|
||||
SELECT _st_asewkt(_ST_GeomFromEWKT('SRID=4269;POLYGON((0 0.000035379323451,0.000006466490655 0.000008682268431,0.000026970365057 0.000024413715792,0.000151654188725 0.000034529750537,0.00006579467362 -0.00010449622015,-0.000025454219399 -0.000110606436693,-0.000062701646319 -0.000019388332115,0 0.000035379323451)) '),1) t;
|
||||
SELECT _st_asewkt(_st_geomfromewkt('srid=4269;point(0.000008682268431 0.000026970365057)'), 3);
|
||||
# SRID=4269;POLYGON((0 0,0 0,0 0,0.0002 0,0.0001 -0.0001,0 -0.0001,-0.0001 0,0 0))
|
||||
SELECT _st_asewkt(_ST_GeomFromEWKT('SRID=4269;POLYGON((0 0.000035379323451,0.000006466490655 0.000008682268431,0.000026970365057 0.000024413715792,0.000151654188725 0.000034529750537,0.00006579467362 -0.00010449622015,-0.000025454219399 -0.000110606436693,-0.000062701646319 -0.000019388332115,0 0.000035379323451)) '),4) t;
|
||||
# SRID=4269;POLYGON((0 0.0000354,0.0000065 0.0000087,0.000027 0.0000244,0.0001517 0.0000345,0.0000658 -0.0001045,-0.0000255 -0.0001106,-0.0000627 -0.0000194,0 0.0000354))
|
||||
SELECT _st_asewkt(_ST_GeomFromEWKT('SRID=4269;POLYGON((0 0.000035379323451,0.000006466490655 0.000008682268431,0.000026970365057 0.000024413715792,0.000151654188725 0.000034529750537,0.00006579467362 -0.00010449622015,-0.000025454219399 -0.000110606436693,-0.000062701646319 -0.000019388332115,0 0.000035379323451)) '),7) t;
|
||||
|
||||
select _st_asewkt(_st_geomfromewkt('srid=4269;point(1e-15 1e-15)'), 1);
|
||||
select _st_asewkt(_st_geomfromewkt('srid=4269;point(0.1e-15 1e-15)'), 1);
|
||||
select _st_asewkt(_st_geomfromewkt('srid=4269;point(1.123456789e-15 1.123456789e-15)'), 1);
|
||||
select _st_asewkt(_st_geomfromewkt('srid=4269;point(1e-6 1e-10)'), 3);
|
||||
|
||||
# SRID=4269;POINT(0.0000001 1e-10)
|
||||
select _st_asewkt(_st_geomfromewkt('srid=4269;point(1e-7 1e-10)'));
|
||||
# SRID=4269;POINT(0.0007 1e-10)
|
||||
select _st_asewkt(_st_geomfromewkt('srid=4269;point(7000e-7 1e-10)'),6);
|
||||
# SRID=4269;POINT(0.00000007 1e-10)
|
||||
select _st_asewkt(_st_geomfromewkt('srid=4269;point(0.7e-7 1e-10)'),8);
|
||||
# POINT(1.001e-15 1e-16)
|
||||
select _st_asewkt(_st_geomfromewkt('point(1.001110000000000000009e-15 1e-16)'));
|
||||
# POINT(1.001e-15 1e-16)
|
||||
select _st_asewkt(_st_geomfromewkt('point(1.001110000000000000009e-15 1e-16)'), 3);
|
||||
# POINT(1e-15 1e-16)
|
||||
select _st_asewkt(_st_geomfromewkt('point(1.001110000000000000009e-15 1e-16)'), 2);
|
||||
# POINT(1e-16 1.001e-16)
|
||||
select _st_asewkt(_st_geomfromewkt('point(1e-16 1.001410000000000000009e-16)'), 3);
|
||||
# POINT(1e-16 1.002e-16)
|
||||
select _st_asewkt(_st_geomfromewkt('point(1e-16 1.001510000000000000009e-16)'), 3);
|
||||
|
||||
#
|
||||
# SRID=4326;POINT(1 2)
|
||||
select _st_asewkt(st_geomfromtext('point(1 2)',4326,'axis-order=long-lat'));
|
||||
|
||||
select _st_asewkt(_st_geomfromewkb(_st_asewkb(st_geomfromtext('point(1 1)', 4326))));
|
||||
|
||||
#fix: bug
|
||||
#select _st_asewkt(_st_geomfromewkb(_st_asewkb(st_geomfromtext('point(1 10)', 4326, 'axis-order=long-lat'))));
|
||||
|
||||
|
||||
--error ER_GIS_DATA_WRONG_ENDIANESS
|
||||
select st_astext(x'00000000000100000000000000000024C000000000000034C0');
|
||||
--error ER_GIS_INVALID_DATA
|
||||
select st_astext(x'000000000100000000000000000024C000000000000034C0');
|
||||
|
||||
select st_astext(x'00000001010100000000000000000024C000000000000034C0');
|
||||
|
||||
--error ER_GIS_DATA_WRONG_ENDIANESS
|
||||
select st_astext(x'010100000000000000000024C000000000000034C0');
|
||||
|
||||
# todo : fix func_name cast_as_geometry
|
||||
--error ER_GIS_INVALID_DATA
|
||||
select st_astext(x'00000000010200000000000000000024C000000000000034C0');
|
||||
--error ER_GIS_INVALID_DATA
|
||||
select st_astext(x'00000000010300000000000000000024C000000000000034C0');
|
||||
--error ER_GIS_INVALID_DATA
|
||||
select st_astext(x'00000000010400000000000000000024C000000000000034C0');
|
||||
--error ER_GIS_INVALID_DATA
|
||||
select st_astext(x'00000000010500000000000000000024C000000000000034C0');
|
||||
--error ER_GIS_INVALID_DATA
|
||||
select st_astext(x'00000000010600000000000000000024C000000000000034C0');
|
||||
--error ER_GIS_INVALID_DATA
|
||||
select st_astext(x'00000000010700000000000000000024C000000000000034C0');
|
||||
--error ER_GIS_INVALID_DATA
|
||||
select st_astext(x'00000000010100000003000000010100000000000000000024400000000000002440010100000000000000000024C000000000000034C00102000000020000000000000000002E400000000000002E4000000000000034400000000000003440');
|
||||
--error ER_GIS_INVALID_DATA
|
||||
select st_astext(x'0000000001050000000300000001020000000200000000000000000024400000000000002440000000000000344000000000000034400102000000020000000000000000002E400000000000002E400000000000003E400000000000002E40');
|
||||
|
||||
# bugfix:
|
||||
--error ER_GIS_DATA_WRONG_ENDIANESS
|
||||
SELECT ST_ASTEXT('MULTIPOINT(1 1)');
|
||||
--error ER_GIS_DATA_WRONG_ENDIANESS
|
||||
SELECT ST_ASWKT('MULTIPOINT(1 1)');
|
||||
|
||||
# bugfix:
|
||||
--error 3037
|
||||
select st_aswkt('');
|
||||
--error 3037
|
||||
select st_astext('');
|
||||
--error 3037
|
||||
select st_aswkb('');
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists gis_point_and_int_with_spatial_index;
|
||||
--enable_warnings
|
||||
# bugfix :
|
||||
CREATE TABLE gis_point_and_int_with_spatial_index (fid INTEGER NOT NULL PRIMARY KEY, g POINT NOT NULL SRID 0, a int, index (a) );
|
||||
INSERT INTO gis_point_and_int_with_spatial_index VALUES
|
||||
(101, ST_GEOMFROMTEXT('POINT(10 10)'),1),
|
||||
(102, ST_GEOMFROMTEXT('point(10 20)'),21),
|
||||
(103, ST_GEOMFROMTEXT('point(100 20)'),3),
|
||||
(104, ST_GEOMFROMTEXT('POINT(101 20)'),3);
|
||||
SELECT ST_AsText(g) FROM gis_point_and_int_with_spatial_index WHERE ST_AsText(g) LIKE "%point%";
|
||||
drop table gis_point_and_int_with_spatial_index;
|
||||
|
||||
--disable_warnings
|
||||
drop view if exists v;
|
||||
--enable_warnings
|
||||
# bugfix:
|
||||
create or replace view v as select cast(Point(0,0) as Multipoint) a;
|
||||
select st_astext(v.a) from v;
|
||||
drop view v;
|
||||
|
||||
# bugfix:
|
||||
--error ER_GIS_INVALID_DATA
|
||||
select st_astext(cast(x'000000000107000000070000000101000000000000000000244000000000000014400102000000020000000000000000002E400000000000002E400000000000003440000000000000344001030000000100000004000000000000000000F03F00000000000000000000000000002440000000000000000000000000000024400000000000002440000000000000F03F000000000000000001040000000200000001010000000000000000000000000000000000000001010000000000000000003440000000000000344001050000000200000001020000000200000000000000000014400000000000002440000000000000144000000000000034400102000000020000000000000000002E4000000000000024400000000000003E400000000000002E4001060000000200000001030000000100000005000000000000000000F03F0000000000000000000000000000244000000000000000000000000000002440000000000000244000000000000000000000000000002440000000000000F03F000000000000000001030000000100000005000000000000000000184000000000000014400000000000001C4000000000000014400000000000001C400000000000001C4000000000000014400000000000001C4000000000000018400000000000001440' as GEOMETRYCOLLECTION));
|
||||
# bugfix:
|
||||
--error ER_GIS_INVALID_DATA
|
||||
select st_astext(ST_GeometryFromWKB(x'0103000000020000000500000000000000000034C00000000000002440000000000000544000000000008056C000000000000054C000000000000034C00000000000000000000000000000544000000000000034C00000000000002440',4326,'axis-order=lat-long'));
|
||||
@ -0,0 +1,698 @@
|
||||
#owner: ht353245
|
||||
#owner group: shenzhen
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--echo # Base test of ST_ASWKB.
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--source mysql_test/test_suite/geometry/t/import_default_srs_data_mysql.inc
|
||||
|
||||
|
||||
SET @pt = ST_GeomFromText('POINT(0 1)');
|
||||
SET @ln = ST_GeomFromText('LINESTRING(0 1,2 3,4 5,6 7,8 9, 10 11)');
|
||||
SET @py = ST_GeomFromText('POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4))');
|
||||
SET @mpt = ST_GeomFromText('MULTIPOINT(0 1,2 3,4 5,6 7)');
|
||||
SET @mln = ST_GeomFromText('MULTILINESTRING((0 1,2 3,4 5),(6 7,8 9,10 11))');
|
||||
SET @mpy = ST_GeomFromText('MULTIPOLYGON(((0 1,0 10,10 11,10 0,0 1),(4 5,4 6,6 7,6 4,4 5)),'
|
||||
'((10 11,10 12,12 13,12 10,10 11)))');
|
||||
SET @gc = ST_GeomFromText('GEOMETRYCOLLECTION('
|
||||
'POINT(0 1),'
|
||||
'LINESTRING(0 1,10 11),'
|
||||
'POLYGON((0 0,0 10,10 10,10 0, 0 0)),'
|
||||
'MULTIPOINT(0 1,2 3,4 5,6 7,8 9,10 11),'
|
||||
'MULTILINESTRING((0 1,10 11),(0 10,10 0)),'
|
||||
'MULTIPOLYGON(((0 1,0 5,5 6,5 0,0 1)),((5 4,5 10,10 11,10 5,5 4))))');
|
||||
|
||||
--echo # test for ST_ASWKB
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(@pt)));
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(@ln)));
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(@py)));
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(@mpt)));
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(@mln)));
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(@mpy)));
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(@gc)));
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASBINARY(@pt)));
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASBINARY(@ln)));
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASBINARY(@py)));
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASBINARY(@mpt)));
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASBINARY(@mln)));
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASBINARY(@mpy)));
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASBINARY(@gc)));
|
||||
SELECT ST_ASTEXT(_st_geomfromewkb(_ST_ASEWKB(@pt)));
|
||||
SELECT ST_ASTEXT(_st_geomfromewkb(_ST_ASEWKB(@ln)));
|
||||
SELECT ST_ASTEXT(_st_geomfromewkb(_ST_ASEWKB(@py)));
|
||||
SELECT ST_ASTEXT(_st_geomfromewkb(_ST_ASEWKB(@mpt)));
|
||||
SELECT ST_ASTEXT(_st_geomfromewkb(_ST_ASEWKB(@mln)));
|
||||
SELECT ST_ASTEXT(_st_geomfromewkb(_ST_ASEWKB(@mpy)));
|
||||
SELECT ST_ASTEXT(_st_geomfromewkb(_ST_ASEWKB(@gc)));
|
||||
|
||||
###############################################################################
|
||||
# #
|
||||
# Inserting geographical srs(30000000) with long-lat ordering #
|
||||
# Inserting geographical srs(30100000) with lat-long ordering #
|
||||
# Inserting projected srs(30200000) with northing-easting ordering #
|
||||
# Inserting projected srs(30300000) with easting-northing ordering #
|
||||
# #
|
||||
###############################################################################
|
||||
|
||||
####################################
|
||||
# Creating the spatial objects
|
||||
####################################
|
||||
|
||||
--echo # Creating the spatial objects
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS gis_point, gis_linestring, gis_polygon, gis_multi_point, gis_multi_linestring, gis_multi_polygon, gis_geometrycollection;
|
||||
--enable_warnings
|
||||
CREATE TABLE gis_point (fid INTEGER NOT NULL PRIMARY KEY, g POINT);
|
||||
CREATE TABLE gis_linestring (fid INTEGER NOT NULL PRIMARY KEY, g LINESTRING);
|
||||
CREATE TABLE gis_polygon (fid INTEGER NOT NULL PRIMARY KEY, g POLYGON);
|
||||
CREATE TABLE gis_multi_point (fid INTEGER NOT NULL PRIMARY KEY, g MULTIPOINT);
|
||||
CREATE TABLE gis_multi_linestring (fid INTEGER NOT NULL PRIMARY KEY, g MULTILINESTRING);
|
||||
CREATE TABLE gis_multi_polygon (fid INTEGER NOT NULL PRIMARY KEY, g MULTIPOLYGON);
|
||||
CREATE TABLE gis_geometrycollection (fid INTEGER NOT NULL PRIMARY KEY, g GEOMETRYCOLLECTION);
|
||||
|
||||
######################################
|
||||
# Inserting POINT Geometry values
|
||||
######################################
|
||||
|
||||
--echo # Inserting POINT Geometry Values with different SRID types
|
||||
|
||||
INSERT INTO gis_point VALUES
|
||||
(101, ST_GeomFromText('POINT(5 10)',30000000)),
|
||||
(102, ST_GeomFromText('POINT(5 10)',30100000)),
|
||||
(103, ST_GeomFromText('POINT(5 10)',30200000)),
|
||||
(104, ST_GeomFromText('POINT(5 10)',30300000)),
|
||||
(105, ST_GeomFromText('POINT(5 10)',0));
|
||||
|
||||
###########################################
|
||||
# Inserting LINESTRING Geometry values
|
||||
###########################################
|
||||
|
||||
--echo # Inserting LINESTRING Geometry Values with different SRID types
|
||||
|
||||
INSERT INTO gis_linestring VALUES
|
||||
(201, ST_GeomFromText('LINESTRING(0 5,5 10,10 15)',30000000)),
|
||||
(202, ST_GeomFromText('LINESTRING(0 5,5 10,10 15)',30100000)),
|
||||
(203, ST_GeomFromText('LINESTRING(0 5,5 10,10 15)',30200000)),
|
||||
(204, ST_GeomFromText('LINESTRING(0 5,5 10,10 15)',30300000)),
|
||||
(205, ST_GeomFromText('LINESTRING(0 5,5 10,10 15)',0));
|
||||
|
||||
############################################
|
||||
# Inserting POLYGON Geometry values
|
||||
############################################
|
||||
|
||||
--echo # Inserting POLYGON Geometry Values with different SRID types
|
||||
|
||||
INSERT INTO gis_polygon VALUES
|
||||
(301, ST_GeomFromText('POLYGON((0 0,5 0,5 5,0 5,0 0))',30000000)),
|
||||
(302, ST_GeomFromText('POLYGON((0 0,5 0,5 5,0 5,0 0))',30100000)),
|
||||
(303, ST_GeomFromText('POLYGON((0 0,5 0,5 5,0 5,0 0))',30200000)),
|
||||
(304, ST_GeomFromText('POLYGON((0 0,5 0,5 5,0 5,0 0))',30300000)),
|
||||
(305, ST_GeomFromText('POLYGON((0 0,5 0,5 5,0 5,0 0))',0));
|
||||
|
||||
############################################
|
||||
# Inserting MULTIPOINT Geometry values
|
||||
############################################
|
||||
|
||||
--echo # Inserting MULTIPOINT Geometry Values with different SRID types
|
||||
|
||||
INSERT INTO gis_multi_point VALUES
|
||||
(401, ST_GeomFromText('MULTIPOINT((0 2), (5 7), (8 2), (4 9))',30000000)),
|
||||
(402, ST_GeomFromText('MULTIPOINT((0 2), (5 7), (8 2), (4 9))',30100000)),
|
||||
(403, ST_GeomFromText('MULTIPOINT((0 2), (5 7), (8 2), (4 9))',30200000)),
|
||||
(404, ST_GeomFromText('MULTIPOINT((0 2), (5 7), (8 2), (4 9))',30300000)),
|
||||
(405, ST_GeomFromText('MULTIPOINT((0 2), (5 7), (8 2), (4 9))',0));
|
||||
|
||||
################################################
|
||||
# Inserting MULTILINESTRING Geometry values
|
||||
################################################
|
||||
|
||||
--echo # Inserting MULTILINESTRING Geometry Values with different SRID types
|
||||
|
||||
INSERT INTO gis_multi_linestring VALUES
|
||||
(501, ST_GeomFromText('MULTILINESTRING((0 2,2 4,4 6),(8 11,11 14,14 17))',30000000)),
|
||||
(502, ST_GeomFromText('MULTILINESTRING((0 2,2 4,4 6),(8 11,11 14,14 17))',30100000)),
|
||||
(503, ST_GeomFromText('MULTILINESTRING((0 2,2 4,4 6),(8 11,11 14,14 17))',30200000)),
|
||||
(504, ST_GeomFromText('MULTILINESTRING((0 2,2 4,4 6),(8 11,11 14,14 17))',30300000)),
|
||||
(505, ST_GeomFromText('MULTILINESTRING((0 2,2 4,4 6),(8 11,11 14,14 17))',0));
|
||||
|
||||
#############################################
|
||||
# Inserting MULTIPOLYGON Geometry values
|
||||
#############################################
|
||||
|
||||
--echo # Inserting MULTIPOLYGON Geometry Values with different SRID types
|
||||
|
||||
INSERT INTO gis_multi_polygon VALUES
|
||||
(601, ST_GeomFromText('MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(4 4,4 6,6 6,6 4, 4 4)),((0 0,-2 -2,0 -2, 0 0)))',30000000)),
|
||||
(602, ST_GeomFromText('MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(4 4,4 6,6 6,6 4, 4 4)),((0 0,-2 -2,0 -2, 0 0)))',30100000)),
|
||||
(603, ST_GeomFromText('MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(4 4,4 6,6 6,6 4, 4 4)),((0 0,-2 -2,0 -2, 0 0)))',30200000)),
|
||||
(604, ST_GeomFromText('MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(4 4,4 6,6 6,6 4, 4 4)),((0 0,-2 -2,0 -2, 0 0)))',30300000)),
|
||||
(605, ST_GeomFromText('MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(4 4,4 6,6 6,6 4, 4 4)),((0 0,-2 -2,0 -2, 0 0)))',0));
|
||||
|
||||
##################################################
|
||||
# Inserting GEOMETRYCOLLECTION Geometry values
|
||||
##################################################
|
||||
|
||||
--echo # Inserting GEOMETRYCOLLECTION Geometry Values with different SRID types
|
||||
|
||||
INSERT INTO gis_geometrycollection VALUES
|
||||
(701, ST_GeomFromText('GEOMETRYCOLLECTION(POINT(3 5), POLYGON((0 0,10 0,10 10,0 10,0 0)), MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(4 4,4 6,6 6,6 4, 4 4)),((0 0,-2 -2,0 -2, 0 0))))',30000000)),
|
||||
(702, ST_GeomFromText('GEOMETRYCOLLECTION(POINT(3 5), POLYGON((0 0,10 0,10 10,0 10,0 0)), MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(4 4,4 6,6 6,6 4, 4 4)),((0 0,-2 -2,0 -2, 0 0))))',30100000)),
|
||||
(703, ST_GeomFromText('GEOMETRYCOLLECTION(POINT(3 5), POLYGON((0 0,10 0,10 10,0 10,0 0)), MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(4 4,4 6,6 6,6 4, 4 4)),((0 0,-2 -2,0 -2, 0 0))))',30200000)),
|
||||
(704, ST_GeomFromText('GEOMETRYCOLLECTION(POINT(3 5), POLYGON((0 0,10 0,10 10,0 10,0 0)), MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(4 4,4 6,6 6,6 4, 4 4)),((0 0,-2 -2,0 -2, 0 0))))',30300000)),
|
||||
(705, ST_GeomFromText('GEOMETRYCOLLECTION(POINT(3 5), POLYGON((0 0,10 0,10 10,0 10,0 0)), MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(4 4,4 6,6 6,6 4, 4 4)),((0 0,-2 -2,0 -2, 0 0))))',0));
|
||||
|
||||
--echo #####################################################################
|
||||
--echo # Retrieving geometries with ST_ASWKB with no parameter
|
||||
--echo # (Should thus be retrieved with the SRID default axis ordering)
|
||||
--echo #####################################################################
|
||||
|
||||
--echo # Retrieve all values from gis_point
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(g))) FROM gis_point
|
||||
ORDER BY fid;
|
||||
SELECT ST_ASTEXT(_st_geomfromewkb(_ST_ASEWKB(g))) FROM gis_point
|
||||
ORDER BY fid;
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASBINARY(g))) FROM gis_point
|
||||
ORDER BY fid;
|
||||
|
||||
--echo # Retrieve all values from gis_linestring
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(g))) FROM gis_linestring
|
||||
ORDER BY fid;
|
||||
SELECT ST_ASTEXT(_st_geomfromewkb(_ST_ASEWKB(g))) FROM gis_linestring
|
||||
ORDER BY fid;
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASBINARY(g))) FROM gis_linestring
|
||||
ORDER BY fid;
|
||||
|
||||
--echo # Retrieve all values from gis_polygon
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(g))) FROM gis_polygon
|
||||
ORDER BY fid;
|
||||
SELECT ST_ASTEXT(_st_geomfromewkb(_ST_ASEWKB(g))) FROM gis_polygon
|
||||
ORDER BY fid;
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASBINARY(g))) FROM gis_polygon
|
||||
ORDER BY fid;
|
||||
|
||||
--echo # Retrieve all values from gis_multi_point
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(g))) FROM gis_multi_point
|
||||
ORDER BY fid;
|
||||
SELECT ST_ASTEXT(_st_geomfromewkb(_ST_ASEWKB(g))) FROM gis_multi_point
|
||||
ORDER BY fid;
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASBINARY(g))) FROM gis_multi_point
|
||||
ORDER BY fid;
|
||||
|
||||
--echo # Retrieve all values from gis_multi_linestring
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(g))) FROM gis_multi_linestring
|
||||
ORDER BY fid;
|
||||
SELECT ST_ASTEXT(_st_geomfromewkb(_ST_ASEWKB(g))) FROM gis_multi_linestring
|
||||
ORDER BY fid;
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASBINARY(g))) FROM gis_multi_linestring
|
||||
ORDER BY fid;
|
||||
|
||||
--echo # Retrieve all values from gis_multi_polygon
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(g))) FROM gis_multi_polygon
|
||||
ORDER BY fid;
|
||||
SELECT ST_ASTEXT(_st_geomfromewkb(_ST_ASEWKB(g))) FROM gis_multi_polygon
|
||||
ORDER BY fid;
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASBINARY(g))) FROM gis_multi_polygon
|
||||
ORDER BY fid;
|
||||
|
||||
--echo # Retrieve all values from gis_geometrycollection
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(g))) FROM gis_geometrycollection
|
||||
ORDER BY fid;
|
||||
SELECT ST_ASTEXT(_st_geomfromewkb(_ST_ASEWKB(g))) FROM gis_geometrycollection
|
||||
ORDER BY fid;
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASBINARY(g))) FROM gis_geometrycollection
|
||||
ORDER BY fid;
|
||||
|
||||
--echo #####################################################################
|
||||
--echo # Retrieving geometries with ST_ASWKB with lat-long axis ordering
|
||||
--echo # (Default SRID coordination should thus be overridden)
|
||||
--echo #####################################################################
|
||||
|
||||
--echo # Retrieve all values from gis_point
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(g, 'axis-order=lat-long'))) FROM gis_point
|
||||
ORDER BY fid;
|
||||
--error 1582
|
||||
SELECT ST_ASTEXT(_st_geomfromewkb(_ST_ASEWKB(g, 'axis-order=lat-long'))) FROM gis_point
|
||||
ORDER BY fid;
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASBINARY(g, 'axis-order=lat-long'))) FROM gis_point
|
||||
ORDER BY fid;
|
||||
|
||||
--echo # Retrieve all values from gis_linestring
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(g, 'axis-order=lat-long'))) FROM gis_linestring ORDER BY fid;
|
||||
--error 1582
|
||||
SELECT ST_ASTEXT(_st_geomfromewkb(_ST_ASEWKB(g, 'axis-order=lat-long'))) FROM gis_linestring ORDER BY fid;
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASBINARY(g, 'axis-order=lat-long'))) FROM gis_linestring ORDER BY fid;
|
||||
|
||||
--echo # Retrieve all values from gis_polygon
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(g, 'axis-order=lat-long'))) FROM gis_polygon
|
||||
ORDER BY fid;
|
||||
--error 1582
|
||||
SELECT ST_ASTEXT(_st_geomfromewkb(_ST_ASEWKB(g, 'axis-order=lat-long'))) FROM gis_polygon
|
||||
ORDER BY fid;
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASBINARY(g, 'axis-order=lat-long'))) FROM gis_polygon
|
||||
ORDER BY fid;
|
||||
|
||||
--echo # Retrieve all values from gis_multi_point
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(g, 'axis-order=lat-long'))) FROM gis_multi_point ORDER BY fid;
|
||||
--error 1582
|
||||
SELECT ST_ASTEXT(_st_geomfromewkb(_ST_ASEWKB(g, 'axis-order=lat-long'))) FROM gis_multi_point ORDER BY fid;
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASBINARY(g, 'axis-order=lat-long'))) FROM gis_multi_point ORDER BY fid;
|
||||
|
||||
--echo # Retrieve all values from gis_multi_linestring
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(g, 'axis-order=lat-long'))) FROM gis_multi_linestring ORDER BY fid;
|
||||
--error 1582
|
||||
SELECT ST_ASTEXT(_st_geomfromewkb(_ST_ASEWKB(g, 'axis-order=lat-long'))) FROM gis_multi_linestring ORDER BY fid;
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASBINARY(g, 'axis-order=lat-long'))) FROM gis_multi_linestring ORDER BY fid;
|
||||
|
||||
--echo # Retrieve all values from gis_multi_polygon
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(g, 'axis-order=lat-long'))) FROM gis_multi_polygon ORDER BY fid;
|
||||
--error 1582
|
||||
SELECT ST_ASTEXT(_st_geomfromewkb(_ST_ASEWKB(g, 'axis-order=lat-long'))) FROM gis_multi_polygon ORDER BY fid;
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASBINARY(g, 'axis-order=lat-long'))) FROM gis_multi_polygon ORDER BY fid;
|
||||
|
||||
--echo # Retrieve all values from gis_geometrycollection
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(g, 'axis-order=lat-long'))) FROM gis_geometrycollection ORDER BY fid;
|
||||
--error 1582
|
||||
SELECT ST_ASTEXT(_st_geomfromewkb(_ST_ASEWKB(g, 'axis-order=lat-long'))) FROM gis_geometrycollection ORDER BY fid;
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASBINARY(g, 'axis-order=lat-long'))) FROM gis_geometrycollection ORDER BY fid;
|
||||
|
||||
--echo #####################################################################
|
||||
--echo # Retrieving geometries with ST_ASWKB with long-lat axis ordering
|
||||
--echo # (Default SRID coordination should thus be overridden)
|
||||
--echo #####################################################################
|
||||
|
||||
--echo # Retrieve all values from gis_point
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(g, 'axis-order=long-lat'))) FROM gis_point
|
||||
ORDER BY fid;
|
||||
--error 1582
|
||||
SELECT ST_ASTEXT(_st_geomfromewkb(_ST_ASEWKB(g, 'axis-order=long-lat'))) FROM gis_point
|
||||
ORDER BY fid;
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASBINARY(g, 'axis-order=long-lat'))) FROM gis_point
|
||||
ORDER BY fid;
|
||||
|
||||
--echo # Retrieve all values from gis_linestring
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(g, 'axis-order=long-lat'))) FROM gis_linestring ORDER BY fid;
|
||||
--error 1582
|
||||
SELECT ST_ASTEXT(_st_geomfromewkb(_ST_ASEWKB(g, 'axis-order=long-lat'))) FROM gis_linestring ORDER BY fid;
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASBINARY(g, 'axis-order=long-lat'))) FROM gis_linestring ORDER BY fid;
|
||||
|
||||
--echo # Retrieve all values from gis_polygon
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(g, 'axis-order=long-lat'))) FROM gis_polygon
|
||||
ORDER BY fid;
|
||||
--error 1582
|
||||
SELECT ST_ASTEXT(_st_geomfromewkb(_ST_ASEWKB(g, 'axis-order=long-lat'))) FROM gis_polygon
|
||||
ORDER BY fid;
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASBINARY(g, 'axis-order=long-lat'))) FROM gis_polygon
|
||||
ORDER BY fid;
|
||||
|
||||
--echo # Retrieve all values from gis_multi_point
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(g, 'axis-order=long-lat'))) FROM gis_multi_point ORDER BY fid;
|
||||
--error 1582
|
||||
SELECT ST_ASTEXT(_st_geomfromewkb(_ST_ASEWKB(g, 'axis-order=long-lat'))) FROM gis_multi_point ORDER BY fid;
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASBINARY(g, 'axis-order=long-lat'))) FROM gis_multi_point ORDER BY fid;
|
||||
|
||||
--echo # Retrieve all values from gis_multi_linestring
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(g, 'axis-order=long-lat'))) FROM gis_multi_linestring ORDER BY fid;
|
||||
--error 1582
|
||||
SELECT ST_ASTEXT(_st_geomfromewkb(_ST_ASEWKB(g, 'axis-order=long-lat'))) FROM gis_multi_linestring ORDER BY fid;
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASBINARY(g, 'axis-order=long-lat'))) FROM gis_multi_linestring ORDER BY fid;
|
||||
|
||||
--echo # Retrieve all values from gis_multi_polygon
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(g, 'axis-order=long-lat'))) FROM gis_multi_polygon ORDER BY fid;
|
||||
--error 1582
|
||||
SELECT ST_ASTEXT(_st_geomfromewkb(_ST_ASEWKB(g, 'axis-order=long-lat'))) FROM gis_multi_polygon ORDER BY fid;
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASBINARY(g, 'axis-order=long-lat'))) FROM gis_multi_polygon ORDER BY fid;
|
||||
|
||||
--echo # Retrieve all values from gis_geometrycollection
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(g, 'axis-order=long-lat'))) FROM gis_geometrycollection ORDER BY fid;
|
||||
--error 1582
|
||||
SELECT ST_ASTEXT(_st_geomfromewkb(_ST_ASEWKB(g, 'axis-order=long-lat'))) FROM gis_geometrycollection ORDER BY fid;
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASBINARY(g, 'axis-order=long-lat'))) FROM gis_geometrycollection ORDER BY fid;
|
||||
|
||||
--echo #####################################################################
|
||||
--echo # Retrieving geometries with ST_ASWKB with srid-default axis ordering
|
||||
--echo # (Default SRID coordination should thus be explicitly used)
|
||||
--echo #####################################################################
|
||||
|
||||
--echo # Retrieve all values from gis_point
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(g, 'axis-order=srid-defined'))) FROM gis_point
|
||||
ORDER BY fid;
|
||||
--error 1582
|
||||
SELECT ST_ASTEXT(_st_geomfromewkb(_ST_ASEWKB(g, 'axis-order=srid-defined'))) FROM gis_point
|
||||
ORDER BY fid;
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASBINARY(g, 'axis-order=srid-defined'))) FROM gis_point
|
||||
ORDER BY fid;
|
||||
|
||||
--echo # Retrieve all values from gis_linestring
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(g, 'axis-order=srid-defined'))) FROM gis_linestring ORDER BY fid;
|
||||
--error 1582
|
||||
SELECT ST_ASTEXT(_st_geomfromewkb(_ST_ASEWKB(g, 'axis-order=srid-defined'))) FROM gis_linestring ORDER BY fid;
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASBINARY(g, 'axis-order=srid-defined'))) FROM gis_linestring ORDER BY fid;
|
||||
|
||||
--echo # Retrieve all values from gis_polygon
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(g, 'axis-order=srid-defined'))) FROM gis_polygon ORDER BY fid;
|
||||
--error 1582
|
||||
SELECT ST_ASTEXT(_st_geomfromewkb(_ST_ASEWKB(g, 'axis-order=srid-defined'))) FROM gis_polygon ORDER BY fid;
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASBINARY(g, 'axis-order=srid-defined'))) FROM gis_polygon ORDER BY fid;
|
||||
|
||||
--echo # Retrieve all values from gis_multi_point
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(g, 'axis-order=srid-defined'))) FROM gis_multi_point ORDER BY fid;
|
||||
--error 1582
|
||||
SELECT ST_ASTEXT(_st_geomfromewkb(_ST_ASEWKB(g, 'axis-order=srid-defined'))) FROM gis_multi_point ORDER BY fid;
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASBINARY(g, 'axis-order=srid-defined'))) FROM gis_multi_point ORDER BY fid;
|
||||
|
||||
--echo # Retrieve all values from gis_multi_linestring
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(g, 'axis-order=srid-defined'))) FROM gis_multi_linestring ORDER BY fid;
|
||||
--error 1582
|
||||
SELECT ST_ASTEXT(_st_geomfromewkb(_ST_ASEWKB(g, 'axis-order=srid-defined'))) FROM gis_multi_linestring ORDER BY fid;
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASBINARY(g, 'axis-order=srid-defined'))) FROM gis_multi_linestring ORDER BY fid;
|
||||
|
||||
--echo # Retrieve all values from gis_multi_polygon
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(g, 'axis-order=srid-defined'))) FROM gis_multi_polygon ORDER BY fid;
|
||||
--error 1582
|
||||
SELECT ST_ASTEXT(_st_geomfromewkb(_ST_ASEWKB(g, 'axis-order=srid-defined'))) FROM gis_multi_polygon ORDER BY fid;
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASBINARY(g, 'axis-order=srid-defined'))) FROM gis_multi_polygon ORDER BY fid;
|
||||
|
||||
--echo # Retrieve all values from gis_geometrycollection
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(g, 'axis-order=srid-defined'))) FROM gis_geometrycollection ORDER BY fid;
|
||||
--error 1582
|
||||
SELECT ST_ASTEXT(_st_geomfromewkb(_ST_ASEWKB(g, 'axis-order=srid-defined'))) FROM gis_geometrycollection ORDER BY fid;
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASBINARY(g, 'axis-order=srid-defined'))) FROM gis_geometrycollection ORDER BY fid;
|
||||
|
||||
--echo ##########################################################################
|
||||
--echo # Retrieving geometries with ST_ASWKB with empty axis ordering parameter
|
||||
--echo # (Default SRID coordination should thus be used)
|
||||
--echo ##########################################################################
|
||||
|
||||
--echo # Retrieve all values from gis_point
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(g, ''))) FROM gis_point
|
||||
ORDER BY fid;
|
||||
--error 1582
|
||||
SELECT ST_ASTEXT(_st_geomfromewkb(_ST_ASEWKB(g, ''))) FROM gis_point
|
||||
ORDER BY fid;
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASBINARY(g, ''))) FROM gis_point
|
||||
ORDER BY fid;
|
||||
|
||||
--echo # Retrieve all values from gis_linestring
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(g, ''))) FROM gis_linestring
|
||||
ORDER BY fid;
|
||||
--error 1582
|
||||
SELECT ST_ASTEXT(_st_geomfromewkb(_ST_ASEWKB(g, ''))) FROM gis_linestring
|
||||
ORDER BY fid;
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASBINARY(g, ''))) FROM gis_linestring
|
||||
ORDER BY fid;
|
||||
|
||||
--echo # Retrieve all values from gis_polygon
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(g, ''))) FROM gis_polygon
|
||||
ORDER BY fid;
|
||||
--error 1582
|
||||
SELECT ST_ASTEXT(_st_geomfromewkb(_ST_ASEWKB(g, ''))) FROM gis_polygon
|
||||
ORDER BY fid;
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASBINARY(g, ''))) FROM gis_polygon
|
||||
ORDER BY fid;
|
||||
|
||||
--echo # Retrieve all values from gis_multi_point
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(g, ''))) FROM gis_multi_point
|
||||
ORDER BY fid;
|
||||
--error 1582
|
||||
SELECT ST_ASTEXT(_st_geomfromewkb(_ST_ASEWKB(g, ''))) FROM gis_multi_point
|
||||
ORDER BY fid;
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASBINARY(g, ''))) FROM gis_multi_point
|
||||
ORDER BY fid;
|
||||
|
||||
--echo # Retrieve all values from gis_multi_linestring
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(g, ''))) FROM gis_multi_linestring
|
||||
ORDER BY fid;
|
||||
--error 1582
|
||||
SELECT ST_ASTEXT(_st_geomfromewkb(_ST_ASEWKB(g, ''))) FROM gis_multi_linestring
|
||||
ORDER BY fid;
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASBINARY(g, ''))) FROM gis_multi_linestring
|
||||
ORDER BY fid;
|
||||
|
||||
--echo # Retrieve all values from gis_multi_polygon
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(g, ''))) FROM gis_multi_polygon
|
||||
ORDER BY fid;
|
||||
--error 1582
|
||||
SELECT ST_ASTEXT(_st_geomfromewkb(_ST_ASEWKB(g, ''))) FROM gis_multi_polygon
|
||||
ORDER BY fid;
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASBINARY(g, ''))) FROM gis_multi_polygon
|
||||
ORDER BY fid;
|
||||
|
||||
--echo # Retrieve all values from gis_geometrycollection
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(g, ''))) FROM gis_geometrycollection
|
||||
ORDER BY fid;
|
||||
--error 1582
|
||||
SELECT ST_ASTEXT(_st_geomfromewkb(_ST_ASEWKB(g, ''))) FROM gis_geometrycollection
|
||||
ORDER BY fid;
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASBINARY(g, ''))) FROM gis_geometrycollection
|
||||
ORDER BY fid;
|
||||
|
||||
--echo ################################
|
||||
--echo # Specific cases testing
|
||||
--echo # ##############################
|
||||
|
||||
--echo # Test with combined lowercase and uppercase characters in optional parameter
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(g, 'aXIs-oRDer=sriD-dEFineD'))) FROM gis_geometrycollection ORDER BY fid;
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(g, 'axis-order=LaT-LOng'))) FROM gis_geometrycollection ORDER BY fid;
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(g, 'axis-order=LOnG-lAT'))) FROM gis_geometrycollection ORDER BY fid;
|
||||
--error 1582
|
||||
SELECT ST_ASTEXT(_st_geomfromewkb(_ST_ASEWKB(g, 'aXIs-oRDer=sriD-dEFineD'))) FROM gis_geometrycollection ORDER BY fid;
|
||||
--error 1582
|
||||
SELECT ST_ASTEXT(_st_geomfromewkb(_ST_ASEWKB(g, 'axis-order=LaT-LOng'))) FROM gis_geometrycollection ORDER BY fid;
|
||||
--error 1582
|
||||
SELECT ST_ASTEXT(_st_geomfromewkb(_ST_ASEWKB(g, 'axis-order=LOnG-lAT'))) FROM gis_geometrycollection ORDER BY fid;
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASBINARY(g, 'aXIs-oRDer=sriD-dEFineD'))) FROM gis_geometrycollection ORDER BY fid;
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASBINARY(g, 'axis-order=LaT-LOng'))) FROM gis_geometrycollection ORDER BY fid;
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASBINARY(g, 'axis-order=LOnG-lAT'))) FROM gis_geometrycollection ORDER BY fid;
|
||||
|
||||
--echo # Test with combined lowercase, uppercase and whitespaces in optional parameter
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(g, ' aXIs-oRDer=sriD-dEFineD '))) FROM gis_geometrycollection ORDER BY fid;
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(g, ' axis-order=LaT-LOng '))) FROM gis_geometrycollection ORDER BY fid;
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(g, ' axis-order=LOnG-lAT '))) FROM gis_geometrycollection ORDER BY fid;
|
||||
--error 1582
|
||||
SELECT ST_ASTEXT(_st_geomfromewkb(_ST_ASEWKB(g, ' aXIs-oRDer=sriD-dEFineD '))) FROM gis_geometrycollection ORDER BY fid;
|
||||
--error 1582
|
||||
SELECT ST_ASTEXT(_st_geomfromewkb(_ST_ASEWKB(g, ' axis-order=LaT-LOng '))) FROM gis_geometrycollection ORDER BY fid;
|
||||
--error 1582
|
||||
SELECT ST_ASTEXT(_st_geomfromewkb(_ST_ASEWKB(g, ' axis-order=LOnG-lAT '))) FROM gis_geometrycollection ORDER BY fid;
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASBINARY(g, ' aXIs-oRDer=sriD-dEFineD '))) FROM gis_geometrycollection ORDER BY fid;
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASBINARY(g, ' axis-order=LaT-LOng '))) FROM gis_geometrycollection ORDER BY fid;
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASBINARY(g, ' axis-order=LOnG-lAT '))) FROM gis_geometrycollection ORDER BY fid;
|
||||
|
||||
--echo # Test with only whitespaces in optional parameter (Should return same as empty string)
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(g, ' '))) FROM gis_geometrycollection
|
||||
ORDER BY fid;
|
||||
--error 1582
|
||||
SELECT ST_ASTEXT(_st_geomfromewkb(_ST_ASEWKB(g, ' '))) FROM gis_geometrycollection
|
||||
ORDER BY fid;
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASBINARY(g, ' '))) FROM gis_geometrycollection
|
||||
ORDER BY fid;
|
||||
|
||||
--echo ##########################
|
||||
--echo # Error testing
|
||||
--echo # ########################
|
||||
|
||||
--echo # Test with badly formed options string
|
||||
|
||||
--error 3560
|
||||
SELECT ST_ASWKB(g, 'axis-order srid-defined') FROM gis_geometrycollection;
|
||||
#--error ER_INVALID_OPTION_START_CHARACTER
|
||||
--error 3560
|
||||
SELECT ST_ASWKB(g, '=axis-order srid-defined') FROM gis_geometrycollection;
|
||||
#--error ER_INVALID_OPTION_END_CHARACTER
|
||||
--error 3560
|
||||
SELECT ST_ASWKB(g, 'axis-order=srid-defined=') FROM gis_geometrycollection;
|
||||
#--error ER_INVALID_OPTION_CHARACTERS
|
||||
--error 3560
|
||||
SELECT ST_ASWKB(g, 'axis-order== srid-defined') FROM gis_geometrycollection;
|
||||
--error 3560
|
||||
SELECT ST_ASWKB(g, 'axis-=order srid-def=ined') FROM gis_geometrycollection;
|
||||
#--error ER_INVALID_OPTION_END_CHARACTER
|
||||
--error 3560
|
||||
SELECT ST_ASWKB(g, 'axis-order srid-defined,') FROM gis_geometrycollection;
|
||||
#--error ER_INVALID_OPTION_START_CHARACTER
|
||||
--error 3560
|
||||
SELECT ST_ASWKB(g, ',axis-order srid-defined') FROM gis_geometrycollection;
|
||||
#--error ER_INVALID_OPTION_CHARACTERS
|
||||
--error 3560
|
||||
SELECT ST_ASWKB(g, 'axis-order,,srid-defined') FROM gis_geometrycollection;
|
||||
#--error ER_DUPLICATE_OPTION_KEY
|
||||
--error 3560
|
||||
SELECT ST_ASWKB(g, 'axis-order=srid-defined, axis-order=lat-long') FROM gis_geometrycollection;
|
||||
|
||||
|
||||
|
||||
--echo # Test with too many options
|
||||
|
||||
#--error ER_INVALID_OPTION_KEY
|
||||
--error 3560
|
||||
SELECT ST_ASWKB(g, 'axis-order=srid-defined, axis-order2=lat-long') FROM gis_geometrycollection;
|
||||
|
||||
--echo # Test with invalid options key
|
||||
|
||||
#--error ER_INVALID_OPTION_KEY
|
||||
--error 3560
|
||||
SELECT ST_ASWKB(g, 'axix-order=srid-defined') FROM gis_geometrycollection;
|
||||
#--error ER_INVALID_OPTION_KEY
|
||||
--error 3560
|
||||
SELECT ST_ASWKB(g, 'axix-order=lat-long') FROM gis_geometrycollection;
|
||||
#--error ER_INVALID_OPTION_KEY
|
||||
--error 3560
|
||||
SELECT ST_ASWKB(g, 'axix-order=long-lat') FROM gis_geometrycollection;
|
||||
|
||||
--echo # Test with invalid options value
|
||||
|
||||
#--error ER_INVALID_OPTION_VALUE
|
||||
--error 3560
|
||||
SELECT ST_ASWKB(g, 'axis-order=invalid-option') FROM gis_geometrycollection;
|
||||
|
||||
--echo # Test with too many function parameters
|
||||
|
||||
--error 1582
|
||||
SELECT ST_ASWKB(g, 'axis-order=long-lat', POINT(2, 4)) FROM gis_geometrycollection;
|
||||
|
||||
--echo # Test with too invalid start and end characters in substring
|
||||
|
||||
#--error ER_INVALID_OPTION_START_CHARACTER
|
||||
--error 3560
|
||||
SELECT ST_ASWKB(POINT(4, 2), 'axis-order=test,=long-lathello,=test');
|
||||
|
||||
#--error ER_INVALID_OPTION_END_CHARACTER
|
||||
--error 3560
|
||||
SELECT ST_ASWKB(POINT(4, 2), 'axis-order=long-lat=, axis-order=lat-long');
|
||||
|
||||
--echo # Test with both invalid option and invalid value
|
||||
|
||||
#--error ER_INVALID_OPTION_KEY
|
||||
--error 3560
|
||||
SELECT ST_ASWKB(g, 'invalid_option=invalid-value') FROM gis_geometrycollection;
|
||||
|
||||
--echo # NULL value testing: Should return NULL if either or both parameters of
|
||||
--echo # ST_ASWKB/ST_ASBINARY is NULL
|
||||
|
||||
SELECT ST_AsWKB(NULL, 'axis-order=srid-defined');
|
||||
SELECT ST_AsWKB(POINT(0, 0), NULL);
|
||||
SELECT ST_AsWKB(NULL, NULL);
|
||||
|
||||
--echo # Test with options strings that previously gave wrong error message
|
||||
|
||||
#--error ER_INVALID_OPTION_KEY
|
||||
--error 3560
|
||||
SELECT ST_AsWKB(POINT(1, 1), 'axis-order=lat-long,foo=bar');
|
||||
#--error ER_INVALID_OPTION_KEY
|
||||
--error 3560
|
||||
SELECT ST_AsWKB(POINT(1, 1), 'axis-order=lat-long , foo=bar');
|
||||
|
||||
--echo # Test with invalid options value and invalid SRID (should give same
|
||||
--echo # error as with a valid SRID)
|
||||
|
||||
--echo #####################################################################
|
||||
--echo # ST_ASBINARY
|
||||
--echo #####################################################################
|
||||
|
||||
# ST_ASBINARY has the exact same implementation as ST_ASWKB. We still need
|
||||
# minimal testing of the interface to detect changes that affect only the one
|
||||
# function name.
|
||||
|
||||
# These queries are a selection of those done for ST_ASWKB.
|
||||
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASBINARY(g)))
|
||||
FROM gis_geometrycollection ORDER BY fid;
|
||||
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASBINARY(g, 'axis-order=srid-defined')))
|
||||
FROM gis_geometrycollection ORDER BY fid;
|
||||
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASBINARY(g, '')))
|
||||
FROM gis_geometrycollection ORDER BY fid;
|
||||
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASBINARY(g, 'axis-order=lat-long')))
|
||||
FROM gis_geometrycollection ORDER BY fid;
|
||||
|
||||
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASBINARY(g, 'axis-order=long-lat')))
|
||||
FROM gis_geometrycollection ORDER BY fid;
|
||||
|
||||
#--error ER_INVALID_OPTION_KEY
|
||||
--error 3560
|
||||
SELECT ST_ASBINARY(g, 'invalid_option=invalid-value')
|
||||
FROM gis_geometrycollection;
|
||||
|
||||
#--error ER_INVALID_OPTION_KEY
|
||||
--error 3560
|
||||
SELECT ST_ASBINARY(g, 'axis-order=srid-defined, axis-order2=lat-long')
|
||||
FROM gis_geometrycollection;
|
||||
|
||||
--error 1582
|
||||
SELECT ST_ASBINARY(g, 'axis-order=long-lat', POINT(2, 4))
|
||||
FROM gis_geometrycollection;
|
||||
|
||||
SELECT ST_ASBINARY(NULL, 'axis-order=srid-defined');
|
||||
SELECT ST_ASBINARY(POINT(0, 0), NULL);
|
||||
SELECT ST_ASBINARY(NULL, NULL);
|
||||
|
||||
DROP TABLE gis_point;
|
||||
DROP TABLE gis_linestring;
|
||||
DROP TABLE gis_polygon;
|
||||
DROP TABLE gis_multi_point;
|
||||
DROP TABLE gis_multi_linestring;
|
||||
DROP TABLE gis_multi_polygon;
|
||||
DROP TABLE gis_geometrycollection;
|
||||
|
||||
|
||||
--echo # Assume SRID 10 is not defined. Should raise warning.
|
||||
SELECT hex(ST_ASBINARY(x'0A000000010100000000000000000000000000000000000000'));
|
||||
SELECT hex(ST_ASWKB(x'0A000000010100000000000000000000000000000000000000'));
|
||||
|
||||
# bugfix:
|
||||
--error 3731
|
||||
select hex(_st_asewkb(x'E6100000010100000033333333338366403333333333836640'));
|
||||
|
||||
# bugfix:
|
||||
--error 3037
|
||||
select hex(_st_asewkb(x'E61000000103000000000000000000F03F000000000000F0Bf'));
|
||||
|
||||
# bugfix:
|
||||
select hex(st_aswkb(x'0000000001030000000200000005000000000000000000F0BF00000000000000C0000000000000244000000000000000000000000000002440000000000000244000000000000000000000000000002440000000000000F0BF00000000000000C005000000000000000000184000000000000014400000000000001C4000000000000014400000000000001C400000000000001C4000000000000014400000000000001C4000000000000018400000000000001441'));
|
||||
|
||||
# bugfix:
|
||||
--error 3055
|
||||
select st_aswkb(x'E610000000010000000000000000A066C00000000000A06640');
|
||||
|
||||
# bugfix:
|
||||
--error 3548
|
||||
select hex(_st_asewkb(x'0101000000000000000000F03F000000000000F0Bf'));
|
||||
|
||||
# bugfix:
|
||||
--error 3516
|
||||
select _st_asewkb(x'000000000001000000000000000000F03F000000000000F0Bf');
|
||||
|
||||
# bugfix:
|
||||
--error 3516
|
||||
select _st_asewkb(x'0000000001000000000000000000F03F000000000000F0Bf');
|
||||
|
||||
--error 3516
|
||||
select _st_asewkb(x'00000000000100000000000000000024C000000000000034C0');
|
||||
--error 3516
|
||||
select _st_asewkb(x'000000000100000000000000000024C000000000000034C0');
|
||||
|
||||
--error 3548
|
||||
select _st_asewkb(x'00000001010100000000000000000024C000000000000034C0');
|
||||
--error 3548
|
||||
select _st_asewkb(x'010100000000000000000024C000000000000034C0');
|
||||
|
||||
--error ER_GIS_INVALID_DATA
|
||||
select _st_asewkb(x'00000000010200000000000000000024C000000000000034C0');
|
||||
--error ER_GIS_INVALID_DATA
|
||||
select _st_asewkb(x'00000000010300000000000000000024C000000000000034C0');
|
||||
--error ER_GIS_INVALID_DATA
|
||||
select _st_asewkb(x'00000000010400000000000000000024C000000000000034C0');
|
||||
--error ER_GIS_INVALID_DATA
|
||||
select _st_asewkb(x'00000000010500000000000000000024C000000000000034C0');
|
||||
--error ER_GIS_INVALID_DATA
|
||||
select _st_asewkb(x'00000000010600000000000000000024C000000000000034C0');
|
||||
--error ER_GIS_INVALID_DATA
|
||||
select _st_asewkb(x'00000000010700000000000000000024C000000000000034C0');
|
||||
--error ER_GIS_INVALID_DATA
|
||||
select _st_asewkb(x'00000000010100000003000000010100000000000000000024400000000000002440010100000000000000000024C000000000000034C00102000000020000000000000000002E400000000000002E4000000000000034400000000000003440');
|
||||
--error ER_GIS_INVALID_DATA
|
||||
select _st_asewkb(x'0000000001050000000300000001020000000200000000000000000024400000000000002440000000000000344000000000000034400102000000020000000000000000002E400000000000002E400000000000003E400000000000002E40');
|
||||
# bugfix:
|
||||
--error 3037
|
||||
select st_asbinary(x'000000000104000000060000000101000000000000000000244000000000000014400102000000020000000000000000002E400000000000002E400000000000003440000000000000344001030000000100000004000000000000000000F03F00000000000000000000000000002440000000000000000000000000000024400000000000002440000000000000F03F000000000000000001040000000200000001010000000000000000000000000000000000000001010000000000000000003440000000000000344001050000000200000001020000000200000000000000000014400000000000002440000000000000144000000000000034400102000000020000000000000000002E4000000000000024400000000000003E400000000000002E4001060000000200000001030000000100000005000000000000000000F03F0000000000000000000000000000244000000000000000000000000000002440000000000000244000000000000000000000000000002440000000000000F03F000000000000000001030000000100000005000000000000000000184000000000000014400000000000001C4000000000000014400000000000001C400000000000001C4000000000000014400000000000001C4000000000000018400000000000001440');
|
||||
@ -0,0 +1,164 @@
|
||||
#owner: ht353245
|
||||
#owner group: shenzhen
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--echo # Test of GEOMETRY ST_BESTSRID
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--source mysql_test/test_suite/geometry/t/import_default_srs_data_mysql.inc
|
||||
|
||||
|
||||
--echo # st_transform is the same as mysql, use _st_transform instead
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-70 0)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-70 0)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(70 0)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(70 0)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 180)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 180)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -180)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -180)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 180)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 180)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -180)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -180)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(40 160)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(40 160)', 4326), ST_GeomFromText('POINT(-40 -160)', 4326))));
|
||||
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -177)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -177)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -171)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -171)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -165)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -165)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -159)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -159)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -153)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -153)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -147)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -147)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -141)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -141)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -135)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -135)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -129)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -129)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -123)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -123)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -117)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -117)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -111)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -111)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -105)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -105)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -99)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -99)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -93)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -93)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -87)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -87)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -81)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -81)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -75)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -75)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -69)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -69)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -63)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -63)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -57)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -57)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -51)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -51)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -45)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -45)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -39)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -39)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -33)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -33)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -27)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -27)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -21)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -21)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -15)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -15)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -9)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -9)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 -3)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 -3)', 4326))));
|
||||
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 177)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 177)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 171)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 171)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 165)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 165)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 159)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 159)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 153)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 153)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 147)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 147)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 141)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 141)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 135)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 135)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 129)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 129)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 123)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 123)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 117)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 117)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 111)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 111)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 105)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 105)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 99)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 99)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 93)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 93)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 87)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 87)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 81)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 81)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 75)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 75)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 69)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 69)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 63)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 63)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 57)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 57)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 51)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 51)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 45)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 45)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 39)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 39)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 33)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 33)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 27)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 27)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 21)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 21)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 15)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 15)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 9)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 9)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(60 3)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(60 3)', 4326))));
|
||||
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -177)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -177)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -171)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -171)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -165)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -165)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -159)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -159)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -153)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -153)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -147)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -147)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -141)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -141)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -135)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -135)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -129)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -129)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -123)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -123)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -117)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -117)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -111)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -111)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -105)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -105)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -99)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -99)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -93)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -93)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -87)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -87)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -81)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -81)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -75)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -75)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -69)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -69)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -63)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -63)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -57)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -57)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -51)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -51)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -45)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -45)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -39)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -39)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -33)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -33)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -27)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -27)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -21)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -21)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -15)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -15)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -9)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -9)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 -3)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 -3)', 4326))));
|
||||
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 177)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 177)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 171)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 171)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 165)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 165)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 159)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 159)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 153)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 153)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 147)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 147)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 141)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 141)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 135)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 135)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 129)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 129)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 123)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 123)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 117)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 117)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 111)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 111)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 105)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 105)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 99)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 99)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 93)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 93)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 87)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 87)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 81)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 81)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 75)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 75)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 69)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 69)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 63)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 63)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 57)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 57)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 51)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 51)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 45)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 45)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 39)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 39)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 33)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 33)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 27)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 27)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 21)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 21)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 15)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 15)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 9)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 9)', 4326))));
|
||||
select st_astext(_st_transform(ST_GeomFromText('point(-60 3)', 4326), _ST_BestSRID(ST_GeomFromText('POINT(-60 3)', 4326))));
|
||||
|
||||
select _st_bestsrid(st_geomfromtext('MULTILINESTRING((0 0,2 2,2 1,0 1),(0 0,1 1,0 0))',4326),null);
|
||||
select _st_bestsrid(null);
|
||||
--error 3705
|
||||
select _st_bestsrid(st_geomfromtext('point(12.321 -32.123)',26918));
|
||||
|
||||
select _st_bestsrid(st_geomfromtext('GEOMETRYCOLLECTION empty',4326,'axis-order=long-lat'));
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists shape;
|
||||
--enable_warnings
|
||||
|
||||
create table shape(id int, geo geometry NOT NULL SRID 4326);
|
||||
INSERT INTO shape (id, geo) VALUES
|
||||
(1, ST_GeomFromText('POINT(1 1)', 4326, 'axis-order=long-lat')),
|
||||
(2, ST_GeomFromText('LINESTRING(1 1, 2 2)', 4326, 'axis-order=long-lat')),
|
||||
(3, ST_GeomFromText('POLYGON((1 1, 2 2, 3 0, 1 1))', 4326, 'axis-order=long-lat')),
|
||||
(4, ST_GeomFromText('MULTIPOINT(5 0,2 3,8 7,15 25)', 4326, 'axis-order=long-lat')),
|
||||
(5, ST_GeomFromText('MULTILINESTRING((2.5 0,0 1.5,1.5 3.0,0 5))', 4326, 'axis-order=long-lat')),
|
||||
(6, ST_GeomFromText('MULTIPOLYGON(((5 0,1.5 2.5,2.5 0,1.5 5,5 0)),((2.5 0,0 1.5,3.0 1.5,2.2 1.0,2.5 0)))', 4326, 'axis-order=long-lat')),
|
||||
(7, ST_GeomFromText('GEOMETRYCOLLECTION(MULTIPOLYGON(((5 0,1.5 2.5,2.5 0,1.5 5,5 0)),((2.5 0,0 1.5,3.0 1.5,2.2 1.0,2.5 0))),POLYGON((5 0,7 1.0,0 1.5,1.0 1.5,1.5 2.5,2.0 1.5,3.0 1.5,2.2 1.0,2.5 0,1.5 5,5 0)),LINESTRING(1.5 2.5,1.5 1.0),MULTIPOINT(5 0,2.5 0),POINT(1.5 2.5))', 4326, 'axis-order=long-lat'));
|
||||
|
||||
select _st_bestsrid(geo) from shape;
|
||||
drop table shape;
|
||||
1434
tools/deploy/mysql_test/test_suite/geometry/t/st_buffer_mysql.test
Normal file
1434
tools/deploy/mysql_test/test_suite/geometry/t/st_buffer_mysql.test
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,151 @@
|
||||
#owner: ht353245
|
||||
#owner group: shenzhen
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--echo # Test of GEOMETRY _ST_Buffer.
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--source mysql_test/test_suite/geometry/t/import_default_srs_data_mysql.inc
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists buffer_transform, geom_operators_test;
|
||||
--enable_warnings
|
||||
|
||||
# mysql only support empty collection
|
||||
#SELECT 'T2.1', ST_AsText(_ST_Buffer(ST_GeomFromText('POINT EMPTY', 4326), 0));
|
||||
#SELECT 'T2.2', ST_AsText(_ST_Buffer(ST_GeomFromText('LINESTRING EMPTY', 4326), 0));
|
||||
#SELECT 'T2.3', ST_AsText(_ST_Buffer(ST_GeomFromText('MULTIPOLYGON EMPTY', 4326), 0));
|
||||
#SELECT 'T2.4', ST_AsText(_ST_Buffer(ST_GeomFromText('MULTIPOINT EMPTY', 4326), 1));
|
||||
#fix: not support empty geometry
|
||||
SELECT 'T2.5', ST_AsText(_ST_Buffer(ST_GeomFromText('GEOMETRYCOLLECTION EMPTY', 4326), 1));
|
||||
#Notice: mysql result inconsist with postgis, pg result is 'POLYGON EMPTY'
|
||||
SELECT 'T2.6', ST_AsText(_ST_Buffer(ST_GeomFromText('GEOMETRYCOLLECTION EMPTY'), 1));
|
||||
|
||||
SELECT '1', ST_AsText(_ST_Buffer(ST_GeomFromText('POINT(4 0)'), 2, 1));
|
||||
|
||||
SELECT 'point quadsegs=2', ST_AsText(_ST_Buffer(ST_GeomFromText('POINT(0 0)'), 1, 'quad_segs=2'));
|
||||
SELECT 'point quadsegs=2', ST_AsText(_ST_Buffer(ST_GeomFromText('POINT(0 0)'), 1, ST_Buffer_Strategy('point_circle', 8)));
|
||||
|
||||
# Notice, 有些组合mysql会报非法,但是postgis仅仅是不生效, e.g. end flat for point or polygon
|
||||
# SELECT 'line quadsegs=2', ST_AsText(_ST_Buffer(ST_GeomFromText('LINESTRING(0 0, 10 0)'), 2, 'quad_segs=2'));
|
||||
# ERROR 1210 (HY000): Incorrect arguments to _ST_Buffer ST_Buffer_Strategy('point_circle', 8),
|
||||
SELECT 'line quadsegs=2', ST_AsText(_ST_Buffer(ST_GeomFromText('LINESTRING(0 0, 10 0)'), 2));
|
||||
|
||||
--echo # Test for distance = 0
|
||||
SELECT ST_ASTEXT(_ST_BUFFER(ST_GEOMFROMTEXT('POLYGON((0 0,10 0,10 10,0 10,0 0))'), 0));
|
||||
SELECT ST_ASTEXT(_ST_BUFFER(ST_GEOMFROMTEXT('POLYGON((0 0,0 10,10 10,10 0,0 0))'), 0));
|
||||
|
||||
SELECT 'line quadsegs=2 endcap=flat', ST_AsText(_ST_Buffer(ST_GeomFromText('LINESTRING(0 0, 10 0)'), 2, 'quad_segs=2 endcap=flat'));
|
||||
SELECT 'line quadsegs=2 endcap=butt', ST_AsText(_ST_Buffer(ST_GeomFromText('LINESTRING(0 0, 10 0)'), 2, 'quad_segs=2 endcap=butt'));
|
||||
SELECT 'line quadsegs=2 endcap=flat', ST_AsText(_ST_Buffer(ST_GeomFromText('LINESTRING(0 0, 10 0)'), 2, ST_Buffer_Strategy('end_flat')));
|
||||
|
||||
#SELECT 'line join=mitre mitre_limit=1.0 side=both', ST_AsText(_ST_Buffer(ST_GeomFromText('LINESTRING(50 50,150 150,150 50)'),10,'join=mitre mitre_limit=1.0 side=both'));
|
||||
SELECT 'line join=mitre mitre_limit=1.0 side=both', ST_AsText(_ST_Buffer(ST_GeomFromText('LINESTRING(50 50,150 150,150 50)'),10,'join=mitre mitre_limit=1.0'));
|
||||
SELECT 'line join=mitre mitre_limit=1.0 side=both', ST_AsText(_ST_Buffer(ST_GeomFromText('LINESTRING(50 50,150 150,150 50)'),10, ST_Buffer_Strategy('join_miter', 1.0)));
|
||||
# not supported
|
||||
#SELECT 'line side=left',ST_AsText(_ST_Buffer(ST_GeomFromText('LINESTRING(50 50,150 150,150 50)'),10,'side=left'));
|
||||
#SELECT 'line side=right',ST_AsText(_ST_Buffer(ST_GeomFromText('LINESTRING(50 50,150 150,150 50)'),10,'side=right'));
|
||||
#SELECT 'line side=left join=mitre',ST_AsText(_ST_Buffer(ST_GeomFromText('LINESTRING(50 50,150 150,150 50)'),10,'side=left join=mitre'));
|
||||
|
||||
SELECT 'poly quadsegs=2 join=round', ST_AsText(_ST_Buffer(ST_GeomFromText('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))'), 2, 'quad_segs=2 join=round'));
|
||||
SELECT 'poly quadsegs=2 join=round', ST_AsText(_ST_Buffer(ST_GeomFromText('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))'), 2, ST_Buffer_Strategy('join_round', 8)));
|
||||
|
||||
SELECT 'poly quadsegs=2 join=mitre', ST_AsText(_ST_Buffer(ST_GeomFromText('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))'), 2, 'quad_segs=2 join=mitre'));
|
||||
SELECT 'poly quadsegs=2 join=mitre', ST_AsText(_ST_Buffer(ST_GeomFromText('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))'), 2, ST_Buffer_Strategy('join_miter', 5.0)));
|
||||
|
||||
SELECT 'poly quadsegs=2 join=mitre mitre_limit=1', ST_AsText(_ST_Buffer(ST_GeomFromText('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))'), 2, 'quad_segs=2 join=mitre mitre_limit=1'));
|
||||
SELECT 'poly quadsegs=2 join=mitre mitre_limit=1', ST_AsText(_ST_Buffer(ST_GeomFromText('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))'), 2, ST_Buffer_Strategy('join_miter', 1.0)));
|
||||
|
||||
SELECT 'poly quadsegs=2 join=miter miter_limit=1', ST_AsText(_ST_Buffer(ST_GeomFromText('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))'), 2, 'quad_segs=2 join=miter miter_limit=1'));
|
||||
SELECT 'poly quadsegs=2 join=miter miter_limit=1', ST_AsText(_ST_Buffer(ST_GeomFromText('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))'), 2, ST_Buffer_Strategy('join_miter', 1.0)));
|
||||
|
||||
# not support ndr/xdr
|
||||
SELECT '#145a', ST_AsText(_ST_Buffer(ST_GeomFromText('LINESTRING(-116.93414544665981 34.16033385105459,-116.87777514700957 34.10831080544884,-116.86972224705954 34.086748622072776,-116.9327074288116 34.08458099517253,-117.00216369088065 34.130329331330216,-117.00216369088065 34.130329331330216)', 4326, 'axis-order=long-lat'), 0));
|
||||
#fix error result
|
||||
SELECT '#145b', ST_Area(_ST_Buffer(ST_GeomFromText('LINESTRING(-116.93414544665981 34.16033385105459,-116.87777514700957 34.10831080544884,-116.86972224705954 34.086748622072776,-116.9327074288116 34.08458099517253,-117.00216369088065 34.130329331330216,-117.00216369088065 34.130329331330216)', 4326, 'axis-order=long-lat'), 0.1));
|
||||
--disable_warnings
|
||||
SELECT '#145c', ST_Area(_ST_Buffer(ST_GeomFromText('LINESTRING(-116.93414544665981 34.16033385105459,-116.87777514700957 34.10831080544884,-116.86972224705954 34.086748622072776,-116.9327074288116 34.08458099517253,-117.00216369088065 34.130329331330216,-117.00216369088065 34.130329331330216)', 'axis-order=long-lat'), 0.1));
|
||||
--enable_warnings
|
||||
|
||||
create table buffer_transform(the_pt geometry, utm_srid int);
|
||||
insert into buffer_transform values
|
||||
(ST_GeomFromText('POINT(-170 -80)', 4326, 'axis-order=long-lat'), 32702),
|
||||
(ST_GeomFromText('POINT(-160 -80)', 4326, 'axis-order=long-lat'), 32704),
|
||||
(ST_GeomFromText('POINT(-150 -80)', 4326, 'axis-order=long-lat'), 32706),
|
||||
(ST_GeomFromText('POINT(-140 -80)', 4326, 'axis-order=long-lat'), 32707),
|
||||
(ST_GeomFromText('POINT(-130 -80)', 4326, 'axis-order=long-lat'), 32709),
|
||||
(ST_GeomFromText('POINT(-120 -80)', 4326, 'axis-order=long-lat'), 32711),
|
||||
(ST_GeomFromText('POINT(-110 -80)', 4326, 'axis-order=long-lat'), 32712),
|
||||
(ST_GeomFromText('POINT(-100 -80)', 4326, 'axis-order=long-lat'), 32714),
|
||||
(ST_GeomFromText('POINT(-90 -80)', 4326, 'axis-order=long-lat'), 32716),
|
||||
(ST_GeomFromText('POINT(-80 -80)', 4326, 'axis-order=long-lat'), 32717);
|
||||
|
||||
# mysql does not support, but we need to support it
|
||||
select st_astext(the_pt), utm_srid, st_area(_ST_Buffer(the_pt, 10)) as the_area,
|
||||
st_area(_st_transform(_ST_Buffer(_st_transform(the_pt, utm_srid), 10), 4326)) as utm_area
|
||||
from buffer_transform;
|
||||
|
||||
#fix st_setsrid, st_point not supported
|
||||
#select st_asText(_ST_Buffer(st_setsrid(st_point(-10, 40), 4326), 40));
|
||||
#similar with select st_asText(ST_ForcePolygonCCW(_ST_Buffer(ST_GeogFromText('srid=4326;point(-10 40)'), 40)::geometry));
|
||||
select st_asText(_ST_Buffer(ST_GeomFromText('point(-10 40)', 4326, 'axis-order=long-lat'), 40), 'axis-order=long-lat');
|
||||
|
||||
CREATE TABLE geom_operators_test (
|
||||
description varchar(64) PRIMARY KEY,
|
||||
geom GEOMETRY
|
||||
);
|
||||
|
||||
#fix mysql only support empty geometry
|
||||
#fix error for geometry null
|
||||
INSERT INTO geom_operators_test VALUES
|
||||
('NULL', NULL),
|
||||
('Square (left)', ST_GeomFromText('POLYGON((-1.0 0.0, 0.0 0.0, 0.0 1.0, -1.0 1.0, -1.0 0.0))')),
|
||||
('Point middle of Left Square', ST_GeomFromText('POINT(-0.5 0.5)')),
|
||||
('Square (right)', ST_GeomFromText('POLYGON((0.0 0.0, 1.0 0.0, 1.0 1.0, 0.0 1.0, 0.0 0.0))')),
|
||||
('Point middle of Right Square', ST_GeomFromText('POINT(0.5 0.5)')),
|
||||
('Square overlapping left and right square', ST_GeomFromText('POLYGON((-0.1 0.0, 1.0 0.0, 1.0 1.0, -0.1 1.0, -0.1 0.0))')),
|
||||
('Line going through left and right square', ST_GeomFromText('LINESTRING(-0.5 0.5, 0.5 0.5)')),
|
||||
('Faraway point', ST_GeomFromText('POINT(5.0 5.0)')),
|
||||
('Empty LineString', ST_GeomFromText('GEOMETRYCOLLECTION EMPTY')),
|
||||
('Empty Point', ST_GeomFromText('GEOMETRYCOLLECTION EMPTY')),
|
||||
('Empty GeometryCollection', ST_GeomFromText('GEOMETRYCOLLECTION EMPTY')),
|
||||
('Nested Geometry Collection', ST_GeomFromText('GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(POINT(0 0)))'));
|
||||
|
||||
SELECT
|
||||
a.description,
|
||||
ST_AsText(_ST_Buffer(a.geom, 10)),
|
||||
ST_AsText(_ST_Buffer(a.geom, 10, 'endcap=flat'))
|
||||
FROM geom_operators_test a
|
||||
ORDER BY a.description;
|
||||
|
||||
SELECT ST_AsText(_ST_Buffer(ST_GeomFromText('POINT(0 0)', 4326, 'axis-order=long-lat'), 10.0));
|
||||
|
||||
drop table buffer_transform, geom_operators_test;
|
||||
|
||||
select st_astext(_st_buffer(ST_GeomFromText('POINT(15 20)'),1,-1));
|
||||
# bug fix :
|
||||
select st_astext(_st_buffer(ST_GeomFromText('POINT(15 20)'),1,0));
|
||||
select _st_asewkt(_st_buffer(ST_GeomFromText('POINT(15 20)',26918),1,'quad_segs=0'));
|
||||
select _st_asewkt(_st_buffer(ST_GeomFromText('POINT(15 20)',26918),1,'quad_segs=null'));
|
||||
# bug fix :
|
||||
--error 3037
|
||||
select _st_buffer(ST_GeomFromText('POINT(15 20)'),'');
|
||||
# bugfix :
|
||||
--error 1210
|
||||
select _st_buffer(ST_GeomFromText('POINT(15 20)'),1,'test');
|
||||
# bugfix :
|
||||
--error 3037
|
||||
select st_buffer(ST_GeomFromText('POINT'),null);
|
||||
--error 3037
|
||||
select _st_buffer(ST_GeomFromText('POINT'),null);
|
||||
# bugfix :
|
||||
--error 3134
|
||||
select _st_asewkt(_st_buffer(ST_GeomFromText('POINT(15 20)',26918),2,9999999));
|
||||
--error 3037
|
||||
select _st_buffer(x'0000000001060000000200000001030000000100000005000000000000000000000000000000000000000000000000002440000000000000000000000000000024400000000000002440000000000000000000000000000024400000000000000000000000000000000001030000000100000005000000000000000000144000000000000014400000000000001C4000000000000014400000000000001C400000000000001C4000000000000014400000000000001C4000000000000014400000000000001441',1);
|
||||
|
||||
#
|
||||
select _st_asewkt(_st_buffer(ST_GeomFromText('MULTIPOLYGON(((0 1,10 0,10 10,0 10,0 1)))',4326),1));
|
||||
|
||||
#
|
||||
select _st_asewkt(_st_buffer(ST_GeomFromText('POINT(15 20)',4236),1,1));
|
||||
select _st_asewkt(_st_buffer(ST_GeomFromText('POINT(15 20)',4267),1,1));
|
||||
|
||||
1025
tools/deploy/mysql_test/test_suite/geometry/t/st_covers_mysql.test
Normal file
1025
tools/deploy/mysql_test/test_suite/geometry/t/st_covers_mysql.test
Normal file
File diff suppressed because it is too large
Load Diff
2429
tools/deploy/mysql_test/test_suite/geometry/t/st_distance_mysql.test
Normal file
2429
tools/deploy/mysql_test/test_suite/geometry/t/st_distance_mysql.test
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,548 @@
|
||||
#owner: ht353245
|
||||
#owner group: shenzhen
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--echo # Base test of st_distance_sphere.
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--source mysql_test/test_suite/geometry/t/import_default_srs_data_mysql.inc
|
||||
|
||||
|
||||
# Null
|
||||
SELECT ST_DISTANCE_SPHERE(NULL, NULL);
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(0 0)'), NULL);
|
||||
|
||||
# Different SRS
|
||||
--error ER_GIS_DIFFERENT_SRIDS
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)', 4326), ST_GEOMFROMTEXT('POINT(0 0)'));
|
||||
|
||||
# Default radius
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'));
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(1 1)'));
|
||||
|
||||
# Explicitly provided radius
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'), 1);
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(1 1)'), 1);
|
||||
|
||||
# Spherical SRS
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)', 4047), ST_GEOMFROMTEXT('POINT(1 1)', 4047));
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(0 0)', 4047), ST_GEOMFROMTEXT('MULTIPOINT(1 1)', 4047));
|
||||
|
||||
# Non-spherical SRS
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)', 4326), ST_GEOMFROMTEXT('POINT(1 1)', 4326));
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(0 0)', 4326), ST_GEOMFROMTEXT('MULTIPOINT(1 1)', 4326));
|
||||
|
||||
# Projected SRS
|
||||
--error 3705
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)', 3857), ST_GEOMFROMTEXT('POINT(1 1)', 3857), 1);
|
||||
|
||||
# Nonpositive radius
|
||||
--error 3706
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'), 0);
|
||||
--error 3706
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'), -1);
|
||||
|
||||
# Numeric overflow
|
||||
#--error ER_STD_OVERFLOW_ERROR
|
||||
--error 4175 #cast报错,错误码和mysql不兼容
|
||||
SELECT ST_Distance_Sphere(POINT(-50, -50), POINT(50, 50), 1.0e308);
|
||||
|
||||
############################################################################################
|
||||
# Creating the spatial objects #
|
||||
############################################################################################
|
||||
|
||||
--echo # Creating the spatial Geometry object
|
||||
USE test;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists gis_geometrycollection;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE gis_geometrycollection (fid INTEGER NOT NULL PRIMARY KEY, g GEOMETRY);
|
||||
|
||||
############################################################################################
|
||||
# Inserting the values specific to the spatial objects #
|
||||
############################################################################################
|
||||
|
||||
# Geometric elements constructing a star and some of its elememts as base
|
||||
SET @star_elem_vertical= 'POLYGON((5 0,15 25,25 0,15 5,5 0))';
|
||||
SET @star_elem_horizontal= 'POLYGON((25 0,0 15,30 15,22 10,25 0))';
|
||||
SET @star_center= 'POINT(15 10)';
|
||||
SET @star_top= 'POINT(15 25)';
|
||||
SET @star_bottom_left= 'POINT(5 0)';
|
||||
SET @star_bottom_right= 'POINT(25 0)';
|
||||
SET @star_bottom_points= 'MULTIPOINT(5 0,25 0)';
|
||||
SET @star_all_points= 'MULTIPOINT(5 0,25 0,15 10,15 25)';
|
||||
SET @star_line_horizontal= 'LINESTRING(10 15,20 15)';
|
||||
SET @star_line_vertical= 'LINESTRING(15 5,15 25)';
|
||||
SET @star_top_to_center= 'LINESTRING(15 25,15 10)';
|
||||
SET @star_lines_near_horizontal= 'MULTILINESTRING((25 0,0 15,15 30,0 5))';
|
||||
SET @star_lines_near_vertical= 'MULTILINESTRING((0 5,15 25,0 25))';
|
||||
SET @star= 'POLYGON((5 0,7 10,0 15,10 15,15 25,20 15,30 15,22 10,25 0,15 5,5 0))';
|
||||
SET @star_of_elems='MULTIPOLYGON(((5 0,15 25,25 0,15 5,5 0)),((25 0,0 15,30 15,22 10,25 0)))';
|
||||
SET @star_collection_elems='GEOMETRYCOLLECTION(MULTIPOLYGON(((5 0,15 25,25 0,15 5,5 0)),((25 0,0 15,30 15,22 10,25 0))),POLYGON((5 0,7 10,0 15,10 15,15 25,20 15,30 15,22 10,25 0,15 5,5 0)),LINESTRING(15 25,15 10),MULTIPOINT(5 0,25 0),POINT(15 25))';
|
||||
SET @star_collection_multilinestr='GEOMETRYCOLLECTION(MULTIPOLYGON(((5 0,15 25,25 0,15 5,5 0)),((25 0,0 15,30 15,22 10,25 0))),POLYGON((5 0,7 10,0 15,10 15,15 25,20 15,30 15,22 10,25 0,15 5,5 0)),MULTILINESTRING((25 0,0 15,15 30,0 5)),LINESTRING(15 25,15 10),MULTIPOINT(5 0,25 0),POINT(15 25))';
|
||||
|
||||
--echo #INSERT base star
|
||||
INSERT INTO gis_geometrycollection VALUES
|
||||
(100,ST_GEOMFROMTEXT(@star)),
|
||||
(101,ST_GEOMFROMTEXT(@star_elem_vertical)),
|
||||
(102,ST_GEOMFROMTEXT(@star_elem_horizontal)),
|
||||
(103,ST_GEOMFROMTEXT(@star_of_elems)),
|
||||
(104,ST_GEOMFROMTEXT(@star_top)),
|
||||
(105,ST_GEOMFROMTEXT(@star_center)),
|
||||
(106,ST_GEOMFROMTEXT(@star_bottom_left)),
|
||||
(107,ST_GEOMFROMTEXT(@star_bottom_right)),
|
||||
(108,ST_GEOMFROMTEXT(@star_bottom_points)),
|
||||
(109,ST_GEOMFROMTEXT(@star_all_points)),
|
||||
(110,ST_GEOMFROMTEXT(@star_line_horizontal)),
|
||||
(111,ST_GEOMFROMTEXT(@star_line_vertical)),
|
||||
(112,ST_GEOMFROMTEXT(@star_top_to_center)),
|
||||
(113,ST_GEOMFROMTEXT(@star_lines_near_horizontal)),
|
||||
(114,ST_GEOMFROMTEXT(@star_lines_near_vertical)),
|
||||
(115,ST_GEOMFROMTEXT(@star_collection_elems)),
|
||||
(116,ST_GEOMFROMTEXT(@star_collection_multilinestr));
|
||||
|
||||
--echo # Checking the integrity of the above create/insert statements
|
||||
|
||||
--echo # 17 rows.
|
||||
SELECT count(ST_ASTEXT(g) != 'NULL') FROM gis_geometrycollection;
|
||||
|
||||
--echo #####################################################################################
|
||||
--echo # ST_DISTANCE_SPHERE(point, point)
|
||||
--echo #####################################################################################
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(0 0)'));
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(180 0)'));
|
||||
|
||||
--replace_numeric_round 5
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(0 90)'));
|
||||
|
||||
--replace_numeric_round 5
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(-179 0)'));
|
||||
|
||||
--replace_numeric_round 5
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(0 -90)'));
|
||||
|
||||
--replace_numeric_round 5
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(180 90)'));
|
||||
|
||||
--replace_numeric_round 5
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(180 -90)'));
|
||||
|
||||
--replace_numeric_round 5
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(-179 90)'));
|
||||
|
||||
--replace_numeric_round 5
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(-179 -90)'));
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'));
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(0.0000 -0.000)'));
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'));
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 -1)'));
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(-1 1)'));
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(-1 -1)'));
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(90 45)'));
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(90 -45)'));
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(-90 45)'));
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(-90 -45)'));
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(180 90)'), ST_GEOMFROMTEXT('POINT(180 90)'));
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(180 -90)'), ST_GEOMFROMTEXT('POINT(180 -90)'));
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(-179.999 -90)'), ST_GEOMFROMTEXT('POINT(-179.999 -90)'));
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(-179.999 -89.999)'), ST_GEOMFROMTEXT('POINT(-179.999 -89.999)'));
|
||||
|
||||
--replace_numeric_round 15
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(-179.9 90)'), ST_GEOMFROMTEXT('POINT(-179.99 90)'));
|
||||
|
||||
--replace_numeric_round 15
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(-179.9 -90)'), ST_GEOMFROMTEXT('POINT(-179.9999 -90)'));
|
||||
|
||||
--echo #####################################################################################
|
||||
--echo # ST_DISTANCE_SPHERE(point, multipoint)
|
||||
--echo #####################################################################################
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(0 0)'));
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(180 0)'));
|
||||
|
||||
--replace_numeric_round 5
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(0 90)'));
|
||||
|
||||
--replace_numeric_round 5
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(-179 0)'));
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(0 0,1 1,2 2)'));
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(0 0,180 90)'));
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(180 90,0 0,-179 -90)'));
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(0 1)'));
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(0 1,1 0,1 1)'));
|
||||
|
||||
--replace_numeric_round 14
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(180 90)'), ST_GEOMFROMTEXT('MULTIPOINT(180 -90,-179 90,-179 -90)'));
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(37 -42)'), ST_GEOMFROMTEXT('MULTIPOINT(57 32)'));
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(-85 48)'), ST_GEOMFROMTEXT('MULTIPOINT(159 -49)'));
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(168 -21)'), ST_GEOMFROMTEXT('MULTIPOINT(-22 -32)'));
|
||||
|
||||
--replace_numeric_round 5
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(-64 67)'), ST_GEOMFROMTEXT('MULTIPOINT(-103 45,155 57,-166 85)'));
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(-36 -41)'), ST_GEOMFROMTEXT('MULTIPOINT(-37 45,-49 23,97 -19)'));
|
||||
|
||||
--replace_numeric_round 5
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(138 86)'), ST_GEOMFROMTEXT('MULTIPOINT(15 -79,-110 -76,49 31)'));
|
||||
|
||||
--replace_numeric_round 5
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(164 -41)'), ST_GEOMFROMTEXT('MULTIPOINT(-11 2,-81 3,161 62,-119 31)'));
|
||||
|
||||
--replace_numeric_round 5
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(-106 -23)'), ST_GEOMFROMTEXT('MULTIPOINT(-152 72,89 -3,-23 -42,126 59)'));
|
||||
|
||||
--replace_numeric_round 5
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(168 -15)'), ST_GEOMFROMTEXT('MULTIPOINT(68 73,157 -55,-178 -29,46 78,-133 59,180 59)'));
|
||||
|
||||
--replace_numeric_round 5
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(106 76)'), ST_GEOMFROMTEXT('MULTIPOINT(53 20,148 -40,-61 -90,170 -37,-64 -82,-167 85)'));
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(-50 36)'), ST_GEOMFROMTEXT('MULTIPOINT(-32 -64,-116 -35,148 89,-75 16,-99 87,-51 -2,-113 24,93 46,168 53)'));
|
||||
|
||||
--replace_numeric_round 5
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(-139 54)'), ST_GEOMFROMTEXT('MULTIPOINT(151 -57,-74 61,10 28,170 -47,97 -45,-5 -82,121 -21,-96 -44,81 -68)'));
|
||||
|
||||
--echo #####################################################################################
|
||||
--echo # ST_DISTANCE_SPHERE(multipoint, point)
|
||||
--echo #####################################################################################
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(0 0)'), ST_GEOMFROMTEXT('POINT(0 0)'));
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(0 0)'), ST_GEOMFROMTEXT('POINT(180 0)'));
|
||||
|
||||
--replace_numeric_round 5
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(0 0)'), ST_GEOMFROMTEXT('POINT(0 90)'));
|
||||
|
||||
--replace_numeric_round 5
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(0 0)'), ST_GEOMFROMTEXT('POINT(-179 0)'));
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(0 0,1 1,2 2)'), ST_GEOMFROMTEXT('POINT(0 0)'));
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(180 90,0 0,180 -90)'), ST_GEOMFROMTEXT('POINT(-0 0)'));
|
||||
|
||||
--replace_numeric_round 5
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-179 90,0 0,-179 -90)'), ST_GEOMFROMTEXT('POINT(-179 0)'));
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-179 90,0 0,-179 -90)'), ST_GEOMFROMTEXT('POINT(-179 -90)'));
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-172 -70)'), ST_GEOMFROMTEXT('POINT(45 90)'));
|
||||
|
||||
--replace_numeric_round 5
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-157 -67)'), ST_GEOMFROMTEXT('POINT(-92 -88)'));
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(156 -64,-96 57,-15 -18)'), ST_GEOMFROMTEXT('POINT(-73 -1)'));
|
||||
|
||||
--replace_numeric_round 5
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-110 43,-79 -82,-32 24)'), ST_GEOMFROMTEXT('POINT(61 27)'));
|
||||
|
||||
--replace_numeric_round 5
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-85 87,-155 48,-163 -84)'), ST_GEOMFROMTEXT('POINT(-95 84)'));
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(33 -49,174 -25,-4 -56)'), ST_GEOMFROMTEXT('POINT(48 46)'));
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-36 -87,-75 20,-157 78)'), ST_GEOMFROMTEXT('POINT(-165 18)'));
|
||||
|
||||
--replace_numeric_round 5
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(151 17,-150 -43,-165 76,87 53)'), ST_GEOMFROMTEXT('POINT(152 27)'));
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-159 -88,-177 -82,17 76,79 1)'), ST_GEOMFROMTEXT('POINT(35 -74)'));
|
||||
|
||||
--replace_numeric_round 5
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-130 -20,-118 -63,-57 0)'), ST_GEOMFROMTEXT('POINT(-156 89)'));
|
||||
|
||||
--replace_numeric_round 5
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-84 25,-52 53,125 -50,-171 51,55 -13,-4 -69)'), ST_GEOMFROMTEXT('POINT(-127 52)'));
|
||||
|
||||
--replace_numeric_round 5
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(56 -45,158 84,112 2,85 21,88 89,-151 33,-158 40)'), ST_GEOMFROMTEXT('POINT(-172 87)'));
|
||||
|
||||
--replace_numeric_round 5
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-6 -56,-73 54,20 -74,-160 72,-4 42,-120 -62,-54 -8,-85 48,159 -49,100 -75)'),
|
||||
ST_GEOMFROMTEXT('POINT(167 -17)'));
|
||||
|
||||
--echo #####################################################################################
|
||||
--echo # ST_DISTANCE_SPHERE(multipoint, multipoint)
|
||||
--echo #####################################################################################
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(0 0)'));
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(180 0)'));
|
||||
|
||||
--replace_numeric_round 5
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(0 90)'));
|
||||
|
||||
--replace_numeric_round 5
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(-179 0)'));
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(0 0,1 1,2 2)'), ST_GEOMFROMTEXT('MULTIPOINT(1 1,0 0,2 2)'));
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(180 90,0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(180 90)'));
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(180 0,0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(180 0,0 90)'));
|
||||
|
||||
--replace_numeric_round 5
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-179 90,0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(-179 0,0 -90)'));
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(111 11,11 1)'), ST_GEOMFROMTEXT('MULTIPOINT(1 11,11 11)'));
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(10 10,20 20,30 30)'), ST_GEOMFROMTEXT('MULTIPOINT(15 15,20 20,25 25)'));
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-10 -10,-20 -20,-30 -30)'), ST_GEOMFROMTEXT('MULTIPOINT(180 0,-30 -30,180 -90)'));
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-150 -79)'), ST_GEOMFROMTEXT('MULTIPOINT(145 -2)'));
|
||||
|
||||
--replace_numeric_round 5
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(164 -37)'), ST_GEOMFROMTEXT('MULTIPOINT(67 59)'));
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(135 62)'), ST_GEOMFROMTEXT('MULTIPOINT(-116 -22)'));
|
||||
|
||||
--replace_numeric_round 5
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-123 85)'), ST_GEOMFROMTEXT('MULTIPOINT(-54 -40)'));
|
||||
|
||||
--replace_numeric_round 5
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(152 43)'), ST_GEOMFROMTEXT('MULTIPOINT(106 76,53 20,148 -40)'));
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-177 -88,-165 9,153 40,2 17)'), ST_GEOMFROMTEXT('MULTIPOINT(-150 -4)'));
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(154 84,-124 37,17 50)'), ST_GEOMFROMTEXT('MULTIPOINT(42 34)'));
|
||||
|
||||
--replace_numeric_round 5
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(88 -65,49 85,68 77)'), ST_GEOMFROMTEXT('MULTIPOINT(125 82,-83 -5,3 -40)'));
|
||||
|
||||
--replace_numeric_round 5
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(174 59,91 24,26 28)'), ST_GEOMFROMTEXT('MULTIPOINT(-35 -33,-171 -37,-30 -43)'));
|
||||
|
||||
--replace_numeric_round 5
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-140 -63,103 -42,160 -53)'), ST_GEOMFROMTEXT('MULTIPOINT(-78 -80,-133 -24,73 -15)'));
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(137 -65,-63 13,38 9)'), ST_GEOMFROMTEXT('MULTIPOINT(-166 -35,107 -18,-83 -18,91 -24)'));
|
||||
|
||||
--replace_numeric_round 5
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-128 90,90 -17,-176 -37,40 -78,156 -82,37 -42)'), ST_GEOMFROMTEXT('MULTIPOINT(57 32,-3 22,24 -88)'));
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(87 -12,-25 31,-47 23,134 83,120 69,39 -41)'), ST_GEOMFROMTEXT('MULTIPOINT(-9 -4,-171 -82,140 -26)'));
|
||||
|
||||
--replace_numeric_round 5
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-119 50,28 22,-122 -74)'), ST_GEOMFROMTEXT('MULTIPOINT(134 14,-32 -84,96 74,44 59,-88 73,-136 12)'));
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-144 73,81 61,-78 4,50 -28)'),
|
||||
ST_GEOMFROMTEXT('MULTIPOINT(-176 48,-154 -39,-140 -60,135 72,-97 28,-35 69)'));
|
||||
|
||||
--replace_numeric_round 5
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-14 49)'),
|
||||
ST_GEOMFROMTEXT('MULTIPOINT(-160 -51,-141 72,50 -30,96 -64,-41 -59,-128 -28,0 -77,179 -78,-84 -67)'));
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(-165 61,-43 -47,-89 40,-137 -64,11 26,-8 -31,28 -77,37 -44,124 51)'),
|
||||
ST_GEOMFROMTEXT('MULTIPOINT(63 39,98 14,-123 79,-30 -27)'));
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(11 -38,-17 54,-104 73)'),
|
||||
ST_GEOMFROMTEXT('MULTIPOINT(167 -50,103 -21,-122 24,-122 80,-41 37,-175 -25,-155 48,-23 -34,-105 48)'));
|
||||
|
||||
--echo #####################################################################################
|
||||
--echo # ST_DISTANCE_SPHERE with different earth radius value
|
||||
--echo #####################################################################################
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 1)'), ST_GEOMFROMTEXT('POINT(0 0)'), 1);
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 1)'), ST_GEOMFROMTEXT('POINT(0 0)'), 10);
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 1)'), ST_GEOMFROMTEXT('POINT(0 0)'), 100);
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 1)'), ST_GEOMFROMTEXT('POINT(0 0)'), 2000);
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 1)'), ST_GEOMFROMTEXT('POINT(0 0)'), 1234567);
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 1)'), ST_GEOMFROMTEXT('POINT(0 0)'), 6370986);
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 1)'), ST_GEOMFROMTEXT('POINT(0 0)'), 6370987);
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 1)'), ST_GEOMFROMTEXT('POINT(0 0)'), 1234567890);
|
||||
|
||||
--echo #####################################################################################
|
||||
--echo # Invalid function calls
|
||||
--echo #####################################################################################
|
||||
|
||||
--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
||||
SELECT ST_DISTANCE_SPHERE();
|
||||
|
||||
--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(10 10)'));
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(10 10)'),NULL);
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(NULL,ST_GEOMFROMTEXT('POINT(10 10)'));
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(NULL,ST_GEOMFROMTEXT(@star_top));
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT(@star_of_elems),NULL);
|
||||
|
||||
SELECT ST_DISTANCE_SPHERE(NULL,NULL);
|
||||
|
||||
--error ER_GIS_INVALID_DATA
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT()'),ST_GEOMFROMTEXT('POINT(0 0)'));
|
||||
|
||||
--error ER_GIS_INVALID_DATA
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(a 0)'),ST_GEOMFROMTEXT('POINT(0 0)'));
|
||||
|
||||
--error ER_GIS_INVALID_DATA
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(! 0)'),ST_GEOMFROMTEXT('POINT(0 0)'));
|
||||
|
||||
--error ER_PARSE_ERROR
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT('!' 0)'),ST_GEOMFROMTEXT('POINT(0 0)'));
|
||||
|
||||
--error ER_GIS_INVALID_DATA
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(12,34 0)'),ST_GEOMFROMTEXT('POINT(0 0)'));
|
||||
|
||||
--error ER_GIS_INVALID_DATA
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT()'),ST_GEOMFROMTEXT('POINT(0 0)'));
|
||||
|
||||
--error ER_GIS_INVALID_DATA
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 12,34 a)'),ST_GEOMFROMTEXT('POINT(0 0)'));
|
||||
|
||||
--error ER_GIS_INVALID_DATA
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 12,34 0,1)'),ST_GEOMFROMTEXT('POINT(0 0)'));
|
||||
|
||||
--error ER_PARSE_ERROR
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 1,2 2,'!' 0)'),ST_GEOMFROMTEXT('POINT(0 0)'));
|
||||
|
||||
--error ER_PARSE_ERROR
|
||||
SELECT ST_DISTANCE_SPHERE(,);
|
||||
|
||||
--error ER_PARSE_ERROR
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT(@star_of_elems),);
|
||||
|
||||
--error ER_PARSE_ERROR
|
||||
SELECT ST_DISTANCE_SPHERE(,ST_GEOMFROMTEXT(@star_top));
|
||||
|
||||
--error 3704
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 1)'), ST_GEOMFROMTEXT('LINESTRING(0 0,10 10)'));
|
||||
|
||||
--error 3704
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 1)'), ST_GEOMFROMTEXT('POLYGON((0 0,0 5,5 5,5 0,0 0))'));
|
||||
|
||||
--error 3704
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 1)'), ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(0 0))'));
|
||||
|
||||
--error 3704
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(1 1))'), ST_GEOMFROMTEXT('POINT(0 0)'));
|
||||
|
||||
--error 3704
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 1)'), ST_GEOMFROMTEXT('GEOMETRYCOLLECTION()'));
|
||||
|
||||
--error 3704
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 1)'), ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(POINT(0 0)))'));
|
||||
|
||||
--error 3704
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 1)'), ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(0 0),GEOMETRYCOLLECTION())'));
|
||||
|
||||
--error 3704
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(0 1)'), ST_GEOMFROMTEXT('LINESTRING(0 0,10 10)'));
|
||||
|
||||
--error 3704
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(0 1)'), ST_GEOMFROMTEXT('POLYGON((0 0,0 5,5 5,5 0,0 0))'));
|
||||
|
||||
--error 3704
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(0 1)'), ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(0 0))'));
|
||||
|
||||
--error 3704
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(MULTIPOINT(1 1))'), ST_GEOMFROMTEXT('POINT(0 0)'));
|
||||
|
||||
--error 3704
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(0 1)'), ST_GEOMFROMTEXT('GEOMETRYCOLLECTION()'));
|
||||
|
||||
--error 3704
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(0 1)'), ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(POINT(0 0)))'));
|
||||
|
||||
--error 3704
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(0 1)'), ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(0 0),GEOMETRYCOLLECTION())'));
|
||||
|
||||
--error 3704
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION()'), ST_GEOMFROMTEXT('GEOMETRYCOLLECTION()'));
|
||||
|
||||
--error 3706
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 1)'), ST_GEOMFROMTEXT('POINT(0 0)'), -200);
|
||||
|
||||
--error 3706
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 1)'), ST_GEOMFROMTEXT('POINT(0 0)'), -1);
|
||||
|
||||
--error 3706
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 1)'), ST_GEOMFROMTEXT('POINT(0 0)'), 0);
|
||||
|
||||
--error 3616
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(200 1)'), ST_GEOMFROMTEXT('POINT(0 0)'), 200);
|
||||
|
||||
--error 3617
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(20 1)'), ST_GEOMFROMTEXT('POINT(0 100)'), 200);
|
||||
|
||||
--error 1582
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 1)'), ST_GEOMFROMTEXT('POINT(0 0)'), 200, 300);
|
||||
|
||||
--echo # Clean up
|
||||
DROP TABLE gis_geometrycollection;
|
||||
|
||||
--echo #
|
||||
--echo # WL#8579 Spatial Reference Systems
|
||||
--echo #
|
||||
|
||||
--echo # SRID 0 (should pass)
|
||||
--replace_regex /([0-9]+\.[0-9]{5})[0-9]*/\1/
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)', 0), ST_GEOMFROMTEXT('POINT(1 1)', 0));
|
||||
|
||||
--echo # Projected SRS (should error)
|
||||
--replace_regex /([0-9]+\.[0-9]{5})[0-9]*/\1/
|
||||
--error 3705
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)', 2000), ST_GEOMFROMTEXT('POINT(1 1)', 2000));
|
||||
|
||||
--echo # Geographic SRS (should pass)
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)', 4326), ST_GEOMFROMTEXT('POINT(1 1)', 4326));
|
||||
|
||||
--echo #
|
||||
--echo # WL#11096 Don't do Cartesian computations on geographic geometries
|
||||
--echo #
|
||||
|
||||
--echo # Assume SRID 10 is not defined.
|
||||
--error 3548
|
||||
SELECT ST_DISTANCE_SPHERE(
|
||||
x'0A000000010100000000000000000000000000000000000000',
|
||||
x'0A000000010100000000000000000000000000000000000000'
|
||||
);
|
||||
|
||||
# bugfix:
|
||||
--error 3616
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(-1 -1)'),ST_GEOMFROMTEXT('MULTIPOINT(200 -200)'));
|
||||
--error 3617
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(-1 -1)'),ST_GEOMFROMTEXT('MULTIPOINT(20 -200)'));
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 1)'),ST_GEOMFROMTEXT('MULTIPOINT(90 -90)'));
|
||||
|
||||
# bugfix:
|
||||
--error 3548
|
||||
SELECT ST_DISTANCE_SPHERE('POINT(1 1)','POINT(1 1)');
|
||||
|
||||
# bugfix:
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMETRYFROMTEXT('MULTIPOINT((1E-15 1E-15),(1E-14 1E-14))'),ST_GEOMETRYFROMTEXT('MULTIPOINT((1E-15 1E-15),(-90 90))'));
|
||||
SELECT ST_DISTANCE_SPHERE(ST_GEOMETRYFROMTEXT('MULTIPOINT((1E-15 1E-15),(1E-14 1E-14))'),ST_GEOMETRYFROMTEXT('POINT(1E-15 1E-15)'));
|
||||
@ -0,0 +1,180 @@
|
||||
#owner: ht353245
|
||||
#owner group: shenzhen
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--echo # Test of _st_dwithin.
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--source mysql_test/test_suite/geometry/t/import_default_srs_data_mysql.inc
|
||||
##
|
||||
## Basic test for _st_dwithin
|
||||
##
|
||||
|
||||
select 'dwithin_pt_pt_1', _st_dwithin(ST_GeomFromText('POINT(0 0)', 4326), ST_GeomFromText('POINT(1 1)', 4326), 300000);
|
||||
select 'dwithin_pt_pt_2', _st_dwithin(ST_GeomFromText('POINT(0 0)', 4326), ST_GeomFromText('POINT(1 1)', 4326), 10);
|
||||
select 'dwithin_pt_line_1', _st_dwithin(ST_GeomFromText('POINT(0 0)', 4326), ST_GeomFromText('LINESTRING(1 1, 2 2)', 4326), 300000);
|
||||
select 'dwithin_line_pt_1', _st_dwithin(ST_GeomFromText('LINESTRING(1 1, 2 2)', 4326), ST_GeomFromText('POINT(0 0)', 4326), 300000);
|
||||
select 'dwithin_pt_poly_1', _st_dwithin(ST_GeomFromText('POINT(0 0)', 4326), ST_GeomFromText('POLYGON((1 1, 2 2, 3 0, 1 1))', 4326), 300000);
|
||||
select 'dwithin_poly_pt_1', _st_dwithin(ST_GeomFromText('POLYGON((1 1, 2 2, 3 0, 1 1))', 4326), ST_GeomFromText('POINT(0 0)', 4326), 300000);
|
||||
select 'dwithin_poly_pt_2', _st_dwithin(ST_GeomFromText('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))', 4326), ST_GeomFromText('POINT(5 10.01)', 4326), 1000);
|
||||
select 'dwithin_poly_pt_3', _st_dwithin(ST_GeomFromText('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))', 4326), ST_GeomFromText('POINT(5 10.01)', 4326), 3000);
|
||||
select 'dwithin_line_poly_1', _st_dwithin(ST_GeomFromText('LINESTRING(-1 -1, 0 0)', 4326), ST_GeomFromText('POLYGON((1 1, 2 2, 3 0, 1 1))', 4326), 300000);
|
||||
select 'dwithin_poly_line_1', _st_dwithin(ST_GeomFromText('POLYGON((1 1, 2 2, 3 0, 1 1))', 4326), ST_GeomFromText('LINESTRING(-1 -1, 0 0)', 4326), 300000);
|
||||
select 'dwithin_poly_poly_1', _st_dwithin(ST_GeomFromText('POLYGON((0 0, -2 -2, -3 0, 0 0))', 4326), ST_GeomFromText('POLYGON((1 1, 2 2, 3 0, 1 1))', 4326), 10);
|
||||
select 'dwithin_poly_poly_2', _st_dwithin(ST_GeomFromText('POLYGON((0 0, -2 -2, -3 0, 0 0))', 4326), ST_GeomFromText('POLYGON((1 1, 2 2, 3 0, 1 1))', 4326), 300000);
|
||||
select 'dwithin_poly_poly_2', _st_dwithin(ST_GeomFromText('POLYGON((1 1, -2 -2, -3 0, 1 1))', 4326), ST_GeomFromText('POLYGON((1 1, 2 2, 3 0, 1 1))', 4326), 300000);
|
||||
|
||||
--error ER_GIS_DIFFERENT_SRIDS
|
||||
select _st_dwithin(ST_GeomFromText('POLYGON((1 1, -2 -2, -3 0, 1 1))', 4326), ST_GeomFromText('POLYGON((1 1, 2 2, 3 0, 1 1))', 2000), 300000);
|
||||
--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
||||
select _st_dwithin(ST_GeomFromText('POLYGON((1 1, -2 -2, -3 0, 1 1))', 4326));
|
||||
--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
||||
select _st_dwithin(ST_GeomFromText('POLYGON((1 1, -2 -2, -3 0, 1 1))', 4326), ST_GeomFromText('POLYGON((1 1, 2 2, 3 0, 1 1))', 2000));
|
||||
|
||||
select _st_dwithin(null, ST_GeomFromText('POLYGON((1 1, 2 2, 3 0, 1 1))', 2000), 10);
|
||||
select _st_dwithin(ST_GeomFromText('POLYGON((1 1, 2 2, 3 0, 1 1))', 2000), null, 10);
|
||||
select _st_dwithin(null, null, null);
|
||||
select _st_dwithin(ST_GeomFromText('POLYGON((1 1, -2 -2, -3 0, 1 1))', 4326), ST_GeomFromText('POLYGON((1 1, 2 2, 3 0, 1 1))', 4326), null);
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t, t1, shape;
|
||||
--enable_warnings
|
||||
|
||||
##
|
||||
## Basic test for _st_dwithin index
|
||||
##
|
||||
|
||||
|
||||
SET @star_point= 'POINT(1 1)';
|
||||
SET @star_linestring= 'LINESTRING(1 1, 2 2)';
|
||||
SET @star_polygon= 'POLYGON((1 1, 2 2, 3 0, 1 1))';
|
||||
SET @star_multipoint= 'MULTIPOINT(5 0,2 3,8 7,15 25)';
|
||||
SET @star_multiline= 'MULTILINESTRING((2.5 0,0 1.5,1.5 3.0,0 5))';
|
||||
SET @star_multipolygon= 'MULTIPOLYGON(((5 0,1.5 2.5,2.5 0,1.5 5,5 0)),((2.5 0,0 1.5,3.0 1.5,2.2 1.0,2.5 0)))';
|
||||
SET @star_gc= 'GEOMETRYCOLLECTION(MULTIPOLYGON(((5 0,1.5 2.5,2.5 0,1.5 5,5 0)),((2.5 0,0 1.5,3.0 1.5,2.2 1.0,2.5 0))),POLYGON((5 0,7 1.0,0 1.5,1.0 1.5,1.5 2.5,2.0 1.5,3.0 1.5,2.2 1.0,2.5 0,1.5 5,5 0)),LINESTRING(1.5 2.5,1.5 1.0),MULTIPOINT(5 0,2.5 0),POINT(1.5 2.5))';
|
||||
|
||||
|
||||
create table t(g geometry NOT NULL SRID 4326);
|
||||
create index idx on t (g);
|
||||
|
||||
INSERT INTO t (g) VALUES
|
||||
(ST_GeomFromText('POINT(0 0)', 4326, 'axis-order=long-lat')),
|
||||
(ST_GeomFromText('POINT(1 1)', 4326, 'axis-order=long-lat')),
|
||||
(ST_GeomFromText('POINT(1.5 1.5)', 4326, 'axis-order=long-lat')),
|
||||
(ST_GeomFromText('POINT(2 2)', 4326, 'axis-order=long-lat')),
|
||||
(ST_GeomFromText('POINT(2.5 2.5)', 4326, 'axis-order=long-lat')),
|
||||
(ST_GeomFromText('POINT(3 3)', 4326, 'axis-order=long-lat')),
|
||||
(ST_GeomFromText('POINT(3.5 3.5)', 4326, 'axis-order=long-lat')),
|
||||
(ST_GeomFromText('POINT(4 4)', 4326, 'axis-order=long-lat')),
|
||||
(ST_GeomFromText('POINT(5 5.5)', 4326, 'axis-order=long-lat')),
|
||||
(ST_GeomFromText('POINT(6 6)', 4326, 'axis-order=long-lat')),
|
||||
(ST_GeomFromText('POINT(7 7)', 4326, 'axis-order=long-lat')),
|
||||
(ST_GeomFromText('MULTIPOINT(1 1,1 4,4 4,4 0.00009)', 4326, 'axis-order=long-lat')),
|
||||
(ST_GeomFromText('LINESTRING(2 2,5 0,8 2)', 4326, 'axis-order=long-lat')),
|
||||
(ST_GeomFromText('MULTILINESTRING((2 2,2 10,10 10),(10 10,10 2,2 2))', 4326, 'axis-order=long-lat')),
|
||||
(ST_GeomFromText('POLYGON((0 0,0 10,10 10,10 0, 0 0),(4 4,4 6,6 6,6 4,4 4))', 4326, 'axis-order=long-lat')),
|
||||
(ST_GeomFromText('MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4)),((3 3,3 7,7 7,7 3,3 3),(4 4,4 6,6 6,6 4,4 4)))', 4326, 'axis-order=long-lat')),
|
||||
(ST_GeomFromText('GEOMETRYCOLLECTION(POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4)),POLYGON((3 3,3 7,7 7,7 3,3 3),(4 4,4 6,6 6,6 4,4 4)))', 4326, 'axis-order=long-lat'));
|
||||
|
||||
|
||||
select /*+index(t idx)*/ st_astext(g) from t where _st_dwithin(g, st_geomfromtext('POINT(1 1)', 4326, 'axis-order=long-lat'), 5);
|
||||
select /*+index(t idx)*/ st_astext(g) from t where _st_dwithin(g, st_geomfromtext('LINESTRING(1 1, 2 2)', 4326, 'axis-order=long-lat'), 5);
|
||||
select /*+index(t idx)*/ st_astext(g) from t where _st_dwithin(g, st_geomfromtext('POLYGON((1 1, 2 2, 3 0, 1 1))', 4326, 'axis-order=long-lat'), 5);
|
||||
select /*+index(t idx)*/ st_astext(g) from t where _st_dwithin(g, st_geomfromtext('MULTIPOINT(5 0,2 3,8 7,15 25)', 4326, 'axis-order=long-lat'), 5);
|
||||
select /*+index(t idx)*/ st_astext(g) from t where _st_dwithin(g, st_geomfromtext('MULTILINESTRING((2.5 0,0 1.5,1.5 3.0,0 5))', 4326, 'axis-order=long-lat'), 5);
|
||||
select /*+index(t idx)*/ st_astext(g) from t where _st_dwithin(g, st_geomfromtext('MULTIPOLYGON(((5 0,1.5 2.5,2.5 0,1.5 5,5 0)),((2.5 0,0 1.5,3.0 1.5,2.2 1.0,2.5 0)))', 4326, 'axis-order=long-lat'), 5);
|
||||
select /*+index(t idx)*/ st_astext(g) from t where _st_dwithin(g, st_geomfromtext('GEOMETRYCOLLECTION(MULTIPOLYGON(((5 0,1.5 2.5,2.5 0,1.5 5,5 0)),((2.5 0,0 1.5,3.0 1.5,2.2 1.0,2.5 0))),POLYGON((5 0,7 1.0,0 1.5,1.0 1.5,1.5 2.5,2.0 1.5,3.0 1.5,2.2 1.0,2.5 0,1.5 5,5 0)),LINESTRING(1.5 2.5,1.5 1.0),MULTIPOINT(5 0,2.5 0),POINT(1.5 2.5))', 4326, 'axis-order=long-lat'), 5);
|
||||
|
||||
select /*+index(t idx)*/ st_astext(g) from t where _st_dwithin(g, st_geomfromtext('POINT(1 1)', 4326, 'axis-order=long-lat'), 100);
|
||||
select /*+index(t idx)*/ st_astext(g) from t where _st_dwithin(g, st_geomfromtext('LINESTRING(1 1, 2 2)', 4326, 'axis-order=long-lat'), 100);
|
||||
select /*+index(t idx)*/ st_astext(g) from t where _st_dwithin(g, st_geomfromtext('POLYGON((1 1, 2 2, 3 0, 1 1))', 4326, 'axis-order=long-lat'), 100);
|
||||
select /*+index(t idx)*/ st_astext(g) from t where _st_dwithin(g, st_geomfromtext('MULTIPOINT(5 0,2 3,8 7,15 25)', 4326, 'axis-order=long-lat'), 100);
|
||||
select /*+index(t idx)*/ st_astext(g) from t where _st_dwithin(g, st_geomfromtext('MULTILINESTRING((2.5 0,0 1.5,1.5 3.0,0 5))', 4326, 'axis-order=long-lat'), 100);
|
||||
select /*+index(t idx)*/ st_astext(g) from t where _st_dwithin(g, st_geomfromtext('MULTIPOLYGON(((5 0,1.5 2.5,2.5 0,1.5 5,5 0)),((2.5 0,0 1.5,3.0 1.5,2.2 1.0,2.5 0)))', 4326, 'axis-order=long-lat'), 100);
|
||||
select /*+index(t idx)*/ st_astext(g) from t where _st_dwithin(g, st_geomfromtext('GEOMETRYCOLLECTION(MULTIPOLYGON(((5 0,1.5 2.5,2.5 0,1.5 5,5 0)),((2.5 0,0 1.5,3.0 1.5,2.2 1.0,2.5 0))),POLYGON((5 0,7 1.0,0 1.5,1.0 1.5,1.5 2.5,2.0 1.5,3.0 1.5,2.2 1.0,2.5 0,1.5 5,5 0)),LINESTRING(1.5 2.5,1.5 1.0),MULTIPOINT(5 0,2.5 0),POINT(1.5 2.5))', 4326, 'axis-order=long-lat'), 100);
|
||||
|
||||
select /*+index(t idx)*/ st_astext(g) from t where _st_dwithin(g, st_geomfromtext('POINT(1 1)', 4326, 'axis-order=long-lat'), 100000);
|
||||
select /*+index(t idx)*/ st_astext(g) from t where _st_dwithin(g, st_geomfromtext('LINESTRING(1 1, 2 2)', 4326, 'axis-order=long-lat'), 100000);
|
||||
select /*+index(t idx)*/ st_astext(g) from t where _st_dwithin(g, st_geomfromtext('POLYGON((1 1, 2 2, 3 0, 1 1))', 4326, 'axis-order=long-lat'), 100000);
|
||||
select /*+index(t idx)*/ st_astext(g) from t where _st_dwithin(g, st_geomfromtext('MULTIPOINT(5 0,2 3,8 7,15 25)', 4326, 'axis-order=long-lat'), 100000);
|
||||
select /*+index(t idx)*/ st_astext(g) from t where _st_dwithin(g, st_geomfromtext('MULTILINESTRING((2.5 0,0 1.5,1.5 3.0,0 5))', 4326, 'axis-order=long-lat'), 100000);
|
||||
select /*+index(t idx)*/ st_astext(g) from t where _st_dwithin(g, st_geomfromtext('MULTIPOLYGON(((5 0,1.5 2.5,2.5 0,1.5 5,5 0)),((2.5 0,0 1.5,3.0 1.5,2.2 1.0,2.5 0)))', 4326, 'axis-order=long-lat'), 100000);
|
||||
select /*+index(t idx)*/ st_astext(g) from t where _st_dwithin(g, st_geomfromtext('GEOMETRYCOLLECTION(MULTIPOLYGON(((5 0,1.5 2.5,2.5 0,1.5 5,5 0)),((2.5 0,0 1.5,3.0 1.5,2.2 1.0,2.5 0))),POLYGON((5 0,7 1.0,0 1.5,1.0 1.5,1.5 2.5,2.0 1.5,3.0 1.5,2.2 1.0,2.5 0,1.5 5,5 0)),LINESTRING(1.5 2.5,1.5 1.0),MULTIPOINT(5 0,2.5 0),POINT(1.5 2.5))', 4326, 'axis-order=long-lat'), 100000);
|
||||
|
||||
select /*+index(t idx)*/ st_astext(g) from t where _st_dwithin(g, st_geomfromtext('POINT(1 1)', 4326, 'axis-order=long-lat'), 500000);
|
||||
select /*+index(t idx)*/ st_astext(g) from t where _st_dwithin(g, st_geomfromtext('LINESTRING(1 1, 2 2)', 4326, 'axis-order=long-lat'), 500000);
|
||||
select /*+index(t idx)*/ st_astext(g) from t where _st_dwithin(g, st_geomfromtext('POLYGON((1 1, 2 2, 3 0, 1 1))', 4326, 'axis-order=long-lat'), 500000);
|
||||
select /*+index(t idx)*/ st_astext(g) from t where _st_dwithin(g, st_geomfromtext('MULTIPOINT(5 0,2 3,8 7,15 25)', 4326, 'axis-order=long-lat'), 500000);
|
||||
select /*+index(t idx)*/ st_astext(g) from t where _st_dwithin(g, st_geomfromtext('MULTILINESTRING((2.5 0,0 1.5,1.5 3.0,0 5))', 4326, 'axis-order=long-lat'), 500000);
|
||||
select /*+index(t idx)*/ st_astext(g) from t where _st_dwithin(g, st_geomfromtext('MULTIPOLYGON(((5 0,1.5 2.5,2.5 0,1.5 5,5 0)),((2.5 0,0 1.5,3.0 1.5,2.2 1.0,2.5 0)))', 4326, 'axis-order=long-lat'), 500000);
|
||||
select /*+index(t idx)*/ st_astext(g) from t where _st_dwithin(g, st_geomfromtext('GEOMETRYCOLLECTION(MULTIPOLYGON(((5 0,1.5 2.5,2.5 0,1.5 5,5 0)),((2.5 0,0 1.5,3.0 1.5,2.2 1.0,2.5 0))),POLYGON((5 0,7 1.0,0 1.5,1.0 1.5,1.5 2.5,2.0 1.5,3.0 1.5,2.2 1.0,2.5 0,1.5 5,5 0)),LINESTRING(1.5 2.5,1.5 1.0),MULTIPOINT(5 0,2.5 0),POINT(1.5 2.5))', 4326, 'axis-order=long-lat'), 500000);
|
||||
|
||||
select /*+index(t idx)*/ st_astext(g) from t where _st_dwithin(g, st_geomfromtext('POINT(1 1)', 4326, 'axis-order=long-lat'), 1000000);
|
||||
select /*+index(t idx)*/ st_astext(g) from t where _st_dwithin(g, st_geomfromtext('LINESTRING(1 1, 2 2)', 4326, 'axis-order=long-lat'), 1000000);
|
||||
select /*+index(t idx)*/ st_astext(g) from t where _st_dwithin(g, st_geomfromtext('POLYGON((1 1, 2 2, 3 0, 1 1))', 4326, 'axis-order=long-lat'), 1000000);
|
||||
select /*+index(t idx)*/ st_astext(g) from t where _st_dwithin(g, st_geomfromtext('MULTIPOINT(5 0,2 3,8 7,15 25)', 4326, 'axis-order=long-lat'), 1000000);
|
||||
select /*+index(t idx)*/ st_astext(g) from t where _st_dwithin(g, st_geomfromtext('MULTILINESTRING((2.5 0,0 1.5,1.5 3.0,0 5))', 4326, 'axis-order=long-lat'), 1000000);
|
||||
select /*+index(t idx)*/ st_astext(g) from t where _st_dwithin(g, st_geomfromtext('MULTIPOLYGON(((5 0,1.5 2.5,2.5 0,1.5 5,5 0)),((2.5 0,0 1.5,3.0 1.5,2.2 1.0,2.5 0)))', 4326, 'axis-order=long-lat'), 1000000);
|
||||
select /*+index(t idx)*/ st_astext(g) from t where _st_dwithin(g, st_geomfromtext('GEOMETRYCOLLECTION(MULTIPOLYGON(((5 0,1.5 2.5,2.5 0,1.5 5,5 0)),((2.5 0,0 1.5,3.0 1.5,2.2 1.0,2.5 0))),POLYGON((5 0,7 1.0,0 1.5,1.0 1.5,1.5 2.5,2.0 1.5,3.0 1.5,2.2 1.0,2.5 0,1.5 5,5 0)),LINESTRING(1.5 2.5,1.5 1.0),MULTIPOINT(5 0,2.5 0),POINT(1.5 2.5))', 4326, 'axis-order=long-lat'), 1000000);
|
||||
|
||||
drop table t;
|
||||
|
||||
create table t(g geometry NOT NULL SRID 3740);
|
||||
create index idx on t (g);
|
||||
|
||||
INSERT INTO t (g) VALUES
|
||||
(ST_GeomFromText('POINT(540000 4800000)', 3740)),
|
||||
(ST_GeomFromText('POINT(540001 4800001)', 3740)),
|
||||
(ST_GeomFromText('POINT(540001.5 4800001.5)', 3740)),
|
||||
(ST_GeomFromText('POINT(540002 4800002)', 3740)),
|
||||
(ST_GeomFromText('POINT(540002.5 4800002.5)', 3740)),
|
||||
(ST_GeomFromText('POINT(540003 4800003)', 3740)),
|
||||
(ST_GeomFromText('POINT(540003.5 4800003.5)', 3740)),
|
||||
(ST_GeomFromText('POINT(540004 4800004)', 3740)),
|
||||
(ST_GeomFromText('POINT(540005 4800005.5)', 3740)),
|
||||
(ST_GeomFromText('POINT(540006 4800006)', 3740)),
|
||||
(ST_GeomFromText('POINT(540007 4800007)', 3740)),
|
||||
(ST_GeomFromText('MULTIPOINT(540001 4800001,540001 4800004,540004 4800004,540004 4800000.00009)', 3740)),
|
||||
(ST_GeomFromText('LINESTRING(540002 4800002,540005 4800000,540008 4800002)', 3740)),
|
||||
(ST_GeomFromText('MULTILINESTRING((540002 4800002,540002 4800010,540010 4800010),(540010 4800010,540010 4800002,540002 4800002))', 3740)),
|
||||
(ST_GeomFromText('POLYGON((540000 4800000,540000 4800010,540010 4800010,540010 4800000, 540000 4800000),(540004 4800004,540004 4800006,540006 4800006,540006 4800004,540004 4800004))', 3740)),
|
||||
(ST_GeomFromText('MULTIPOLYGON(((540000 4800000,540000 4800010,540010 4800010,540010 4800000,540000 4800000),(540004 4800004,540004 4800006,540006 4800006,540006 4800004,540004 4800004)),((540003 4800003,540003 4800007,540007 4800007,540007 4800003,540003 4800003),(540004 4800004,540004 4800006,540006 4800006,540006 4800004,540004 4800004)))', 3740)),
|
||||
(ST_GeomFromText('GEOMETRYCOLLECTION(POLYGON((540000 4800000,540000 4800010,540010 4800010,540010 4800000,540000 4800000),(540004 4800004,540004 4800006,540006 4800006,540006 4800004,540004 4800004)),POLYGON((540003 4800003,540003 4800007,540007 4800007,540007 4800003,540003 4800003),(540004 4800004,540004 4800006,540006 4800006,540006 4800004,540004 4800004)))', 3740));
|
||||
|
||||
SET @star_point= 'POINT(540001 4800001)';
|
||||
SET @star_linestring= 'LINESTRING(540001 4800001, 540002 4800002)';
|
||||
SET @star_polygon= 'POLYGON((540001 4800001, 540002 4800002, 540003 4800000, 540001 4800001))';
|
||||
SET @star_multipoint= 'MULTIPOINT(540005 4800000,540002 4800003,540008 4800007,540015 4800025)';
|
||||
SET @star_multiline= 'MULTILINESTRING((540002.5 4800000,540000 4800001.5,540001.5 4800003.0,540000 4800005))';
|
||||
SET @star_multipolygon= 'MULTIPOLYGON(((540005 4800000,540001.5 4800002.5,540002.5480000 0,540001.5 4800005,540005 4800000)),((540002.5 4800000,540000 4800001.5,540003.0 4800001.5,540002.2 4800001.0,540002.5 4800000)))';
|
||||
SET @star_gc= 'GEOMETRYCOLLECTION(MULTIPOLYGON(((540005 4800000,540001.5 4800002.5,540002.5 4800000,540001.5 4800005,540005 4800000)),((540002.5 4800000,540000 4800001.5,540003.0 4800001.5,540002.2 4800001.0,540002.5 4800000))),POLYGON((540005 4800000,540007 4800001.0,540000 4800001.5,540001.0 4800001.5,540001.5 4800002.5,540002.0 4800001.5,540003.0 4800001.5,540002.2 4800001.0,540002.5 4800000,540001.5 4800005,540005 4800000)),LINESTRING(540001.5 4800002.5,540001.5 4800001.0),MULTIPOINT(540005 4800000,540002.5 4800000),POINT(540001.5 4800002.5))';
|
||||
|
||||
select /*+index(t idx)*/ st_astext(g) from t where _st_dwithin(g, st_geomfromtext('POINT(540001 4800001)', 3740), 0.5);
|
||||
|
||||
let $dis=1;
|
||||
while ($dis < 9)
|
||||
{
|
||||
--eval select /*+index(t idx)*/ st_astext(g) from t where _st_dwithin(g, st_geomfromtext('POINT(540001 4800001)', 3740), $dis);
|
||||
--eval select /*+index(t idx)*/ st_astext(g) from t where _st_dwithin(g, st_geomfromtext('LINESTRING(540001 4800001, 540002 4800002)', 3740), $dis);
|
||||
--eval select /*+index(t idx)*/ st_astext(g) from t where _st_dwithin(g, st_geomfromtext('POLYGON((540001 4800001, 540002 4800002, 540003 4800000, 540001 4800001))', 3740), $dis);
|
||||
--eval select /*+index(t idx)*/ st_astext(g) from t where _st_dwithin(g, st_geomfromtext('MULTIPOINT(540005 4800000,540002 4800003,540008 4800007,540015 4800025)', 3740), $dis);
|
||||
--eval select /*+index(t idx)*/ st_astext(g) from t where _st_dwithin(g, st_geomfromtext('MULTILINESTRING((540002.5 4800000,540000 4800001.5,540001.5 4800003.0,540000 4800005))', 3740), $dis);
|
||||
--eval select /*+index(t idx)*/ st_astext(g) from t where _st_dwithin(g, st_geomfromtext('MULTIPOLYGON(((540005 4800000,540001.5 4800002.5,540002.5480000 0,540001.5 4800005,540005 4800000)),((540002.5 4800000,540000 4800001.5,540003.0 4800001.5,540002.2 4800001.0,540002.5 4800000)))', 3740), $dis);
|
||||
--eval select /*+index(t idx)*/ st_astext(g) from t where _st_dwithin(g, st_geomfromtext('GEOMETRYCOLLECTION(MULTIPOLYGON(((540005 4800000,540001.5 4800002.5,540002.5 4800000,540001.5 4800005,540005 4800000)),((540002.5 4800000,540000 4800001.5,540003.0 4800001.5,540002.2 4800001.0,540002.5 4800000))),POLYGON((540005 4800000,540007 4800001.0,540000 4800001.5,540001.0 4800001.5,540001.5 4800002.5,540002.0 4800001.5,540003.0 4800001.5,540002.2 4800001.0,540002.5 4800000,540001.5 4800005,540005 4800000)),LINESTRING(540001.5 4800002.5,540001.5 4800001.0),MULTIPOINT(540005 4800000,540002.5 4800000),POINT(540001.5 4800002.5))', 3740), $dis);
|
||||
inc $dis;
|
||||
}
|
||||
|
||||
drop table t;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t2;
|
||||
--enable_warnings
|
||||
create table t2(k int, g geometry NOT NULL SRID 0);
|
||||
create index idx on t2 (g);
|
||||
INSERT INTO t2 VALUES
|
||||
(1, ST_GeomFromText('POINT(1.0 1.0)')),
|
||||
(2, ST_GeomFromText('LINESTRING(1.0 1.0, 2.0 2.0)')),
|
||||
(3, ST_GeomFromText('POINT(3.0 3.0)')),
|
||||
(4, ST_GeomFromText('LINESTRING(4.0 4.0, 5.0 5.0)')),
|
||||
(5, ST_GeomFromText('LINESTRING(40.0 40.0, 41.0 41.0)')),
|
||||
(6, ST_GeomFromText('POLYGON((1.0 1.0, 5.0 1.0, 5.0 5.0, 1.0 5.0, 1.0 1.0))'));
|
||||
SELECT k FROM t2 WHERE _st_dwithin(ST_GeomFromText('POINT(2.5 2.5)'), g, 1) ORDER BY k;
|
||||
drop table t2;
|
||||
@ -0,0 +1,59 @@
|
||||
#owner: ht353245
|
||||
#owner group: shenzhen
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--echo # Test of ST_GEOMETRY_COLUMNS.
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--source mysql_test/test_suite/geometry/t/import_default_srs_data_mysql.inc
|
||||
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists geo;
|
||||
--enable_warnings
|
||||
|
||||
create table geo(id int primary key auto_increment, g1 geometry not null srid 4326);
|
||||
select * from INFORMATION_SCHEMA.ST_GEOMETRY_COLUMNS where TABLE_SCHEMA = 'test' and TABLE_NAME = 'geo' ORDER BY COLUMN_NAME;
|
||||
|
||||
alter table geo add column g2 geometry;
|
||||
select * from INFORMATION_SCHEMA.ST_GEOMETRY_COLUMNS where TABLE_SCHEMA = 'test' and TABLE_NAME = 'geo' ORDER BY COLUMN_NAME;
|
||||
|
||||
alter table geo add column g3 point srid 2000;
|
||||
select * from INFORMATION_SCHEMA.ST_GEOMETRY_COLUMNS where TABLE_SCHEMA = 'test' and TABLE_NAME = 'geo' ORDER BY COLUMN_NAME;
|
||||
|
||||
alter table geo add column g4 linestring srid 3857;
|
||||
select * from INFORMATION_SCHEMA.ST_GEOMETRY_COLUMNS where TABLE_SCHEMA = 'test' and TABLE_NAME = 'geo' ORDER BY COLUMN_NAME;
|
||||
|
||||
alter table geo add column g5 polygon srid 32766;
|
||||
select * from INFORMATION_SCHEMA.ST_GEOMETRY_COLUMNS where TABLE_SCHEMA = 'test' and TABLE_NAME = 'geo' ORDER BY COLUMN_NAME;
|
||||
|
||||
alter table geo add column g6 multipoint srid 32766;
|
||||
select * from INFORMATION_SCHEMA.ST_GEOMETRY_COLUMNS where TABLE_SCHEMA = 'test' and TABLE_NAME = 'geo' ORDER BY COLUMN_NAME;
|
||||
|
||||
alter table geo add column g7 multilinestring srid 3857;
|
||||
select * from INFORMATION_SCHEMA.ST_GEOMETRY_COLUMNS where TABLE_SCHEMA = 'test' and TABLE_NAME = 'geo' ORDER BY COLUMN_NAME;
|
||||
|
||||
alter table geo add column g8 multipolygon srid 2000;
|
||||
select * from INFORMATION_SCHEMA.ST_GEOMETRY_COLUMNS where TABLE_SCHEMA = 'test' and TABLE_NAME = 'geo' ORDER BY COLUMN_NAME;
|
||||
|
||||
alter table geo add column g9 geometrycollection srid 4326;
|
||||
select * from INFORMATION_SCHEMA.ST_GEOMETRY_COLUMNS where TABLE_SCHEMA = 'test' and TABLE_NAME = 'geo' ORDER BY COLUMN_NAME;
|
||||
|
||||
alter table geo drop column g1;
|
||||
select * from INFORMATION_SCHEMA.ST_GEOMETRY_COLUMNS where TABLE_SCHEMA = 'test' and TABLE_NAME = 'geo' ORDER BY COLUMN_NAME;
|
||||
|
||||
alter table geo drop column g2;
|
||||
select * from INFORMATION_SCHEMA.ST_GEOMETRY_COLUMNS where TABLE_SCHEMA = 'test' and TABLE_NAME = 'geo' ORDER BY COLUMN_NAME;
|
||||
|
||||
alter table geo drop column g3;
|
||||
select * from INFORMATION_SCHEMA.ST_GEOMETRY_COLUMNS where TABLE_SCHEMA = 'test' and TABLE_NAME = 'geo' ORDER BY COLUMN_NAME;
|
||||
|
||||
alter table geo drop column g4;
|
||||
select * from INFORMATION_SCHEMA.ST_GEOMETRY_COLUMNS where TABLE_SCHEMA = 'test' and TABLE_NAME = 'geo' ORDER BY COLUMN_NAME;
|
||||
|
||||
alter table geo drop column g5;
|
||||
select * from INFORMATION_SCHEMA.ST_GEOMETRY_COLUMNS where TABLE_SCHEMA = 'test' and TABLE_NAME = 'geo' ORDER BY COLUMN_NAME;
|
||||
|
||||
truncate table geo;
|
||||
select * from INFORMATION_SCHEMA.ST_GEOMETRY_COLUMNS where TABLE_SCHEMA = 'test' and TABLE_NAME = 'geo' ORDER BY COLUMN_NAME;
|
||||
|
||||
drop table geo;
|
||||
select * from INFORMATION_SCHEMA.ST_GEOMETRY_COLUMNS where TABLE_SCHEMA = 'test' and TABLE_NAME = 'geo' ORDER BY COLUMN_NAME;
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,152 @@
|
||||
#owner: ht353245
|
||||
#owner group: shenzhen
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--echo # Test of GEOMETRY st_geomfromwkb
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--source mysql_test/test_suite/geometry/t/import_default_srs_data_mysql.inc
|
||||
|
||||
|
||||
select ST_AsText(st_geomfromwkb(x'010100000000000000000044400000000000004440'));
|
||||
select ST_AsText(st_geomfromwkb(x'01010000000000000000004e400000000000005e40'));
|
||||
select ST_AsText(st_geomfromwkb(x'010100000000000000000044400000000000004440'));
|
||||
select ST_AsText(st_geomfromwkb(x'01010000000000000000004e400000000000004e40'));
|
||||
|
||||
SET @wkb_pt = ST_GeomFromText('POINT(0 1)');
|
||||
SET @wkb_ln = ST_GeomFromText('LINESTRING(0 1,2 3,4 5,6 7,8 9, 10 11)');
|
||||
SET @wkb_py = ST_GeomFromText('POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4))');
|
||||
SET @wkb_mpt = ST_GeomFromText('MULTIPOINT(0 1,2 3,4 5,6 7)');
|
||||
SET @wkb_mln = ST_GeomFromText('MULTILINESTRING((0 1,2 3,4 5),(6 7,8 9,10 11))');
|
||||
SET @wkb_mpy = ST_GeomFromText('MULTIPOLYGON(((0 1,0 10,10 11,10 0,0 1),(4 5,4 6,6 7,6 4,4 5)),'
|
||||
'((10 11,10 12,12 13,12 10,10 11)))');
|
||||
SET @wkb_gc = ST_GeomFromText('GEOMETRYCOLLECTION('
|
||||
'POINT(0 1),'
|
||||
'LINESTRING(0 1,10 11),'
|
||||
'POLYGON((0 0,0 10,10 10,10 0, 0 0)),'
|
||||
'MULTIPOINT(0 1,2 3,4 5,6 7,8 9,10 11),'
|
||||
'MULTILINESTRING((0 1,10 11),(0 10,10 0)),'
|
||||
'MULTIPOLYGON(((0 1,0 5,5 6,5 0,0 1)),((5 4,5 10,10 11,10 5,5 4))))');
|
||||
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_pt)));
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_ln)));
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_py)));
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_mpt)));
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_mln)));
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_mpy)));
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_gc)));
|
||||
|
||||
SELECT ST_AsText(ST_GeometryFromWKB(st_aswkb(@wkb_pt)));
|
||||
SELECT ST_AsText(ST_GeometryFromWKB(st_aswkb(@wkb_ln)));
|
||||
SELECT ST_AsText(ST_GeometryFromWKB(st_aswkb(@wkb_py)));
|
||||
SELECT ST_AsText(ST_GeometryFromWKB(st_aswkb(@wkb_mpt)));
|
||||
SELECT ST_AsText(ST_GeometryFromWKB(st_aswkb(@wkb_mln)));
|
||||
SELECT ST_AsText(ST_GeometryFromWKB(st_aswkb(@wkb_mpy)));
|
||||
SELECT ST_AsText(ST_GeometryFromWKB(st_aswkb(@wkb_gc)));
|
||||
|
||||
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_pt), 2000));
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_ln), 2000));
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_py), 2000));
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_mpt), 2000));
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_mln), 2000));
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_mpy), 2000));
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_gc), 2000));
|
||||
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_pt), 2000, 'axis-order=long-lat'));
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_ln), 2000, 'axis-order=long-lat'));
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_py), 2000, 'axis-order=long-lat'));
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_mpt), 2000, 'axis-order=long-lat'));
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_mln), 2000, 'axis-order=long-lat'));
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_mpy), 2000, 'axis-order=long-lat'));
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_gc), 2000, 'axis-order=long-lat'));
|
||||
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_pt), 4326));
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_ln), 4326));
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_py), 4326));
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_mpt), 4326));
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_mln), 4326));
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_mpy), 4326));
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_gc), 4326));
|
||||
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_pt), 4326, 'axis-order=long-lat'));
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_ln), 4326, 'axis-order=long-lat'));
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_py), 4326, 'axis-order=long-lat'));
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_mpt), 4326, 'axis-order=long-lat'));
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_mln), 4326, 'axis-order=long-lat'));
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_mpy), 4326, 'axis-order=long-lat'));
|
||||
SELECT ST_AsText(ST_GeomFromWKB(st_aswkb(@wkb_gc), 4326, 'axis-order=long-lat'));
|
||||
|
||||
|
||||
--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
||||
SELECT ST_GeomFromWKB();
|
||||
|
||||
SELECT ST_GeomFromWKB(NULL);
|
||||
|
||||
--error ER_GIS_INVALID_DATA
|
||||
SELECT ST_GeomFromWKB(ST_GeomFromText('POINT()'));
|
||||
|
||||
--error ER_GIS_INVALID_DATA
|
||||
SELECT ST_GeomFromWKB(ST_GeomFromText('LINESTRING(0 0,! 10)'));
|
||||
|
||||
--error ER_GIS_INVALID_DATA
|
||||
select ST_GeometryFromWKB(x'010100000000000000000034C00000000000002E4000000000000034400000000000003440');
|
||||
--error ER_GIS_INVALID_DATA
|
||||
select ST_GeomFromWKB(x'010100000000000000000034C00000000000002E4000000000000034400000000000003440');
|
||||
--error ER_GIS_INVALID_DATA
|
||||
select ST_GeometryFromWKB(x'0101000000');
|
||||
--error ER_GIS_INVALID_DATA
|
||||
select ST_GeomFromWKB(x'01020000000200000000000000000059400000000000005e400000000000005940');
|
||||
|
||||
--error 3617
|
||||
select st_geomfromwkb(x'01020000000200000000000000000059400000000000005e4000000000000059400000000000006e40',4326);
|
||||
--error 3616
|
||||
select st_geomfromwkb(x'010100000000000000008046400000000000006940',4326);
|
||||
|
||||
# Wrong byte order at wkb header.
|
||||
--error ER_GIS_INVALID_DATA
|
||||
SELECT ST_GeomFromWKB(0x020100000000000000000000000000000000000000);
|
||||
# Wrong component type: a multipoint having a linestring component.
|
||||
--error ER_GIS_INVALID_DATA
|
||||
SELECT ST_GeomFromWKB(0x01040000000100000001020000000100000000000000000000000000000000000000);
|
||||
# Wrong byte order at 1st component's wkb header.
|
||||
--error ER_GIS_INVALID_DATA
|
||||
SELECT ST_GeomFromWKB(0x01040000000100000002020000000100000000000000000000000000000000000000);
|
||||
|
||||
# Wrong component type: a multilinestring having a multipoint component.
|
||||
--error ER_GIS_INVALID_DATA
|
||||
SELECT ST_GeomFromWKB(0x01050000000100000001040000000100000000000000000000000000000000000000);
|
||||
# Wrong byte order at 1st component's wkb header.
|
||||
--error ER_GIS_INVALID_DATA
|
||||
SELECT ST_GeomFromWKB(0x01050000000100000002040000000100000000000000000000000000000000000000);
|
||||
# Wrong component type: a multipolygon having a linestring component.
|
||||
--error ER_GIS_INVALID_DATA
|
||||
SELECT ST_GeomFromWKB(0x01060000000100000001020000000100000000000000000000000000000000000000);
|
||||
|
||||
# Wrong byte order at 1st component's wkb header.
|
||||
--error ER_GIS_INVALID_DATA
|
||||
SELECT ST_GeomFromWKB(0x01060000000100000003020000000100000000000000000000000000000000000000);
|
||||
# Wrong byte order at 1st component's wkb header.
|
||||
--error ER_GIS_INVALID_DATA
|
||||
SELECT ST_GeomFromWKB(0x01070000000100000002010000000000000000000000);
|
||||
# invalid polygon
|
||||
--error ER_GIS_INVALID_DATA
|
||||
select ST_GeomFromWKB(x'010300000001000000050000000000000000C056C000000000004054400000000000C0564000000000008056C000000000000054C000000000000034C000000000000000000000000000C056400000000000C056C00000000000405490');
|
||||
|
||||
select ST_AsText(ST_GeometryFromWKB(x'010100000000000000000034C00000000000002E40',26918,'axis-order=lat-long'));
|
||||
select ST_AsText(ST_GeomFromWKB(x'010100000000000000000034C00000000000002E40',26918,'axis-order=lat-long'));
|
||||
|
||||
--error 3559
|
||||
select ST_GeometryFromWKB(x'010100000000000000000034C00000000000002E40',4326,'axis-order=long-long');
|
||||
--error 3559
|
||||
select ST_GeomFromWKB(x'010100000000000000000034C00000000000002E40',4326,'axis-order=lat-lat');
|
||||
--error 3560
|
||||
select ST_GeomFromWKB(x'010100000000000000000034C00000000000002E40',4326,'axis-ord');
|
||||
--error 3560
|
||||
select ST_GeometryFromWKB(x'010100000000000000000034C00000000000002E40',4326,'axis-ord');
|
||||
--error 3560
|
||||
select ST_GeomFromWKB(x'010100000000000000000034C00000000000002E40',4326,11);
|
||||
--error 3560
|
||||
select ST_GeometryFromWKB(x'010100000000000000000034C00000000000002E40',4326,11);
|
||||
--error 3558
|
||||
select ST_GeometryFromWKB(x'010100000000000000000034C00000000000002E40','axis-order=long-lat','srid=4326');
|
||||
--error 3558
|
||||
select ST_GeomFromWKB(x'010100000000000000000034C00000000000002E40','axis-order=long-lat','srid=4326');
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,319 @@
|
||||
#owner: ht353245
|
||||
#owner group: shenzhen
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--echo # Test of GEOMETRY ST_Intersects (cases from postgis).
|
||||
--echo # ----------------------------------------------------------------------
|
||||
#fix srs only support sys tenant currently
|
||||
#connect (conn_admin, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
--source mysql_test/test_suite/geometry/t/import_default_srs_data_mysql.inc
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists gis_geometrycollection, gis_geometrycollection_2, tbl_polygon;
|
||||
--enable_warnings
|
||||
|
||||
SELECT ST_INTERSECTS(st_geomfromtext('LINESTRING(0 10, 0 -10)'), st_geomfromtext('LINESTRING(0 0, 1 1)'));
|
||||
|
||||
SELECT ST_INTERSECTS(st_geomfromtext('POINT(5 5)'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'));
|
||||
SELECT ST_INTERSECTS(st_geomfromtext('POINT(0 0)'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'));
|
||||
SELECT ST_INTERSECTS(st_geomfromtext('POINT(-1 0)'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'));
|
||||
SELECT ST_INTERSECTS(st_geomfromtext('POINT(0 5)'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'));
|
||||
SELECT ST_INTERSECTS(st_geomfromtext('POINT(0 12)'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'));
|
||||
|
||||
SELECT ST_INTERSECTS(st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), st_geomfromtext('POINT(5 5)'));
|
||||
SELECT ST_INTERSECTS(st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), st_geomfromtext('POINT(5 5)'));
|
||||
SELECT ST_INTERSECTS(st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), st_geomfromtext('POINT(0 0)'));
|
||||
SELECT ST_INTERSECTS(st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), st_geomfromtext('POINT(-1 0)'));
|
||||
SELECT ST_INTERSECTS(st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), st_geomfromtext('POINT(0 5)'));
|
||||
SELECT ST_INTERSECTS(st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), st_geomfromtext('POINT(0 12)'));
|
||||
|
||||
# different order repeat test
|
||||
--echo # intersects105
|
||||
SELECT ST_INTERSECTS(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631), ST_GeomFromText('POINT(521513 5377804)', 32631));
|
||||
SELECT ST_INTERSECTS(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631), ST_GeomFromText('POINT(521513 5377804)', 32631));
|
||||
SELECT ST_INTERSECTS(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631), ST_GeomFromText('POINT(521513 5377804)', 32631));
|
||||
|
||||
--echo # intersects106
|
||||
SELECT ST_INTERSECTS(ST_GeomFromText('POINT(521513 5377804)', 32631), ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631));
|
||||
SELECT ST_INTERSECTS(ST_GeomFromText('POINT(521513 5377804)', 32631), ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631));
|
||||
SELECT ST_INTERSECTS(ST_GeomFromText('POINT(521513 5377804)', 32631), ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631));
|
||||
|
||||
--echo # intersects107
|
||||
SELECT ST_INTERSECTS(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631), ST_GeomFromText('POINT(521513 5377804)', 32631));
|
||||
SELECT ST_INTERSECTS(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631), ST_GeomFromText('POINT(521513 5377804)', 32631));
|
||||
SELECT ST_INTERSECTS(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631), ST_GeomFromText('POINT(521513 5377804)', 32631));
|
||||
|
||||
--echo # intersects108
|
||||
SELECT ST_INTERSECTS(ST_GeomFromText('POINT(521513 5377804)', 32631), ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631));
|
||||
SELECT ST_INTERSECTS(ST_GeomFromText('POINT(521513 5377804)', 32631), ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631));
|
||||
SELECT ST_INTERSECTS(ST_GeomFromText('POINT(521513 5377804)', 32631), ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631));
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1, t2;
|
||||
--enable_warnings
|
||||
|
||||
--echo # intersects20x types100 types114
|
||||
create table t1 (p1 geometry, p2 geometry);
|
||||
insert into t1(p1, p2) values
|
||||
(ST_GeomFromText('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), ST_GeomFromText('POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))')),
|
||||
(ST_GeomFromText('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), ST_GeomFromText('POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))')),
|
||||
(ST_GeomFromText('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), ST_GeomFromText('POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))')),
|
||||
(ST_GeomFromText('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), ST_GeomFromText('POLYGON((-5 -5, 5 -5, 5 5, -5 5, -5 -5))')),
|
||||
(ST_GeomFromText('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), ST_GeomFromText('POLYGON((-2 -2, -2 -3, -3 -3, -3 -2, -2 -2))')),
|
||||
(ST_GeomFromText('POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))'), ST_GeomFromText('POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))')),
|
||||
(ST_GeomFromText('POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))'), ST_GeomFromText('POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))')),
|
||||
(ST_GeomFromText('POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))'), ST_GeomFromText('POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))')),
|
||||
(ST_GeomFromText('POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))'), ST_GeomFromText('POLYGON((-5 -5, 5 -5, 5 5, -5 5, -5 -5))')),
|
||||
(ST_GeomFromText('POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))'), ST_GeomFromText('POLYGON((-2 -2, -2 -3, -3 -3, -3 -2, -2 -2))')),
|
||||
(ST_GeomFromText('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), ST_GeomFromText('POINT(5 5)')),
|
||||
(ST_GeomFromText('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), ST_GeomFromText('POINT(5 5)')),
|
||||
(ST_GeomFromText('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), ST_GeomFromText('POINT(5 5)')),
|
||||
(ST_GeomFromText('LINESTRING(0 0, 0 10, 10 10, 10 0)'), ST_GeomFromText('POINT(5 5)')),
|
||||
(ST_GeomFromText('LINESTRING(0 0, 0 10, 10 10, 10 0)'), ST_GeomFromText('POINT(5 5)')),
|
||||
(ST_GeomFromText('LINESTRING(0 0, 0 10, 10 10, 10 0)'), ST_GeomFromText('POINT(5 5)')),
|
||||
(ST_GeomFromText('POINT(5 5)'), ST_GeomFromText('POINT(5 5)')),
|
||||
(ST_GeomFromText('POINT(5 5)'), ST_GeomFromText('POINT(5 5)')),
|
||||
(ST_GeomFromText('POINT(5 5)'), ST_GeomFromText('POINT(5 5)')),
|
||||
(ST_GeomFromText('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), ST_GeomFromText('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))')),
|
||||
(ST_GeomFromText('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), ST_GeomFromText('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))')),
|
||||
(ST_GeomFromText('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), ST_GeomFromText('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))')),
|
||||
(ST_GeomFromText('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), ST_GeomFromText('LINESTRING(0 0, 0 10, 10 10, 10 0)')),
|
||||
(ST_GeomFromText('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), ST_GeomFromText('LINESTRING(0 0, 0 10, 10 10, 10 0)')),
|
||||
(ST_GeomFromText('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), ST_GeomFromText('LINESTRING(0 0, 0 10, 10 10, 10 0)'));
|
||||
|
||||
select ST_Intersects(p1, p2) AS intersects_p1p2, ST_Intersects(p2, p1) AS intersects_p2p1 from t1;
|
||||
|
||||
drop table t1;
|
||||
|
||||
--echo # intersects310
|
||||
SELECT ST_INTERSECTS(st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), st_geomfromtext('LINESTRING(1 10, 9 10, 9 8)'));
|
||||
SELECT ST_INTERSECTS(st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), st_geomfromtext('LINESTRING(1 10, 9 10, 9 8)'));
|
||||
SELECT ST_INTERSECTS(st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), st_geomfromtext('LINESTRING(1 10, 9 10, 9 8)'));
|
||||
|
||||
--echo # intersects311
|
||||
SELECT ST_INTERSECTS(st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), st_geomfromtext('LINESTRING(1 10, 10 10, 10 8)'));
|
||||
SELECT ST_INTERSECTS(st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), st_geomfromtext('LINESTRING(1 10, 10 10, 10 8)'));
|
||||
SELECT ST_INTERSECTS(st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), st_geomfromtext('LINESTRING(1 10, 10 10, 10 8)'));
|
||||
|
||||
|
||||
--echo # multipoint on polygon vertex
|
||||
SELECT 'intersects111', ST_Intersects(st_geomfromtext('MULTIPOINT ((0 0))'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'));
|
||||
--echo # multipoint outside polygon
|
||||
SELECT 'intersects112', ST_intersects(st_geomfromtext('MULTIPOINT ((-1 0))'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'));
|
||||
--echo # multipoint on polygon edge
|
||||
SELECT 'intersects113', ST_intersects(st_geomfromtext('MULTIPOINT ((0 5))'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'));
|
||||
SELECT 'intersects114', ST_intersects(st_geomfromtext('MULTIPOINT ((0 5), (0 8))'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'));
|
||||
--echo # multipoint in line with polygon edge
|
||||
SELECT 'intersects115', ST_intersects(st_geomfromtext('MULTIPOINT ((0 12))'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'));
|
||||
--echo # multipoint vertically aligned with polygon vertex
|
||||
SELECT 'intersects116', ST_intersects(ST_GeomFromText('MULTIPOINT ((521513 5377804))', 32631), ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631));
|
||||
--echo # repeated vertex
|
||||
SELECT 'intersects117', ST_intersects(ST_GeomFromText('MULTIPOINT ((521543 5377804))', 32631), ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631));
|
||||
--echo # multipoint within polygon
|
||||
SELECT 'intersects118', ST_intersects(st_geomfromtext('MULTIPOINT ((5 5))'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'));
|
||||
SELECT 'intersects119', ST_intersects(st_geomfromtext('MULTIPOINT ((5 5), (7 7))'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'));
|
||||
--echo # multipoint partially within polygon
|
||||
SELECT 'intersects120', ST_intersects(st_geomfromtext('MULTIPOINT ((5 5), (15 5))'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'));
|
||||
SELECT 'intersects121', ST_intersects(st_geomfromtext('MULTIPOINT ((15 5), (5 5))'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'));
|
||||
--echo # point within polygon
|
||||
SELECT 'intersects150', ST_intersects(st_geomfromtext('POINT(5 5)'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'));
|
||||
--echo # point on polygon vertex
|
||||
SELECT 'intersects151', ST_intersects(st_geomfromtext('POINT(0 0)'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'));
|
||||
--echo # point outside polygon
|
||||
SELECT 'intersects152', ST_intersects(st_geomfromtext('POINT(-1 0)'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'));
|
||||
--echo # point on polygon edge
|
||||
SELECT 'intersects153', ST_intersects(st_geomfromtext('POINT(0 5)'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'));
|
||||
--echo # point in line with polygon edge
|
||||
SELECT 'intersects154', ST_intersects(st_geomfromtext('POINT(0 12)'), st_geomfromtext('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'));
|
||||
|
||||
select 'intersects', ST_intersects(
|
||||
st_geomfromtext('POLYGON((0.0 0.0,1.0 0.0,1.0 1.0,1.0 0.0,0.0 0.0))'),
|
||||
st_geomfromtext('POLYGON((0.0 2.0,1.0 2.0,1.0 3.0,0.0 3.0,0.0 2.0))'));
|
||||
select 'intersects', ST_intersects(
|
||||
st_geomfromtext('POLYGON((0.0 0.0,1.0 0.0,1.0 1.0,1.0 0.0,0.0 0.0))', 4326),
|
||||
st_geomfromtext('POLYGON((0.0 2.0,1.0 2.0,1.0 3.0,0.0 3.0,0.0 2.0))', 4326));
|
||||
select 'intersects', ST_intersects(
|
||||
st_geomfromtext('POLYGON((0.0 0.0,1.0 0.0,1.0 1.0,1.0 0.0,0.0 0.0))', 32631),
|
||||
st_geomfromtext('POLYGON((0.0 2.0,1.0 2.0,1.0 3.0,0.0 3.0,0.0 2.0))', 32631));
|
||||
--error 3033
|
||||
select 'intersects', ST_intersects(
|
||||
st_geomfromtext('POLYGON((0.0 0.0,1.0 0.0,1.0 1.0,1.0 0.0,0.0 0.0))', 4326),
|
||||
st_geomfromtext('POLYGON((0.0 2.0,1.0 2.0,1.0 3.0,0.0 3.0,0.0 2.0))', 32631));
|
||||
|
||||
SELECT '#845', ST_Intersects(st_geomfromtext('POINT(169.69960846592 -46.5061209281002)'), st_geomfromtext('POLYGON((169.699607857174 -46.5061218662,169.699607857174 -46.5061195965597,169.699608806526 -46.5061195965597,169.699608806526 -46.5061218662,169.699607857174 -46.5061218662))'));
|
||||
|
||||
CREATE TABLE t2 (id int, g geometry);
|
||||
insert into t2(id, g) values
|
||||
(1, st_geomfromtext('POINT(0.5 0.5000000000001)')),
|
||||
(2, st_geomfromtext('POINT(0.5 0.5000000000001)'));
|
||||
select id,st_astext(g) from t2;
|
||||
|
||||
select '#852.1', id,
|
||||
st_intersects(g, st_geomfromtext('POLYGON((0 0, 10 10, 1 0, 0 0))')),
|
||||
st_intersects(g, st_geomfromtext('POLYGON((0 0, 1 1, 1 0, 0 0))')) from t2;
|
||||
UPDATE t2 SET g = st_geomfromtext('POINT(0.5 0.5)');
|
||||
|
||||
select id,st_astext(g) from t2;
|
||||
|
||||
drop table t2;
|
||||
|
||||
SELECT '#4176', ST_Intersects(st_geomfromtext('POLYGON((0 0, 10 10, 3 5, 0 0))'), st_geomfromtext('GEOMETRYCOLLECTION(POINT(10 10), LINESTRING(0 0, 3 3))'));
|
||||
|
||||
# from cockroachdb
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists geo_table, geo_table2, geo_table3, geo_table4, ltable, rtable, rtable2;
|
||||
--enable_warnings
|
||||
|
||||
create table geo_table( k int primary key, geom geometry not null);
|
||||
create index geom_index on geo_table(geom);
|
||||
|
||||
INSERT INTO geo_table VALUES
|
||||
(1, ST_GeomFromText('POINT(1.0 1.0)')),
|
||||
(2, ST_GeomFromText('LINESTRING(1.0 1.0, 2.0 2.0)')),
|
||||
(3, ST_GeomFromText('POINT(3.0 3.0)')),
|
||||
(4, ST_GeomFromText('LINESTRING(4.0 4.0, 5.0 5.0)')),
|
||||
(5, ST_GeomFromText('LINESTRING(40.0 40.0, 41.0 41.0)')),
|
||||
(6, ST_GeomFromText('POLYGON((1.0 1.0, 5.0 1.0, 5.0 5.0, 1.0 5.0, 1.0 1.0))'));
|
||||
|
||||
SELECT k FROM geo_table WHERE ST_Intersects(ST_GeomFromText('POINT(3.0 3.0)'), geom) ORDER BY k;
|
||||
|
||||
SELECT k FROM geo_table WHERE ST_Intersects(ST_GeomFromText('POINT(4.5 4.5)'), geom) ORDER BY k;
|
||||
|
||||
SELECT k FROM geo_table WHERE ST_Intersects(ST_GeomFromText('POINT(2.5 2.5)'), geom) ORDER BY k;
|
||||
|
||||
CREATE TABLE geo_table2(k int, geom geometry not null, k_plus_one int, PRIMARY KEY (k, k_plus_one));
|
||||
create index geom_index2 on geo_table2(geom);
|
||||
|
||||
INSERT INTO geo_table2 VALUES
|
||||
(1, ST_GeomFromText('LINESTRING(1.0 1.0, 2.0 2.0)'), 2),
|
||||
(2, ST_GeomFromText('POLYGON((1.0 1.0, 5.0 1.0, 5.0 5.0, 1.0 5.0, 1.0 1.0))'), 3);
|
||||
|
||||
SELECT k FROM geo_table2 WHERE ST_Intersects(ST_GeomFromText('POINT(3.0 3.0)'), geom);
|
||||
|
||||
SELECT k, k_plus_one FROM geo_table2 WHERE ST_Intersects(ST_GeomFromText('POINT(3.0 3.0)'), geom);
|
||||
|
||||
SELECT k, k_plus_one, st_astext(geom) FROM geo_table2 WHERE ST_Intersects(ST_GeomFromText('POINT(3.0 3.0)'), geom);
|
||||
|
||||
create table geo_table3( k int primary key, geom geometry not null);
|
||||
create index geom_index3 on geo_table3(geom);
|
||||
|
||||
INSERT INTO geo_table3 VALUES
|
||||
(1, ST_GeomFromText('POINT(1 1)')),
|
||||
(2, ST_GeomFromText('LINESTRING(1 1, 2 2)')),
|
||||
(3, ST_GeomFromText('POINT(3 3)')),
|
||||
(4, ST_GeomFromText('LINESTRING(4 4, 5 5)')),
|
||||
(5, ST_GeomFromText('LINESTRING(40 40, 41 41)')),
|
||||
(6, ST_GeomFromText('POLYGON((1 1, 5 1, 5 5, 1 5, 1 1))')),
|
||||
(7, ST_GeomFromText('LINESTRING(1 1, 3 3)'));
|
||||
|
||||
SELECT k FROM geo_table3 WHERE ST_Intersects(ST_GeomFromText('MULTIPOINT((2.2 2.2), (3.0 3.0))'), geom) ORDER BY k;
|
||||
|
||||
# SRID of the geometry column is unspecified, so default index bounds are used.
|
||||
create table geo_table4( k int primary key, geom geometry not null);
|
||||
create index geom_index4 on geo_table4(geom);
|
||||
|
||||
INSERT INTO geo_table4 VALUES
|
||||
(1, ST_GeomFromText('POINT(400001 4000001)')),
|
||||
(2, ST_GeomFromText('LINESTRING(400001 4000001, 400002 4000002)')),
|
||||
(3, ST_GeomFromText('POINT(400003 4000003)')),
|
||||
(4, ST_GeomFromText('LINESTRING(400004 4000004, 400005 4000005)')),
|
||||
(5, ST_GeomFromText('LINESTRING(400040 4000040, 400041 4000041)')),
|
||||
(6, ST_GeomFromText('POLYGON((400001 4000001, 400005 4000001, 400005 4000005, 400001 4000005, 400001 4000001))'));
|
||||
|
||||
SELECT k FROM geo_table4 WHERE ST_Intersects(ST_GeomFromText('POINT(400003 4000003)'), geom) ORDER BY k;
|
||||
|
||||
DROP TABLE geo_table4;
|
||||
|
||||
# test again
|
||||
create table geo_table4( k int primary key, geom geometry not null);
|
||||
create index geom_index4 on geo_table4(geom);
|
||||
|
||||
INSERT INTO geo_table4 VALUES
|
||||
(1, ST_GeomFromText('POINT(400001 4000001)')),
|
||||
(2, ST_GeomFromText('LINESTRING(400001 4000001, 400002 4000002)')),
|
||||
(3, ST_GeomFromText('POINT(400003 4000003)')),
|
||||
(4, ST_GeomFromText('LINESTRING(400004 4000004, 400005 4000005)')),
|
||||
(5, ST_GeomFromText('LINESTRING(400040 4000040, 400041 4000041)')),
|
||||
(6, ST_GeomFromText('POLYGON((400001 4000001, 400005 4000001, 400005 4000005, 400001 4000005, 400001 4000001))'));
|
||||
|
||||
SELECT k FROM geo_table4 WHERE ST_Intersects(ST_GeomFromText('POINT(400003 4000003)'), geom) ORDER BY k;
|
||||
|
||||
# join test
|
||||
create table ltable( lk int primary key, geom1 geometry, geom2 geometry);
|
||||
|
||||
INSERT INTO ltable VALUES
|
||||
(1, ST_GeomFromText('POINT(3.0 3.0)'), ST_GeomFromText('POINT(3.0 3.0)')),
|
||||
(2, ST_GeomFromText('POINT(4.5 4.5)'), ST_GeomFromText('POINT(3.0 3.0)')),
|
||||
(3, ST_GeomFromText('POINT(1.5 1.5)'), ST_GeomFromText('POINT(3.0 3.0)')),
|
||||
(4, NULL, ST_GeomFromText('POINT(3.0 3.0)')),
|
||||
(5, ST_GeomFromText('POINT(1.5 1.5)'), NULL),
|
||||
(6, NULL, NULL);
|
||||
|
||||
create table rtable( rk int primary key, i int, geom geometry not null);
|
||||
create index igeom_idx on rtable(geom);
|
||||
|
||||
INSERT INTO rtable VALUES
|
||||
(11, 10, ST_GeomFromText('POINT(1.0 1.0)')),
|
||||
(12, 10, ST_GeomFromText('LINESTRING(1.0 1.0, 2.0 2.0)')),
|
||||
(13, 10, ST_GeomFromText('POINT(3.0 3.0)')),
|
||||
(14, 10, ST_GeomFromText('LINESTRING(4.0 4.0, 5.0 5.0)')),
|
||||
(15, 10, ST_GeomFromText('LINESTRING(40.0 40.0, 41.0 41.0)')),
|
||||
(16, 10, ST_GeomFromText('POLYGON((1.0 1.0, 5.0 1.0, 5.0 5.0, 1.0 5.0, 1.0 1.0))')),
|
||||
(17, 20, ST_GeomFromText('POINT(1.0 1.0)')),
|
||||
(18, 20, ST_GeomFromText('LINESTRING(1.0 1.0, 2.0 2.0)')),
|
||||
(19, 20, ST_GeomFromText('POINT(3.0 3.0)')),
|
||||
(20, 20, ST_GeomFromText('LINESTRING(4.0 4.0, 5.0 5.0)')),
|
||||
(21, 20, ST_GeomFromText('LINESTRING(40.0 40.0, 41.0 41.0)')),
|
||||
(22, 20, ST_GeomFromText('POLYGON((1.0 1.0, 5.0 1.0, 5.0 5.0, 1.0 5.0, 1.0 1.0))'));
|
||||
|
||||
# not supported by mysql
|
||||
#SELECT lk, rk FROM ltable
|
||||
#JOIN rtable
|
||||
# ON rtable.i = 10 AND ST_Intersects(ltable.geom1, rtable.geom)
|
||||
#ORDER BY (lk, rk);
|
||||
|
||||
create table rtable2( rk int primary key, geom geometry not null);
|
||||
create index igeom_idx2 on rtable2(geom);
|
||||
|
||||
INSERT INTO rtable2 VALUES
|
||||
(11, ST_GeomFromText('POINT(1.0 1.0)')),
|
||||
(12, ST_GeomFromText('LINESTRING(1.0 1.0, 2.0 2.0)')),
|
||||
(13, ST_GeomFromText('POINT(3.0 3.0)')),
|
||||
(14, ST_GeomFromText('LINESTRING(4.0 4.0, 5.0 5.0)')),
|
||||
(15, ST_GeomFromText('LINESTRING(40.0 40.0, 41.0 41.0)')),
|
||||
(16, ST_GeomFromText('POLYGON((1.0 1.0, 5.0 1.0, 5.0 5.0, 1.0 5.0, 1.0 1.0))'));
|
||||
|
||||
# not supported by mysql
|
||||
#SELECT lk, rk FROM ltable JOIN rtable2 ON ST_Intersects(ltable.geom1, rtable2.geom) ORDER BY (lk, rk);
|
||||
|
||||
# These queries perform semi-joins
|
||||
SELECT lk FROM ltable WHERE EXISTS (SELECT * FROM rtable2 WHERE ST_Intersects(ltable.geom2, rtable2.geom));
|
||||
|
||||
SELECT rk FROM rtable2 WHERE EXISTS (SELECT * FROM ltable WHERE ST_Intersects(ltable.geom2, rtable2.geom))
|
||||
ORDER BY rk;
|
||||
|
||||
# not supported by mysql
|
||||
# Left join
|
||||
#SELECT lk, rk FROM ltable LEFT JOIN rtable2 ON ST_Intersects(ltable.geom1, rtable2.geom) ORDER BY (lk, rk);
|
||||
|
||||
#not supported by mysql
|
||||
#WITH q AS (
|
||||
# SELECT * FROM ltable WHERE lk > 2
|
||||
#)
|
||||
#SELECT lk, count(*), (SELECT count(*) FROM q) FROM (
|
||||
# SELECT lk, rk
|
||||
# FROM q
|
||||
# LEFT JOIN rtable2 ON ST_Intersects(q.geom1, rtable2.geom)
|
||||
#) GROUP BY lk ORDER BY lk;
|
||||
|
||||
# Anti-join
|
||||
SELECT lk FROM ltable WHERE NOT EXISTS (SELECT * FROM rtable2 WHERE ST_Intersects(ltable.geom2, rtable2.geom))
|
||||
ORDER BY lk;
|
||||
|
||||
SELECT rk FROM rtable2 WHERE NOT EXISTS (SELECT * FROM ltable WHERE ST_Intersects(ltable.geom2, rtable2.geom))
|
||||
ORDER BY rk;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists geo_table, geo_table2, geo_table3, geo_table4, ltable, rtable, rtable2;
|
||||
--enable_warnings
|
||||
|
||||
@ -0,0 +1,98 @@
|
||||
#owner: ht353245
|
||||
#owner group: shenzhen
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--echo # Test of GEOMETRY ST_Latitude
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--source mysql_test/test_suite/geometry/t/import_default_srs_data_mysql.inc
|
||||
|
||||
|
||||
--echo # NULL as one of the parameters must result in NULL return value.
|
||||
SELECT ST_LATITUDE(NULL);
|
||||
SELECT ST_LATITUDE(NULL, NULL);
|
||||
SELECT ST_LATITUDE(NULL, 1);
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 4326), NULL);
|
||||
|
||||
--echo # Invalid data is not allowed.
|
||||
--echo #todo@dazhi
|
||||
#--error 3064
|
||||
#SELECT ST_LATITUDE(x'000000000123456789abcdef');
|
||||
#--error 3064
|
||||
#SELECT ST_LATITUDE(x'000000000123456789abcdef', 1);
|
||||
|
||||
--echo # New value must be within the allowed range.
|
||||
--error 3617
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 4326), -90.000000001);
|
||||
--error 3617
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 4326), 90.000000001);
|
||||
|
||||
--echo # First parameter must be a point.
|
||||
--echo # Cartesian SRID 0
|
||||
--error 3516
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('LINESTRING(0 0, 1 1)', 0));
|
||||
--error 3516
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('POLYGON((0 0, 0 1, 1 1, 0 0))', 0));
|
||||
--error 3516
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('MULTIPOINT((0 0))', 0));
|
||||
--error 3516
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('MULTIPOINT((0 0), (1 1))', 0));
|
||||
--error 3516
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('MULTILINESTRING((0 0, 1 1))', 0));
|
||||
--error 3516
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0, 0 1, 1 1, 0 0)))', 0));
|
||||
--error 3516
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(0 0))', 0));
|
||||
--echo # Projected
|
||||
--error 3516
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('LINESTRING(0 0, 1 1)', 3857));
|
||||
--error 3516
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('POLYGON((0 0, 0 1, 1 1, 0 0))', 3857));
|
||||
--error 3516
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('MULTIPOINT((0 0))', 3857));
|
||||
--error 3516
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('MULTIPOINT((0 0), (1 1))', 3857));
|
||||
--error 3516
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('MULTILINESTRING((0 0, 1 1))', 3857));
|
||||
--error 3516
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0, 0 1, 1 1, 0 0)))', 3857));
|
||||
--error 3516
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(0 0))', 3857));
|
||||
--echo # Geographic
|
||||
--error 3516
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('LINESTRING(0 0, 1 1)', 4326));
|
||||
--error 3516
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('POLYGON((0 0, 0 1, 1 1, 0 0))', 4326));
|
||||
--error 3516
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('MULTIPOINT((0 0))', 4326));
|
||||
--error 3516
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('MULTIPOINT((0 0), (1 1))', 4326));
|
||||
--error 3516
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('MULTILINESTRING((0 0, 1 1))', 4326));
|
||||
--error 3516
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0, 0 1, 1 1, 0 0)))', 4326));
|
||||
--error 3516
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(0 0))', 4326));
|
||||
|
||||
--echo # Point must be geographic.
|
||||
--error 3726
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 0));
|
||||
--error 3726
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 3857));
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 4326));
|
||||
--error 3726
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 0), 1);
|
||||
--error 3726
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 3857), 1);
|
||||
SELECT ST_ASTEXT(ST_LATITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 4326), 1));
|
||||
|
||||
--echo # Get or set the latitude of a point in a lat-long SRS.
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('POINT(1 0)', 4326));
|
||||
SELECT ST_ASTEXT(ST_LATITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 4326), 1));
|
||||
|
||||
--echo # Get or set the latitude of a point in a long-lat SRS.
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('POINT(0 1)', 7035));
|
||||
SELECT ST_ASTEXT(ST_LATITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 7035), 1));
|
||||
|
||||
--echo # Get or set the latitude of a point in a lat-long SRS with a meridian
|
||||
--echo # that doesn't go through Greenwich.
|
||||
SELECT ST_LATITUDE(ST_GEOMFROMTEXT('POINT(1 0)', 4801));
|
||||
SELECT ST_ASTEXT(ST_LATITUDE(ST_GEOMFROMTEXT('POINT(1 0)', 4801), 1));
|
||||
@ -0,0 +1,98 @@
|
||||
#owner: ht353245
|
||||
#owner group: shenzhen
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--echo # Test of GEOMETRY ST_Longitude
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--source mysql_test/test_suite/geometry/t/import_default_srs_data_mysql.inc
|
||||
|
||||
|
||||
--echo # NULL as one of the parameters must result in NULL return value.
|
||||
SELECT ST_LONGITUDE(NULL);
|
||||
SELECT ST_LONGITUDE(NULL, NULL);
|
||||
SELECT ST_LONGITUDE(NULL, 1);
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 4326), NULL);
|
||||
|
||||
--echo # Invalid data is not allowed. todo@dazhi
|
||||
#--error 3064
|
||||
#SELECT ST_LONGITUDE(x'000000000123456789abcdef');
|
||||
#--error 3064
|
||||
#SELECT ST_LONGITUDE(x'000000000123456789abcdef', 1);
|
||||
|
||||
--echo # New value must be within the allowed range.
|
||||
--error 3616
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 4326), -180.000000001);
|
||||
--error 3616
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 4326), 180.000000001);
|
||||
|
||||
--echo # First parameter must be a point.
|
||||
--echo # Cartesian SRID 0
|
||||
--error 3516
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('LINESTRING(0 0, 1 1)', 0));
|
||||
--error 3516
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('POLYGON((0 0, 0 1, 1 1, 0 0))', 0));
|
||||
--error 3516
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('MULTIPOINT((0 0))', 0));
|
||||
--error 3516
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('MULTIPOINT((0 0), (1 1))', 0));
|
||||
--error 3516
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('MULTILINESTRING((0 0, 1 1))', 0));
|
||||
--error 3516
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0, 0 1, 1 1, 0 0)))', 0));
|
||||
--error 3516
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(0 0))', 0));
|
||||
--echo # Projected
|
||||
--error 3516
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('LINESTRING(0 0, 1 1)', 3857));
|
||||
--error 3516
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('POLYGON((0 0, 0 1, 1 1, 0 0))', 3857));
|
||||
--error 3516
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('MULTIPOINT((0 0))', 3857));
|
||||
--error 3516
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('MULTIPOINT((0 0), (1 1))', 3857));
|
||||
--error 3516
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('MULTILINESTRING((0 0, 1 1))', 3857));
|
||||
--error 3516
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0, 0 1, 1 1, 0 0)))', 3857));
|
||||
--error 3516
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(0 0))', 3857));
|
||||
--echo # Geographic
|
||||
--error 3516
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('LINESTRING(0 0, 1 1)', 4326));
|
||||
--error 3516
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('POLYGON((0 0, 0 1, 1 1, 0 0))', 4326));
|
||||
--error 3516
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('MULTIPOINT((0 0))', 4326));
|
||||
--error 3516
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('MULTIPOINT((0 0), (1 1))', 4326));
|
||||
--error 3516
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('MULTILINESTRING((0 0, 1 1))', 4326));
|
||||
--error 3516
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0, 0 1, 1 1, 0 0)))', 4326));
|
||||
--error 3516
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(0 0))', 4326));
|
||||
|
||||
--echo # Point must be geographic.
|
||||
--error 3726
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 0));
|
||||
--error 3726
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 3857));
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 4326));
|
||||
--error 3726
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 0), 1);
|
||||
--error 3726
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 3857), 1);
|
||||
SELECT ST_ASTEXT(ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 4326), 1));
|
||||
|
||||
--echo # Get or set the longitude of a point in a lat-long SRS.
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(0 1)', 4326));
|
||||
SELECT ST_ASTEXT(ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(0 1)', 4326), 1));
|
||||
|
||||
--echo # Get or set the longitude of a point in a long-lat SRS.
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(1 0)', 7035));
|
||||
SELECT ST_ASTEXT(ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 7035), 1));
|
||||
|
||||
--echo # Get or set the longitude of a point in a lat-long SRS with a meridian
|
||||
--echo # that doesn't go through Greenwich.
|
||||
--echo # todo@dazhi: different result w.r.t mysql8
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(0 1)', 4801));
|
||||
SELECT ST_ASTEXT(ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(0 1)', 4801), 1));
|
||||
@ -0,0 +1,51 @@
|
||||
#owner: ht353245
|
||||
#owner group: shenzhen
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--echo # Base test of _ST_POINT.
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--source mysql_test/test_suite/geometry/t/import_default_srs_data_mysql.inc
|
||||
|
||||
SELECT HEX(_ST_POINT(0, 0));
|
||||
SELECT HEX(_ST_POINT('0', '0'));
|
||||
SELECT HEX(_ST_POINT(NULL, NULL));
|
||||
--error 1292
|
||||
SELECT HEX(_ST_POINT('NULL', 'NULL'));
|
||||
SELECT HEX(_ST_POINT(0, 0, 0));
|
||||
SELECT HEX(_ST_POINT('0', '0', '0'));
|
||||
SELECT HEX(_ST_POINT(NULL, NULL, NULL));
|
||||
--error 1292
|
||||
SELECT HEX(_ST_POINT('NULL', 'NULL', 'NULL'));
|
||||
--error 1292
|
||||
SELECT HEX(_ST_POINT(1, 1, 'NULL'));
|
||||
SELECT HEX(_ST_POINT(1, 2, 4326));
|
||||
SELECT HEX(_ST_POINT(1, 2, '4326'));
|
||||
--error 3548
|
||||
SELECT HEX(_ST_POINT(1, 2, 43267));
|
||||
|
||||
# bugfix:
|
||||
--error 1292
|
||||
SELECT _ST_POINT('','');
|
||||
|
||||
# bugfix:
|
||||
--error 1292
|
||||
SELECT HEX(_ST_POINT('ABC','CBA'));
|
||||
--error 5083
|
||||
SELECT HEX(_ST_POINT(true,false));
|
||||
--error 5083
|
||||
SELECT HEX(_ST_POINT(DATE('2000-11-11'),DATE('2000-11-11')));
|
||||
# 超出数据范围是ob框架处理的,没办法兼容pg,pg会报错“超过双精度范围”
|
||||
SELECT HEX(_ST_POINT(1E-324,1E-324));
|
||||
|
||||
# bugfix:
|
||||
--error 1292
|
||||
SELECT HEX(_ST_POINT(11,22,'4326.123'));
|
||||
--error 1292
|
||||
SELECT HEX(_ST_POINT(11,22,'4326ABCD'));
|
||||
--error 1292
|
||||
SELECT HEX(_ST_POINT(11,22,'CBA4326ABCD'));
|
||||
--error 1292
|
||||
SELECT HEX(_ST_POINT(11,22,'false'));
|
||||
--error 1292
|
||||
SELECT HEX(_ST_POINT(11,22,''));
|
||||
--error 5083
|
||||
SELECT HEX(_ST_POINT(11,22,false));
|
||||
119
tools/deploy/mysql_test/test_suite/geometry/t/st_srid_mysql.test
Normal file
119
tools/deploy/mysql_test/test_suite/geometry/t/st_srid_mysql.test
Normal file
@ -0,0 +1,119 @@
|
||||
#owner: ht353245
|
||||
#owner group: shenzhen
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--echo # Test of GEOMETRY ST_SRID
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--source mysql_test/test_suite/geometry/t/import_default_srs_data_mysql.inc
|
||||
|
||||
--echo # Must return 0.
|
||||
SELECT ST_SRID(CAST(ST_GEOMFROMTEXT('POINT(1 1)', 0) AS POINT));
|
||||
--echo #
|
||||
|
||||
--echo # Must return 4326.
|
||||
SELECT ST_SRID(CAST(ST_GEOMFROMTEXT('POINT(45 90)', 4326) AS POINT));
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
SET @g = ST_GeomFromText('LineString(1 1,2 2)', 0);
|
||||
SELECT ST_SRID(@g);
|
||||
SELECT ST_ASTEXT(ST_SRID(@g, 4326));
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
SET @g = ST_GeomFromText('MULTIPOINT(1 1, 11 11, 11 21, 21 21)', 2343);
|
||||
SELECT ST_SRID(@g);
|
||||
SELECT ST_ASTEXT(ST_SRID(@g, 3234));
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
SET @g = ST_GeomFromText('Polygon((0 0, 0 8, 8 8, 8 10, -10 10, -10 0, 0 0))', 4326);
|
||||
SELECT ST_SRID(@g);
|
||||
SELECT ST_ASTEXT(ST_SRID(@g, 2343));
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
SET @g = ST_GeomFromText('GEOMETRYCOLLECTION(POLYGON((0 0,50 45,40 50,0 0)),LINESTRING(-10 -10,0 0),LINESTRING(46.666666666666664 46.666666666666664,200 200,199 201,45.333333333333336 47.333333333333336),LINESTRING(8 10,-11 -9))', 2343);
|
||||
SELECT ST_SRID(@g);
|
||||
SELECT ST_ASTEXT(ST_SRID(@g, 2343));
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
SET @g = ST_GeomFromText('GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(),GEOMETRYCOLLECTION EMPTY, GEOMETRYCOLLECTION(POINT(1 1)), MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48)), MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18))), MULTIPOINT((0 0),(10 10),(10 20),(20 20)), MULTIPOINT(1 1, 11 11, 11 21, 21 21), GEOMETRYCOLLECTION(LINESTRING(1 1,2 2)), GEOMETRYCOLLECTION(POLYGON((0 0,50 45,40 50,0 0)),LINESTRING(-10 -10,0 0),LINESTRING(46.666666666666664 46.666666666666664,200 200,199 201,45.333333333333336 47.333333333333336),LINESTRING(8 10,-11 -9)))', 2343);
|
||||
SELECT ST_SRID(@g);
|
||||
SELECT ST_ASTEXT(ST_SRID(@g, 0));
|
||||
--echo #
|
||||
|
||||
--echo # Test for String (creates the geometry in SRID 0, then casts it to SRID 4326)
|
||||
SELECT ST_ASTEXT(ST_SRID(Point(1, 1), 4326));
|
||||
SELECT ST_ASTEXT(ST_SRID(POINT(25.416666666666668, 25.416666666666668), 4326));
|
||||
--error 1690
|
||||
SELECT ST_SRID(Point(1, 1), -1);
|
||||
--error 1690
|
||||
SELECT ST_SRID(Point(1, 1), 1e30);
|
||||
# SELECT ST_SRID(POLYGON(LINESTRING(POINT(0,0), POINT(0,10), POINT(10,10), POINT(10,0), POINT(0,0)), LINESTRING(POINT(4,4), POINT(4,6), POINT(6,6), POINT(6,4), POINT(4,4))), 4326);
|
||||
# SELECT ST_SRID(GEOMETRYCOLLECTION(MULTILINESTRING(LINESTRING(POINT(0,0),POINT(1,0)),LINESTRING(POINT(0,0),POINT(1,0)))), 4326);
|
||||
--echo #
|
||||
|
||||
--echo # Test for ->srid 0
|
||||
select ST_ASTEXT(st_srid(st_geomfromtext('point(90 90)', 4326), 0));
|
||||
select ST_ASTEXT(st_srid(st_geomfromtext('point(90 90)', 4396), 0));
|
||||
--echo # Test for invalid input data
|
||||
--error 3732
|
||||
select st_srid(st_geomfromtext('point(100 100)'), 4326);
|
||||
--echo #
|
||||
|
||||
--echo # Test for setsrid
|
||||
select ST_ASTEXT(_st_setsrid(point(90,90), 4326));
|
||||
--error 3732
|
||||
set @g = _st_setsrid(point(100,100), 4326);
|
||||
--error 3732
|
||||
select _st_setsrid(point(100,100), 4326);
|
||||
--echo # Test for invalid srid
|
||||
select ST_ASTEXT(st_srid(point(90,90), ''));
|
||||
select ST_ASTEXT(st_srid(point(90,90), 'invalid'));
|
||||
--echo #
|
||||
|
||||
--echo # Test for srid!=0 && srs_item == null
|
||||
select st_srid(x'02000000010100000000000000000000000000000000000000');
|
||||
--echo #
|
||||
|
||||
--echo # Test unusual input (different from st_x/st_buffer..)
|
||||
--error 3037
|
||||
select st_srid(1.1);
|
||||
--error 3037
|
||||
select st_srid(10.2);
|
||||
--error 3037
|
||||
select st_srid(102342);
|
||||
--error 3037
|
||||
select st_srid('sdfwefqwe');
|
||||
--error 3037
|
||||
select st_isvalid(x'e610000001040000000000000000002EC000000000000034C0');
|
||||
|
||||
# bugfix :
|
||||
select st_srid(x'0000000001030000000200000005000000000000000000000000000000000000000000000000002440000000000000000000000000000024400000000000002440000000000000000000000000000024400000000000000000000000000000000005000000000000000000144000000000000014400000000000001C4000000000000014400000000000001C400000000000001C4000000000000014400000000000001C4000000000000014400000000000001441');
|
||||
|
||||
# bugfix:
|
||||
--error 3037
|
||||
SELECT _ST_SETSRID(NULL,4326);
|
||||
--error 3037
|
||||
SELECT _ST_SETSRID('NULL',4326);
|
||||
--error 3037
|
||||
SELECT _ST_SETSRID(x'02000000010100000000000000000000000000000000000000',NULL);
|
||||
SELECT ST_ASTEXT(_ST_SETSRID(ST_GEOMFROMTEXT('POINT(1 2)'),NULL));
|
||||
--error 1292
|
||||
SELECT _ST_SETSRID(ST_GEOMFROMTEXT('POINT(1 2)'),'NULL');
|
||||
SELECT ST_ASTEXT(_ST_SETSRID(ST_GEOMFROMTEXT('POINT(1 2)'),4326));
|
||||
SELECT ST_ASTEXT(_ST_SETSRID(ST_GEOMFROMTEXT('POINT(1 2)'),'4326'));
|
||||
--error 1292
|
||||
SELECT ST_ASTEXT(_ST_SETSRID(ST_GEOMFROMTEXT('POINT(1 2)'),'4326abc'));
|
||||
--error 1292
|
||||
SELECT ST_ASTEXT(_ST_SETSRID(ST_GEOMFROMTEXT('POINT(1 2)'),'true'));
|
||||
--error 5083
|
||||
SELECT ST_ASTEXT(_ST_SETSRID(ST_GEOMFROMTEXT('POINT(1 2)'),true));
|
||||
|
||||
# bugfix :
|
||||
--error 3037
|
||||
SELECT _ST_SETSRID(ST_GEOMFROMTEXT('POINT'),NULL);
|
||||
|
||||
# bugfix :
|
||||
select st_astext(st_srid(x'0000000001030000000300000005000000000010000000000000000000000000000000000000002440000000000000000000000000000024400000000000002440000000000000000000000000000024400000000000000000000000000000000005000000000000000000144000000000000014400000000000001C4000000000000014400000000000001C400000000000001C4000000000000014400000000000001C40000000000000144000000000000014410500000000000000000014C000000000000014C00000000000001CC000000000000014C00000000000001CC00000000000001CC000000000000014C00000000000001CC000000000000014C000000000000014C0',0));
|
||||
File diff suppressed because it is too large
Load Diff
205
tools/deploy/mysql_test/test_suite/geometry/t/st_x_mysql.test
Normal file
205
tools/deploy/mysql_test/test_suite/geometry/t/st_x_mysql.test
Normal file
@ -0,0 +1,205 @@
|
||||
#owner: ht353245
|
||||
#owner group: shenzhen
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--echo # Test of GEOMETRY ST_X Function.
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--source mysql_test/test_suite/geometry/t/import_default_srs_data_mysql.inc
|
||||
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('POINT(0 0)'));
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('POINT(1.1111 -1.1111)'));
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('POINT(1e308 -1e308)'));
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('POINT(0 0)'));
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('POINT(1.1111 -1.1111)'));
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('POINT(1e308 -1e308)'));
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists geo;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE geo (
|
||||
id INT PRIMARY KEY AUTO_INCREMENT,
|
||||
type_name TEXT,
|
||||
geo_value GEOMETRY
|
||||
);
|
||||
|
||||
INSERT INTO geo (type_name,geo_value) VALUES
|
||||
('P1', ST_GeomFromText("POINT(1 3)")),
|
||||
('P2', ST_GeomFromText("POINT(-100 +2e6)")),
|
||||
('P3', ST_GeomFromText("POINT(23.45 67.910)")),
|
||||
('P4', ST_GeomFromText("POINT(1111 2222)"));
|
||||
SELECT ST_X(geo_value) FROM geo ORDER BY id;
|
||||
SELECT ST_ASTEXT(ST_X(geo_value, 2012.2102)) FROM geo ORDER BY id;
|
||||
SELECT ST_Y(geo_value) FROM geo ORDER BY id;
|
||||
SELECT ST_ASTEXT(ST_Y(geo_value, 2102.2012)) FROM geo ORDER BY id;
|
||||
truncate table geo;
|
||||
drop table geo;
|
||||
|
||||
# TODO: point
|
||||
--error 1690
|
||||
SELECT ST_X(POINT(pow(2, 2048), 4), 5);
|
||||
--error 3516
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('LINESTRING(0 0, 1 1)'), 5);
|
||||
--error 3516
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('MULTIPOINT(10 40, 40 30, 20 20, 30 10)'), 1024);
|
||||
--error 3516
|
||||
SELECT ST_X(ST_GEOMFROMTEXT("MULTILINESTRING((10 10, 20 20, 10 40), (40 40, 30 30, 40 20, 30 10))"), 1024);
|
||||
--error 3516
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('POLYGON((0 0,2 2,0 2,0 0))'), -1024);
|
||||
--error 3516
|
||||
SELECT ST_X(ST_GEOMFROMTEXT("MULTIPOLYGON(((40 40, 20 45, 45 30, 40 40)), ((20 35, 10 30, 10 10, 30 5, 45 20, 20 35)))"), -1024);
|
||||
--error 3516
|
||||
SELECT ST_X(ST_GEOMFROMTEXT("GEOMETRYCOLLECTION(
|
||||
POINT(4 6),
|
||||
LINESTRING(4 6,7 10),
|
||||
POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10)),
|
||||
MULTIPOINT (10 40, 40 30, 20 20, 30 10),
|
||||
MULTILINESTRING ((10 10, 20 20, 10 40), (40 40, 30 30, 40 20, 30 10)),
|
||||
MULTIPOLYGON (((30 20, 45 40, 10 40, 30 20)),
|
||||
((15 5, 40 10, 10 20, 5 10, 15 5))))"),
|
||||
1024);
|
||||
|
||||
--echo # NULL as one of the parameters must result in NULL return value.
|
||||
SELECT ST_X(NULL);
|
||||
SELECT ST_X(NULL, NULL);
|
||||
SELECT ST_X(NULL, 1);
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('POINT(0 0)', 4326), NULL);
|
||||
|
||||
--echo # Invalid data is not allowed.
|
||||
--echo #todo@dazhi: string -> geometry
|
||||
#--error 3064
|
||||
#SELECT ST_X(x'000000000123456789abcdef');
|
||||
|
||||
--echo # New value must be within the allowed range.
|
||||
--error 3617
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('POINT(0 0)', 4326), -90.000000001);
|
||||
--error 3617
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('POINT(0 0)', 4326), 90.000000001);
|
||||
--error 3616
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('POINT(0 0)', 7035), -180.000000001);
|
||||
--error 3616
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('POINT(0 0)', 7035), 180.000000001);
|
||||
|
||||
--echo # First parameter must be a point.
|
||||
--echo # Cartesian SRID 0
|
||||
--error 3516
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('LINESTRING(0 0, 1 1)', 0));
|
||||
--error 3516
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('POLYGON((0 0, 0 1, 1 1, 0 0))', 0));
|
||||
--error 3516
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('MULTIPOINT((0 0))', 0));
|
||||
--error 3516
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('MULTIPOINT((0 0), (1 1))', 0));
|
||||
--error 3516
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('MULTILINESTRING((0 0, 1 1))', 0));
|
||||
--error 3516
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0, 0 1, 1 1, 0 0)))', 0));
|
||||
--error 3516
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(0 0))', 0));
|
||||
|
||||
--echo # Projected
|
||||
--error 3516
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('LINESTRING(0 0, 1 1)', 3857));
|
||||
--error 3516
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('POLYGON((0 0, 0 1, 1 1, 0 0))', 3857));
|
||||
--error 3516
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('MULTIPOINT((0 0))', 3857));
|
||||
--error 3516
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('MULTIPOINT((0 0), (1 1))', 3857));
|
||||
--error 3516
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('MULTILINESTRING((0 0, 1 1))', 3857));
|
||||
--error 3516
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0, 0 1, 1 1, 0 0)))', 3857));
|
||||
--error 3516
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(0 0))', 3857));
|
||||
|
||||
--echo # Geographic
|
||||
--error 3516
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('LINESTRING(0 0, 1 1)', 4326));
|
||||
--error 3516
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('POLYGON((0 0, 0 1, 1 1, 0 0))', 4326));
|
||||
--error 3516
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('MULTIPOINT((0 0))', 4326));
|
||||
--error 3516
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('MULTIPOINT((0 0), (1 1))', 4326));
|
||||
--error 3516
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('MULTILINESTRING((0 0, 1 1))', 4326));
|
||||
--error 3516
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0, 0 1, 1 1, 0 0)))', 4326));
|
||||
--error 3516
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(0 0))', 4326));
|
||||
|
||||
--echo # Invalied geometry
|
||||
--error 3516
|
||||
SELECT ST_X(ST_GeomFromText('LINESTRING(0 0, 1 1)'), 5);
|
||||
--error 3516
|
||||
SELECT ST_Y(ST_GeomFromText('LINESTRING(0 0, 1 1)'), 5);
|
||||
--error 3516
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('POLYGON((0 0,2 2,0 2,0 0))'), -1024);
|
||||
--error 3516
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('POLYGON((0 0,2 2,0 2,0 0))'), -1024);
|
||||
--error 3516
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('MULTIPOINT(10 40, 40 30, 20 20, 30 10)'), 1024);
|
||||
--error 3516
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('MULTIPOINT(10 40, 40 30, 20 20, 30 10)'), 1024);
|
||||
--error 3516
|
||||
SELECT ST_X(ST_GEOMFROMTEXT("MULTILINESTRING((10 10, 20 20, 10 40),"
|
||||
"(40 40, 30 30, 40 20, 30 10))"), 1024);
|
||||
|
||||
--echo # Get or set the X coordinate of SRID 0.
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('POINT(1 0)', 0));
|
||||
# SELECT HEX(ST_X(ST_GEOMFROMTEXT('POINT(0 0)', 0), 1));
|
||||
|
||||
--echo # Get or set the X coordinate of a projected SRS.
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('POINT(1 0)', 3857));
|
||||
# SELECT HEX(ST_X(ST_GEOMFROMTEXT('POINT(0 0)', 3857), 1));
|
||||
|
||||
--echo # Get or set the X coordinate (latitude) of a point in a lat-long SRS.
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('POINT(1 0)', 4326));
|
||||
# SELECT HEX(ST_X(ST_GEOMFROMTEXT('POINT(0 0)', 4326), 1));
|
||||
|
||||
--echo # Get or set the X coordinate (longitude) of a point in a long-lat SRS.
|
||||
SELECT ST_X(ST_GEOMFROMTEXT('POINT(1 0)', 7035));
|
||||
# SELECT HEX(ST_X(ST_GEOMFROMTEXT('POINT(0 0)', 7035), 1));
|
||||
|
||||
SELECT 'X1', ST_X(ST_GEOMFROMTEXT('POINT (0 0)'));
|
||||
SELECT 'X2', ST_X(ST_GEOMFROMTEXT('POINT (1 2)'));
|
||||
SELECT 'X3', ST_X(ST_GEOMFROMTEXT('POINT (6 7)'));
|
||||
SELECT 'X4', ST_X(ST_GEOMFROMTEXT('POINT (10 11)'));
|
||||
--error 3516
|
||||
SELECT 'X5', ST_X(ST_GEOMFROMTEXT('MULTIPOINT ((0 0), (1 1))'));
|
||||
--error 3516
|
||||
SELECT 'X6', ST_X(ST_GEOMFROMTEXT('LINESTRING (0 0, 1 1)'));
|
||||
--error 3516
|
||||
SELECT 'X7', ST_X(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION (POINT(0 0))'));
|
||||
--error 3516
|
||||
SELECT 'X8', ST_X(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION (POINT(0 1), LINESTRING(0 0, 1 1))'));
|
||||
|
||||
--echo # Test unusual input
|
||||
SET @A = NULL;
|
||||
SELECT ST_ASTEXT(ST_LATITUDE(ST_GEOMFROMTEXT('POINT(90 -90)',4326), @A));
|
||||
--error 3617
|
||||
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(180 -180)',4269,'axis-order=long-lat'),NULL);
|
||||
SELECT ST_ASTEXT(ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(90 -90)',4120), ' '));
|
||||
SELECT ST_ASTEXT(ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(90 -90)',4120), 'invalid input'));
|
||||
--echo #
|
||||
|
||||
--echo # Test precision
|
||||
select st_latitude(st_geomfromtext('point(1e-16 1e-16)', 4326));
|
||||
--echo #
|
||||
|
||||
--echo # Test wkb type
|
||||
--error 3037
|
||||
select st_x(x'E6100000010000000041CF2402F51C54C0845661A4703A4940');
|
||||
--error 3037
|
||||
select st_y(x'E6100000010800000041CF2402F51C54C0845661A4703A4940');
|
||||
--echo #
|
||||
|
||||
--echo # Test unusual input
|
||||
--error 3037
|
||||
select st_x(1.1);
|
||||
--error 3548
|
||||
select st_y(10.2);
|
||||
--error 3548
|
||||
select st_x(102342);
|
||||
--error 3548
|
||||
select st_y('sdfwefqwe');
|
||||
103
tools/deploy/mysql_test/test_suite/geometry/t/st_y_mysql.test
Normal file
103
tools/deploy/mysql_test/test_suite/geometry/t/st_y_mysql.test
Normal file
@ -0,0 +1,103 @@
|
||||
#owner: ht353245
|
||||
#owner group: shenzhen
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--echo # Test of GEOMETRY ST_Y
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--source mysql_test/test_suite/geometry/t/import_default_srs_data_mysql.inc
|
||||
|
||||
|
||||
--echo # NULL as one of the parameters must result in NULL return value.
|
||||
SELECT ST_Y(NULL);
|
||||
SELECT ST_Y(NULL, NULL);
|
||||
SELECT ST_Y(NULL, 1);
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('POINT(0 0)', 4326), NULL);
|
||||
|
||||
--echo # Invalid data is not allowed. todo@dazhi
|
||||
#--error 3064
|
||||
#SELECT ST_Y(x'000000000123456789abcdef');
|
||||
|
||||
--echo # New value must be within the allowed range.
|
||||
--error 3616
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('POINT(0 0)', 4326), -180.000000001);
|
||||
--error 3616
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('POINT(0 0)', 4326), 180.000000001);
|
||||
--error 3617
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('POINT(0 0)', 7035), -90.000000001);
|
||||
--error 3617
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('POINT(0 0)', 7035), 90.000000001);
|
||||
|
||||
--echo # First parameter must be a point.
|
||||
--echo # Cartesian SRID 0
|
||||
--error 3516
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('LINESTRING(0 0, 1 1)', 0));
|
||||
--error 3516
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('POLYGON((0 0, 0 1, 1 1, 0 0))', 0));
|
||||
--error 3516
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('MULTIPOINT((0 0))', 0));
|
||||
--error 3516
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('MULTIPOINT((0 0), (1 1))', 0));
|
||||
--error 3516
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('MULTILINESTRING((0 0, 1 1))', 0));
|
||||
--error 3516
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0, 0 1, 1 1, 0 0)))', 0));
|
||||
--error 3516
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(0 0))', 0));
|
||||
--echo # Projected
|
||||
--error 3516
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('LINESTRING(0 0, 1 1)', 3857));
|
||||
--error 3516
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('POLYGON((0 0, 0 1, 1 1, 0 0))', 3857));
|
||||
--error 3516
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('MULTIPOINT((0 0))', 3857));
|
||||
--error 3516
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('MULTIPOINT((0 0), (1 1))', 3857));
|
||||
--error 3516
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('MULTILINESTRING((0 0, 1 1))', 3857));
|
||||
--error 3516
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0, 0 1, 1 1, 0 0)))', 3857));
|
||||
--error 3516
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(0 0))', 3857));
|
||||
--echo # Geographic
|
||||
--error 3516
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('LINESTRING(0 0, 1 1)', 4326));
|
||||
--error 3516
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('POLYGON((0 0, 0 1, 1 1, 0 0))', 4326));
|
||||
--error 3516
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('MULTIPOINT((0 0))', 4326));
|
||||
--error 3516
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('MULTIPOINT((0 0), (1 1))', 4326));
|
||||
--error 3516
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('MULTILINESTRING((0 0, 1 1))', 4326));
|
||||
--error 3516
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0, 0 1, 1 1, 0 0)))', 4326));
|
||||
--error 3516
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(0 0))', 4326));
|
||||
|
||||
--echo # Get or set the Y coordinate of SRID 0.
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('POINT(0 1)', 0));
|
||||
SELECT ST_ASTEXT(ST_Y(ST_GEOMFROMTEXT('POINT(0 0)', 0), 1));
|
||||
|
||||
--echo # Get or set the Y coordinate of a projected SRS.
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('POINT(0 1)', 3857));
|
||||
SELECT ST_ASTEXT(ST_Y(ST_GEOMFROMTEXT('POINT(0 0)', 3857), 1));
|
||||
|
||||
--echo # Get or set the Y coordinate (longitude) of a point in a lat-long SRS.
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('POINT(0 1)', 4326));
|
||||
SELECT ST_ASTEXT(ST_Y(ST_GEOMFROMTEXT('POINT(0 0)', 4326), 1));
|
||||
|
||||
--echo # Get or set the Y coordinate (latitude) of a point in a long-lat SRS.
|
||||
SELECT ST_Y(ST_GEOMFROMTEXT('POINT(0 1)', 7035));
|
||||
SELECT ST_ASTEXT(ST_Y(ST_GEOMFROMTEXT('POINT(0 0)', 7035), 1));
|
||||
|
||||
SELECT 'Y1', ST_Y(ST_GEOMFROMTEXT('POINT (0 0)'));
|
||||
SELECT 'Y2', ST_Y(ST_GEOMFROMTEXT('POINT (1 2)'));
|
||||
SELECT 'Y3', ST_Y(ST_GEOMFROMTEXT('POINT (6 7)'));
|
||||
SELECT 'Y4', ST_Y(ST_GEOMFROMTEXT('POINT (10 11)'));
|
||||
--error 3516
|
||||
SELECT 'Y5', ST_Y(ST_GEOMFROMTEXT('MULTIPOINT ((0 0), (1 1))'));
|
||||
--error 3516
|
||||
SELECT 'Y6', ST_Y(ST_GEOMFROMTEXT('LINESTRING (0 0, 1 1)'));
|
||||
--error 3516
|
||||
SELECT 'Y7', ST_Y(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION (POINT(0 0))'));
|
||||
--error 3516
|
||||
SELECT 'Y8', ST_Y(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION (POINT(0 1), LINESTRING(0 0, 1 1))'));
|
||||
Reference in New Issue
Block a user