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.