I had a normal table. Now i added a spatial column
ALTER TABLE roadData ADD pt POINT ;
and now my table has null values :
Now in MySQL tutorial insert statement is used:
INSERT INTO geom VALUES (ST_GeomFromText('POINT(1 1)'));
but i want to to do it in already existing table removing null values and insert point data based on Latitude and Longitude give in each row. Like
INSERT INTO pt VALUES (ST_GeomFromText('POINT(latitude longitude)'));
and also make a spatial index. How can I do it?
That's an UPDATE STATEMENT
and not an INSERT STATEMENT
, try this:
UPDATE geom t
SET t.pt = ST_GeomFromText(CONCAT('POINT(',t.longitude,t.latitude,')'))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.