問題描述
我有一個帶有 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的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!