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;

相关推荐
叼烟扛炮5 分钟前
[LangGraph] 学习笔记(053):工作流模式(二)—— LLM 结构化路由
数据库·笔记·学习
cndes7 分钟前
出现 2013 lost connection to MySQL server during query
运维·服务器·数据库
xixiaoyunya20 分钟前
服务器备份怎么做?覆盖文件、数据库、虚拟机并落地异地容灾
服务器·数据库·oracle
ZHOUPUYU37 分钟前
2026年 PHP + HTML + MySQL 实现通用后台登录页面
mysql·html·php
TDengine (老段)42 分钟前
TDengine TSDB 磁盘占用清理与缩减指南
大数据·数据库·物联网·时序数据库·tdengine·涛思数据·iotdb
Pniubi43 分钟前
一条SQL语句在MySQL中的执行流程
数据库·sql·mysql
DataMover智迁1 小时前
MySQL 到 PostgreSQL 工单同步:主键、状态回写与 CDC 校验
数据库·mysql·postgresql
海鸥-w2 小时前
FastApi项目中 使用工具让AI agent 读取PostgreSQL数据库中的数据
数据库·postgresql·fastapi
dingdingfish2 小时前
Oracle数据库《高级安全指南》第9章 笔记:关于透明数据加密的常见问题
数据库·安全·oracle·database·security·tde
ShineWinsu2 小时前
对于Qt:绘图的解析
开发语言·数据库·c++·qt·面试·客户端·绘图