如何将点附加到LINESTRING SQL [英] How to append points to LINESTRING SQL

查看:127
本文介绍了如何将点附加到LINESTRING SQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表,其中有个点,这是一个LINESTRING。我在其中有一行,其中所说的列中有一些点。

I have a table with points which is a LINESTRING. I have a row in there which has some points in said column.

我以字符串a的形式有第二组点,我想附加这些点指向现有行。在MySQL中有什么方法可以在不选择点作为文本的情况下,手动合并字符串然后更新行中的

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函数不包含任何用于附加LINESTRING的解决方案,但是有一种变通办法已经为您尝试过。

MYSQL Spatial function does not include any solution for appending a LINESTRING but there is a workaround which i have tried for you.


  1. 获取值

  1. Get the value

set @gval =(选择ST_AsText (路线)从 spatial 其中id = 5);

set @gval = (select ST_AsText(route) from spatial where id =5);




我将表命名为 spatial,并将一列添加为 route,其数据类型为线串




  1. 通过使用replace函数并输入所需的纬度(或点)来附加字符串

  1. Appended the string by using the replace function and entering your required lat lon (or point)

set @gval = replace(@gval,')',',8.5684875 76.8520767)');
更新空间设置路由= GEOMFROMTEXT(@gval)其中id = 5;

set @gval = replace(@gval, ')', ',8.5684875 76.8520767)'); Update spatial set route =GEOMFROMTEXT(@gval) where id=5;

这对我有用。

这篇关于如何将点附加到LINESTRING SQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆