阅读量:0
- 创建Geometry类型的列:
CREATE TABLE table_name ( geom_column_name GEOMETRY );
- 插入Geometry类型的数据:
INSERT INTO table_name (geom_column_name) VALUES (ST_GeomFromText('POINT(x y)'));
- 查询Geometry类型的数据:
SELECT ST_AsText(geom_column_name) FROM table_name;
- 计算Geometry对象的面积:
SELECT ST_Area(geom_column_name) FROM table_name;
- 计算Geometry对象的周长:
SELECT ST_Perimeter(geom_column_name) FROM table_name;
- 判断Geometry对象是否相交:
SELECT ST_Intersects(geom_column_name1, geom_column_name2) FROM table_name;
- 计算Geometry对象之间的距离:
SELECT ST_Distance(geom_column_name1, geom_column_name2) FROM table_name;
- 计算Geometry对象的交集:
SELECT ST_Intersection(geom_column_name1, geom_column_name2) FROM table_name;
这些是MySQL中常用的Geometry相关的SQL语句,可以用来操作和计算Geometry类型的数据。