archive_gis.result
来自「视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.」· RESULT 代码 · 共 545 行 · 第 1/2 页
RESULT
545 行
106 5107 2SELECT fid, AsText(PointN(g, 2)) FROM gis_line ORDER by fid;fid AsText(PointN(g, 2))105 POINT(0 10)106 POINT(20 10)107 POINT(40 10)SELECT fid, IsClosed(g) FROM gis_line ORDER by fid;fid IsClosed(g)105 0106 1107 0explain extended select AsText(StartPoint(g)),AsText(EndPoint(g)),GLength(g),NumPoints(g),AsText(PointN(g, 2)),IsClosed(g) FROM gis_line;id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE gis_line ALL NULL NULL NULL NULL 3 Warnings:Note 1003 select astext(startpoint(`test`.`gis_line`.`g`)) AS `AsText(StartPoint(g))`,astext(endpoint(`test`.`gis_line`.`g`)) AS `AsText(EndPoint(g))`,glength(`test`.`gis_line`.`g`) AS `GLength(g)`,numpoints(`test`.`gis_line`.`g`) AS `NumPoints(g)`,astext(pointn(`test`.`gis_line`.`g`,2)) AS `AsText(PointN(g, 2))`,isclosed(`test`.`gis_line`.`g`) AS `IsClosed(g)` from `test`.`gis_line`SELECT fid, AsText(Centroid(g)) FROM gis_polygon ORDER by fid;fid AsText(Centroid(g))108 POINT(15 15)109 POINT(25.416666666667 25.416666666667)110 POINT(20 10)SELECT fid, Area(g) FROM gis_polygon ORDER by fid;fid Area(g)108 100109 2400110 450SELECT fid, AsText(ExteriorRing(g)) FROM gis_polygon ORDER by fid;fid AsText(ExteriorRing(g))108 LINESTRING(10 10,20 10,20 20,10 20,10 10)109 LINESTRING(0 0,50 0,50 50,0 50,0 0)110 LINESTRING(0 0,30 0,30 30,0 0)SELECT fid, NumInteriorRings(g) FROM gis_polygon ORDER by fid;fid NumInteriorRings(g)108 0109 1110 0SELECT fid, AsText(InteriorRingN(g, 1)) FROM gis_polygon ORDER by fid;fid AsText(InteriorRingN(g, 1))108 NULL109 LINESTRING(10 10,20 10,20 20,10 20,10 10)110 NULLexplain extended select AsText(Centroid(g)),Area(g),AsText(ExteriorRing(g)),NumInteriorRings(g),AsText(InteriorRingN(g, 1)) FROM gis_polygon;id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE gis_polygon ALL NULL NULL NULL NULL 3 Warnings:Note 1003 select astext(centroid(`test`.`gis_polygon`.`g`)) AS `AsText(Centroid(g))`,area(`test`.`gis_polygon`.`g`) AS `Area(g)`,astext(exteriorring(`test`.`gis_polygon`.`g`)) AS `AsText(ExteriorRing(g))`,numinteriorrings(`test`.`gis_polygon`.`g`) AS `NumInteriorRings(g)`,astext(interiorringn(`test`.`gis_polygon`.`g`,1)) AS `AsText(InteriorRingN(g, 1))` from `test`.`gis_polygon`SELECT fid, IsClosed(g) FROM gis_multi_line ORDER by fid;fid IsClosed(g)114 0115 0116 0SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon ORDER by fid;fid AsText(Centroid(g))117 POINT(55.588527753042 17.426536064114)118 POINT(55.588527753042 17.426536064114)119 POINT(2 2)SELECT fid, Area(g) FROM gis_multi_polygon ORDER by fid;fid Area(g)117 1684.5118 1684.5119 4.5SELECT fid, NumGeometries(g) from gis_multi_point ORDER by fid;fid NumGeometries(g)111 4112 4113 2SELECT fid, NumGeometries(g) from gis_multi_line ORDER by fid;fid NumGeometries(g)114 2115 1116 2SELECT fid, NumGeometries(g) from gis_multi_polygon ORDER by fid;fid NumGeometries(g)117 2118 2119 1SELECT fid, NumGeometries(g) from gis_geometrycollection ORDER by fid;fid NumGeometries(g)120 2121 2explain extended SELECT fid, NumGeometries(g) from gis_multi_point;id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 Warnings:Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,numgeometries(`test`.`gis_multi_point`.`g`) AS `NumGeometries(g)` from `test`.`gis_multi_point`SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point ORDER by fid;fid AsText(GeometryN(g, 2))111 POINT(10 10)112 POINT(11 11)113 POINT(4 10)SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_line ORDER by fid;fid AsText(GeometryN(g, 2))114 LINESTRING(16 0,16 23,16 48)115 NULL116 LINESTRING(2 5,5 8,21 7)SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_polygon ORDER by fid;fid AsText(GeometryN(g, 2))117 POLYGON((59 18,67 18,67 13,59 13,59 18))118 POLYGON((59 18,67 18,67 13,59 13,59 18))119 NULLSELECT fid, AsText(GeometryN(g, 2)) from gis_geometrycollection ORDER by fid;fid AsText(GeometryN(g, 2))120 LINESTRING(0 0,10 10)121 LINESTRING(3 6,7 9)SELECT fid, AsText(GeometryN(g, 1)) from gis_geometrycollection ORDER by fid;fid AsText(GeometryN(g, 1))120 POINT(0 0)121 POINT(44 6)explain extended SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point;id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 Warnings:Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,astext(geometryn(`test`.`gis_multi_point`.`g`,2)) AS `AsText(GeometryN(g, 2))` from `test`.`gis_multi_point`SELECT g1.fid as first, g2.fid as second,Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as rFROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;first second w c o e d t i r120 120 1 1 0 1 0 0 1 0120 121 0 0 1 0 0 0 1 0121 120 0 0 1 0 0 0 1 0121 121 1 1 0 1 0 0 1 0explain extended SELECT g1.fid as first, g2.fid as second,Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as rFROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE g1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort1 SIMPLE g2 ALL NULL NULL NULL NULL 2 Warnings:Note 1003 select `test`.`g1`.`fid` AS `first`,`test`.`g2`.`fid` AS `second`,within(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `w`,contains(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `c`,overlaps(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `o`,equals(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `e`,disjoint(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `d`,touches(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `t`,intersects(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `i`,crosses(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `r` from `test`.`gis_geometrycollection` `g1` join `test`.`gis_geometrycollection` `g2` order by `test`.`g1`.`fid`,`test`.`g2`.`fid`DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;CREATE TABLE t1 (gp point,ln linestring,pg polygon,mp multipoint,mln multilinestring,mpg multipolygon,gc geometrycollection,gm geometry);SHOW FIELDS FROM t1;Field Type Null Key Default Extragp point YES NULL ln linestring YES NULL pg polygon YES NULL mp multipoint YES NULL mln multilinestring YES NULL mpg multipolygon YES NULL gc geometrycollection YES NULL gm geometry YES NULL ALTER TABLE t1 ADD fid INT;SHOW FIELDS FROM t1;Field Type Null Key Default Extragp point YES NULL ln linestring YES NULL pg polygon YES NULL mp multipoint YES NULL mln multilinestring YES NULL mpg multipolygon YES NULL gc geometrycollection YES NULL gm geometry YES NULL fid int(11) YES NULL DROP TABLE t1;create table t1 (a geometry not null);insert into t1 values (GeomFromText('Point(1 2)'));insert into t1 values ('Garbage');ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY fieldinsert IGNORE into t1 values ('Garbage');ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY fielddrop 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;End of 4.1 testsCREATE 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;End of 5.0 tests
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?