Debian Codegraph @

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

raw
1 Use test;
2 # Test all 3 functions within stored procedure
3 CREATE PROCEDURE geom_lineinterpolate()
4 BEGIN
5 SET @g1 = ST_GeomFromText('LINESTRING(10 10,20 20,30 30,40 40,50 50,60 60,70 70,80 80,90 90)', 4326);
6 SELECT ST_ASTEXT(ST_PointAtDistance(@g1,0.0));
7 SELECT ST_ASTEXT(ST_LINEINTERPOLATEPOINT(@g1,0.0));
8 SELECT ST_ASTEXT(ST_LINEINTERPOLATEPOINTS(@g1,0.0));
9 SELECT ST_ASTEXT(ST_LINEINTERPOLATEPOINT(@g1,NULL));
10 SELECT ST_ASTEXT(ST_LINEINTERPOLATEPOINTS(@g1,NULL));
11 SELECT ST_ASTEXT(ST_PointAtDistance(@g1,NULL));
12 END ||
13 CALL geom_lineinterpolate();
14 ST_ASTEXT(ST_PointAtDistance(@g1,0.0))
15 POINT(10 10)
16 ST_ASTEXT(ST_LINEINTERPOLATEPOINT(@g1,0.0))
17 POINT(10 10)
18 ST_ASTEXT(ST_LINEINTERPOLATEPOINTS(@g1,0.0))
19 MULTIPOINT((10 10))
20 ST_ASTEXT(ST_LINEINTERPOLATEPOINT(@g1,NULL))
21 NULL
22 ST_ASTEXT(ST_LINEINTERPOLATEPOINTS(@g1,NULL))
23 NULL
24 ST_ASTEXT(ST_PointAtDistance(@g1,NULL))
25 NULL
26 DROP PROCEDURE geom_lineinterpolate;
27 # Test all 3 functions in UPDATE and WHERE and SELECT Clauses
28 CREATE TABLE tab(c1 INT,c2 LINESTRING,c3 POINT,c4 GEOMETRY);
29 CREATE VIEW view1 AS SELECT * FROM tab;
30 SET @ls = ST_GEOMFROMTEXT('LINESTRING(10 10,20 20,30 30,40 40,50 50,60 60,70 70,80 80,90 90)');
31 INSERT INTO tab(c1,c2) VALUES(1,@g1);
32 SET @pt = ST_GEOMFROMTEXT('POINT(10 10)',4326);
33 SELECT c1, ST_ASTEXT(ST_LINEINTERPOLATEPOINT(c2,0.0)) FROM view1 WHERE ST_INTERSECTS(ST_LINEINTERPOLATEPOINT(c2,0.0),@pt) = 0;
34 c1 ST_ASTEXT(ST_LINEINTERPOLATEPOINT(c2,0.0))
35 SELECT c1, ST_ASTEXT(ST_LINEINTERPOLATEPOINT(c2,0.0)) FROM view1 WHERE ST_INTERSECTS(ST_LINEINTERPOLATEPOINT(c2,0.0),@pt) = 1;
36 c1 ST_ASTEXT(ST_LINEINTERPOLATEPOINT(c2,0.0))
37 1 POINT(10 10)
38 SELECT c1, ST_ASTEXT(ST_LINEINTERPOLATEPOINTS(c2,0.0)) FROM view1 WHERE ST_INTERSECTS(ST_LINEINTERPOLATEPOINTS(c2,0.0),@pt) = 0;
39 c1 ST_ASTEXT(ST_LINEINTERPOLATEPOINTS(c2,0.0))
40 SELECT c1, ST_ASTEXT(ST_LINEINTERPOLATEPOINTS(c2,0.0)) FROM view1 WHERE ST_INTERSECTS(ST_LINEINTERPOLATEPOINTS(c2,0.0),@pt) = 1;
41 c1 ST_ASTEXT(ST_LINEINTERPOLATEPOINTS(c2,0.0))
42 1 MULTIPOINT((10 10))
43 SELECT c1, ST_ASTEXT(ST_POINTATDISTANCE(c2,0.0)) FROM view1 WHERE ST_INTERSECTS(ST_POINTATDISTANCE(c2,0.0),@pt) = 1;
44 c1 ST_ASTEXT(ST_POINTATDISTANCE(c2,0.0))
45 1 POINT(10 10)
46 SELECT c1, ST_ASTEXT(ST_POINTATDISTANCE(c2,0.0)) FROM view1 WHERE ST_INTERSECTS(ST_POINTATDISTANCE(c2,0.0),@pt) = 0;
47 c1 ST_ASTEXT(ST_POINTATDISTANCE(c2,0.0))
48 UPDATE tab SET c3 = ST_LINEINTERPOLATEPOINT(@ls,0.0) WHERE c1 = 1;
49 SELECT ST_ASTEXT(c3) FROM tab;
50 ST_ASTEXT(c3)
51 POINT(10 10)
52 UPDATE tab SET c3 = ST_POINTATDISTANCE(@ls,0.1) WHERE c1 = 1;
53 SELECT ST_ASTEXT(c3) FROM tab;
54 ST_ASTEXT(c3)
55 POINT(10.070710678118655 10.070710678118655)
56 UPDATE tab SET c4 = ST_LINEINTERPOLATEPOINTS(@ls,0.0) WHERE c1 = 1;
57 SELECT ST_ASTEXT(c4) FROM tab;
58 ST_ASTEXT(c4)
59 MULTIPOINT((10 10))
60 DROP VIEW view1;
61 DROP TABLE tab;
62 # The geometry must be a linestring.
63 # Test ST_LINEINTERPOLATEPOINT with Cartesian SRID 0
64 DO ST_LINEINTERPOLATEPOINT(ST_GEOMFROMTEXT('POINT(0 0)', 0), 1);
65 ERROR 22S01: LINESTRING value is a geometry of unexpected type POINT in st_lineinterpolatepoint.
66 DO ST_LINEINTERPOLATEPOINT(ST_GEOMFROMTEXT('POLYGON((0 0, 0 1, 1 1, 0 0))', 0), 1);
67 ERROR 22S01: LINESTRING value is a geometry of unexpected type POLYGON in st_lineinterpolatepoint.
68 DO ST_LINEINTERPOLATEPOINT(ST_GEOMFROMTEXT('MULTIPOINT((0 0), (1 1))', 0), 1);
69 ERROR 22S01: LINESTRING value is a geometry of unexpected type MULTIPOINT in st_lineinterpolatepoint.
70 DO ST_LINEINTERPOLATEPOINT(ST_GEOMFROMTEXT('MULTILINESTRING((0 0, 1 1))', 0), 1);
71 ERROR 22S01: LINESTRING value is a geometry of unexpected type MULTILINESTRING in st_lineinterpolatepoint.
72 DO ST_LINEINTERPOLATEPOINT(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0, 0 1, 1 1, 0 0)))', 0), 1);
73 ERROR 22S01: LINESTRING value is a geometry of unexpected type MULTIPOLYGON in st_lineinterpolatepoint.
74 DO ST_LINEINTERPOLATEPOINT(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(0 0))', 0), 1);
75 ERROR 22S01: LINESTRING value is a geometry of unexpected type GEOMCOLLECTION in st_lineinterpolatepoint.
76 # Test ST_LINEINTERPOLATEPOINT with Geographic
77 DO ST_LINEINTERPOLATEPOINT(ST_GEOMFROMTEXT('POINT(0 0)', 4326), 1);
78 ERROR 22S01: LINESTRING value is a geometry of unexpected type POINT in st_lineinterpolatepoint.
79 DO ST_LINEINTERPOLATEPOINT(ST_GEOMFROMTEXT('POLYGON((0 0, 0 1, 1 1, 0 0))', 4326), 1);
80 ERROR 22S01: LINESTRING value is a geometry of unexpected type POLYGON in st_lineinterpolatepoint.
81 DO ST_LINEINTERPOLATEPOINT(ST_GEOMFROMTEXT('MULTIPOINT((0 0), (1 1))', 4326), 1);
82 ERROR 22S01: LINESTRING value is a geometry of unexpected type MULTIPOINT in st_lineinterpolatepoint.
83 DO ST_LINEINTERPOLATEPOINT(ST_GEOMFROMTEXT('MULTILINESTRING((0 0, 1 1))', 4326), 1);
84 ERROR 22S01: LINESTRING value is a geometry of unexpected type MULTILINESTRING in st_lineinterpolatepoint.
85 DO ST_LINEINTERPOLATEPOINT(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0, 0 1, 1 1, 0 0)))', 4326), 1);
86 ERROR 22S01: LINESTRING value is a geometry of unexpected type MULTIPOLYGON in st_lineinterpolatepoint.
87 DO ST_LINEINTERPOLATEPOINT(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(0 0))', 4326), 1);
88 ERROR 22S01: LINESTRING value is a geometry of unexpected type GEOMCOLLECTION in st_lineinterpolatepoint.
89 # Test ST_LINEINTERPOLATEPOINTS with Cartesian SRID 0
90 DO ST_LINEINTERPOLATEPOINTS(ST_GEOMFROMTEXT('POINT(0 0)', 0), 1);
91 ERROR 22S01: LINESTRING value is a geometry of unexpected type POINT in st_lineinterpolatepoints.
92 DO ST_LINEINTERPOLATEPOINTS(ST_GEOMFROMTEXT('POLYGON((0 0, 0 1, 1 1, 0 0))', 0), 1);
93 ERROR 22S01: LINESTRING value is a geometry of unexpected type POLYGON in st_lineinterpolatepoints.
94 DO ST_LINEINTERPOLATEPOINTS(ST_GEOMFROMTEXT('MULTIPOINT((0 0), (1 1))', 0), 1);
95 ERROR 22S01: LINESTRING value is a geometry of unexpected type MULTIPOINT in st_lineinterpolatepoints.
96 DO ST_LINEINTERPOLATEPOINTS(ST_GEOMFROMTEXT('MULTILINESTRING((0 0, 1 1))', 0), 1);
97 ERROR 22S01: LINESTRING value is a geometry of unexpected type MULTILINESTRING in st_lineinterpolatepoints.
98 DO ST_LINEINTERPOLATEPOINT(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0, 0 1, 1 1, 0 0)))', 0), 1);
99 ERROR 22S01: LINESTRING value is a geometry of unexpected type MULTIPOLYGON in st_lineinterpolatepoint.
100 DO ST_LINEINTERPOLATEPOINTS(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(0 0))', 0), 1);
101 ERROR 22S01: LINESTRING value is a geometry of unexpected type GEOMCOLLECTION in st_lineinterpolatepoints.
102 # Test ST_LINEINTERPOLATEPOINTS with Geographic
103 DO ST_LINEINTERPOLATEPOINTS(ST_GEOMFROMTEXT('POINT(0 0)', 4326), 1);
104 ERROR 22S01: LINESTRING value is a geometry of unexpected type POINT in st_lineinterpolatepoints.
105 DO ST_LINEINTERPOLATEPOINTS(ST_GEOMFROMTEXT('POLYGON((0 0, 0 1, 1 1, 0 0))', 4326), 1);
106 ERROR 22S01: LINESTRING value is a geometry of unexpected type POLYGON in st_lineinterpolatepoints.
107 DO ST_LINEINTERPOLATEPOINTS(ST_GEOMFROMTEXT('MULTIPOINT((0 0), (1 1))', 4326), 1);
108 ERROR 22S01: LINESTRING value is a geometry of unexpected type MULTIPOINT in st_lineinterpolatepoints.
109 DO ST_LINEINTERPOLATEPOINTS(ST_GEOMFROMTEXT('MULTILINESTRING((0 0, 1 1))', 4326), 1);
110 ERROR 22S01: LINESTRING value is a geometry of unexpected type MULTILINESTRING in st_lineinterpolatepoints.
111 DO ST_LINEINTERPOLATEPOINTS(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0, 0 1, 1 1, 0 0)))', 4326), 1);
112 ERROR 22S01: LINESTRING value is a geometry of unexpected type MULTIPOLYGON in st_lineinterpolatepoints.
113 DO ST_LINEINTERPOLATEPOINTS(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(0 0))', 4326), 1);
114 ERROR 22S01: LINESTRING value is a geometry of unexpected type GEOMCOLLECTION in st_lineinterpolatepoints.
115 # Test ST_LINEINTERPOLATEPOINTS with NULL
116 SET @g1 = ST_GeomFromText('LINESTRING(10 10,20 20,30 30,40 40,50 50,60 60,70 70,80 80,90 90)', 4326);
117 SELECT ST_LINEINTERPOLATEPOINTS(NULL, NULL);
118 ST_LINEINTERPOLATEPOINTS(NULL, NULL)
119 NULL
120 SELECT ST_LINEINTERPOLATEPOINTS(@g1, NULL);
121 ST_LINEINTERPOLATEPOINTS(@g1, NULL)
122 NULL
123 # Test ST_LINEINTERPOLATEPOINT with NULL
124 SET @g1 = ST_GeomFromText('LINESTRING(10 10,20 20,30 30,40 40,50 50,60 60,70 70,80 80,90 90)', 4326);
125 SELECT ST_LINEINTERPOLATEPOINT(NULL, NULL);
126 ST_LINEINTERPOLATEPOINT(NULL, NULL)
127 NULL
128 SELECT ST_LINEINTERPOLATEPOINT(@g1, NULL);
129 ST_LINEINTERPOLATEPOINT(@g1, NULL)
130 NULL
131 # Test ST_LINEINTERPOLATEPOINT function with Latitude values must be within range [-90, 90].
132 SELECT ST_LINEINTERPOLATEPOINT(0xE6100000010200000002000000000000000000000000000000000000000000000000000000F2D24D62108056C0, 1);
133 ERROR 22S03: A parameter of function st_lineinterpolatepoint contains a geometry with latitude -90.001000, which is out of range. It must be within [-90.000000, 90.000000].
134 SELECT ST_LINEINTERPOLATEPOINT(0xE6100000010200000002000000000000000000000000000000000000000000000000000000F2D24D6210805640, 1);
135 ERROR 22S03: A parameter of function st_lineinterpolatepoint contains a geometry with latitude 90.001000, which is out of range. It must be within [-90.000000, 90.000000].
136 # Longitude values must be within range [-180, 180].
137 SELECT ST_LINEINTERPOLATEPOINT(0xE610000001020000000200000079E92631088066C0000000000000000000000000000000000000000000000000, 1);
138 ERROR 22S02: A parameter of function st_lineinterpolatepoint contains a geometry with longitude -180.001000, which is out of range. It must be within (-180.000000, 180.000000].
139 SELECT ST_LINEINTERPOLATEPOINT(0xE61000000102000000020000000000000000000000000000000000000079E92631088066400000000000000000, 1);
140 ERROR 22S02: A parameter of function st_lineinterpolatepoint contains a geometry with longitude 180.001000, which is out of range. It must be within (-180.000000, 180.000000].
141 # Test ST_LINEINTERPOLATEPOINTS function with Latitude values must be within range [-90, 90].
142 SELECT ST_LINEINTERPOLATEPOINTS(0xE6100000010200000002000000000000000000000000000000000000000000000000000000F2D24D62108056C0, 1);
143 ERROR 22S03: A parameter of function st_lineinterpolatepoints contains a geometry with latitude -90.001000, which is out of range. It must be within [-90.000000, 90.000000].
144 SELECT ST_LINEINTERPOLATEPOINTS(0xE6100000010200000002000000000000000000000000000000000000000000000000000000F2D24D6210805640, 1);
145 ERROR 22S03: A parameter of function st_lineinterpolatepoints contains a geometry with latitude 90.001000, which is out of range. It must be within [-90.000000, 90.000000].
146 # Longitude values must be within range [-180, 180].
147 SELECT ST_LINEINTERPOLATEPOINTS(0xE610000001020000000200000079E92631088066C0000000000000000000000000000000000000000000000000, 1);
148 ERROR 22S02: A parameter of function st_lineinterpolatepoints contains a geometry with longitude -180.001000, which is out of range. It must be within (-180.000000, 180.000000].
149 SELECT ST_LINEINTERPOLATEPOINTS(0xE61000000102000000020000000000000000000000000000000000000079E92631088066400000000000000000, 1);
150 ERROR 22S02: A parameter of function st_lineinterpolatepoints contains a geometry with longitude 180.001000, which is out of range. It must be within (-180.000000, 180.000000].