本文主要是介绍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;
这篇关于MySQL geometry 类型数据测试的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!