有没有办法从MySQL查询创建一些几何(fe LineString(pt1,pt2,...)
)(其中pt1,pt2,...
是另一个查询的结果,换句话说,pt1,pt2,...
存储在MySQL表中?
示例:SELECT LineString(SELECT point FROM points) AS line;
谢谢!
答案 0 :(得分:0)
我有类似的问题并以这种方式解决了它:
SELECT pt1, pt2, pt3, pt4, @Line_string := GEOMFROMTEXT(CONCAT('LINESTRING(',pt1,' ',pt2,', ',pt3,' ',pt4,')')) FROM table;
答案 1 :(得分:0)
LineString(pt1,pt2)
MySQL和MariaDB现在都支持LineString(pt1,pt2,...)
> SELECT ST_AsText( LineString( Point(0,0), Point(1,1) ) );
+---------------------------------------------------+
| ST_AsText( LineString( Point(0,0), Point(1,1) ) ) |
+---------------------------------------------------+
| LINESTRING(0 0,1 1) |
+---------------------------------------------------+