DROP TABLE IF EXISTS t1; select 1, ST_Intersects(ST_GeomFromText('POLYGON((0 0,20 0,20 20,0 20,0 0))'), ST_GeomFromText('POLYGON((10 10,30 10,30 30,10 30,10 10))')); 1 ST_Intersects(ST_GeomFromText('POLYGON((0 0,20 0,20 20,0 20,0 0))'), ST_GeomFromText('POLYGON((10 10,30 10,30 30,10 30,10 10))')) 1 1 select 0, ST_Intersects(ST_GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), ST_GeomFromText('POLYGON((10 40, 40 50, 20 70, 10 40))')); 0 ST_Intersects(ST_GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), ST_GeomFromText('POLYGON((10 40, 40 50, 20 70, 10 40))')) 0 0 select 1, ST_Intersects(ST_GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), ST_GeomFromText('POINT(10 10)')); 1 ST_Intersects(ST_GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), ST_GeomFromText('POINT(10 10)')) 1 1 select 1, ST_Intersects(ST_GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), ST_GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))')); 1 ST_Intersects(ST_GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), ST_GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))')) 1 1 select 0, ST_Within(ST_GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), ST_GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))')); 0 ST_Within(ST_GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), ST_GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))')) 0 0 select 1, ST_Within(ST_GeomFromText('POLYGON((1 1,20 10,10 30, 1 1))'), ST_GeomFromText('POLYGON((0 0,30 5,10 40, 0 0))')); 1 ST_Within(ST_GeomFromText('POLYGON((1 1,20 10,10 30, 1 1))'), ST_GeomFromText('POLYGON((0 0,30 5,10 40, 0 0))')) 1 1 create table t1 (g point)engine=innodb; insert into t1 values (ST_GeomFromText('POINT(2 2)')), (ST_GeomFromText('POINT(2 4)')), (ST_GeomFromText('POINT(2 6)')), (ST_GeomFromText('POINT(2 8)')), (ST_GeomFromText('POINT(4 2)')), (ST_GeomFromText('POINT(4 4)')), (ST_GeomFromText('POINT(4 6)')), (ST_GeomFromText('POINT(4 8)')), (ST_GeomFromText('POINT(6 2)')), (ST_GeomFromText('POINT(6 4)')), (ST_GeomFromText('POINT(6 6)')), (ST_GeomFromText('POINT(6 8)')), (ST_GeomFromText('POINT(8 2)')), (ST_GeomFromText('POINT(8 4)')), (ST_GeomFromText('POINT(8 6)')), (ST_GeomFromText('POINT(8 8)')); select ST_astext(g) from t1 where ST_Within(g, ST_GeomFromText('POLYGON((5 1, 7 1, 7 7, 5 7, 3 3, 5 3, 5 1))')); ST_astext(g) POINT(4 4) POINT(6 2) POINT(6 4) POINT(6 6) select 'Contains'; Contains Contains select ST_astext(g) from t1 where ST_Contains(ST_GeomFromText('POLYGON((5 1, 7 1, 7 7, 5 7, 3 3, 5 3, 5 1))'), g); ST_astext(g) POINT(4 4) POINT(6 2) POINT(6 4) POINT(6 6) select 'Intersects'; Intersects Intersects select ST_astext(g) from t1 where ST_Intersects(ST_GeomFromText('POLYGON((5 1, 7 1, 7 7, 5 7, 3 3, 5 3, 5 1))'), g); ST_astext(g) POINT(4 4) POINT(6 2) POINT(6 4) POINT(6 6) select 'Contains'; Contains Contains select ST_astext(g) from t1 where ST_Contains(ST_GeomFromText('POLYGON((5 1, 7 1, 7 7, 5 7, 3 3, 5 3, 5 1))'), g); ST_astext(g) POINT(4 4) POINT(6 2) POINT(6 4) POINT(6 6) select 'Contains2'; Contains2 Contains2 select ST_astext(g) from t1 where ST_Contains(ST_GeomFromText('POLYGON((5 1, 7 1, 7 7, 5 7, 3 3, 5 3, 5 1), (5.01 3.01, 6 5, 9 5, 8 3, 5.01 3.01))'), g); ST_astext(g) POINT(4 4) POINT(6 2) POINT(6 6) POINT(8 4) DROP TABLE t1; select 0, ST_Within(ST_GeomFromText('LINESTRING(15 15, 50 50, 60 60)'), ST_GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))')); 0 ST_Within(ST_GeomFromText('LINESTRING(15 15, 50 50, 60 60)'), ST_GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))')) 0 0 select 1, ST_Within(ST_GeomFromText('LINESTRING(15 15, 16 16)'), ST_GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))')); 1 ST_Within(ST_GeomFromText('LINESTRING(15 15, 16 16)'), ST_GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))')) 1 1 select 1, ST_Intersects(ST_GeomFromText('LINESTRING(15 15, 50 50)'), ST_GeomFromText('LINESTRING(50 15, 15 50)')); 1 ST_Intersects(ST_GeomFromText('LINESTRING(15 15, 50 50)'), ST_GeomFromText('LINESTRING(50 15, 15 50)')) 1 1 select 1, ST_Intersects(ST_GeomFromText('LINESTRING(15 15, 50 50)'), ST_GeomFromText('LINESTRING(16 16, 51 51)')); 1 ST_Intersects(ST_GeomFromText('LINESTRING(15 15, 50 50)'), ST_GeomFromText('LINESTRING(16 16, 51 51)')) 1 1 select 1, ST_Intersects(ST_GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), ST_GeomFromText('POLYGON((50 5, 55 10, 0 45, 50 5))')); 1 ST_Intersects(ST_GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), ST_GeomFromText('POLYGON((50 5, 55 10, 0 45, 50 5))')) 1 1 select ST_astext(ST_Union(ST_geometryfromtext('point(1 1)'), ST_geometryfromtext('polygon((0 0, 2 0, 1 2, 0 0))'))); ST_astext(ST_Union(ST_geometryfromtext('point(1 1)'), ST_geometryfromtext('polygon((0 0, 2 0, 1 2, 0 0))'))) POLYGON((0 0,1 2,2 0,0 0)) select ST_astext(ST_Intersection(ST_geometryfromtext('point(1 1)'), ST_geometryfromtext('polygon((0 0, 2 0, 1 2, 0 0))'))); ST_astext(ST_Intersection(ST_geometryfromtext('point(1 1)'), ST_geometryfromtext('polygon((0 0, 2 0, 1 2, 0 0))'))) POINT(1 1) select ST_Intersects(ST_GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), ST_GeomFromText('POLYGON((50 5, 55 10, 0 45, 50 5))')); ST_Intersects(ST_GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), ST_GeomFromText('POLYGON((50 5, 55 10, 0 45, 50 5))')) 1 select ST_contains(ST_GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)), ((6 6, 6 11, 11 11, 11 6, 6 6)))'), ST_GeomFromText('POINT(5 10)')); ST_contains(ST_GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)), ((6 6, 6 11, 11 11, 11 6, 6 6)))'), ST_GeomFromText('POINT(5 10)')) 0 select ST_Disjoint(ST_GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'), ST_GeomFromText('POLYGON((10 10, 10 15, 15 15, 15 10, 10 10))')); ST_Disjoint(ST_GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'), ST_GeomFromText('POLYGON((10 10, 10 15, 15 15, 15 10, 10 10))')) 1 select ST_Disjoint(ST_GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'), ST_GeomFromText('POLYGON((10 10, 10 4, 4 4, 4 10, 10 10))')); ST_Disjoint(ST_GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'), ST_GeomFromText('POLYGON((10 10, 10 4, 4 4, 4 10, 10 10))')) 0 select ST_Overlaps(ST_GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'), ST_GeomFromText('POLYGON((10 10, 10 4, 4 4, 4 10, 10 10))')); ST_Overlaps(ST_GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'), ST_GeomFromText('POLYGON((10 10, 10 4, 4 4, 4 10, 10 10))')) 1 select ST_Overlaps(ST_GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'), ST_GeomFromText('POLYGON((1 1, 1 4, 4 4, 4 1, 1 1))')); ST_Overlaps(ST_GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'), ST_GeomFromText('POLYGON((1 1, 1 4, 4 4, 4 1, 1 1))')) 0 select ST_DISTANCE(ST_geomfromtext('polygon((0 0, 1 2, 2 1, 0 0))'), ST_geomfromtext('polygon((2 2, 3 4, 4 3, 2 2))')); ST_DISTANCE(ST_geomfromtext('polygon((0 0, 1 2, 2 1, 0 0))'), ST_geomfromtext('polygon((2 2, 3 4, 4 3, 2 2))')) 0.7071067811865475 select ST_DISTANCE(ST_geomfromtext('polygon((0 0, 1 2, 2 1, 0 0))'), ST_geomfromtext('linestring(0 1, 1 0)')); ST_DISTANCE(ST_geomfromtext('polygon((0 0, 1 2, 2 1, 0 0))'), ST_geomfromtext('linestring(0 1, 1 0)')) 0 select ST_DISTANCE(ST_geomfromtext('polygon((0 0, 3 6, 6 3, 0 0))'), ST_geomfromtext('polygon((2 2, 3 4, 4 3, 2 2))')); ST_DISTANCE(ST_geomfromtext('polygon((0 0, 3 6, 6 3, 0 0))'), ST_geomfromtext('polygon((2 2, 3 4, 4 3, 2 2))')) 0 select ST_DISTANCE(ST_geomfromtext('polygon((0 0, 3 6, 6 3, 0 0),(2 2, 3 4, 4 3, 2 2))'), ST_geomfromtext('point(3 3)')); ST_DISTANCE(ST_geomfromtext('polygon((0 0, 3 6, 6 3, 0 0),(2 2, 3 4, 4 3, 2 2))'), ST_geomfromtext('point(3 3)')) 0.4472135954999579 select ST_DISTANCE(ST_geomfromtext('linestring(0 0, 3 6, 6 3, 0 0)'), ST_geomfromtext('polygon((2 2, 3 4, 4 3, 2 2))')); ST_DISTANCE(ST_geomfromtext('linestring(0 0, 3 6, 6 3, 0 0)'), ST_geomfromtext('polygon((2 2, 3 4, 4 3, 2 2))')) 0.8944271909999159 select ST_astext(ST_Intersection(ST_GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), ST_GeomFromText('POLYGON((50 5, 55 10, 0 45, 50 5))'))); ST_astext(ST_Intersection(ST_GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), ST_GeomFromText('POLYGON((50 5, 55 10, 0 45, 50 5))'))) POLYGON((26.47058823529412 23.823529411764707,21.951219512195124 27.439024390243905,23.855421686746986 29.819277108433734,29.289940828402365 26.36094674556213,26.47058823529412 23.823529411764707)) select ST_astext(ST_Intersection(ST_GeomFromText('LINESTRING(0 0, 50 45, 40 50, 0 0)'), ST_GeomFromText('LINESTRING(50 5, 55 10, 0 45, 50 5)'))); ST_astext(ST_Intersection(ST_GeomFromText('LINESTRING(0 0, 50 45, 40 50, 0 0)'), ST_GeomFromText('LINESTRING(50 5, 55 10, 0 45, 50 5)'))) MULTIPOINT(26.47058823529412 23.823529411764707,29.289940828402365 26.36094674556213,21.951219512195124 27.439024390243905,23.855421686746986 29.819277108433734) select ST_astext(ST_Intersection(ST_GeomFromText('LINESTRING(0 0, 50 45, 40 50)'), ST_GeomFromText('LINESTRING(50 5, 55 10, 0 45)'))); ST_astext(ST_Intersection(ST_GeomFromText('LINESTRING(0 0, 50 45, 40 50)'), ST_GeomFromText('LINESTRING(50 5, 55 10, 0 45)'))) POINT(29.289940828402365 26.36094674556213) select ST_astext(ST_Intersection(ST_GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), ST_GeomFromText('POINT(20 20)'))); ST_astext(ST_Intersection(ST_GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), ST_GeomFromText('POINT(20 20)'))) POINT(20 20) select ST_astext(ST_Intersection(ST_GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), ST_GeomFromText('LINESTRING(-10 -10, 200 200)'))); ST_astext(ST_Intersection(ST_GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), ST_GeomFromText('LINESTRING(-10 -10, 200 200)'))) LINESTRING(0 0,46.666666666666664 46.666666666666664) select ST_astext(ST_Intersection(ST_GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), ST_GeomFromText('LINESTRING(-10 -10, 200 200, 199 201, -11 -9)'))); ST_astext(ST_Intersection(ST_GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), ST_GeomFromText('LINESTRING(-10 -10, 200 200, 199 201, -11 -9)'))) MULTILINESTRING((0 0,46.666666666666664 46.666666666666664),(8 10,45.33333333333333 47.33333333333333)) select ST_astext(ST_UNION(ST_GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), ST_GeomFromText('LINESTRING(-10 -10, 200 200, 199 201, -11 -9)'))); ST_astext(ST_UNION(ST_GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), ST_GeomFromText('LINESTRING(-10 -10, 200 200, 199 201, -11 -9)'))) GEOMETRYCOLLECTION(LINESTRING(-10 -10,0 0),LINESTRING(-11 -9,8 10),POLYGON((0 0,40 50,50 45,0 0)),LINESTRING(46.666666666666664 46.666666666666664,200 200,199 201,45.33333333333333 47.33333333333333)) select ST_astext(ST_intersection(ST_geomfromtext('polygon((0 0, 1 0, 0 1, 0 0))'), ST_geomfromtext('polygon((0 0, 1 1, 0 2, 0 0))'))); ST_astext(ST_intersection(ST_geomfromtext('polygon((0 0, 1 0, 0 1, 0 0))'), ST_geomfromtext('polygon((0 0, 1 1, 0 2, 0 0))'))) POLYGON((0 0,0 1,0.5 0.5,0 0)) select ST_astext(ST_symdifference(ST_geomfromtext('polygon((0 0, 1 0, 0 1, 0 0))'), ST_geomfromtext('polygon((0 0, 1 1, 0 2, 0 0))'))); ST_astext(ST_symdifference(ST_geomfromtext('polygon((0 0, 1 0, 0 1, 0 0))'), ST_geomfromtext('polygon((0 0, 1 1, 0 2, 0 0))'))) MULTIPOLYGON(((0 0,0.5 0.5,1 0,0 0)),((0.5 0.5,0 1,0 2,1 1,0.5 0.5))) select ST_astext(ST_UNION(ST_GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), ST_GeomFromText('LINESTRING(-10 -10, 200 200, 199 201, -11 -9)'))); ST_astext(ST_UNION(ST_GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), ST_GeomFromText('LINESTRING(-10 -10, 200 200, 199 201, -11 -9)'))) GEOMETRYCOLLECTION(LINESTRING(-10 -10,0 0),LINESTRING(-11 -9,8 10),POLYGON((0 0,40 50,50 45,0 0)),LINESTRING(46.666666666666664 46.666666666666664,200 200,199 201,45.33333333333333 47.33333333333333)) select ST_astext(ST_buffer(ST_geometryfromtext('point(1 1)'), 1)); ST_astext(ST_buffer(ST_geometryfromtext('point(1 1)'), 1)) POLYGON((1 0,0.9509 0.0012,0.9019 0.0048,0.8532 0.0108,0.8049 0.0192,0.7570 0.0299,0.7097 0.0430,0.6631 0.0584,0.6173 0.0761,0.5724 0.0960,0.5286 0.1180,0.4858 0.1422,0.4444 0.1685,0.4043 0.1967,0.3656 0.2269,0.3284 0.2590,0.2928 0.2928,0.2590 0.3284,0.2269 0.3656,0.1967 0.4043,0.1685 0.4444,0.1422 0.4858,0.1180 0.5286,0.0960 0.5724,0.0761 0.6173,0.0584 0.6631,0.0430 0.7097,0.0299 0.7570,0.0192 0.8049,0.0108 0.8532,0.0048 0.9019,0.0012 0.9509,0 1,0.0048 1.0980,0.0108 1.1467,0.0192 1.1950,0.0299 1.2429,0.0430 1.2902,0.0584 1.3368,0.0761 1.3826,0.0960 1.4275,0.1180 1.4713,0.1422 1.5141,0.1685 1.5555,0.1967 1.5956,0.2269 1.6343,0.2590 1.6715,0.2928 1.7071,0.3284 1.7409,0.3656 1.7730,0.4043 1.8032,0.4444 1.8314,0.4858 1.8577,0.5286 1.8819,0.5724 1.9039,0.6173 1.9238,0.6631 1.9415,0.7097 1.9569,0.7570 1.9700,0.8049 1.9807,0.8532 1.9891,0.9019 1.9951,0.9509 1.9987,1 2,1.0490 1.9987,1.0980 1.9951,1.1467 1.9891,1.1950 1.9807,1.2429 1.9700,1.2902 1.9569,1.3368 1.9415,1.3826 1.9238,1.4275 1.9039,1.4713 1.8819,1.5141 1.8577,1.5555 1.8314,1.5956 1.8032,1.6343 1.7730,1.6715 1.7409,1.7071 1.7071,1.7409 1.6715,1.7730 1.6343,1.8032 1.5956,1.8314 1.5555,1.8577 1.5141,1.8819 1.4713,1.9039 1.4275,1.9238 1.3826,1.9415 1.3368,1.9569 1.2902,1.9700 1.2429,1.9807 1.1950,1.9891 1.1467,1.9951 1.0980,1.9987 1.0490,2 1,1.9951 0.9019,1.9891 0.8532,1.9807 0.8049,1.9700 0.7570,1.9569 0.7097,1.9415 0.6631,1.9238 0.6173,1.9039 0.5724,1.8819 0.5286,1.8577 0.4858,1.8314 0.4444,1.8032 0.4043,1.7730 0.3656,1.7409 0.3284,1.7071 0.2928,1.6715 0.2590,1.6343 0.2269,1.5956 0.1967,1.5555 0.1685,1.5141 0.1422,1.4713 0.1180,1.4275 0.0960,1.3826 0.0761,1.3368 0.0584,1.2902 0.0430,1.2429 0.0299,1.1950 0.0192,1.1467 0.0108,1.0980 0.0048,1.0490 0.0012,1 0)) create table t1(geom geometrycollection)engine=innodb; select ST_astext(geom), ST_area(geom),ST_area(ST_buffer(geom,2)) from t1; ST_astext(geom) ST_area(geom) ST_area(ST_buffer(geom,2)) select ST_NUMPOINTS(ST_EXTERIORRING(ST_buffer(geom,2))) from t1; ST_NUMPOINTS(ST_EXTERIORRING(ST_buffer(geom,2))) set @geom=ST_geomfromtext('LINESTRING(2 1, 4 2, 2 3, 2 5)'); set @buff=ST_buffer(@geom,1); select ST_NUMPOINTS(ST_EXTERIORRING(@buff)) from t1; ST_NUMPOINTS(ST_EXTERIORRING(@buff)) DROP TABLE t1; select st_touches(ST_geomfromtext('point(0 0)'), ST_geomfromtext('point(1 1)')); st_touches(ST_geomfromtext('point(0 0)'), ST_geomfromtext('point(1 1)')) 0 select st_touches(ST_geomfromtext('point(1 1)'), ST_geomfromtext('point(1 1)')); st_touches(ST_geomfromtext('point(1 1)'), ST_geomfromtext('point(1 1)')) 0 select st_touches(ST_geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), ST_geomfromtext('point(1 1)')); st_touches(ST_geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), ST_geomfromtext('point(1 1)')) 1 select st_touches(ST_geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), ST_geomfromtext('point(1 0)')); st_touches(ST_geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), ST_geomfromtext('point(1 0)')) 0 select st_touches(ST_geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), ST_geomfromtext('point(1 2)')); st_touches(ST_geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), ST_geomfromtext('point(1 2)')) 0 select st_touches(ST_geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), ST_geomfromtext('polygon((1 1.2, 1 0, 2 0, 1 1.2))')); st_touches(ST_geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), ST_geomfromtext('polygon((1 1.2, 1 0, 2 0, 1 1.2))')) 0 select st_touches(ST_geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), ST_geomfromtext('polygon((1 1, 1 0, 2 0, 1 1))')); st_touches(ST_geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), ST_geomfromtext('polygon((1 1, 1 0, 2 0, 1 1))')) 1 SELECT ST_Equals(ST_PolyFromText('POLYGON((67 13, 67 18, 67 18, 59 18, 59 13, 67 13) )'),ST_PolyFromText('POLYGON((67 13, 67 18, 59 19, 59 13, 59 13, 67 13) )')) as result; result 0 SELECT ST_Equals(ST_PolyFromText('POLYGON((67 13, 67 18, 67 18, 59 18, 59 13, 67 13) )'),ST_PolyFromText('POLYGON((67 13, 67 18, 59 18, 59 13, 59 13, 67 13) )')) as result; result 1 SELECT ST_Equals(ST_PointFromText('POINT (12 13)'),ST_PointFromText('POINT (12 13)')) as result; result 1 # # BUG#11755628/47429: INTERSECTION FUNCTION CRASHED MYSQLD # BUG#11759650/51979: UNION/INTERSECTION OF POLYGONS CRASHES MYSQL # SELECT ST_ASTEXT(ST_UNION(ST_GEOMFROMTEXT('POLYGON((525000 183300,525400 183300,525400 18370, 525000 183700,525000 183300))'), ST_geomfromtext('POLYGON((525298.67 183511.53,525296.57 183510.39,525296.42 183510.31,525289.11 183506.62,525283.17 183503.47,525280.98 183502.26,525278.63 183500.97,525278.39 183500.84,525276.79 183500,525260.7 183491.55,525263.95 183484.75,525265.58 183481.95,525278.97 183488.73,525276.5 183493.45,525275.5 183495.7,525280.35 183498.2,525282.3 183499.1,525282.2 183499.3,525283.55 183500,525301.75 183509.35,525304.45 183504.25,525307.85 183504.95,525304.5 183510.83,525302.81 183513.8,525298.67 183511.53),(525275.06 183489.89,525272.06 183488.37,525268.94 183494.51,525271.94 183496.03,525275.06 183489.89),(525263.26 183491.55,525266.15 183493.04,525269.88 183485.82,525266.99 183484.33,525263.26 183491.55))'))) st_u; st_u MULTIPOLYGON(((525400 18370,525000.9677614468 183300,525400 183300,525400 18370)),((525000 183300,525000 183700,525000.9677614468 183300,525000 183300)),((525265.58 183481.95,525263.95 183484.75,525260.7 183491.55,525276.79 183500,525278.39 183500.84,525278.63 183500.97,525280.98 183502.26,525283.17 183503.47,525289.11 183506.62,525296.42 183510.31,525296.57 183510.39,525298.67 183511.53,525302.81 183513.8,525304.5 183510.83,525307.85 183504.95,525304.45 183504.25,525301.75 183509.35,525283.55 183500,525282.2 183499.3,525282.3 183499.1,525280.35 183498.2,525275.5 183495.7,525276.5 183493.45,525278.97 183488.73,525265.58 183481.95),(525266.99 183484.33,525263.26 183491.55,525266.15 183493.04,525269.88 183485.82,525266.99 183484.33),(525272.06 183488.37,525268.94 183494.51,525271.94 183496.03,525275.06 183489.89,525272.06 183488.37))) SET @a=0x0000000001030000000200000005000000000000000000000000000000000000000000000000002440000000000000000000000000000024400000000000002440000000000000000000000000000024400000000000000000000000000000000000000000000000000000F03F000000000000F03F0000000000000040000000000000F03F00000000000000400000000000000040000000000000F03F0000000000000040000000000000F03F000000000000F03F; SELECT ST_ASTEXT(ST_TOUCHES(@a, ST_GEOMFROMTEXT('point(0 0)'))) t; ERROR HY000: Illegal parameter data type boolean for operation 'st_astext' DROP TABLE IF EXISTS p1; CREATE PROCEDURE p1(dist DOUBLE, geom TEXT) BEGIN DECLARE g GEOMETRY; SET g=GeomFromText(geom); SELECT geom AS `-----`; SELECT dist, GeometryType(@buf:=ST_Buffer(g, dist)) AS `buffer`, ROUND(ST_AREA(@buf),2) AS buf_area; END| # # Testing ST_BUFFER with positive distance # ----- POINT(0 0)) dist buffer buf_area 1 POLYGON 3.14 ----- LineString(0 1, 1 1)) dist buffer buf_area 1 POLYGON 5.14 ----- LineString(9 9,8 1,1 5,0 0) dist buffer buf_area 1 POLYGON 44.63 ----- Polygon((2 2,2 8,8 8,8 2,2 2)) dist buffer buf_area 1 POLYGON 63.14 ----- Polygon((0 0,0 8,8 8,8 0,0 0),(2 2,6 2,6 6,2 6,2 2)) dist buffer buf_area 1 POLYGON 95.14 ----- Polygon((0 0, 0 8, 8 8, 8 10, -10 10, -10 0, 0 0)) dist buffer buf_area 1 POLYGON 174.93 ----- MultiPoint(9 9,8 1,1 5) dist buffer buf_area 1 MULTIPOLYGON 9.42 ----- MultiLineString((0 0,2 2)) dist buffer buf_area 1 POLYGON 8.80 ----- MultiLineString((0 0,2 2,0 4)) dist buffer buf_area 1 POLYGON 14.24 ----- MultiLineString((0 0,2 2),(0 2,2 0)) dist buffer buf_area 1 POLYGON 13.59 ----- MultiLineString((2 2,2 8,-2 8),(-6 -6, 6 6),(10 10, 14 14)) dist buffer buf_area 1 MULTIPOLYGON 70.06 ----- MultiPolygon(((2 2,2 8,8 8,8 2,2 2)), ((9 9,8 1,1 5,9 9))) dist buffer buf_area 1 POLYGON 73.18 ----- MultiPolygon(((2 2,2 8,8 8,8 2,2 2), (4 4,4 6,6 6,6 4,4 4)),((9 9,8 1,1 5,9 9))) dist buffer buf_area 1 POLYGON 73.18 ----- GeometryCollection(Point(0 0)) dist buffer buf_area 1 POLYGON 3.14 ----- GeometryCollection(LineString(0 0, 2 2))) dist buffer buf_area 1 POLYGON 8.80 ----- GeometryCollection(Polygon((2 2,2 8,8 8,8 2,2 2)))) dist buffer buf_area 1 POLYGON 63.14 ----- GeometryCollection(MultiPoint(9 9,8 1,1 5)) dist buffer buf_area 1 MULTIPOLYGON 9.42 ----- GeometryCollection(MultiLineString((0 0,0 1),(3 0,3 1))) dist buffer buf_area 1 MULTIPOLYGON 10.28 ----- GeometryCollection(MultiPolygon(((0 0, 3 0, 3 3, 0 3, 0 0)),((6 6,6 9,9 9,9 6,6 6)))) dist buffer buf_area 1 MULTIPOLYGON 48.28 ----- GeometryCollection(Point(9 9),LineString(1 5,0 0),Polygon((2 2,2 8,8 8,8 2,2 2))) dist buffer buf_area 1 POLYGON 75.92 # # Testing ST_BUFFER with zero distance # ----- POINT(0 0)) dist buffer buf_area 0 POINT 0.00 ----- LineString(0 1, 1 1)) dist buffer buf_area 0 LINESTRING 0.00 ----- LineString(9 9,8 1,1 5,0 0) dist buffer buf_area 0 LINESTRING 0.00 ----- Polygon((2 2,2 8,8 8,8 2,2 2)) dist buffer buf_area 0 POLYGON 36.00 ----- Polygon((0 0,0 8,8 8,8 0,0 0),(2 2,6 2,6 6,2 6,2 2)) dist buffer buf_area 0 POLYGON 48.00 ----- Polygon((0 0, 0 8, 8 8, 8 10, -10 10, -10 0, 0 0)) dist buffer buf_area 0 POLYGON 116.00 ----- MultiPoint(9 9,8 1,1 5) dist buffer buf_area 0 MULTIPOINT NULL ----- MultiLineString((0 0,2 2)) dist buffer buf_area 0 MULTILINESTRING NULL ----- MultiLineString((0 0,2 2,0 4)) dist buffer buf_area 0 MULTILINESTRING NULL ----- MultiLineString((0 0,2 2),(0 2,2 0)) dist buffer buf_area 0 MULTILINESTRING NULL ----- MultiLineString((2 2,2 8,-2 8),(-6 -6, 6 6),(10 10, 14 14)) dist buffer buf_area 0 MULTILINESTRING NULL ----- MultiPolygon(((2 2,2 8,8 8,8 2,2 2)), ((9 9,8 1,1 5,9 9))) dist buffer buf_area 0 MULTIPOLYGON 66.00 ----- MultiPolygon(((2 2,2 8,8 8,8 2,2 2), (4 4,4 6,6 6,6 4,4 4)),((9 9,8 1,1 5,9 9))) dist buffer buf_area 0 MULTIPOLYGON 62.00 ----- GeometryCollection(Point(0 0)) dist buffer buf_area 0 GEOMETRYCOLLECTION 0.00 ----- GeometryCollection(LineString(0 0, 2 2))) dist buffer buf_area 0 GEOMETRYCOLLECTION 0.00 ----- GeometryCollection(Polygon((2 2,2 8,8 8,8 2,2 2)))) dist buffer buf_area 0 GEOMETRYCOLLECTION 36.00 ----- GeometryCollection(MultiPoint(9 9,8 1,1 5)) dist buffer buf_area 0 GEOMETRYCOLLECTION NULL ----- GeometryCollection(MultiLineString((0 0,0 1),(3 0,3 1))) dist buffer buf_area 0 GEOMETRYCOLLECTION NULL ----- GeometryCollection(MultiPolygon(((0 0, 3 0, 3 3, 0 3, 0 0)),((6 6,6 9,9 9,9 6,6 6)))) dist buffer buf_area 0 GEOMETRYCOLLECTION 18.00 ----- GeometryCollection(Point(9 9),LineString(1 5,0 0),Polygon((2 2,2 8,8 8,8 2,2 2))) dist buffer buf_area 0 GEOMETRYCOLLECTION 36.00 # # Testing ST_BUFFER with negative distance # ----- POINT(0 0)) dist buffer buf_area -1 GEOMETRYCOLLECTION 0.00 ----- LineString(0 1, 1 1)) dist buffer buf_area -1 GEOMETRYCOLLECTION 0.00 ----- LineString(9 9,8 1,1 5,0 0) dist buffer buf_area -1 GEOMETRYCOLLECTION 0.00 ----- Polygon((2 2,2 8,8 8,8 2,2 2)) dist buffer buf_area -1 POLYGON 16.00 ----- MultiPoint(9 9,8 1,1 5) dist buffer buf_area -1 GEOMETRYCOLLECTION 0.00 ----- MultiLineString((0 0,2 2)) dist buffer buf_area -1 GEOMETRYCOLLECTION 0.00 ----- MultiLineString((0 0,2 2,0 4)) dist buffer buf_area -1 GEOMETRYCOLLECTION 0.00 ----- MultiLineString((0 0,2 2),(0 2,2 0)) dist buffer buf_area -1 GEOMETRYCOLLECTION 0.00 ----- MultiLineString((2 2,2 8,-2 8),(-6 -6, 6 6),(10 10, 14 14)) dist buffer buf_area -1 GEOMETRYCOLLECTION 0.00 ----- GeometryCollection(Point(0 0)) dist buffer buf_area -1 GEOMETRYCOLLECTION 0.00 ----- GeometryCollection(LineString(0 0, 2 2))) dist buffer buf_area -1 GEOMETRYCOLLECTION 0.00 ----- GeometryCollection(Polygon((2 2,2 8,8 8,8 2,2 2)))) dist buffer buf_area -1 POLYGON 16.00 ----- GeometryCollection(MultiPoint(9 9,8 1,1 5)) dist buffer buf_area -1 GEOMETRYCOLLECTION 0.00 ----- GeometryCollection(MultiLineString((0 0,0 1),(3 0,3 1))) dist buffer buf_area -1 GEOMETRYCOLLECTION 0.00 ----- GeometryCollection(Point(9 9),LineString(1 5,0 0),Polygon((2 2,2 8,8 8,8 2,2 2))) dist buffer buf_area -1 POLYGON 16.00 SELECT ST_CONTAINS( GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)),((6 6, 6 11, 11 11, 11 6, 6 6)))'), GeomFromText('POINT(5 10)')); ST_CONTAINS( GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)),((6 6, 6 11, 11 11, 11 6, 6 6)))'), GeomFromText('POINT(5 10)')) 0 SELECT AsText(ST_UNION( GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)),((6 6, 6 11, 11 11, 11 6, 6 6)))'), GeomFromText('POINT(5 10)'))); AsText(ST_UNION( GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)),((6 6, 6 11, 11 11, 11 6, 6 6)))'), GeomFromText('POINT(5 10)'))) GEOMETRYCOLLECTION(POLYGON((0 0,0 5,5 5,5 0,0 0)),POLYGON((6 6,6 11,11 11,11 6,6 6)),POINT(5 10)) DROP PROCEDURE p1; # # Bug #13833019 ASSERTION `T1->RESULT_RANGE' FAILED IN GCALC_OPERATION_REDUCER::END_COUPLE # SELECT GeometryType(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((0 0,9 4,3 3,0 0)),((2 2,2 2,8 8,2 3,2 2)))'), 3)); GeometryType(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((0 0,9 4,3 3,0 0)),((2 2,2 2,8 8,2 3,2 2)))'), 3)) POLYGON # # Bug #13832749 HANDLE_FATAL_SIGNAL IN GCALC_FUNCTION::COUNT_INTERNAL # SELECT GeometryType(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5)),((2 2,2 8,8 8,8 2,2 2), (4 4,4 6,6 6,6 4,4 4)), ((9 9,8 1,1 5,9 9)))'),1)); GeometryType(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5)),((2 2,2 8,8 8,8 2,2 2), (4 4,4 6,6 6,6 4,4 4)), ((9 9,8 1,1 5,9 9)))'),1)) POLYGON # # Bug#13358363 - ASSERTION: N > 0 && N < SINUSES_CALCULATED*2+1 | GET_N_SINCOS/ADD_EDGE_BUFFER # DO ST_BUFFER(ST_GEOMCOLLFROMTEXT('linestring(1 1,2 2)'),''); Warnings: Warning 1292 Truncated incorrect DOUBLE value: '' SELECT ST_WITHIN( LINESTRINGFROMTEXT(' LINESTRING(3 8,9 2,3 8,3 3,7 6,4 7,4 7,8 1) '), ST_BUFFER(MULTIPOLYGONFROMTEXT(' MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5)),((2 2,2 8,8 8,8 2,2 2),(4 4,4 6,6 6,6 4,4 4)),((0 5,3 5,3 2,1 2,1 1,3 1,3 0,0 0,0 3,2 3,2 4,0 4,0 5))) '), ST_NUMINTERIORRINGS(POLYGONFROMTEXT('POLYGON((3 5,2 4,2 5,3 5)) ')))); ST_WITHIN( LINESTRINGFROMTEXT(' LINESTRING(3 8,9 2,3 8,3 3,7 6,4 7,4 7,8 1) '), ST_BUFFER(MULTIPOLYGONFROMTEXT(' MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5)),((2 2,2 8,8 8,8 2,2 2),(4 4,4 6,6 6,6 4,4 4)),((0 5,3 5,3 2,1 2,1 1,3 1,3 0,0 0,0 3,2 3,2 4,0 4,0 5))) ') 0 SELECT ST_DIMENSION(ST_BUFFER(POLYGONFROMTEXT(' POLYGON((3 5,2 5,2 4,3 4,3 5)) '), ST_NUMINTERIORRINGS(POLYGONFROMTEXT(' POLYGON((0 0,9 3,4 2,0 0))')))); ST_DIMENSION(ST_BUFFER(POLYGONFROMTEXT(' POLYGON((3 5,2 5,2 4,3 4,3 5)) '), ST_NUMINTERIORRINGS(POLYGONFROMTEXT(' POLYGON((0 0,9 3,4 2,0 0))')))) 2 SELECT ST_NUMINTERIORRINGS( ST_ENVELOPE(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5))) '), SRID(MULTILINESTRINGFROMTEXT('MULTILINESTRING((2 2,4 2,1 2,2 4,2 2)) '))))); ST_NUMINTERIORRINGS( ST_ENVELOPE(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5))) '), SRID(MULTILINESTRINGFROMTEXT('MULTILINESTRING((2 2,4 2,1 2,2 4,2 2)) '))))) 0 SELECT ASTEXT(ST_BUFFER(POLYGONFROMTEXT(' POLYGON((9 9,5 2,4 5,9 9))'), SRID(GEOMETRYFROMTEXT(' MULTIPOINT(8 4,5 0,7 8,6 9,3 4,7 3,5 5) ')))); ASTEXT(ST_BUFFER(POLYGONFROMTEXT(' POLYGON((9 9,5 2,4 5,9 9))'), SRID(GEOMETRYFROMTEXT(' MULTIPOINT(8 4,5 0,7 8,6 9,3 4,7 3,5 5) ')))) POLYGON((9 9,5 2,4 5,9 9))