📄 gis.result
字号:
36.316211,-114.952446 36.313883,-114.952644 36.309488,-114.94472536.313083,-114.93706 36.32043,-114.932478 36.323497,-114.92455636.327708,-114.922608 36.329715,-114.92009 36.328695,-114.91210536.323566,-114.901647 36.317952,-114.897436 36.313968,-114.89534436.309573,-114.891699 36.304398,-114.890569 36.303551,-114.88635636.302702,-114.885141 36.301351,-114.885709 36.297391,-114.89249936.290893,-114.902142 36.288974,-114.904941 36.288838,-114.90530836.289845,-114.906325 36.290395,-114.909916 36.289549,-114.91452736.287535,-114.918797 36.284423,-114.922982 36.279731,-114.92411336.277282,-114.924057 36.275817,-114.927733 36.27053,-114.92935436.269029,-114.929354 36.269029,-114.950856 36.268715,-114.95076836.264324,-114.960206 36.264293,-114.960301 36.268943,-115.00666236.268929,-115.008583 36.265619,-115.00665 36.264247,-115.00665936.246873,-115.006659 36.246873,-115.006838 36.247697,-115.01076436.247774,-115.015609 36.25113,-115.015765 36.254505,-115.02951736.254619,-115.038573 36.249317,-115.038573 36.249317,-115.02340336.25841,-115.023873 36.258994,-115.031845 36.259829,-115.0318336.261053,-115.025561 36.261095,-115.036417 36.274632,-115.03372936.276041,-115.032217 36.274851,-115.029845 36.273959,-115.02993436.274966,-115.025763 36.274896,-115.025406 36.281044,-115.02873136.284471,-115.036497 36.290377,-115.042071 36.291039,-115.02675936.298478,-115.008995 36.301966,-115.006363 36.305435),(-115.07983536.244369,-115.079735 36.260186,-115.076435 36.262369,-115.06975836.265,-115.070235 36.268757,-115.064542 36.268655,-115.06184336.269857,-115.062676 36.270693,-115.06305 36.272344,-115.05905136.281023,-115.05918 36.283008,-115.060591 36.285246,-115.06191336.290022,-115.062499 36.306353,-115.062499 36.306353,-115.06091836.30642,-115.06112 36.289779,-115.05713 36.2825,-115.05731436.279446,-115.060779 36.274659,-115.061366 36.27209,-115.05785836.26557,-115.055805 36.262883,-115.054688 36.262874,-115.04733536.25037,-115.044234 36.24637,-115.052434 36.24047,-115.06173436.23507,-115.061934 36.22677,-115.061934 36.22677,-115.06149136.225267,-115.062024 36.218194,-115.060134 36.218278,-115.06013336.210771,-115.057833 36.210771,-115.057433 36.196271,-115.06223336.196271,-115.062233 36.190371,-115.062233 36.190371,-115.06553336.190371,-115.071333 36.188571,-115.098331 36.188275,-115.09833136.188275,-115.098435 36.237569,-115.097535 36.240369,-115.09753536.240369,-115.093235 36.240369,-115.089135 36.240469,-115.08313536.240569,-115.083135 36.240569,-115.07983536.244369)))')),('85998',GeomFromText('MULTIPOLYGON(((-115.33310736.264587,-115.333168 36.280638,-115.333168 36.280638,-115.3222636.280643,-115.322538 36.274311,-115.327222 36.274258,-115.3273336.263026,-115.330675 36.262984,-115.332132 36.264673,-115.33310736.264587),(-115.247239 36.247066,-115.247438 36.218267,-115.24743836.218267,-115.278525 36.219263,-115.278525 36.219263,-115.30154536.219559,-115.332748 36.219197,-115.332757 36.220041,-115.33275736.220041,-115.332895 36.233514,-115.349023 36.233479,-115.35148936.234475,-115.353681 36.237021,-115.357106 36.239789,-115.3651936.243331,-115.368156 36.243487,-115.367389 36.244902,-115.36455336.246014,-115.359219 36.24616,-115.356186 36.248025,-115.35334736.248004,-115.350813 36.249507,-115.339673 36.25387,-115.33306936.255018,-115.333069 36.255018,-115.333042 36.247767,-115.27903936.248666,-115.263639 36.247466,-115.263839 36.252766,-115.26143936.252666,-115.261439 36.247366,-115.247239 36.247066)))'));select object_id, geometrytype(geo), ISSIMPLE(GEO), ASTEXT(centroid(geo)) fromt1 where object_id=85998;object_id geometrytype(geo) ISSIMPLE(GEO) ASTEXT(centroid(geo))85998 MULTIPOLYGON 0 POINT(115.31877315203 -36.237472821022)select object_id, geometrytype(geo), ISSIMPLE(GEO), ASTEXT(centroid(geo)) fromt1 where object_id=85984;object_id geometrytype(geo) ISSIMPLE(GEO) ASTEXT(centroid(geo))85984 MULTIPOLYGON 0 POINT(-114.87787186923 36.33101763469)drop table t1;create table t1 (fl geometry not null);insert into t1 values (1);ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY fieldinsert into t1 values (1.11);ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY fieldinsert into t1 values ("qwerty");ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY fieldinsert into t1 values (pointfromtext('point(1,1)'));ERROR 23000: Column 'fl' cannot be nulldrop table t1;select (asWKT(geomfromwkb((0x000000000140240000000000004024000000000000))));(asWKT(geomfromwkb((0x000000000140240000000000004024000000000000))))POINT(10 10)select (asWKT(geomfromwkb((0x010100000000000000000024400000000000002440))));(asWKT(geomfromwkb((0x010100000000000000000024400000000000002440))))POINT(10 10)create table t1 (g GEOMETRY);select * from t1;Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnrdef test t1 t1 g g 255 4294967295 0 Y 144 0 63gselect asbinary(g) from t1;Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnrdef asbinary(g) 252 8192 0 Y 128 0 63asbinary(g)drop table t1;create table t1 (a TEXT, b GEOMETRY NOT NULL, SPATIAL KEY(b));alter table t1 disable keys;load data infile '../std_data_ln/bad_gis_data.dat' into table t1;ERROR 22004: Column was set to data type implicit default; NULL supplied for NOT NULL column 'b' at row 1alter table t1 enable keys;drop table t1;create table t1 (a int, b blob);insert into t1 values (1, ''), (2, NULL), (3, '1');select * from t1;a b1 2 NULL3 1selectgeometryfromtext(b) IS NULL, geometryfromwkb(b) IS NULL, astext(b) IS NULL, aswkb(b) IS NULL, geometrytype(b) IS NULL, centroid(b) IS NULL,envelope(b) IS NULL, startpoint(b) IS NULL, endpoint(b) IS NULL,exteriorring(b) IS NULL, pointn(b, 1) IS NULL, geometryn(b, 1) IS NULL,interiorringn(b, 1) IS NULL, multipoint(b) IS NULL, isempty(b) IS NULL,issimple(b) IS NULL, isclosed(b) IS NULL, dimension(b) IS NULL,numgeometries(b) IS NULL, numinteriorrings(b) IS NULL, numpoints(b) IS NULL,area(b) IS NULL, glength(b) IS NULL, srid(b) IS NULL, x(b) IS NULL, y(b) IS NULLfrom t1;geometryfromtext(b) IS NULL geometryfromwkb(b) IS NULL astext(b) IS NULL aswkb(b) IS NULL geometrytype(b) IS NULL centroid(b) IS NULL envelope(b) IS NULL startpoint(b) IS NULL endpoint(b) IS NULL exteriorring(b) IS NULL pointn(b, 1) IS NULL geometryn(b, 1) IS NULL interiorringn(b, 1) IS NULL multipoint(b) IS NULL isempty(b) IS NULL issimple(b) IS NULL isclosed(b) IS NULL dimension(b) IS NULL numgeometries(b) IS NULL numinteriorrings(b) IS NULL numpoints(b) IS NULL area(b) IS NULL glength(b) IS NULL srid(b) IS NULL x(b) IS NULL y(b) IS NULL1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 11 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 11 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1select within(b, b) IS NULL, contains(b, b) IS NULL, overlaps(b, b) IS NULL, equals(b, b) IS NULL, disjoint(b, b) IS NULL, touches(b, b) IS NULL, intersects(b, b) IS NULL, crosses(b, b) IS NULLfrom t1;within(b, b) IS NULL contains(b, b) IS NULL overlaps(b, b) IS NULL equals(b, b) IS NULL disjoint(b, b) IS NULL touches(b, b) IS NULL intersects(b, b) IS NULL crosses(b, b) IS NULL1 1 1 1 1 1 1 11 1 1 1 1 1 1 11 1 1 1 1 1 1 1select point(b, b) IS NULL, linestring(b) IS NULL, polygon(b) IS NULL, multipoint(b) IS NULL, multilinestring(b) IS NULL, multipolygon(b) IS NULL, geometrycollection(b) IS NULLfrom t1;point(b, b) IS NULL linestring(b) IS NULL polygon(b) IS NULL multipoint(b) IS NULL multilinestring(b) IS NULL multipolygon(b) IS NULL geometrycollection(b) IS NULL0 1 1 1 1 1 11 1 1 1 1 1 10 1 1 1 1 1 1drop table t1;CREATE TABLE t1(a POINT) ENGINE=MyISAM;INSERT INTO t1 VALUES (NULL);SELECT * FROM t1;aNULLDROP TABLE t1;End of 4.1 testscreate table t1 (s1 geometry not null,s2 char(100));create trigger t1_bu before update on t1 for each row set new.s1 = null;insert into t1 values (null,null);ERROR 23000: Column 's1' cannot be nulldrop table t1;drop procedure if exists fn3;create function fn3 () returns point return GeomFromText("point(1 1)");show create function fn3;Function sql_mode Create Functionfn3 CREATE DEFINER=`root`@`localhost` FUNCTION `fn3`() RETURNS pointreturn GeomFromText("point(1 1)")select astext(fn3());astext(fn3())POINT(1 1)drop function fn3;create table t1(pt POINT);alter table t1 add primary key pti(pt);drop table t1;create table t1(pt GEOMETRY);alter table t1 add primary key pti(pt);ERROR 42000: BLOB/TEXT column 'pt' used in key specification without a key lengthalter table t1 add primary key pti(pt(20));drop table t1;create table t1 select GeomFromText('point(1 1)');desc t1;Field Type Null Key Default ExtraGeomFromText('point(1 1)') geometry YES NULL drop table t1;create table t1 (g geometry not null);insert into t1 values(default);ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY fielddrop table t1;CREATE TABLE t1 (a GEOMETRY);CREATE VIEW v1 AS SELECT GeomFromwkb(ASBINARY(a)) FROM t1;CREATE VIEW v2 AS SELECT a FROM t1;DESCRIBE v1;Field Type Null Key Default ExtraGeomFromwkb(ASBINARY(a)) geometry YES NULL DESCRIBE v2;Field Type Null Key Default Extraa geometry YES NULL DROP VIEW v1,v2;DROP TABLE t1;create table t1 (name VARCHAR(100), square GEOMETRY);INSERT INTO t1 VALUES("center", GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))'));INSERT INTO t1 VALUES("small", GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))'));INSERT INTO t1 VALUES("big", GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))'));INSERT INTO t1 VALUES("up", GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))'));INSERT INTO t1 VALUES("up2", GeomFromText('POLYGON (( 0 2, 0 4, 2 4, 2 2, 0 2))'));INSERT INTO t1 VALUES("up3", GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))'));INSERT INTO t1 VALUES("down", GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))'));INSERT INTO t1 VALUES("down2", GeomFromText('POLYGON (( 0 -2, 0 0, 2 0, 2 -2, 0 -2))'));INSERT INTO t1 VALUES("down3", GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))'));INSERT INTO t1 VALUES("right", GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))'));INSERT INTO t1 VALUES("right2", GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))'));INSERT INTO t1 VALUES("right3", GeomFromText('POLYGON (( 3 0, 3 2, 5 2, 5 0, 3 0))'));INSERT INTO t1 VALUES("left", GeomFromText('POLYGON (( -1 0, -1 2, 1 2, 1 0, -1 0))'));INSERT INTO t1 VALUES("left2", GeomFromText('POLYGON (( -2 0, -2 2, 0 2, 0 0, -2 0))'));INSERT INTO t1 VALUES("left3", GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1 0, -3 0))'));SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrcontains FROM t1 a1 JOIN t1 a2 ON MBRContains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;mbrcontainscenter,smallSELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrdisjoint FROM t1 a1 JOIN t1 a2 ON MBRDisjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;mbrdisjointdown3,left3,right3,up3SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrequal FROM t1 a1 JOIN t1 a2 ON MBREqual( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;mbrequalcenterSELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrintersect FROM t1 a1 JOIN t1 a2 ON MBRIntersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;mbrintersectbig,center,down,down2,left,left2,right,right2,small,up,up2SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbroverlaps FROM t1 a1 JOIN t1 a2 ON MBROverlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;mbroverlapsdown,left,right,upSELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrtouches FROM t1 a1 JOIN t1 a2 ON MBRTouches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;mbrtouchesdown2,left2,right2,up2SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrwithin FROM t1 a1 JOIN t1 a2 ON MBRWithin( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;mbrwithinbig,centerSELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS contains FROM t1 a1 JOIN t1 a2 ON Contains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;containscenter,smallSELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS disjoint FROM t1 a1 JOIN t1 a2 ON Disjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;disjointdown3,left3,right3,up3SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS equals FROM t1 a1 JOIN t1 a2 ON Equals( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;equalscenterSELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS intersect FROM t1 a1 JOIN t1 a2 ON Intersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;intersectbig,center,down,down2,left,left2,right,right2,small,up,up2SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS overlaps FROM t1 a1 JOIN t1 a2 ON Overlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;overlapsdown,left,right,upSELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS touches FROM t1 a1 JOIN t1 a2 ON Touches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;touchesdown2,left2,right2,up2SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS within FROM t1 a1 JOIN t1 a2 ON Within( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;withinbig,centerSET @vert1 = GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))');SET @horiz1 = GeomFromText('POLYGON ((-2 0, 2 0, -2 0))');SET @horiz2 = GeomFromText('POLYGON ((-1 0, 3 0, -1 0))');SET @horiz3 = GeomFromText('POLYGON ((2 0, 3 0, 2 0))');SET @point1 = GeomFromText('POLYGON ((0 0))');SET @point2 = GeomFromText('POLYGON ((-2 0))');SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @vert1) GROUP BY a1.name;overlapsSELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @horiz1) GROUP BY a1.name;overlapsSELECT Overlaps(@horiz1, @vert1) FROM DUAL;Overlaps(@horiz1, @vert1)0SELECT Overlaps(@horiz1, @horiz2) FROM DUAL;Overlaps(@horiz1, @horiz2)1SELECT Overlaps(@horiz1, @horiz3) FROM DUAL;Overlaps(@horiz1, @horiz3)0SELECT Overlaps(@horiz1, @point1) FROM DUAL;Overlaps(@horiz1, @point1)0SELECT Overlaps(@horiz1, @point2) FROM DUAL;Overlaps(@horiz1, @point2)0DROP TABLE t1;create table t1(f1 geometry, f2 point, f3 linestring);select f1 from t1 union select f1 from t1;f1insert into t1 (f2,f3) values (GeomFromText('POINT(1 1)'),GeomFromText('LINESTRING(0 0,1 1,2 2)'));select AsText(f2),AsText(f3) from t1;AsText(f2) AsText(f3)POINT(1 1) LINESTRING(0 0,1 1,2 2)select AsText(a) from (select f2 as a from t1 union select f3 from t1) t;AsText(a)POINT(1 1)LINESTRING(0 0,1 1,2 2)create table t2 as select f2 as a from t1 union select f3 from t1;desc t2;Field Type Null Key Default Extraa point YES NULL select AsText(a) from t2;AsText(a)POINT(1 1)LINESTRING(0 0,1 1,2 2)drop table t1, t2;SELECT 1;11End of 5.0 tests
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -