How to append points to LINESTRING SQL(如何将点附加到 LINESTRING SQL)
问题描述
我有一个带有 points
的表格,它是一个 LINESTRING.我在那里有一排,在所述列中有一些点.
我有一个字符串 a 形式的第二组点,我想将这些点附加到现有行.有没有办法在 MySQL 中做到这一点而不选择点作为文本,手动合并字符串然后更新行中的 points
?
MYSQL Spatial 函数不包括任何附加 LINESTRING 的解决方案,但我已经为您尝试了一种解决方法.
获取值
set @gval = (select ST_AsText(route) from
spatial
where id =5);
<块引用>
我将该表命名为spatial",并添加了一列route",该列的数据类型为线串
通过使用替换功能并输入所需的纬度(或点)来附加字符串
set @gval = replace(@gval, ')', ',8.5684875 76.8520767)');更新
spatial
set route =GEOMFROMTEXT(@gval) where id=5;</p>
这对我很有用.
I have a table with points
which is a LINESTRING. I have a row in there which has some points in said column.
I have a second set of points in the form a of a string, I would like to append these points to the existing row. Is there any way to do this in MySQL without selecting the points as text, manually merging the strings then updating points
in the row?
MYSQL Spatial function does not include any solution for appending a LINESTRING but there is a workaround which i have tried for you.
Get the value
set @gval = (select ST_AsText(route) from
spatial
where id =5);
I named the table as 'spatial' and added a column as 'route' which is of datatype linestring
Appended the string by using the replace function and entering your required lat lon (or point)
set @gval = replace(@gval, ')', ',8.5684875 76.8520767)'); Update
spatial
set route =GEOMFROMTEXT(@gval) where id=5;
this works good for me.
这篇关于如何将点附加到 LINESTRING SQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何将点附加到 LINESTRING SQL


基础教程推荐
- 使用 VBS 和注册表来确定安装了哪个版本和 32 位 2021-01-01
- ORA-01830:日期格式图片在转换整个输入字符串之前结束/选择日期查询的总和 2021-01-01
- CHECKSUM 和 CHECKSUM_AGG:算法是什么? 2021-01-01
- 带更新的 sqlite CTE 2022-01-01
- 从字符串 TSQL 中获取数字 2021-01-01
- 如何在 CakePHP 3 中实现 INSERT ON DUPLICATE KEY UPDATE aka upsert? 2021-01-01
- while 在触发器内循环以遍历 sql 中表的所有列 2022-01-01
- MySQL根据从其他列分组的值,对两列之间的值进行求和 2022-01-01
- MySQL 5.7参照时间戳生成日期列 2022-01-01
- 带有WHERE子句的LAG()函数 2022-01-01