📄 gis.result
字号:
101 10102 20103 20104 10SELECT fid, Y(g) FROM gis_point;fid Y(g)101 10102 10103 20104 20explain extended select X(g),Y(g) FROM gis_point;id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE gis_point ALL NULL NULL NULL NULL 4 Warnings:Note 1003 select x(`test`.`gis_point`.`g`) AS `X(g)`,y(`test`.`gis_point`.`g`) AS `Y(g)` from `test`.`gis_point`SELECT fid, AsText(StartPoint(g)) FROM gis_line;fid AsText(StartPoint(g))105 POINT(0 0)106 POINT(10 10)107 POINT(10 10)SELECT fid, AsText(EndPoint(g)) FROM gis_line;fid AsText(EndPoint(g))105 POINT(10 0)106 POINT(10 10)107 POINT(40 10)SELECT fid, GLength(g) FROM gis_line;fid GLength(g)105 24.142135623731106 40107 30SELECT fid, NumPoints(g) FROM gis_line;fid NumPoints(g)105 3106 5107 2SELECT fid, AsText(PointN(g, 2)) FROM gis_line;fid AsText(PointN(g, 2))105 POINT(0 10)106 POINT(20 10)107 POINT(40 10)SELECT fid, IsClosed(g) FROM gis_line;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;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;fid Area(g)108 100109 2400110 450SELECT fid, AsText(ExteriorRing(g)) FROM gis_polygon;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;fid NumInteriorRings(g)108 0109 1110 0SELECT fid, AsText(InteriorRingN(g, 1)) FROM gis_polygon;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;fid IsClosed(g)114 0115 0116 0SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon;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;fid Area(g)117 1684.5118 1684.5119 4.5SELECT fid, NumGeometries(g) from gis_multi_point;fid NumGeometries(g)111 4112 4113 2SELECT fid, NumGeometries(g) from gis_multi_line;fid NumGeometries(g)114 2115 1116 2SELECT fid, NumGeometries(g) from gis_multi_polygon;fid NumGeometries(g)117 2118 2119 1SELECT fid, NumGeometries(g) from gis_geometrycollection;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;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;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;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;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;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 0 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 NOT NULL;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) NO DROP TABLE t1;SELECT AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))));AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))))POINT(1 4)explain extended SELECT AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))));id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables usedWarnings:Note 1003 select astext(geometryfromwkb(aswkb(geometryfromtext(_latin1'POINT(1 4)')))) AS `AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))))`explain extended SELECT AsText(GeometryFromWKB(AsWKB(PointFromText('POINT(1 4)'))));id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables usedWarnings:Note 1003 select astext(geometryfromwkb(aswkb(geometryfromtext(_latin1'POINT(1 4)')))) AS `AsText(GeometryFromWKB(AsWKB(PointFromText('POINT(1 4)'))))`SELECT SRID(GeomFromText('LineString(1 1,2 2)',101));SRID(GeomFromText('LineString(1 1,2 2)',101))101explain extended SELECT SRID(GeomFromText('LineString(1 1,2 2)',101));id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables usedWarnings:Note 1003 select srid(geometryfromtext(_latin1'LineString(1 1,2 2)',101)) AS `SRID(GeomFromText('LineString(1 1,2 2)',101))`explain extended select issimple(MultiPoint(Point(3, 6), Point(4, 10))), issimple(Point(3, 6));id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables usedWarnings:Note 1003 select issimple(multipoint(point(3,6),point(4,10))) AS `issimple(MultiPoint(Point(3, 6), Point(4, 10)))`,issimple(point(3,6)) AS `issimple(Point(3, 6))`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 field
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -