MySQL geometry 类型数据测试

MySQL的geometry类型的表的创建和测试:

CREATE TABLE geom_test01(
   id INT NOT NULL PRIMARY KEY,
   info varchar(100),
   geom GEOMETRY
);

desc geom_test01;

insert into geom_test01 (id,info,geom) values (1, 'geom', geomfromtext('MULTIPOLYGON(((1 1,5 1,5 5,1 5,1 1),(2 2,2 3,3 3,3 2,2 2)),((6 3,9 2,9 4,6 3)))',4490));
insert into geom_test01 (id,info,geom) values (2, 'geom', geomfromtext('MULTIPOLYGON(((1 1,5 1,5 5,1 5,1 1),(2 2,2 3,3 3,3 2,2 2)),((6 3,9 2,9 4,6 3)))'));
insert into geom_test01 (id,info,geom) values (3, 'geom', ST_GeomFromText('MULTIPOLYGON(((1 1,5 1,5 5,1 5,1 1),(2 2,2 3,3 3,3 2,2 2)),((6 3,9 2,9 4,6 3)))',4490));
insert into geom_test01 (id,info,geom) values (4, 'geom', geomfromtext('POINT(1 20)'));
insert into geom_test01 (id,info,geom) values (5, 'geom', geomfromtext('POINT(30 40)',4490));
insert into geom_test01 (id,info,geom) values (6, 'geom', ST_GeomFromText('POINT(30 40)',4490));
insert into geom_test01 (id,info,geom) values (7, 'geom', ST_GeomFromText('MULTIPOLYGON(((121.471603 31.230229, 121.470724 31.23155, 121.471761757556 31.2333253454665, 121.471724 31.23155, 121.471898134093 31.2302649098516, 121.471603 31.230229)), ((121.475442678789 31.2318642395248, 121.474597 31.2339365384615, 121.475777 31.232045, 121.475442678789 31.2318642395248)))',4490));

select * from geom_test01;

select geom from geom_test01;

select hex(geom) from geom_test01;

select length(hex(geom)) from geom_test01;

select length(geom) from geom_test01;

select char_length(geom) from geom_test01;

select octet_length(geom) from geom_test01;

select  BIT_LENGTH(geom) from geom_test01;

你可能感兴趣的:(数据库,GIS,mysql,数据库)