Current Path : /home/usr.opt/mysql57/mysql-test/suite/gis/r/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : //home/usr.opt/mysql57/mysql-test/suite/gis/r/spatial_analysis_functions_convexhull.result |
# Creating the spatial Geometry object USE test; 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 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_CONVEXHULL(point) ##################################################################################### SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT(@star_center))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT(@star_center))) POINT(15 10) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT(@star_top))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT(@star_top))) POINT(15 25) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('POINT(-0 0)'))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('POINT(-0 0)'))) POINT(-0 0) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('POINT(2.34 -2.34)'))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('POINT(2.34 -2.34)'))) POINT(2.34 -2.34) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('POINT(1e308 -1e308)'))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('POINT(1e308 -1e308)'))) POINT(1e308 -1e308) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('POINT(-0.0000 0.000001)'))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('POINT(-0.0000 0.000001)'))) POINT(-0 0.000001) SELECT ST_ASTEXT(ST_CONVEXHULL(g)) FROM gis_geometrycollection WHERE fid=105; ST_ASTEXT(ST_CONVEXHULL(g)) POINT(15 10) ##################################################################################### # ST_CONVEXHULL(multipoint) ##################################################################################### SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT(@star_all_points))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT(@star_all_points))) POLYGON((5 0,25 0,15 25,5 0)) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT(@star_bottom_points))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT(@star_bottom_points))) LINESTRING(5 0,25 0) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('MULTIPOINT(0 0,0 0,0 0,0 0)'))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('MULTIPOINT(0 0,0 0,0 0,0 0)'))) POINT(0 0) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('MULTIPOINT(0 0,0 5,5 5,5 0,0 0)'))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('MULTIPOINT(0 0,0 5,5 5,5 0,0 0)'))) POLYGON((0 0,5 0,5 5,0 5,0 0)) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('MULTIPOINT(1 -1,1000 -1000,0.0001 0.000)'))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('MULTIPOINT(1 -1,1000 -1000,0.0001 0.000)'))) POLYGON((0.0001 0,1 -1,1000 -1000,0.0001 0)) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('MULTIPOINT(5 -3,0 2,5 7,10 2,10 0,10 -2)'))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('MULTIPOINT(5 -3,0 2,5 7,10 2,10 0,10 -2)'))) POLYGON((0 2,5 -3,10 -2,10 2,5 7,0 2)) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('MULTIPOINT(5 0,0 5,5 10,10 5,10 -5)'))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('MULTIPOINT(5 0,0 5,5 10,10 5,10 -5)'))) POLYGON((0 5,10 -5,10 5,5 10,0 5)) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('MULTIPOINT(2 -5,2 5,8 5,8 2,8 0)'))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('MULTIPOINT(2 -5,2 5,8 5,8 2,8 0)'))) POLYGON((2 -5,8 0,8 5,2 5,2 -5)) Select ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('MULTIPOINT(5 0,25 0,15 10,15 25)'))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('MULTIPOINT(5 0,25 0,15 10,15 25)'))) POLYGON((5 0,25 0,15 25,5 0)) SELECT ST_ASTEXT(ST_CONVEXHULL(g)) FROM gis_geometrycollection WHERE fid=108; ST_ASTEXT(ST_CONVEXHULL(g)) LINESTRING(5 0,25 0) ##################################################################################### # ST_CONVEXHULL(linestring) ##################################################################################### SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT(@star_top_to_center))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT(@star_top_to_center))) LINESTRING(15 10,15 25) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT(@star_line_horizontal))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT(@star_line_horizontal))) LINESTRING(10 15,20 15) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('LINESTRING(0 0,-0.00 0,0.0 0)'))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('LINESTRING(0 0,-0.00 0,0.0 0)'))) POINT(0 0) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('LINESTRING(0 0,0 5,5 5,5 0,0 0)'))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('LINESTRING(0 0,0 5,5 5,5 0,0 0)'))) POLYGON((0 0,5 0,5 5,0 5,0 0)) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('LINESTRING(1 -1,1000 -1000,0.0001 0.000)'))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('LINESTRING(1 -1,1000 -1000,0.0001 0.000)'))) POLYGON((0.0001 0,1 -1,1000 -1000,0.0001 0)) SELECT ST_ASTEXT(ST_CONVEXHULL(g)) FROM gis_geometrycollection WHERE fid=110; ST_ASTEXT(ST_CONVEXHULL(g)) LINESTRING(10 15,20 15) ##################################################################################### # ST_CONVEXHULL(multilinestring) ##################################################################################### SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT(@star_lines_near_vertical))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT(@star_lines_near_vertical))) POLYGON((0 5,15 25,0 25,0 5)) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT(@star_lines_near_horizontal))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT(@star_lines_near_horizontal))) POLYGON((0 5,25 0,15 30,0 15,0 5)) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('MULTILINESTRING((0 0,-0.00 0),(0.0 0))'))); ERROR 22023: Invalid GIS data provided to function st_geometryfromtext. SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('MULTILINESTRING((0 0,0 5,5 5,5 0,0 0))'))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('MULTILINESTRING((0 0,0 5,5 5,5 0,0 0))'))) POLYGON((0 0,5 0,5 5,0 5,0 0)) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('MULTILINESTRING((0 10,10 0),(10 0,0 0),(0 0,10 10))'))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('MULTILINESTRING((0 10,10 0),(10 0,0 0),(0 0,10 10))'))) POLYGON((0 0,10 0,10 10,0 10,0 0)) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('MULTILINESTRING((1 -1,1000 -1000,0.0001 0.000))'))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('MULTILINESTRING((1 -1,1000 -1000,0.0001 0.000))'))) POLYGON((0.0001 0,1 -1,1000 -1000,0.0001 0)) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('MULTILINESTRING((4 7,1 0,1 7),(4 9,8 6,9 4))'))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('MULTILINESTRING((4 7,1 0,1 7),(4 9,8 6,9 4))'))) POLYGON((1 0,9 4,8 6,4 9,1 7,1 0)) SELECT ST_ASTEXT(ST_CONVEXHULL(g)) FROM gis_geometrycollection WHERE fid=114; ST_ASTEXT(ST_CONVEXHULL(g)) POLYGON((0 5,15 25,0 25,0 5)) ##################################################################################### # ST_CONVEXHULL(polygon) ##################################################################################### SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT(@star))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT(@star))) POLYGON((0 15,5 0,25 0,30 15,15 25,0 15)) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT(@star_elem_vertical))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT(@star_elem_vertical))) POLYGON((5 0,25 0,15 25,5 0)) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('POLYGON((0 0,0 5,5 5, 0 0))'))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('POLYGON((0 0,0 5,5 5, 0 0))'))) POLYGON((0 0,5 5,0 5,0 0)) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('POLYGON((5 2,5 5,2 8,5 2))'))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('POLYGON((5 2,5 5,2 8,5 2))'))) POLYGON((2 8,5 2,5 5,2 8)) Select ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('POLYGON((5 0,15 25,25 0,15 5,5 0))'))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('POLYGON((5 0,15 25,25 0,15 5,5 0))'))) POLYGON((5 0,25 0,15 25,5 0)) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('POLYGON((0 0,0 10,10 10,10 0,0 0))'))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('POLYGON((0 0,0 10,10 10,10 0,0 0))'))) POLYGON((0 0,10 0,10 10,0 10,0 0)) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('POLYGON((10 10,10 0,0 20,0 10,10 10))'))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('POLYGON((10 10,10 0,0 20,0 10,10 10))'))) POLYGON((0 10,10 0,10 10,0 20,0 10)) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('POLYGON((0 0,0 10,10 10,10 0,0 0,-10 0,-10 -10,0 -10, 0 0))'))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('POLYGON((0 0,0 10,10 10,10 0,0 0,-10 0,-10 -10,0 -10, 0 0))'))) POLYGON((-10 -10,0 -10,10 0,10 10,0 10,-10 0,-10 -10)) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4))'))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4))'))) POLYGON((0 0,10 0,10 10,0 10,0 0)) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('POLYGON((0 0,0 10,10 10,10 0,0 0),(0 0,0 10,10 10,10 0,0 0))'))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('POLYGON((0 0,0 10,10 10,10 0,0 0),(0 0,0 10,10 10,10 0,0 0))'))) POLYGON((0 0,10 0,10 10,0 10,0 0)) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('POLYGON((4 4,4 6,6 6,6 4,4 4),(0 0,0 10,10 10,10 0,0 0))'))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('POLYGON((4 4,4 6,6 6,6 4,4 4),(0 0,0 10,10 10,10 0,0 0))'))) POLYGON((4 4,6 4,6 6,4 6,4 4)) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('POLYGON((4 4,4 6,6 6,6 4,4 4),(8 8,8 10,10 10,10 8,8 8))'))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('POLYGON((4 4,4 6,6 6,6 4,4 4),(8 8,8 10,10 10,10 8,8 8))'))) POLYGON((4 4,6 4,6 6,4 6,4 4)) SELECT ST_ASTEXT(ST_CONVEXHULL(g)) FROM gis_geometrycollection WHERE fid=100; ST_ASTEXT(ST_CONVEXHULL(g)) POLYGON((0 15,5 0,25 0,30 15,15 25,0 15)) ##################################################################################### # ST_CONVEXHULL(multipolygon) ##################################################################################### SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT(@star_of_elems))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT(@star_of_elems))) POLYGON((0 15,5 0,25 0,30 15,15 25,0 15)) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,0 5,5 5, 0 0)))'))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,0 5,5 5, 0 0)))'))) POLYGON((0 0,5 5,0 5,0 0)) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 10,10 0,0 0, 0 10)),((0 0,10 10,10 0, 0 0)))'))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 10,10 0,0 0, 0 10)),((0 0,10 10,10 0, 0 0)))'))) POLYGON((0 0,10 0,10 10,0 10,0 0)) Select ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)),((4 4,4 6,6 6,6 4,4 4)))'))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)),((4 4,4 6,6 6,6 4,4 4)))'))) POLYGON((0 0,10 0,10 10,0 10,0 0)) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,0 10,10 10, 0 0)),((10 10,10 15,15 15,10 10)))'))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,0 10,10 10, 0 0)),((10 10,10 15,15 15,10 10)))'))) POLYGON((0 0,15 15,10 15,0 10,0 0)) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)),((4 4,4 6,6 6,6 4,4 4)))'))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)),((4 4,4 6,6 6,6 4,4 4)))'))) POLYGON((0 0,10 0,10 10,0 10,0 0)) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,0 10,10 10,10 0, 0 0),(4 4,4 6,6 6,6 4,4 4)))'))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,0 10,10 10,10 0, 0 0),(4 4,4 6,6 6,6 4,4 4)))'))) POLYGON((0 0,10 0,10 10,0 10,0 0)) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(0 0,0 10,10 10,10 0,0 0)))'))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(0 0,0 10,10 10,10 0,0 0)))'))) POLYGON((0 0,10 0,10 10,0 10,0 0)) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('MULTIPOLYGON(((4 4,4 6,6 6,6 4,4 4),(0 0,0 10,10 10,10 0,0 0)))'))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('MULTIPOLYGON(((4 4,4 6,6 6,6 4,4 4),(0 0,0 10,10 10,10 0,0 0)))'))) POLYGON((4 4,6 4,6 6,4 6,4 4)) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('MULTIPOLYGON(((4 4,4 6,6 6,6 4,4 4),(8 8,8 10,10 10,10 8,8 8)))'))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('MULTIPOLYGON(((4 4,4 6,6 6,6 4,4 4),(8 8,8 10,10 10,10 8,8 8)))'))) POLYGON((4 4,6 4,6 6,4 6,4 4)) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('MULTIPOLYGON(((10 10,10 0,5 10,10 10)),((0 10,0 20,5 10,0 10)))'))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('MULTIPOLYGON(((10 10,10 0,5 10,10 10)),((0 10,0 20,5 10,0 10)))'))) POLYGON((0 10,10 0,10 10,0 20,0 10)) SELECT ST_ASTEXT(ST_CONVEXHULL(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_ASTEXT(ST_CONVEXHULL(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)))'))) POLYGON((0 0,10 0,10 10,0 10,0 0)) SELECT ST_ASTEXT(ST_CONVEXHULL(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_ASTEXT(ST_CONVEXHULL(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)))'))) POLYGON((0 0,10 0,10 10,0 10,0 0)) ##################################################################################### # ST_CONVEXHULL(geometrycollection) ##################################################################################### SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT(@star_collection_elems))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT(@star_collection_elems))) POLYGON((0 15,5 0,25 0,30 15,15 25,0 15)) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT(@star_collection_multilinestr))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT(@star_collection_multilinestr))) POLYGON((0 5,5 0,25 0,30 15,15 30,0 15,0 5)) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION()'))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION()'))) NULL SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(GEOMETRYCOLLECTION())'))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(GEOMETRYCOLLECTION())'))) NULL SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION()))'))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION()))'))) NULL SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(10 10),MULTIPOINT(0 0,10 10))'))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(10 10),MULTIPOINT(0 0,10 10))'))) LINESTRING(0 0,10 10) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(POINT(10 10),MULTIPOINT(0 0,10 10)))'))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(POINT(10 10),MULTIPOINT(0 0,10 10)))'))) LINESTRING(0 0,10 10) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(LINESTRING(1 1,2 2,3 3),' 'MULTILINESTRING((0 0,0 10,10 10,10 0, 0 0),(10 10,10 15,15 15,10 10)))'))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(LINESTRING(1 1,2 2,3 3),' 'MULTILINESTRING((0 0,0 10,10 10,10 0, 0 0),(10 10,10 15,15 15,10 10)))'))) POLYGON((0 0,10 0,15 15,10 15,0 10,0 0)) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(10 10),' 'MULTIPOINT(0 0,10 10),' 'LINESTRING(1 1,2 2,3 3),' 'MULTILINESTRING((0 0,0 10,10 10,10 0, 0 0),(10 10,10 15,15 15,10 10)))'))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(10 10),' 'MULTIPOINT(0 0,10 10),' 'LINESTRING(1 1,2 2,3 3 POLYGON((0 0,10 0,15 15,10 15,0 10,0 0)) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POLYGON((0 0,0 10,10 10,10 0, 0 0)))'))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POLYGON((0 0,0 10,10 10,10 0, 0 0)))'))) POLYGON((0 0,10 0,10 10,0 10,0 0)) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(POLYGON((0 0,0 10,10 10,10 0, 0 0)))))'))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(POLYGON((0 0,0 10,10 10,10 0, 0 0)))))'))) POLYGON((0 0,10 0,10 10,0 10,0 0)) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POLYGON((0 0,0 10,10 10,10 0,0 0)),POLYGON((0 0,10 0,10 -10,0 -10,0 0)))'))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POLYGON((0 0,0 10,10 10,10 0,0 0)),POLYGON((0 0,10 0,10 -10,0 -10,0 0)))'))) POLYGON((0 -10,10 -10,10 10,0 10,0 -10)) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(LINESTRING(0 0,0 10,10 10,10 0,0 0),LINESTRING(0 0,10 0,10 -10,0 -10,0 0))'))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(LINESTRING(0 0,0 10,10 10,10 0,0 0),LINESTRING(0 0,10 0,10 -10,0 -10,0 0))'))) POLYGON((0 -10,10 -10,10 10,0 10,0 -10)) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4)),' 'MULTIPOLYGON(((0 0,0 10,10 10,10 0, 0 0)),((10 10,10 15,15 15,15 10,10 10))))'))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4)),' 'MULTIPOLYGON(((0 0,0 10,10 10,10 0, 0 0)),((10 10,10 15,15 15,15 10,1 POLYGON((0 0,10 0,15 10,15 15,10 15,0 10,0 0)) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(),POLYGON((0 0,0 10,10 10,10 0,0 0)))'))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(),POLYGON((0 0,0 10,10 10,10 0,0 0)))'))) POLYGON((0 0,10 0,10 10,0 10,0 0)) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POLYGON((0 0,0 10,10 10,10 0,0 0)),GEOMETRYCOLLECTION())'))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POLYGON((0 0,0 10,10 10,10 0,0 0)),GEOMETRYCOLLECTION())'))) POLYGON((0 0,10 0,10 10,0 10,0 0)) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(POINT(10 10),' 'MULTIPOINT(0 0,10 10)),' 'GEOMETRYCOLLECTION(LINESTRING(1 1,2 2,3 3),' 'MULTILINESTRING((0 0,0 10,10 10,10 0, 0 0),(10 10,10 15,15 15,10 10))))'))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(POINT(10 10),' 'MULTIPOINT(0 0,10 10)),' POLYGON((0 0,10 0,15 15,10 15,0 10,0 0)) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(POINT(10 10),' 'MULTIPOINT(0 0,10 10)),' 'GEOMETRYCOLLECTION(LINESTRING(1 1,2 2,3 3),' 'MULTILINESTRING((0 0,0 10,10 10,10 0, 0 0),(10 10,10 15,15 15,10 10))),' 'GEOMETRYCOLLECTION(POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4)),' 'MULTIPOLYGON(((0 0,0 10,10 10,10 0, 0 0)),' '((10 10,10 15,15 15,15 10,10 10)))))'))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(POINT(10 10),' 'MULTIPOINT(0 0,10 10)),' POLYGON((0 0,10 0,15 10,15 15,10 15,0 10,0 0)) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(POINT(10 10),' 'MULTIPOINT(0 0,10 10)),' 'GEOMETRYCOLLECTION(LINESTRING(1 1,2 2,3 3),' 'MULTILINESTRING((0 0,0 10,10 10,10 0, 0 0),(10 10,10 15,15 15,10 10))),' 'GEOMETRYCOLLECTION(GEOMETRYCOLLECTION()))'))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(POINT(10 10),' 'MULTIPOINT(0 0,10 10)),' POLYGON((0 0,10 0,15 15,10 15,0 10,0 0)) SELECT ST_ASTEXT(ST_CONVEXHULL(g)) FROM gis_geometrycollection WHERE fid=115; ST_ASTEXT(ST_CONVEXHULL(g)) POLYGON((0 15,5 0,25 0,30 15,15 25,0 15)) ##################################################################################### # ST_CONVEXHULL(geometry) with different SRID values ##################################################################################### SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT(@star_center,-1024))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT(@star_center,-1024))) POINT(15 10) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT(@star_all_points,-1))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT(@star_all_points,-1))) POLYGON((5 0,25 0,15 25,5 0)) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT(@star_top_to_center,0))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT(@star_top_to_center,0))) LINESTRING(15 10,15 25) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT(@star_lines_near_vertical,1000))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT(@star_lines_near_vertical,1000))) POLYGON((0 5,15 25,0 25,0 5)) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT(@star,123456789))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT(@star,123456789))) POLYGON((0 15,5 0,25 0,30 15,15 25,0 15)) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT(@star_elem_vertical,4294967295))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT(@star_elem_vertical,4294967295))) POLYGON((5 0,25 0,15 25,5 0)) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT(@star_of_elems,4294967296))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT(@star_of_elems,4294967296))) POLYGON((0 15,5 0,25 0,30 15,15 25,0 15)) SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT(@star_collection_elems,4294967295000))); ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT(@star_collection_elems,4294967295000))) POLYGON((0 15,5 0,25 0,30 15,15 25,0 15)) ##################################################################################### # Invalid function calls ##################################################################################### SELECT ST_ASTEXT(ST_CONVEXHULL()); ERROR 42000: Incorrect parameter count in the call to native function 'ST_CONVEXHULL' SELECT ST_ASTEXT(ST_CONVEXHULL(NULL)); ST_ASTEXT(ST_CONVEXHULL(NULL)) NULL SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('POINT()'))); ERROR 22023: Invalid GIS data provided to function st_geometryfromtext. SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('LINESTRING()'))); ERROR 22023: Invalid GIS data provided to function st_geometryfromtext. SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('POLYGON(())'))); ERROR 22023: Invalid GIS data provided to function st_geometryfromtext. SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('MULTIPOINT()'))); ERROR 22023: Invalid GIS data provided to function st_geometryfromtext. SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('MULTILINESTRING(())'))); ERROR 22023: Invalid GIS data provided to function st_geometryfromtext. SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('MULTIPOLYGON((()))'))); ERROR 22023: Invalid GIS data provided to function st_geometryfromtext. SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('POINT(a 0)'))); ERROR 22023: Invalid GIS data provided to function st_geometryfromtext. SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('POINT(! 0)'))); ERROR 22023: Invalid GIS data provided to function st_geometryfromtext. SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('POINT('!' 0)'))); ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '!' 0)')))' at line 1 SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('POINT(12,34 0)'))); ERROR 22023: Invalid GIS data provided to function st_geometryfromtext. SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('LINESTRING(a 0,10 10)'))); ERROR 22023: Invalid GIS data provided to function st_geometryfromtext. SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('LINESTRING(0 0,! 10)'))); ERROR 22023: Invalid GIS data provided to function st_geometryfromtext. SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('LINESTRING('!' 0,10 10)'))); ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '!' 0,10 10)')))' at line 1 SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('LINESTRING(12,34 0,10 10)'))); ERROR 22023: Invalid GIS data provided to function st_geometryfromtext. SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('POLYGON((a 0,10 10,10 0,0 0))'))); ERROR 22023: Invalid GIS data provided to function st_geometryfromtext. SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('POLYGON((0 0,! 10,10 0,0 0))'))); ERROR 22023: Invalid GIS data provided to function st_geometryfromtext. SELECT ST_ASTEXT(ST_CONVEXHULL(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 MySQL server version for the right syntax to use near '!' 0,10 10,10 0,0 0))')))' at line 1 SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('POLYGON((12,34 0,10 10,10 0,0 0))'))); ERROR 22023: Invalid GIS data provided to function st_geometryfromtext. SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('POLYGON((0 0))'))); ERROR 22023: Invalid GIS data provided to function st_geometryfromtext. SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('POLYGON((0 0,5 5))'))); ERROR 22023: Invalid GIS data provided to function st_geometryfromtext. SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('POLYGON((0 0,5 5,10 10))'))); ERROR 22023: Invalid GIS data provided to function st_geometryfromtext. SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('POLYGON((0 0,0 5,10 10),(0 0))'))); ERROR 22023: Invalid GIS data provided to function st_geometryfromtext. SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,5 5,10 10)),((10 10)))'))); ERROR 22023: Invalid GIS data provided to function st_geometryfromtext. SELECT ST_ASTEXT(ST_CONVEXHULL(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0,5 5,10 10)),((10 10))'))); ERROR 22023: Invalid GIS data provided to function st_geometryfromtext. SELECT ST_ASTEXT(ST_CONVEXHULL(0x000000000200000000000000000000000000000000)); ERROR HY000: Geometry byte string must be little endian. SELECT ST_ASTEXT(ST_CONVEXHULL(0x010100000001000000010100000000000000000000)); ERROR HY000: Geometry byte string must be little endian. SELECT ST_ASTEXT(ST_CONVEXHULL(0x010100000002000000000000000000000000000000)); ERROR HY000: Geometry byte string must be little endian. SELECT ST_ASTEXT(ST_CONVEXHULL(0x000000000600000001000000000200000002000000)); ERROR HY000: Geometry byte string must be little endian. SELECT ST_ASTEXT(ST_CONVEXHULL(0x000000000200000001000000050000000000000000)); ERROR HY000: Geometry byte string must be little endian. SELECT ST_ASTEXT(ST_CONVEXHULL(0x010300000002000000010300000002000000050000)); ERROR HY000: Geometry byte string must be little endian. SELECT ST_ASTEXT(ST_CONVEXHULL(0x010400000002000000010100000000000000000000)); ERROR HY000: Geometry byte string must be little endian. # Clean up DROP TABLE gis_geometrycollection;